From e41e9374712cff6ddc5cdada04ddbe14d836388d Mon Sep 17 00:00:00 2001 From: schnetter Date: Tue, 4 Jul 2006 22:27:28 +0000 Subject: Correct an error with the coordinate setup on multi-block systems. Call CartGrid3D_SetRanges in local mode instead of singlemap mode. Re-introduce an explicit check in that routine whether it is called on the coarsest level. This is necessary because the flesh coordinate information needs to be set up according to the coarsest level's grid points. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CartGrid3D/trunk@231 c78560ca-4b45-4335-b268-5f3340f3cb52 --- schedule.ccl | 1 - src/CartGrid3D.c | 20 +++++++++----------- 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; -- cgit v1.2.3