Another spline implementation logistics

Bug #1349168 reported by Alexandr Fonari
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Libpspio
Invalid
Undecided
Unassigned

Bug Description

To introduce JB spline I though there is a need of another constant definition (HAVE_JB_SPLINE) in configure.ac:

# GNU Scientific Library (optional)
if test "${enable_gsl}" = "yes"; then
  PIO_CHECK_GSL
  if test "${pio_gsl_ok}" = "yes"; then
    AC_DEFINE([HAVE_GSL], 1,
      [Define to 1 if you have GSL support.])
    CPPFLAGS="${CPPFLAGS} ${pio_gsl_incs}"
    LIBS="${pio_gsl_libs} ${LIBS}"
    if test "${enable_fortran}" = "yes"; then
      FCFLAGS="${FCFLAGS} ${pio_gsl_incs}"
    fi
  else
    AC_ERROR([GSL support does not work])
  fi
  AC_DEFINE([HAVE_JB_SPLINE], 1,
      [Define to 1 if you have JB spline support.])
fi

Than in the interpolation.c an example would be:

  switch ((*interp)->method) {
#ifdef HAVE_GSL
  case PSPIO_INTERP_GSL_CSPLINE:
    int ierr;
    ierr = gsl_spline_init((*interp)->gsl_spl, mesh->r, f, mesh->np);
    if ( ierr ) {
      RETURN_WITH_ERROR( PSPIO_EGSL );
    }
    break;
#elif HAVE_JB_SPLINE
  case PSPIO_INTERP_JB_CSPLINE:
    //Not yet implemented
#else
  default:
    RETURN_WITH_ERROR(PSPIO_ENOSUPPORT);
#endif
  }

Let me know if this sounds good!

Revision history for this message
Alexandr Fonari (alexandr-fonari) wrote :

In the code itself last #else should be omitted in order to get NOT_IMPLEMENTED case:

  switch ((*interp)->method) {
#ifdef HAVE_GSL
  case PSPIO_INTERP_GSL_CSPLINE:
    int ierr;
    ierr = gsl_spline_init((*interp)->gsl_spl, mesh->r, f, mesh->np);
    if ( ierr ) {
      RETURN_WITH_ERROR( PSPIO_EGSL );
    }
    break;
#elif HAVE_JB_SPLINE
  case PSPIO_INTERP_JB_CSPLINE:
    //Not yet implemented
#endif
  default:
    RETURN_WITH_ERROR(PSPIO_ENOSUPPORT);
  }

OK, I think now it would work.

Revision history for this message
Micael Oliveira (micaeljtoliveira) wrote :

The idea is that JB splines will always be compiled and availlable, so that when GSL is also present one can choose between them at runtime. That is why there is no HAVE_JB_SPLINE macro, as it will always be true.

Yann Pouillon (pouillon)
Changed in libpspio:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.