aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}