aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreschnett <eschnett@082bdb00-0f4f-0410-b49e-b1835e5f2039>2010-09-29 15:43:15 +0000
committereschnett <eschnett@082bdb00-0f4f-0410-b49e-b1835e5f2039>2010-09-29 15:43:15 +0000
commit4991153c2328ce332e2d26f9e90bba45ee5497eb (patch)
tree9923829d3fe20504f676d6d53343d9358a26dea3
parent68eea08cf1b9e713156273054cbe41249dfdc64c (diff)
It's unlikely that this will affect anyone, but I've found some
incorrect behavior in the treatment of *upper-face* symmetries in ReflectionSymmetry. I propose the attached patch. In brief, since the loop runs over the "source" points in descending order and the "destination" points in ascending order, then the index offset between the two sets should just be 2 (or 1 if one is staggering the origin), rather than twice the ghost size as in the lower-face case. The change affects branches that are only executed upon reflection_upper_*, so most people won't see a difference. [Patch from Eloisa Bentivegna] git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/ReflectionSymmetry/trunk@39 082bdb00-0f4f-0410-b49e-b1835e5f2039
-rw-r--r--src/apply.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/apply.c b/src/apply.c
index 353361f..160a691 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -514,6 +514,22 @@ BndReflectVI (cGH const * restrict const cctkGH,
ioff[d] = 0;
idir[d] = 1;
}
+ /* To determine the correct expressions for ioff below,
+ * consider the definitions of iimin and iimax in the macro
+ * COPY_PRE above:
+ *
+ * iioff = ioff + (1 - idir) * imin
+ * iimin = iioff + idir * imin
+ * iimax = iioff + idir * imax
+ *
+ * We need idir = -1 since the loop copying into the
+ * symmetry zones traverses the grid points in opposite
+ * directions.
+ *
+ * Using the expressions above, one chooses the desired
+ * values of iimin and iimax, and can then solve the
+ * equations above for ioff.
+ */
if (face == 0) {
imax[dir] = cctkGH->cctk_nghostzones[dir];
ioff[dir] = (+ 2*cctkGH->cctk_nghostzones[dir] - 1
@@ -521,8 +537,7 @@ BndReflectVI (cGH const * restrict const cctkGH,
idir[dir] = -1;
} else {
imin[dir] = cctkGH->cctk_lsh[dir] - cctkGH->cctk_nghostzones[dir];
- ioff[dir] = (- 2*cctkGH->cctk_nghostzones[dir] + 1
- - (do_stagger[2*dir+face] ? 0 : 1));
+ ioff[dir] = - 1 - (do_stagger[2*dir+face] ? 0 : 1);
idir[dir] = -1;
}