diff options
Diffstat (limited to 'src/interpolate.c')
-rw-r--r-- | src/interpolate.c | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/src/interpolate.c b/src/interpolate.c index d30ed32..b719f41 100644 --- a/src/interpolate.c +++ b/src/interpolate.c @@ -164,7 +164,7 @@ ReflectionSymmetry_Interpolate (CCTK_POINTER_TO_CONST restrict const cctkGH_, int table; char tensortypealias[1000]; enum tensortype { UNKNOWN, - SCALAR, VECTOR, SYMTENSOR, TENSOR, WEYLSCALARS_REAL }; + SCALAR, VECTOR, SYMTENSOR, TENSOR, WEYLSCALARS_REAL, MANUALCARTESIAN }; enum tensortype ttype; CCTK_INT tensorparity; int tcomponent; @@ -282,6 +282,10 @@ ReflectionSymmetry_Interpolate (CCTK_POINTER_TO_CONST restrict const cctkGH_, assert (numvars == 10); ttype = WEYLSCALARS_REAL; tcomponent = vi - firstvar; + } else if (CCTK_EQUALS (tensortypealias, "ManualCartesian")) { + /* Reflection symmetries specified by hand */ + ttype = MANUALCARTESIAN; + tcomponent = vi - firstvar; } else { groupname = CCTK_GroupName(gi); assert (groupname); @@ -307,6 +311,9 @@ ReflectionSymmetry_Interpolate (CCTK_POINTER_TO_CONST restrict const cctkGH_, case WEYLSCALARS_REAL: assert (tcomponent>=0 && tcomponent<10); break; + case MANUALCARTESIAN: + /* No restriction on number of components */ + break; default: assert (0); } @@ -376,6 +383,9 @@ ReflectionSymmetry_Interpolate (CCTK_POINTER_TO_CONST restrict const cctkGH_, } break; } + case MANUALCARTESIAN: + ReflectionSymmetry_GetManualParities(table, gi, parities); + break; default: assert (0); } @@ -437,3 +447,54 @@ ReflectionSymmetry_Interpolate (CCTK_POINTER_TO_CONST restrict const cctkGH_, /* Return */ return iret; } + +void ReflectionSymmetry_GetManualParities(int table, int gi, int *parities) +{ + char cartsyms[100]; + char *groupname = NULL; + int i = 0; + int ierr = -1; + + /* Get and check tensor type information */ + ierr = Util_TableGetString + (table, sizeof cartsyms, cartsyms, "cartesianreflectionparities"); + if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) { + groupname = CCTK_GroupName(gi); + assert (groupname); + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Cartesian refection parity not declared for group \"%s\" -- aborting", + groupname); + assert(0); + } else if (ierr<0) { + groupname = CCTK_GroupName(gi); + assert (groupname); + CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, + "Error in tensor type alias declaration for group \"%s\"", + groupname); + free (groupname); + } + + if (strlen(cartsyms) != 3) + { + CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, + "Invalid format for cartesianreflectionparities: must be xxx where x is + or - for group %s", + groupname); + } + + for (i = 0; i < 3; i++) + { + switch (cartsyms[i]) + { + case '+': + parities[i] = 1; + break; + case '-': + parities[i] = -1; + break; + default: + CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, + "Invalid format for cartesianreflectionparities: must be xxx where x is + or - for group %s", + groupname); + } + } +} |