From b5dd1cb0a2ed48bad1927428a7b43e7750b627e9 Mon Sep 17 00:00:00 2001 From: jthorn Date: Thu, 31 Aug 2006 10:29:10 +0000 Subject: Change the local interpolator to return the new error code CCTK_ERROR_INTERP_DELTA_X_ZERO if the grid spacing is zero along one or more axes; previously it would return the generic "I got a NaN/infinity or other non-finite value" error code CCTK_ERROR_INTERP_COORD_NAN for this case. *** IMPORTANT *** This change requires a cvs-update of the Cactus flesh (more accurately, the file src/include/cctk_Interp.h in the flesh ) in order to define the new error code. If you don't do this cvs update, AEILocalInterp won't compile. git-svn-id: http://svn.aei.mpg.de/numrel/AEIThorns/AEILocalInterp/trunk@42 0f49ee68-0e4f-0410-9b9c-b2c123ded7ef --- src/InterpLocalUniform.h | 3 +++ src/molecule_posn.c | 6 ++++-- src/template.c | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/InterpLocalUniform.h b/src/InterpLocalUniform.h index bb412d0..61a4cf4 100644 --- a/src/InterpLocalUniform.h +++ b/src/InterpLocalUniform.h @@ -178,6 +178,9 @@ struct Jacobian_info /* someone passed us a NaN or other non-finite floating-point number */ #define MOLECULE_POSN_ERROR_NAN (-4) +/* grid spacing $\Delta x$ is zero in at least one axis */ +#define MOLECULE_POSN_ERROR_DX_ZERO (-5) + /******************************************************************************/ /* diff --git a/src/molecule_posn.c b/src/molecule_posn.c index 5343795..553a176 100644 --- a/src/molecule_posn.c +++ b/src/molecule_posn.c @@ -175,6 +175,8 @@ static const char *rcsid = "$Header$"; if the grid is smaller than the molecule MOLECULE_POSN_ERROR_NAN if we encounter a NaN or other non-finite floating-point value + MOLECULE_POSN_ERROR_DX_ZERO + if grid_delta == 0.0 @endreturndesc @@*/ int AEILocalInterp_molecule_posn(fp grid_origin, fp grid_delta, @@ -234,9 +236,9 @@ if ( !finite(boundary_off_centering_tolerance_min) || !finite(boundary_extrapolation_tolerance_max) ) then return MOLECULE_POSN_ERROR_NAN; -/* ditto if the grid spacing is zero (we'll need to divide by it)! */ +/* is the grid spacing zero (we'll need to divide by it)? */ if (grid_delta == 0.0) - then return MOLECULE_POSN_ERROR_NAN; + then return MOLECULE_POSN_ERROR_DX_ZERO; /* molecule radia (inherently positive) in +/- directions */ diff --git a/src/template.c b/src/template.c index fcb198b..fe7a267 100644 --- a/src/template.c +++ b/src/template.c @@ -977,6 +977,9 @@ if (debug > 0) case MOLECULE_POSN_ERROR_NAN: this_axis_status = CCTK_ERROR_INTERP_COORD_NAN; break; + case MOLECULE_POSN_ERROR_DX_ZERO: + this_axis_status = CCTK_ERROR_INTERP_DELTA_X_ZERO; + break; default: CCTK_VWarn(BUG_MSG_SEVERITY_LEVEL, __LINE__, __FILE__, CCTK_THORNSTRING, -- cgit v1.2.3