aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreschnett <eschnett@c78560ca-4b45-4335-b268-5f3340f3cb52>2013-01-14 17:49:47 +0000
committereschnett <eschnett@c78560ca-4b45-4335-b268-5f3340f3cb52>2013-01-14 17:49:47 +0000
commit24ea0747338f9f6422f8a146fc3ff5af411d3601 (patch)
treecff1e3ac74850c13154192b286b86f95adc9d1df
parent5880beb0793f87e6b0c2917783c02ffb2c9e1b9c (diff)
Support array padding (take cctk_ash into account)
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/CartGrid3D/trunk@265 c78560ca-4b45-4335-b268-5f3340f3cb52
-rw-r--r--src/Symmetry.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/Symmetry.c b/src/Symmetry.c
index 1e19f53..1cf8544 100644
--- a/src/Symmetry.c
+++ b/src/Symmetry.c
@@ -284,7 +284,7 @@ void CCTK_FCALL CCTK_FNAME (CartSymVN)
********************* Local Routines *************************
********************************************************************/
/* macro to compute the linear index of a 3D point */
-#define INDEX_3D(lsh, i, j, k) ((i) + (lsh)[0]*((j) + (lsh)[1]*(k)))
+#define INDEX_3D(ash, i, j, k) ((i) + (ash)[0]*((j) + (ash)[1]*(k)))
/*@@
@@ -316,9 +316,9 @@ void CCTK_FCALL CCTK_FNAME (CartSymVN)
{ \
for (ii = 0; ii < gdata.nghostzones[dir/2]; ii++) \
{ \
- _var[INDEX_3D (lsh, i, j, k)] NUMBER_PART \
+ _var[INDEX_3D (ash, i, j, k)] NUMBER_PART \
= (itype)(GFSym[vindex][dir] \
- * _var[INDEX_3D (lsh, iii, jjj, kkk)] NUMBER_PART); \
+ * _var[INDEX_3D (ash, iii, jjj, kkk)] NUMBER_PART); \
} \
} \
} \
@@ -332,9 +332,9 @@ void CCTK_FCALL CCTK_FNAME (CartSymVN)
{ \
for (ii = lsh[dir/2]-gdata.nghostzones[dir/2]; ii < lsh[dir/2]; ii++) \
{ \
- _var[INDEX_3D (lsh, i, j, k)] NUMBER_PART \
+ _var[INDEX_3D (ash, i, j, k)] NUMBER_PART \
= (itype)(GFSym[vindex][dir] \
- * _var[INDEX_3D (lsh, iii, jjj, kkk)] NUMBER_PART); \
+ * _var[INDEX_3D (ash, iii, jjj, kkk)] NUMBER_PART); \
} \
} \
} \
@@ -444,7 +444,7 @@ void CCTK_FCALL CCTK_FNAME (CartSymVN)
/* Function to apply above macros. */
#define SYMMETRY_FUNCTION(cctk_type,integral_type,SUFFIX) \
- static void cctk_type ## _SymBC ## SUFFIX(const cGH *GH, const int vindex, const int *doSym, const int *offset, const int *lsh, const cGroup group_static_data, const cGroupDynamicData gdata, int **GFSym) { int i,j,k; SYMMETRY_BOUNDARY(cctk_type, integral_type); }
+ static void cctk_type ## _SymBC ## SUFFIX(const cGH *GH, const int vindex, const int *doSym, const int *offset, const int *lsh, const int *ash, const cGroup group_static_data, const cGroupDynamicData gdata, int **GFSym) { int i,j,k; SYMMETRY_BOUNDARY(cctk_type, integral_type); }
/* Create functions to apply macros.
* This is much easier for the optiser to deal with.
@@ -505,7 +505,7 @@ SYMMETRY_FUNCTION(CCTK_REAL16,CCTK_REAL16,R)
#endif
#undef NUMBER_PART
-#define CALL_SYMBC(cctk_type,SUFFIX) cctk_type ## _SymBC ## SUFFIX(GH, vindex, doSym, offset, lsh, group_static_data, gdata, GFSym)
+#define CALL_SYMBC(cctk_type,SUFFIX) cctk_type ## _SymBC ## SUFFIX(GH, vindex, doSym, offset, lsh, ash, group_static_data, gdata, GFSym)
/*@@
@routine ApplySymmetry
@@ -560,7 +560,7 @@ static int ApplySymmetry (const cGH *GH, int gindex, int first_vindex,
int i, dim, vindex, retval;
int **GFSym;
int domainsym[2*MAX_DIM], doSym[2*MAX_DIM], offset[2*MAX_DIM];
- int lsh[MAX_DIM], cntstag[MAX_DIM];
+ int lsh[MAX_DIM], ash[MAX_DIM], cntstag[MAX_DIM];
cGroup group_static_data;
cGroupDynamicData gdata;
DECLARE_CCTK_PARAMETERS
@@ -603,10 +603,12 @@ static int ApplySymmetry (const cGH *GH, int gindex, int first_vindex,
if (i < group_static_data.dim)
{
lsh[i] = gdata.lsh[i];
+ ash[i] = gdata.ash[i];
}
else
{
lsh[i] = 1;
+ ash[i] = 1;
}
offset[2*i+0] = 2*gdata.nghostzones[i] - cntstag[i];
offset[2*i+1] = 2*(lsh[i]-1) - offset[2*i+0];