From 6f29655138146a00269de292322f0b02a24147c1 Mon Sep 17 00:00:00 2001 From: goodale Date: Thu, 17 Feb 2000 09:02:34 +0000 Subject: Erik's changes to make things timelevel aware. Tom git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CartGrid3D/trunk@91 c78560ca-4b45-4335-b268-5f3340f3cb52 --- src/Symmetry.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/Symmetry.c b/src/Symmetry.c index 21b262b..e833eaf 100644 --- a/src/Symmetry.c +++ b/src/Symmetry.c @@ -8,6 +8,7 @@ @enddesc @@*/ +#include #include #include @@ -56,7 +57,7 @@ void SetCartSymmetry(cGH *GH, int *sym, const char *imp_gf) { sprintf(message,"Grid function %s has no index",imp_gf); CCTK_WARN(0,message); free(message); - }; + } /* Reference the hash table in the GHex and tell it what kind of symmetry is being applied @@ -160,6 +161,7 @@ int CartSymBCGroupI(cGH *GH, int groupnum) { SymmetryGHex *sGHex; int first,last,index,j; + int time; int doSym[6]; /* Get out if we are sure no symmetries should be applied */ @@ -181,6 +183,14 @@ int CartSymBCGroupI(cGH *GH, int groupnum) { /*get the index of the first GF in the group and how many Vars there are*/ first = CCTK_FirstVarIndexI(groupnum); last = first+CCTK_NumVarsInGroupI(groupnum)-1; + assert (first>=0 && last>=first); + + /* Use next time level, if present */ + time = CCTK_NumTimeLevelsFromVarI(first) - 1; + if (time < 0) + { + time = 0; + } /* loop over the variables in the group */ for (index=first; index<=last; index++) { @@ -218,7 +228,7 @@ int CartSymBCGroupI(cGH *GH, int groupnum) { FORTRAN_NAME(SymmetryCondition)( GH->cctk_lsh, /* xyz-size of PE local grid */ - GH->data[index][0], + GH->data[index][time], /* pointer to start of data array for GF[index]*/ GH->cctk_nghostzones, /* number of ghost zones */ @@ -248,11 +258,20 @@ int CartSymBCVarI(cGH *GH, int varnum) { SymmetryGHex *sGHex; int j; + int time; int doSym[6]; /* Get out if we are sure no symmetries should be applied */ if (CCTK_Equals(domain,"full")) return 0; + assert (varnum>=0); + + /* Use next time level, if present */ + time = CCTK_NumTimeLevelsFromVarI(varnum) - 1; + if (time < 0) + { + time = 0; + } /* Get the pointer to the Symmetry GH extension */ sGHex = (SymmetryGHex*)GH->extensions[CCTK_GHExtensionHandle("Symmetry")]; @@ -292,7 +311,7 @@ int CartSymBCVarI(cGH *GH, int varnum) { FORTRAN_NAME(SymmetryCondition)( GH->cctk_lsh, /* xyz-size of PE local grid */ - GH->data[varnum][0], + GH->data[varnum][time], /* pointer to start of data array for GF[varnum]*/ GH->cctk_nghostzones, /* number of ghost zones */ -- cgit v1.2.3