aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--schedule.ccl1
-rw-r--r--src/CartGrid3D.c20
2 files changed, 9 insertions, 12 deletions
diff --git a/schedule.ccl b/schedule.ccl
index 07f61bb..e0c76c3 100644
--- a/schedule.ccl
+++ b/schedule.ccl
@@ -28,7 +28,6 @@ schedule ParamCheck_CartGrid3D at CCTK_PARAMCHECK
schedule CartGrid3D_SetRanges at CCTK_BASEGRID before SpatialCoordinates
{
LANG:C
- OPTIONS: singlemap
} "Set up ranges for spatial 3D Cartesian coordinates"
schedule CartGrid3D_SetCoordinates as SpatialCoordinates at CCTK_BASEGRID
diff --git a/src/CartGrid3D.c b/src/CartGrid3D.c
index baf83d8..d2da70f 100644
--- a/src/CartGrid3D.c
+++ b/src/CartGrid3D.c
@@ -71,9 +71,8 @@ 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;
+ int is_coarsest_refinement_level, coord_handle, ierr;
CCTK_REAL this_delta[3], origin[3], min1[3], max1[3];
CCTK_REAL *coarse_delta[3];
double lower[3], upper[3];
@@ -83,15 +82,14 @@ 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;
+ /* ranges need to be set up only once, on the coarsest refinement level */
+ is_coarsest_refinement_level = cctk_levfac[0] == 1 &&
+ cctk_levfac[1] == 1 &&
+ cctk_levfac[2] == 1;
+ if (! is_coarsest_refinement_level)
+ {
+ return;
+ }
coarse_delta[0] = coarse_dx;
coarse_delta[1] = coarse_dy;