From 4ad96b2f952bb9ddc07eaa276719ec7983cd239c Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 11 Jun 2003 16:50:04 +0000 Subject: Fixed the stencil range in warning messages about out-of-bound interpolation points. This closes PR CactusPUGH/1527. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHInterp/trunk@63 1c20744c-e24a-42ec-9533-f5004cb800e5 --- src/Operator.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Operator.c b/src/Operator.c index a405ef5..45c6dad 100644 --- a/src/Operator.c +++ b/src/Operator.c @@ -1040,16 +1040,15 @@ static int CheckOutOfBounds (const cGH *GH, const char *coord_system_name, const int *dims, const CCTK_REAL *const *coords) { int i, p, point, out_of_bounds, retval; - CCTK_REAL *origin, *delta, *delta_inv, *below, *offset; + CCTK_REAL *origin, *delta, *delta_inv, *below; char *msg; msg = malloc (100 + N_dims*(10 + 4*30)); - origin = malloc (5 * N_dims * sizeof (CCTK_REAL)); + origin = malloc (4 * N_dims * sizeof (CCTK_REAL)); delta = origin + 1*N_dims; delta_inv = origin + 2*N_dims; below = origin + 3*N_dims; - offset = origin + 4*N_dims; /* get the global origin and delta of the coordinate system */ for (i = 0; i < N_dims; i++) @@ -1071,7 +1070,7 @@ static int CheckOutOfBounds (const cGH *GH, const char *coord_system_name, /* loop over all dimensions */ for (i = 0; i < N_dims; i++) { - /* closest grid point for stencil */ + /* grid point of the lower-left stencil point */ point = floor ((coords[i][p] - origin[i]) * delta_inv[i] - 0.5 * (order - 1)); @@ -1080,27 +1079,24 @@ static int CheckOutOfBounds (const cGH *GH, const char *coord_system_name, /* physical coordinate of that grid point */ below[i] = origin[i] + point * delta[i]; - - /* offset from that grid point, in fractions of grid points */ - offset[i] = (coords[i][p] - below[i]) * delta_inv[i]; } /* check bounds */ if (out_of_bounds) { /* put all information into a single message string for output */ - sprintf (msg, "Interpolation stencil out of bounds at grid point [%f", - (double) coords[0][p]); + sprintf (msg, "Interpolation stencil out of bounds at interpolation " + "coordinate [%f", (double) coords[0][p]); for (i = 1; i < N_dims; i++) { sprintf (msg, "%s, %f", msg, (double) coords[i][p]); } sprintf (msg, "%s]\nrange would be min/max [%f / %f", msg, - (double) below[0], (double) (below[0] + offset[0])); + (double) below[0], (double) (below[0] + order*delta[0])); for (i = 1; i < N_dims; i++) { sprintf (msg, "%s, %f / %f", msg, - (double) below[i], (double) (below[i] + offset[i])); + (double) below[i], (double) (below[i] + order*delta[i])); } sprintf (msg, "%s]\ngrid is min/max [%f / %f", msg, (double) origin[0], (double) (origin[0] + (dims[0]-1)*delta[0])); -- cgit v1.2.3