aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@c78560ca-4b45-4335-b268-5f3340f3cb52>2008-03-05 01:57:14 +0000
committerschnetter <schnetter@c78560ca-4b45-4335-b268-5f3340f3cb52>2008-03-05 01:57:14 +0000
commit20123e142659c01c6d51f4dd8b6b90e0b4f5ee52 (patch)
treeee2b65c80303a461e535b4f4dcfc1099e10f1ba8
parent22d4c8991114cd482907db146d40d0dba4f4cd2e (diff)
Implement new keyword parameter CartGrid3D::set_coordinate_ranges_on,
which has the possible values "all grids", "all maps", or "first level". "all grids" is the default, "all maps" is for multi-patch simulations, and "first level" is for mesh refinement environments where the coarsest grid may not actually exist, such as e.g. in Paramesh. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CartGrid3D/trunk@239 c78560ca-4b45-4335-b268-5f3340f3cb52
-rw-r--r--param.ccl9
-rw-r--r--schedule.ccl25
-rw-r--r--src/CartGrid3D.c37
3 files changed, 58 insertions, 13 deletions
diff --git a/param.ccl b/param.ccl
index 463e7aa..ef99355 100644
--- a/param.ccl
+++ b/param.ccl
@@ -181,3 +181,12 @@ BOOLEAN symmetry_zmax "Symmetry boundary condition on upper z boundary"
{
: :: "Logical"
} "no"
+
+private:
+
+KEYWORD set_coordinate_ranges_on "On which grids to set the coordinate ranges"
+{
+ "all grids" :: "set ranges in local mode, on the coarsest level"
+ "all maps" :: "set ranges in singlemap mode, on the coarsest level"
+ "first level" :: "set ranges in level mode, on the first level"
+} "all grids"
diff --git a/schedule.ccl b/schedule.ccl
index a0e2840..4d543d4 100644
--- a/schedule.ccl
+++ b/schedule.ccl
@@ -25,10 +25,29 @@ schedule ParamCheck_CartGrid3D at CCTK_PARAMCHECK
LANG:C
} "Check coordinates for CartGrid3D"
-schedule CartGrid3D_SetRanges at CCTK_BASEGRID before SpatialCoordinates
+if (CCTK_EQUALS (set_coordinate_ranges_on, "all grids"))
{
- LANG:C
-} "Set up ranges for spatial 3D Cartesian coordinates"
+ schedule CartGrid3D_SetRanges at CCTK_BASEGRID before SpatialCoordinates
+ {
+ LANG:C
+ } "Set up ranges for spatial 3D Cartesian coordinates (on all grids)"
+}
+else if (CCTK_EQUALS (set_coordinate_ranges_on, "all maps"))
+{
+ schedule CartGrid3D_SetRanges at CCTK_BASEGRID before SpatialCoordinates
+ {
+ LANG:C
+ OPTIONS: singlemap
+ } "Set up ranges for spatial 3D Cartesian coordinates (on all maps)"
+}
+else if (CCTK_EQUALS (set_coordinate_ranges_on, "first level"))
+{
+ schedule CartGrid3D_SetRanges at CCTK_BASEGRID before SpatialCoordinates
+ {
+ LANG:C
+ OPTIONS: level
+ } "Set up ranges for spatial 3D Cartesian coordinates (on first level)"
+}
schedule CartGrid3D_SetCoordinates as SpatialCoordinates at CCTK_BASEGRID
{
diff --git a/src/CartGrid3D.c b/src/CartGrid3D.c
index d23d73c..df5539c 100644
--- a/src/CartGrid3D.c
+++ b/src/CartGrid3D.c
@@ -71,24 +71,41 @@ void DecodeSymParameters3D(int sym[6]);
@@*/
void CartGrid3D_SetRanges(CCTK_ARGUMENTS)
{
- int i, j, k, idx;
- int is_coarsest_refinement_level, coord_handle, ierr;
+ int i;
+ int coord_handle, ierr;
CCTK_REAL this_delta[3], origin[3], min1[3], max1[3];
CCTK_REAL *coarse_delta[3];
double lower[3], upper[3];
int domainsym[6], cntstag[3], loweri[3], upperi[3], do_periodic[3];
char coord_name[16];
- DECLARE_CCTK_ARGUMENTS
- DECLARE_CCTK_PARAMETERS
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
- /* 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)
+ if (CCTK_EQUALS (set_coordinate_ranges_on, "first level"))
{
- return;
+ /* 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. */
+ static int is_coarsest_refinement_level = 1;
+ if (! is_coarsest_refinement_level)
+ {
+ return;
+ }
+ is_coarsest_refinement_level = 0;
+ }
+ else
+ {
+ /* Ranges need to be set up only once (or once per map), on the
+ coarsest refinement level */
+ int const 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;