aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@082bdb00-0f4f-0410-b49e-b1835e5f2039>2006-06-01 20:25:25 +0000
committerschnetter <schnetter@082bdb00-0f4f-0410-b49e-b1835e5f2039>2006-06-01 20:25:25 +0000
commit1b42f19112e13f037254b41b5a662721e9372a56 (patch)
tree6c20469cc3ac40bf134d31f46382fb48afa81e03
parenta55d304b547b2ca408d0e9e11cedc0b7e3f47659 (diff)
Support the "tensorparity" attribute
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/ReflectionSymmetry/trunk@13 082bdb00-0f4f-0410-b49e-b1835e5f2039
-rw-r--r--src/apply.c52
-rw-r--r--src/interpolate.c15
2 files changed, 47 insertions, 20 deletions
diff --git a/src/apply.c b/src/apply.c
index 1d90697..ea1df0c 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -59,8 +59,8 @@ CCTK_FILEVERSION(AEIDevelopment_ReflectionSymmetry_apply_c);
int const kk = koff + kdir * k; \
int const srcind = ii + ni * (jj + nj * kk); \
REAL(dstvar[dstind] RE = parity * srcvar[srcind] RE;) \
- IMAG(dstvar[dstind] IM = parity * srcvar[srcind] IM;) \
- } \
+ IMAG(dstvar[dstind] IM = parity * srcvar[srcind] IM;) \
+ } \
} \
} \
}
@@ -75,27 +75,27 @@ COPY(CCTK_INT1)
#endif
#ifdef CCTK_INT2
- COPY(CCTK_INT2)
+COPY(CCTK_INT2)
#endif
#ifdef CCTK_INT4
- COPY(CCTK_INT4)
+COPY(CCTK_INT4)
#endif
#ifdef CCTK_INT8
- COPY(CCTK_INT8)
+COPY(CCTK_INT8)
#endif
#ifdef CCTK_REAL4
- COPY(CCTK_REAL4)
+COPY(CCTK_REAL4)
#endif
#ifdef CCTK_REAL8
- COPY(CCTK_REAL8)
+COPY(CCTK_REAL8)
#endif
#ifdef CCTK_REAL16
- COPY(CCTK_REAL16)
+COPY(CCTK_REAL16)
#endif
#undef REAL
@@ -109,15 +109,15 @@ COPY(CCTK_INT1)
#define IM .Im
#ifdef CCTK_REAL4
- COPY(CCTK_COMPLEX8)
+COPY(CCTK_COMPLEX8)
#endif
#ifdef CCTK_REAL8
- COPY(CCTK_COMPLEX16)
+COPY(CCTK_COMPLEX16)
#endif
#ifdef CCTK_REAL16
- COPY(CCTK_COMPLEX32)
+COPY(CCTK_COMPLEX32)
#endif
#undef REAL
@@ -149,6 +149,7 @@ BndReflectVI (cGH const * restrict const cctkGH,
char tensortypealias[1000];
enum tensortype { UNKNOWN, SCALAR, VECTOR, TENSOR };
enum tensortype ttype;
+ CCTK_INT tensorparity;
int tcomponent;
int do_reflection[6];
@@ -299,6 +300,18 @@ BndReflectVI (cGH const * restrict const cctkGH,
assert (0);
}
+ ierr = Util_TableGetInt (table, & tensorparity, "tensorparity");
+ if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {
+ tensorparity = +1;
+ } else if (ierr<0) {
+ groupname = CCTK_GroupName(gi);
+ assert (groupname);
+ CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Error in tensor parity declaration for group \"%s\"",
+ groupname);
+ free (groupname);
+ }
+
/* Reflection symmetry information */
@@ -331,23 +344,24 @@ BndReflectVI (cGH const * restrict const cctkGH,
{
/* Find parity */
+ parity = tensorparity;
switch (ttype)
{
case SCALAR:
- parity = +1;
+ parity *= +1;
break;
case VECTOR:
- parity = dir == tcomponent ? -1 : +1;
+ parity *= dir == tcomponent ? -1 : +1;
break;
case TENSOR:
switch (tcomponent)
{
- case 0: parity = +1; break;
- case 1: parity = (dir == 0 || dir == 1) ? -1 : +1; break;
- case 2: parity = (dir == 0 || dir == 2) ? -1 : +1; break;
- case 3: parity = +1; break;
- case 4: parity = (dir == 1 || dir == 2) ? -1 : +1; break;
- case 5: parity = +1; break;
+ case 0: parity *= +1; break;
+ case 1: parity *= (dir == 0 || dir == 1) ? -1 : +1; break;
+ case 2: parity *= (dir == 0 || dir == 2) ? -1 : +1; break;
+ case 3: parity *= +1; break;
+ case 4: parity *= (dir == 1 || dir == 2) ? -1 : +1; break;
+ case 5: parity *= +1; break;
default: assert (0);
}
break;
diff --git a/src/interpolate.c b/src/interpolate.c
index e1fe564..d8cdcee 100644
--- a/src/interpolate.c
+++ b/src/interpolate.c
@@ -177,6 +177,7 @@ ReflectionSymmetry_Interpolate (CCTK_POINTER_TO_CONST restrict const cctkGH_,
char tensortypealias[1000];
enum tensortype { UNKNOWN, SCALAR, VECTOR, TENSOR };
enum tensortype ttype;
+ CCTK_INT tensorparity;
int tcomponent;
int parities[3];
@@ -271,6 +272,18 @@ ReflectionSymmetry_Interpolate (CCTK_POINTER_TO_CONST restrict const cctkGH_,
assert (0);
}
+ ierr = Util_TableGetInt (table, & tensorparity, "tensorparity");
+ if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {
+ tensorparity = +1;
+ } else if (ierr<0) {
+ groupname = CCTK_GroupName(gi);
+ assert (groupname);
+ CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Error in tensor parity declaration for group \"%s\"",
+ groupname);
+ free (groupname);
+ }
+
/* Calculate parities */
@@ -329,7 +342,7 @@ ReflectionSymmetry_Interpolate (CCTK_POINTER_TO_CONST restrict const cctkGH_,
{
for (n=0; n<N_interp_points; ++n)
{
- int parity = +1;
+ int parity = tensorparity;
/* Is the point outside the domain? */
for (dir=0; dir<3; ++dir)
{