aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
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
Diffstat (limited to 'src')
-rw-r--r--src/CartGrid3D.c37
1 files changed, 27 insertions, 10 deletions
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;