aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@a491c6a4-70bf-4b89-8b36-d6c0cb1f094e>2005-09-26 00:44:12 +0000
committerschnetter <schnetter@a491c6a4-70bf-4b89-8b36-d6c0cb1f094e>2005-09-26 00:44:12 +0000
commit383661c143028379377dd778fd362e1b6585f8cc (patch)
tree91386e25675a2743794090eeb28223dc280ba7e1
parent7e93921cbc6a5e323a442a9982580e46b7813737 (diff)
Introduce a new schedule group ADMBase_InitialGauge which is run just
after ADMBase_InitialData. This makes it possible to set up all ADM data in these two groups, and then e.g. convert to the BSSN variables after these groups still in the bin "initial". Various other thorns, such as dissipation or multipatch, can now apply transformations to the initial data in the bin "postinitial". This simplifies the interaction between various thorns. Change various thorns to use these two groups. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/SpaceMask/trunk@51 a491c6a4-70bf-4b89-8b36-d6c0cb1f094e
-rw-r--r--schedule.ccl21
-rw-r--r--src/MaskInit.c36
-rw-r--r--src/MaskUtils.c26
-rw-r--r--src/SpaceMask.h6
4 files changed, 68 insertions, 21 deletions
diff --git a/schedule.ccl b/schedule.ccl
index 976857a..2baf8a4 100644
--- a/schedule.ccl
+++ b/schedule.ccl
@@ -5,18 +5,19 @@ if (use_mask)
{
STORAGE: space_mask_group
- schedule MaskZero at CCTK_INITIAL
+ schedule MaskZero at CCTK_BASEGRID
{
LANG: C
} "Initialise mask to zero"
- schedule MaskSym at CCTK_BASEGRID
+ schedule MaskSym at CCTK_WRAGH
{
LANG: C
+ OPTIONS: global
} "Set grid symmetries for mask"
#Initialize the mask again for mesh refinement
- schedule MaskZero at POSTREGRID
+ schedule MaskZero at CCTK_POSTREGRID
{
LANG: C
} "Initialise mask to zero"
@@ -27,18 +28,24 @@ if (use_mask)
# scheme.
#
STORAGE: mask
- schedule MaskSym_emask at CCTK_BASEGRID
+ schedule MaskSym_emask at CCTK_WRAGH
{
LANG: C
+ OPTIONS: global
} "Set grid symmetries for emask (compatibility mode)"
- schedule MaskOne at CCTK_INITIAL
+ schedule MaskOne at CCTK_BASEGRID
{
LANG: C
- } "Set mask to one"
+ } "Set old style mask to one"
+
+ schedule CheckMask at CCTK_POSTSTEP
+ {
+ LANG: C
+ } "Ensure that all mask values are legal"
#Initialize the mask again for mesh refinement
- schedule MaskOne at POSTREGRID
+ schedule MaskOne at CCTK_POSTREGRID
{
LANG: C
} "Set mask to one"
diff --git a/src/MaskInit.c b/src/MaskInit.c
index 2066e2b..b4f8663 100644
--- a/src/MaskInit.c
+++ b/src/MaskInit.c
@@ -8,6 +8,8 @@
@version $Header$
@@*/
+#include <math.h>
+#include <stdio.h>
#include <stdlib.h>
#include "cctk.h"
@@ -125,7 +127,7 @@ void MaskSym_emask(CCTK_ARGUMENTS)
void MaskOne(CCTK_ARGUMENTS)
{
int i;
- DECLARE_CCTK_ARGUMENTS
+ DECLARE_CCTK_ARGUMENTS;
for(i = 0; i < cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; i++)
{
@@ -136,6 +138,38 @@ void MaskOne(CCTK_ARGUMENTS)
}
/*@@
+ @routine CheckMask
+ @date
+ @author Erik Schnetter
+ @desc
+ Ensure that all mask values are legal.
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+void CheckMask(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS
+ int i;
+
+ for(i = 0; i < cctk_lsh[0]*cctk_lsh[1]*cctk_lsh[2]; i++)
+ {
+ if ( fabs(emask[i] - 1.0) > 1.0e-12
+ && fabs(emask[i] - 0.5) > 1.0e-12
+ && fabs(emask[i] - 0.0) > 1.0e-12)
+ {
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Illegal mask value %g detected at grid point %d",
+ (double)emask[i], i);
+ }
+ }
+}
+
+/*@@
@routine MaskZero
@date
@author Denis Pollney
diff --git a/src/MaskUtils.c b/src/MaskUtils.c
index 77350ac..2e9bf8e 100644
--- a/src/MaskUtils.c
+++ b/src/MaskUtils.c
@@ -415,10 +415,13 @@ SpaceMask_GetTypeBits(const char* type_name)
{
int i;
- for (i=0; i<spacemask_registry->ntypes; ++i)
+ if (spacemask_registry != NULL)
{
- if (!strcmp(spacemask_registry->type_list[i]->name, type_name))
- return spacemask_registry->type_list[i]->bitmask;
+ for (i=0; i<spacemask_registry->ntypes; ++i)
+ {
+ if (!strcmp(spacemask_registry->type_list[i]->name, type_name))
+ return spacemask_registry->type_list[i]->bitmask;
+ }
}
CCTK_VInfo (CCTK_THORNSTRING, "Type \"%s\" has not been registered.\n",
@@ -443,17 +446,20 @@ SpaceMask_GetStateBits(const char* type_name, const char* state_name)
SpaceMask_Type* type;
int i, j;
- for (i=0; i<spacemask_registry->ntypes; ++i)
+ if (spacemask_registry != NULL)
{
- if (!strcmp(spacemask_registry->type_list[i]->name, type_name))
+ for (i=0; i<spacemask_registry->ntypes; ++i)
{
- type = spacemask_registry->type_list[i];
- for (j=0; j<type->nstates; ++j)
+ if (!strcmp(spacemask_registry->type_list[i]->name, type_name))
{
- if (!strcmp(type->state_list[j]->name, state_name))
- return type->state_list[j]->bitmask;
+ type = spacemask_registry->type_list[i];
+ for (j=0; j<type->nstates; ++j)
+ {
+ if (!strcmp(type->state_list[j]->name, state_name))
+ return type->state_list[j]->bitmask;
+ }
}
- }
+ }
}
CCTK_VInfo (CCTK_THORNSTRING,
diff --git a/src/SpaceMask.h b/src/SpaceMask.h
index be33436..2714725 100644
--- a/src/SpaceMask.h
+++ b/src/SpaceMask.h
@@ -86,13 +86,13 @@ extern SpaceMask_Registry* spacemask_Registry;
@@*/
#ifdef FCODE
-#define SpaceMask_SetStateBitsF90(mask,i,j,k,type_bits,state_bits) \
- mask((i),(j),(k))=ior(iand(mask((i),(j),(k)),not((type_bits))),(state_bits))
+#define SpaceMask_SetStateBitsF90(mask, i,j,k, type_bits, state_bits) \
+ mask(i,j,k) = ior(iand(mask(i,j,k), not(type_bits)), state_bits)
#endif
#ifdef CCODE
#define SpaceMask_SetStateBits(mask, ijk, type_bits, state_bits) \
- (mask)[ijk] = (((mask)[ijk] & ~(type_bits)) | (state_bits))
+ ((mask)[ijk] = (((mask)[ijk] & ~(type_bits)) | (state_bits)))
#endif
/*@@