aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@082bdb00-0f4f-0410-b49e-b1835e5f2039>2009-11-11 03:26:14 +0000
committerschnetter <schnetter@082bdb00-0f4f-0410-b49e-b1835e5f2039>2009-11-11 03:26:14 +0000
commit5607ee841d9d3e8954af8379503d3a7c309ecfce (patch)
tree2b85b52181f8f0694273a0b5ab98a6d43b03813a
parent885b8531c900ab765917df3d9cc01d431643bdac (diff)
Correct indexing error with staggered grids.
Shorten and simplify the code that switches between the variable types. Remove cvs $Header$ comments. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/ReflectionSymmetry/trunk@27 082bdb00-0f4f-0410-b49e-b1835e5f2039
-rw-r--r--doc/documentation.tex3
-rw-r--r--interface.ccl1
-rw-r--r--param.ccl1
-rw-r--r--schedule.ccl1
-rw-r--r--src/apply.c159
-rw-r--r--src/interpolate.c5
-rw-r--r--src/make.code.defn1
-rw-r--r--src/reflection.h2
-rw-r--r--src/register.c5
9 files changed, 60 insertions, 118 deletions
diff --git a/doc/documentation.tex b/doc/documentation.tex
index fbc1f83..96cf75e 100644
--- a/doc/documentation.tex
+++ b/doc/documentation.tex
@@ -2,7 +2,6 @@
% Cactus Thorn template for ThornGuide documentation
% Author: Ian Kelley
% Date: Sun Jun 02, 2002
-% $Header$
%
% Thorn documentation in the latex file doc/documentation.tex
% will be included in ThornGuides built with the Cactus make system.
@@ -66,7 +65,6 @@
% *======================================================================*
% If you are using CVS use this line to give version information
-% $Header$
\documentclass{article}
@@ -86,7 +84,6 @@
% the date your document was last changed, if your document is in CVS,
% please use:
-% \date{$ $Date$ $}
\date{June 01 2004}
\maketitle
diff --git a/interface.ccl b/interface.ccl
index d1c90c4..698d073 100644
--- a/interface.ccl
+++ b/interface.ccl
@@ -1,5 +1,4 @@
# Interface definition for thorn ReflectionSymmetry
-# $Header$
IMPLEMENTS: ReflectionSymmetry
diff --git a/param.ccl b/param.ccl
index f6406ec..d32ff00 100644
--- a/param.ccl
+++ b/param.ccl
@@ -1,5 +1,4 @@
# Parameter definitions for thorn ReflectionSymmetry
-# $Header$
BOOLEAN verbose "Produce screen output while applying boundary conditions"
{
diff --git a/schedule.ccl b/schedule.ccl
index 8c5db0e..f872979 100644
--- a/schedule.ccl
+++ b/schedule.ccl
@@ -1,5 +1,4 @@
# Schedule definitions for thorn ReflectionSymmetry
-# $Header$
SCHEDULE ReflectionSymmetry_Register IN SymmetryRegister
{
diff --git a/src/apply.c b/src/apply.c
index c1736c6..17e2f1c 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -1,4 +1,5 @@
#include <assert.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -13,11 +14,6 @@
-static const char rcsid[] = "$Header$";
-CCTK_FILEVERSION(AEIDevelopment_ReflectionSymmetry_apply_c);
-
-
-
#define COPY_PRE(VARTYPE) \
static void \
copy_##VARTYPE (VARTYPE const * restrict const srcvar, \
@@ -29,24 +25,27 @@ CCTK_FILEVERSION(AEIDevelopment_ReflectionSymmetry_apply_c);
int const idir, int const jdir, int const kdir, \
int const parity) \
{ \
+ assert (abs(idir)==1); \
+ assert (abs(jdir)==1); \
+ assert (abs(kdir)==1); \
int const iioff = ioff + (1 - idir) * imin; \
int const jjoff = joff + (1 - jdir) * jmin; \
int const kkoff = koff + (1 - kdir) * kmin; \
- int const iimin = iioff + idir*imin; \
- int const jjmin = jjoff + jdir*jmin; \
- int const kkmin = kkoff + kdir*kmin; \
- int const iimax = iioff + idir*imax; \
- int const jjmax = jjoff + jdir*jmax; \
- int const kkmax = kkoff + kdir*kmax; \
- assert(imin>=0 && imax<=ni); \
- assert(jmin>=0 && jmax<=nj); \
- assert(kmin>=0 && kmax<=nk); \
- assert(iimin>=0 && iimax<=ni); \
- assert(jjmin>=0 && jjmax<=nj); \
- assert(kkmin>=0 && kkmax<=nk); \
- assert(iimax>=-1 && iimin<ni); \
- assert(jjmax>=-1 && jjmin<nj); \
- assert(kkmax>=-1 && kkmin<nk);
+ int const iimin = iioff + idir * imin; \
+ int const jjmin = jjoff + jdir * jmin; \
+ int const kkmin = kkoff + kdir * kmin; \
+ int const iimax = iioff + idir * imax; \
+ int const jjmax = jjoff + jdir * jmax; \
+ int const kkmax = kkoff + kdir * kmax; \
+ assert (imin>=0 && imax<=ni); \
+ assert (jmin>=0 && jmax<=nj); \
+ assert (kmin>=0 && kmax<=nk); \
+ assert (iimin>=0 && iimax<=ni); \
+ assert (jjmin>=0 && jjmax<=nj); \
+ assert (kkmin>=0 && kkmax<=nk); \
+ assert (iimax>=-1 && iimin<ni); \
+ assert (jjmax>=-1 && jjmin<nj); \
+ assert (kkmax>=-1 && kkmin<nk);
#define COPY_LOOP(VARTYPE) \
for (int k=kmin; k<kmax; ++k) { \
@@ -69,7 +68,7 @@ CCTK_FILEVERSION(AEIDevelopment_ReflectionSymmetry_apply_c);
#define REAL(x) x
#define IMAG(x) /* nothing */
#define RE /* nothing */
-#define IM /* nothing */
+#define IM ERROR ERROR ERROR
#ifdef HAVE_CCTK_INT1
COPY_PRE(CCTK_INT1)
@@ -164,7 +163,6 @@ COPY_POST(CCTK_COMPLEX32)
static int
BndReflectVI (cGH const * restrict const cctkGH,
- int const * restrict const stencil,
int const vi)
{
DECLARE_CCTK_PARAMETERS;
@@ -204,9 +202,6 @@ BndReflectVI (cGH const * restrict const cctkGH,
if (! cctkGH) {
CCTK_WARN (0, "Argument cctkGH is NULL");
}
- if (! stencil) {
- CCTK_WARN (0, "Argument stencil is NULL");
- }
if (vi < 0 || vi >= CCTK_NumVars()) {
CCTK_WARN (0, "Illegal variable index");
}
@@ -463,7 +458,7 @@ BndReflectVI (cGH const * restrict const cctkGH,
{-1,-1,-1},
{+1,+1,+1},
{-1,-1,-1},
- {+1,+1,+1},
+ {+1,+1,+1},
{-1,-1,-1}};
parity *= weylparities[tcomponent][dir];
break;
@@ -483,30 +478,48 @@ BndReflectVI (cGH const * restrict const cctkGH,
if (face == 0) {
imax[dir] = cctkGH->cctk_nghostzones[dir];
ioff[dir] = (+ 2*cctkGH->cctk_nghostzones[dir] - 1
- + (do_stagger[2*dir+face] ? 0 : 1));
+ - (do_stagger[2*dir+face] ? 0 : 1));
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));
+ + (do_stagger[2*dir+face] ? 0 : 1));
idir[dir] = -1;
}
+ /* Ensure that there are sufficient interior zones, since
+ this thorn does not support filling symmetry zones from
+ other symmetry zones */
+ {
+ int const have_points = cctkGH->cctk_lsh[dir];
+ int const need_points =
+ 3 * cctkGH->cctk_nghostzones[dir]
+ + do_stagger[2*dir] + do_stagger[2*dir+1];
+ if (need_points < have_points) {
+ CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Cannot apply symmetry boundary zones in the %s %c direction, since there seem to be more symmetry zones than interior zones",
+ (face==0 ? "lower" : "upper"),
+ "xyz"[dir]);
+ }
+ }
+
/* Copy region */
switch (group.vartype) {
+#define ARGS varptr, varptr, \
+ lsh[0], lsh[1], lsh[2], \
+ imin[0], imin[1], imin[2], \
+ imax[0], imax[1], imax[2], \
+ ioff[0], ioff[1], ioff[2], \
+ idir[0], idir[1], idir[2], \
+ parity
+
#ifdef HAVE_CCTK_INT1
case CCTK_VARIABLE_INT1:
#ifdef CCTK_INTEGER_PRECISION_1
case CCTK_VARIABLE_INT:
#endif
- copy_CCTK_INT1 (varptr, varptr,
- lsh[0], lsh[1], lsh[2],
- imin[0], imin[1], imin[2],
- imax[0], imax[1], imax[2],
- ioff[0], ioff[1], ioff[2],
- idir[0], idir[1], idir[2],
- parity);
+ copy_CCTK_INT1 (ARGS);
break;
#endif
@@ -515,13 +528,7 @@ BndReflectVI (cGH const * restrict const cctkGH,
#ifdef CCTK_INTEGER_PRECISION_2
case CCTK_VARIABLE_INT:
#endif
- copy_CCTK_INT2 (varptr, varptr,
- lsh[0], lsh[1], lsh[2],
- imin[0], imin[1], imin[2],
- imax[0], imax[1], imax[2],
- ioff[0], ioff[1], ioff[2],
- idir[0], idir[1], idir[2],
- parity);
+ copy_CCTK_INT2 (ARGS);
break;
#endif
@@ -530,13 +537,7 @@ BndReflectVI (cGH const * restrict const cctkGH,
#ifdef CCTK_INTEGER_PRECISION_4
case CCTK_VARIABLE_INT:
#endif
- copy_CCTK_INT4 (varptr, varptr,
- lsh[0], lsh[1], lsh[2],
- imin[0], imin[1], imin[2],
- imax[0], imax[1], imax[2],
- ioff[0], ioff[1], ioff[2],
- idir[0], idir[1], idir[2],
- parity);
+ copy_CCTK_INT4 (ARGS);
break;
#endif
@@ -545,13 +546,7 @@ BndReflectVI (cGH const * restrict const cctkGH,
#ifdef CCTK_INTEGER_PRECISION_8
case CCTK_VARIABLE_INT:
#endif
- copy_CCTK_INT8 (varptr, varptr,
- lsh[0], lsh[1], lsh[2],
- imin[0], imin[1], imin[2],
- imax[0], imax[1], imax[2],
- ioff[0], ioff[1], ioff[2],
- idir[0], idir[1], idir[2],
- parity);
+ copy_CCTK_INT8 (ARGS);
break;
#endif
@@ -560,13 +555,7 @@ BndReflectVI (cGH const * restrict const cctkGH,
#ifdef CCTK_REAL_PRECISION_4
case CCTK_VARIABLE_REAL:
#endif
- copy_CCTK_REAL4 (varptr, varptr,
- lsh[0], lsh[1], lsh[2],
- imin[0], imin[1], imin[2],
- imax[0], imax[1], imax[2],
- ioff[0], ioff[1], ioff[2],
- idir[0], idir[1], idir[2],
- parity);
+ copy_CCTK_REAL4 (ARGS);
break;
#endif
@@ -575,13 +564,7 @@ BndReflectVI (cGH const * restrict const cctkGH,
#ifdef CCTK_REAL_PRECISION_8
case CCTK_VARIABLE_REAL:
#endif
- copy_CCTK_REAL8 (varptr, varptr,
- lsh[0], lsh[1], lsh[2],
- imin[0], imin[1], imin[2],
- imax[0], imax[1], imax[2],
- ioff[0], ioff[1], ioff[2],
- idir[0], idir[1], idir[2],
- parity);
+ copy_CCTK_REAL8 (ARGS);
break;
#endif
@@ -590,13 +573,7 @@ BndReflectVI (cGH const * restrict const cctkGH,
#ifdef CCTK_REAL_PRECISION_16
case CCTK_VARIABLE_REAL:
#endif
- copy_CCTK_REAL16 (varptr, varptr,
- lsh[0], lsh[1], lsh[2],
- imin[0], imin[1], imin[2],
- imax[0], imax[1], imax[2],
- ioff[0], ioff[1], ioff[2],
- idir[0], idir[1], idir[2],
- parity);
+ copy_CCTK_REAL16 (ARGS);
break;
#endif
@@ -605,13 +582,7 @@ BndReflectVI (cGH const * restrict const cctkGH,
#ifdef CCTK_COMPLEX_PRECISION_8
case CCTK_VARIABLE_COMPLEX:
#endif
- copy_CCTK_COMPLEX8 (varptr, varptr,
- lsh[0], lsh[1], lsh[2],
- imin[0], imin[1], imin[2],
- imax[0], imax[1], imax[2],
- ioff[0], ioff[1], ioff[2],
- idir[0], idir[1], idir[2],
- parity);
+ copy_CCTK_COMPLEX8 (ARGS);
break;
#endif
@@ -620,13 +591,7 @@ BndReflectVI (cGH const * restrict const cctkGH,
#ifdef CCTK_COMPLEX_PRECISION_16
case CCTK_VARIABLE_COMPLEX:
#endif
- copy_CCTK_COMPLEX16 (varptr, varptr,
- lsh[0], lsh[1], lsh[2],
- imin[0], imin[1], imin[2],
- imax[0], imax[1], imax[2],
- ioff[0], ioff[1], ioff[2],
- idir[0], idir[1], idir[2],
- parity);
+ copy_CCTK_COMPLEX16 (ARGS);
break;
#endif
@@ -635,16 +600,12 @@ BndReflectVI (cGH const * restrict const cctkGH,
#ifdef CCTK_COMPLEX_PRECISION_32
case CCTK_VARIABLE_COMPLEX:
#endif
- copy_CCTK_COMPLEX32 (varptr, varptr,
- lsh[0], lsh[1], lsh[2],
- imin[0], imin[1], imin[2],
- imax[0], imax[1], imax[2],
- ioff[0], ioff[1], ioff[2],
- idir[0], idir[1], idir[2],
- parity);
+ copy_CCTK_COMPLEX32 (ARGS);
break;
#endif
+#undef ARGS
+
default:
CCTK_WARN (0, "Unsupported variable type");
}
@@ -860,7 +821,7 @@ ReflectionSymmetry_Apply (CCTK_ARGUMENTS)
CheckBoundaryParameters (cctkGH, vi, stencil);
- ierr = BndReflectVI (cctkGH, stencil, vi);
+ ierr = BndReflectVI (cctkGH, vi);
if (ierr) {
CCTK_WARN (0, "Internal error in BndReflectVI");
}
diff --git a/src/interpolate.c b/src/interpolate.c
index 9ec8c17..d30ed32 100644
--- a/src/interpolate.c
+++ b/src/interpolate.c
@@ -13,11 +13,6 @@
-static const char rcsid[] = "$Header$";
-CCTK_FILEVERSION(AEIDevelopment_ReflectionSymmetry_interpolate_c);
-
-
-
CCTK_INT
ReflectionSymmetry_Interpolate (CCTK_POINTER_TO_CONST restrict const cctkGH_,
CCTK_INT const N_dims,
diff --git a/src/make.code.defn b/src/make.code.defn
index 24a04f5..06e0a02 100644
--- a/src/make.code.defn
+++ b/src/make.code.defn
@@ -1,5 +1,4 @@
# Main make.code.defn file for thorn ReflectionSymmetry
-# $Header$
# Source files in this directory
SRCS = apply.c interpolate.c register.c
diff --git a/src/reflection.h b/src/reflection.h
index 19328a7..dc12fec 100644
--- a/src/reflection.h
+++ b/src/reflection.h
@@ -1,5 +1,3 @@
-/* $Header$ */
-
#ifndef REFLECTIONSYMMETRY_H
#define REFLECTIONSYMMETRY_H
diff --git a/src/register.c b/src/register.c
index 2ae4b58..5a538e0 100644
--- a/src/register.c
+++ b/src/register.c
@@ -6,11 +6,6 @@
-static const char rcsid[] = "$Header$";
-CCTK_FILEVERSION(AEIDevelopment_ReflectionSymmetry_register_c);
-
-
-
void
ReflectionSymmetry_Register (CCTK_ARGUMENTS)
{