aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CartGrid3D.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/CartGrid3D.c b/src/CartGrid3D.c
index 8cde05e..baf83d8 100644
--- a/src/CartGrid3D.c
+++ b/src/CartGrid3D.c
@@ -71,6 +71,7 @@ void DecodeSymParameters3D(int sym[6]);
@@*/
void CartGrid3D_SetRanges(CCTK_ARGUMENTS)
{
+ static int have_set_up_ranges = 0;
int i, j, k, idx;
int coord_handle, ierr;
CCTK_REAL this_delta[3], origin[3], min1[3], max1[3];
@@ -82,6 +83,16 @@ void CartGrid3D_SetRanges(CCTK_ARGUMENTS)
DECLARE_CCTK_PARAMETERS
+ /* Ranges must be set up only once, and this must happen on the
+ coarse grid. However, the coarse grid itself may not actually
+ exist; in this case, use the coarsest existing grid. We assume
+ that this is the first grid for which this routine is called. */
+ /* TODO: The ranges should be set up once per patch, not once
+ globally. Implement this once the flesh can maintain per-patch
+ coordinate information. */
+ if (have_set_up_ranges) return;
+ have_set_up_ranges = 1;
+
coarse_delta[0] = coarse_dx;
coarse_delta[1] = coarse_dy;
coarse_delta[2] = coarse_dz;