diff options
author | schnetter <schnetter@a491c6a4-70bf-4b89-8b36-d6c0cb1f094e> | 2005-09-26 00:44:12 +0000 |
---|---|---|
committer | schnetter <schnetter@a491c6a4-70bf-4b89-8b36-d6c0cb1f094e> | 2005-09-26 00:44:12 +0000 |
commit | 383661c143028379377dd778fd362e1b6585f8cc (patch) | |
tree | 91386e25675a2743794090eeb28223dc280ba7e1 /src | |
parent | 7e93921cbc6a5e323a442a9982580e46b7813737 (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
Diffstat (limited to 'src')
-rw-r--r-- | src/MaskInit.c | 36 | ||||
-rw-r--r-- | src/MaskUtils.c | 26 | ||||
-rw-r--r-- | src/SpaceMask.h | 6 |
3 files changed, 54 insertions, 14 deletions
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 /*@@ |