aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@1c20744c-e24a-42ec-9533-f5004cb800e5>2003-06-19 16:09:35 +0000
committertradke <tradke@1c20744c-e24a-42ec-9533-f5004cb800e5>2003-06-19 16:09:35 +0000
commit58aadbd863d07ac0a93c134a266cf780daa0a154 (patch)
treef0b980db2e37cd4e91919b4450a4d4646a0762d4
parent4ad96b2f952bb9ddc07eaa276719ec7983cd239c (diff)
Fokke Dijkstra's patch to fix a potential bug in the global interpolator
where the bbox and global shape info were taken from the cGH structure (which would be wrong if the coordinates are GAs rather than GFs). Now this info is obtained directly from coordinate's pgExtras structure. This closes PR CactusPUGH/1543. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHInterp/trunk@64 1c20744c-e24a-42ec-9533-f5004cb800e5
-rw-r--r--src/InterpGridArrays.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/InterpGridArrays.c b/src/InterpGridArrays.c
index 6f3baa1..23db30b 100644
--- a/src/InterpGridArrays.c
+++ b/src/InterpGridArrays.c
@@ -78,7 +78,8 @@ typedef struct
/********************************************************************
******************** Internal Routines ************************
********************************************************************/
-static int PrepareParameterTable (const cGH *GH, int param_table_handle,
+static int PrepareParameterTable (const int *bbox,
+ int param_table_handle,
int N_dims, int N_input_arrays,
CCTK_INT *input_array_time_levels);
@@ -269,6 +270,12 @@ int PUGHInterp_InterpGridArrays (const cGH *GH,
return (UTIL_ERROR_BAD_INPUT);
}
+ /* get the extras pointer of the first coordinate
+ This is used later on to verify the layout of the input arrays as well
+ as for mapping points to processors. */
+ i = CCTK_CoordIndex (1, NULL, coord_system_name);
+ extras = ((const pGA *) pughGH->variables[i][0])->extras;
+
/* allocate some temporary arrays */
origin_local = malloc (2 * N_dims * sizeof (CCTK_REAL));
delta = origin_local + N_dims;
@@ -278,7 +285,7 @@ int PUGHInterp_InterpGridArrays (const cGH *GH,
input_array_time_levels = input_array_dims + N_dims + N_input_arrays;
/* evaluate the options from the user-supplied parameter table */
- retval = PrepareParameterTable (GH, param_table_handle,
+ retval = PrepareParameterTable (extras->bbox, param_table_handle,
N_dims, N_input_arrays,
input_array_time_levels);
if (retval < 0)
@@ -294,12 +301,6 @@ int PUGHInterp_InterpGridArrays (const cGH *GH,
/*************************************************************************/
- /* get the extras pointer of the first coordinate
- This is used later on to verify the layout of the input arrays as well
- as for mapping points to processors. */
- i = CCTK_CoordIndex (1, NULL, coord_system_name);
- extras = ((const pGA *) pughGH->variables[i][0])->extras;
-
/* get the origin and delta of the processor-local grid,
copy the integer dimension array into an CCTK_INT array */
for (i = 0; i < N_dims; i++)
@@ -520,7 +521,7 @@ int PUGHInterp_InterpGridArrays (const cGH *GH,
/* TODO: use bbox instead -- but the bboxes of other processors
are not known */
int const has_lower = extras->lb[proc][i] == 0;
- int const has_upper = extras->ub[proc][i] == GH->cctk_gsh[i]-1;
+ int const has_upper = extras->ub[proc][i] == extras->nsize[i]-1;
range_min[i] = origin_global[i] + (extras->lb[proc][i] - FUDGE +
(!has_lower) * (extras->nghostzones[i]-0.5)) * delta[i];
range_max[i] = origin_global[i] + (extras->ub[proc][i] + FUDGE -
@@ -600,7 +601,7 @@ int PUGHInterp_InterpGridArrays (const cGH *GH,
{
bbox_interp_coords[i][j] = 0.5 * (bbox_local[2*i+0] + bbox_local[2*i+1]);
}
- if (! GH->cctk_bbox[j]) /* if this is an interprocessor face... */
+ if (! extras->bbox[j]) /* if this is an interprocessor face... */
{
/* ... move the point to the center of this face of the bounding box */
bbox_interp_coords[j/2][j] = bbox_local[j];
@@ -1033,9 +1034,9 @@ int PUGHInterp_InterpGridArrays (const cGH *GH,
option arrays for the local interpolator
@enddesc
- @var GH
- @vdesc pointer to the CCTK grid hierarchy
- @vtype const cGH *
+ @var bbox
+ @vdesc bounding box of the underlying coordinate system
+ @vtype const int *
@vio in
@endvar
@var param_table_handle
@@ -1064,7 +1065,8 @@ int PUGHInterp_InterpGridArrays (const cGH *GH,
0 for success, or one of the UTIL_ERROR_TABLE_* error codes
@endreturndesc
@@*/
-static int PrepareParameterTable (const cGH *GH, int param_table_handle,
+static int PrepareParameterTable (const int *bbox,
+ int param_table_handle,
int N_dims, int N_input_arrays,
CCTK_INT *input_array_time_levels)
{
@@ -1176,7 +1178,7 @@ static int PrepareParameterTable (const cGH *GH, int param_table_handle,
/* complete the bounding box arrays and set them in the parameter table */
for (i = 0; i < 2 * N_dims; i++)
{
- if (! GH->cctk_bbox[i])
+ if (! bbox[i])
{
N_boundary_points_to_omit[i] = 0;
boundary_off_centering_tolerance[i] = 0.0;