diff options
Diffstat (limited to 'src/apply.c')
-rw-r--r-- | src/apply.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/apply.c b/src/apply.c index 0c09b8e..9c39379 100644 --- a/src/apply.c +++ b/src/apply.c @@ -302,19 +302,23 @@ BndReflectVI (cGH const * restrict const cctkGH, assert (numvars % numcomps == 0 && (numvars == numcomps * vectorlength || numvars == vectorlength)); ttype = VECTOR; - tcomponent = (vi - firstvar) % numcomps; + if(numvars == vectorlength) { + tcomponent = (vi - firstvar); + } else { + tcomponent = (vi - firstvar) / vectorlength; + } } else if (CCTK_EQUALS (tensortypealias, "4u") || CCTK_EQUALS (tensortypealias, "4d")) { /* 4-vector */ const int numcomps = 4; assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength); - if ((vi - firstvar) % numcomps == 0) { + if ((vi - firstvar) / vectorlength == 0) { ttype = SCALAR; tcomponent = 0; } else { ttype = VECTOR; - tcomponent = (vi - firstvar) % numcomps - 1; + tcomponent = (vi - firstvar) / vectorlength - 1; } } else if (CCTK_EQUALS (tensortypealias, "uu_sym") || CCTK_EQUALS (tensortypealias, "dd_sym")) @@ -323,7 +327,7 @@ BndReflectVI (cGH const * restrict const cctkGH, const int numcomps = 6; assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength); ttype = SYMTENSOR; - tcomponent = (vi - firstvar) % numcomps; + tcomponent = (vi - firstvar) / vectorlength; } else if (CCTK_EQUALS (tensortypealias, "uu") || CCTK_EQUALS (tensortypealias, "ud") || CCTK_EQUALS (tensortypealias, "du") @@ -333,29 +337,29 @@ BndReflectVI (cGH const * restrict const cctkGH, const int numcomps = 9; assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength); ttype = TENSOR; - tcomponent = (vi - firstvar) % numcomps; + tcomponent = (vi - firstvar) / vectorlength; } else if (CCTK_EQUALS (tensortypealias, "4uu_sym") || CCTK_EQUALS (tensortypealias, "4dd_sym")) { /* symmetric 4-tensor */ const int numcomps = 10; assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength); - if ((vi - firstvar) % numcomps == 0) { + if ((vi - firstvar) / vectorlength == 0) { ttype = SCALAR; tcomponent = 0; - } else if ((vi - firstvar) % numcomps <= 3) { + } else if ((vi - firstvar) / vectorlength <= 3) { ttype = VECTOR; - tcomponent = (vi - firstvar) % numcomps - 1; + tcomponent = (vi - firstvar) / vectorlength - 1; } else { ttype = SYMTENSOR; - tcomponent = (vi - firstvar) % numcomps - 4; + tcomponent = (vi - firstvar) / vectorlength - 4; } } else if (CCTK_EQUALS (tensortypealias, "ddd_sym")) { /* 3rd rank tensor, symmetric in last 2 indices */ const int numcomps = 18; assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength); ttype = SYMTENSOR3; - tcomponent = (vi - firstvar) % numcomps; + tcomponent = (vi - firstvar) / vectorlength; } else if (CCTK_EQUALS (tensortypealias, "weylscalars_real")) { /* Weyl scalars, stored as 10 real values. NOTE: This assumes that Psi_0 comes first, which is NOT the default with @@ -363,7 +367,7 @@ BndReflectVI (cGH const * restrict const cctkGH, const int numcomps = 10; assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength); ttype = WEYLSCALARS_REAL; - tcomponent = (vi - firstvar) % numcomps; + tcomponent = (vi - firstvar) / vectorlength; } else if (CCTK_EQUALS (tensortypealias, "ManualCartesian")) { /* Reflection symmetries specified by hand */ ttype = MANUALCARTESIAN; |