From f0b4af5d17ee11d4333b76ea372653df44a2c572 Mon Sep 17 00:00:00 2001 From: schnetter Date: Mon, 15 May 2006 20:04:56 +0000 Subject: Add a new manual check to ensure that the coordinate ranges are only set up once when there is mesh refinement. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CartGrid3D/trunk@230 c78560ca-4b45-4335-b268-5f3340f3cb52 --- src/CartGrid3D.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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; -- cgit v1.2.3