aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreschnett <eschnett@6a38eb6e-646e-4a02-a296-d141613ad6c4>2013-03-19 02:54:09 +0000
committereschnett <eschnett@6a38eb6e-646e-4a02-a296-d141613ad6c4>2013-03-19 02:54:09 +0000
commit932074d09d9bb230869f4b4246f1cd2933f7c433 (patch)
treeeba1ca57a7a7ec12f1b688d77dcebc168af1934f
parentc6844f3f2026a0bc60046322b8849e4523b2e816 (diff)
Use cctk_ash to index grid functions
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/Boundary/trunk@313 6a38eb6e-646e-4a02-a296-d141613ad6c4
-rw-r--r--src/CopyBoundary.c9
-rw-r--r--src/FlatBoundary.c10
-rw-r--r--src/RobinBoundary.c4
-rw-r--r--src/ScalarBoundary.c8
-rw-r--r--src/StaticBoundary.c13
5 files changed, 25 insertions, 19 deletions
diff --git a/src/CopyBoundary.c b/src/CopyBoundary.c
index 171577c..0a46f02 100644
--- a/src/CopyBoundary.c
+++ b/src/CopyBoundary.c
@@ -959,7 +959,7 @@ void CCTK_FCALL CCTK_FNAME (BndCopyVN)
#define MAXDIM 3
/* 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)))
/*@@
@routine COPY_BOUNDARY
@@ -1000,8 +1000,7 @@ void CCTK_FCALL CCTK_FNAME (BndCopyVN)
{ \
int _index; \
\
- \
- _index = INDEX_3D (lsh, ii, jj, kk) * vtypesize; \
+ _index = INDEX_3D (ash, ii, jj, kk) * vtypesize; \
memcpy ((char *) GH->data[var_to][timelvl_to] + _index, \
(char *) GH->data[var_from][timelvl_from] + _index, \
vtypesize); \
@@ -1094,7 +1093,7 @@ static int ApplyBndCopy (const cGH *GH,
int timelvl_to, timelvl_from;
int gindex, gdim;
int var_to, var_from, vtypesize;
- int doBC[2*MAXDIM], lsh[MAXDIM];
+ int doBC[2*MAXDIM], ash[MAXDIM], lsh[MAXDIM];
CCTK_INT widths[2*MAXDIM];
CCTK_INT symtable;
CCTK_INT symbnd[2*MAXDIM];
@@ -1147,6 +1146,7 @@ static int ApplyBndCopy (const cGH *GH,
so that we can use the INDEX_3D macro later on */
for (i = gdim; i < MAXDIM; i++)
{
+ ash[i] = 0;
lsh[i] = 0;
}
@@ -1180,6 +1180,7 @@ static int ApplyBndCopy (const cGH *GH,
}
for (i = 0; i < gdim; i++)
{
+ ash[i] = GH->cctk_ash[i];
lsh[i] = GH->cctk_lsh[i];
doBC[i*2] &= GH->cctk_lsh[i] > widths[i*2] && GH->cctk_bbox[i*2];
doBC[i*2+1] &= GH->cctk_lsh[i] > widths[i*2+1] && GH->cctk_bbox[i*2+1];
diff --git a/src/FlatBoundary.c b/src/FlatBoundary.c
index 8d18023..7d09cf1 100644
--- a/src/FlatBoundary.c
+++ b/src/FlatBoundary.c
@@ -789,7 +789,7 @@ void CCTK_FCALL CCTK_FNAME (BndFlatVN)
#define MAXDIM 3
/* 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)))
/*@@
@routine FLAT_BOUNDARY
@@ -836,8 +836,8 @@ void CCTK_FCALL CCTK_FNAME (BndFlatVN)
{ \
int _index_to, _index_from; \
\
- _index_to = INDEX_3D (lsh, ii_to, jj_to, kk_to) * vtypesize; \
- _index_from = INDEX_3D (lsh, ii_from, jj_from, kk_from) * vtypesize;\
+ _index_to = INDEX_3D (ash, ii_to, jj_to, kk_to) * vtypesize; \
+ _index_from = INDEX_3D (ash, ii_from, jj_from, kk_from) * vtypesize;\
memcpy ((char *) GH->data[var][timelvl] + _index_to, \
(char *) GH->data[var][timelvl] + _index_from, \
vtypesize); \
@@ -922,7 +922,7 @@ static int ApplyBndFlat (const cGH *GH,
{
int i, j, k;
int var, vtypesize, gindex, gdim, timelvl;
- int doBC[2*MAXDIM], lsh[MAXDIM];
+ int doBC[2*MAXDIM], ash[MAXDIM], lsh[MAXDIM];
CCTK_INT widths[2*MAXDIM];
CCTK_INT symtable;
CCTK_INT symbnd[2*MAXDIM];
@@ -975,6 +975,7 @@ static int ApplyBndFlat (const cGH *GH,
so that we can use the INDEX_3D macro later on */
for (i = gdim; i < MAXDIM; i++)
{
+ ash[i] = 0;
lsh[i] = 0;
}
@@ -1005,6 +1006,7 @@ static int ApplyBndFlat (const cGH *GH,
}
for (i = 0; i < gdim; i++)
{
+ ash[i] = GH->cctk_ash[i];
lsh[i] = GH->cctk_lsh[i];
doBC[i*2] &= GH->cctk_lsh[i] > widths[i*2] && GH->cctk_bbox[i*2];
doBC[i*2+1] &= GH->cctk_lsh[i] > widths[i*2+1] && GH->cctk_bbox[i*2+1];
diff --git a/src/RobinBoundary.c b/src/RobinBoundary.c
index 1e36aa2..46c08d5 100644
--- a/src/RobinBoundary.c
+++ b/src/RobinBoundary.c
@@ -588,8 +588,8 @@ void CCTK_FCALL CCTK_FNAME (BndRobinVN)
#define SET_LINEAR_INDICES(i) \
{ \
dst = CCTK_GFINDEX3D (GH, i, j, k); \
- src = CCTK_GFINDEX3D (GH, i+dx, j+dy, k+dz); \
- distance = dist[abs(dx) + 2*abs (dy) + 4*abs (dz)]; \
+ src = CCTK_GFINDEX3D (GH, (i)+dx, j+dy, k+dz); \
+ distance = dist[abs (dx) + 2*abs (dy) + 4*abs (dz)]; \
}
diff --git a/src/ScalarBoundary.c b/src/ScalarBoundary.c
index c943367..3fa9703 100644
--- a/src/ScalarBoundary.c
+++ b/src/ScalarBoundary.c
@@ -870,7 +870,7 @@ void CCTK_FCALL CCTK_FNAME (BndScalarVN)
#define MAXDIM 3
/* 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)))
/* an empty macro */
#define NOTHING
@@ -922,7 +922,7 @@ void CCTK_FCALL CCTK_FNAME (BndScalarVN)
int _index; \
\
\
- _index = INDEX_3D (lsh, ii, jj, kk); \
+ _index = INDEX_3D (ash, ii, jj, kk); \
((left_cctk_type *) GH->data[var][timelvl])[_index] = \
(right_cctk_type) scalar; \
} \
@@ -1062,7 +1062,7 @@ static int ApplyBndScalar (const cGH *GH,
int i, j, k;
int gindex, gdim;
int var, timelvl;
- int doBC[2*MAXDIM], lsh[MAXDIM];
+ int doBC[2*MAXDIM], ash[MAXDIM], lsh[MAXDIM];
CCTK_INT widths[2*MAXDIM];
CCTK_INT symtable;
CCTK_INT symbnd[2*MAXDIM];
@@ -1111,6 +1111,7 @@ static int ApplyBndScalar (const cGH *GH,
so that we can use the INDEX_3D macro later on */
for (i = gdim; i < MAXDIM; i++)
{
+ ash[i] = 0;
lsh[i] = 0;
}
@@ -1141,6 +1142,7 @@ static int ApplyBndScalar (const cGH *GH,
}
for (i = 0; i < gdim; i++)
{
+ ash[i] = GH->cctk_ash[i];
lsh[i] = GH->cctk_lsh[i];
doBC[i*2] &= GH->cctk_lsh[i] > widths[i*2] && GH->cctk_bbox[i*2];
doBC[i*2+1] &= GH->cctk_lsh[i] > widths[i*2+1] && GH->cctk_bbox[i*2+1];
diff --git a/src/StaticBoundary.c b/src/StaticBoundary.c
index 74372e5..e942531 100644
--- a/src/StaticBoundary.c
+++ b/src/StaticBoundary.c
@@ -804,7 +804,7 @@ void CCTK_FCALL CCTK_FNAME (BndStaticVN)
#define MAXDIM 3
/* 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)))
/*@@
@routine STATIC_BOUNDARY
@@ -845,10 +845,9 @@ void CCTK_FCALL CCTK_FNAME (BndStaticVN)
{ \
int _index; \
\
- \
- _index = INDEX_3D (lsh, ii, jj, kk) * vtypesize; \
- memcpy ((char *) GH->data[var][timelvl_to] + _index, \
- (char *) GH->data[var][timelvl_from] + _index, \
+ _index = INDEX_3D (ash, ii, jj, kk) * vtypesize; \
+ memcpy ((char *) GH->data[var][timelvl_to] + _index, \
+ (char *) GH->data[var][timelvl_from] + _index, \
vtypesize); \
} \
} \
@@ -935,7 +934,7 @@ static int ApplyBndStatic (const cGH *GH,
int timelvl_to, timelvl_from;
int gindex, gdim;
int var, vtypesize;
- int doBC[2*MAXDIM], lsh[MAXDIM];
+ int doBC[2*MAXDIM], ash[MAXDIM], lsh[MAXDIM];
CCTK_INT widths[2*MAXDIM];
CCTK_INT symtable;
CCTK_INT symbnd[2*MAXDIM];
@@ -992,6 +991,7 @@ static int ApplyBndStatic (const cGH *GH,
so that we can use the INDEX_3D macro later on */
for (i = gdim; i < MAXDIM; i++)
{
+ ash[i] = 0;
lsh[i] = 0;
}
@@ -1031,6 +1031,7 @@ static int ApplyBndStatic (const cGH *GH,
}
for (i = 0; i < gdim; i++)
{
+ ash[i] = GH->cctk_ash[i];
lsh[i] = GH->cctk_lsh[i];
doBC[i*2] &= GH->cctk_lsh[i] > widths[i*2] && GH->cctk_bbox[i*2];
doBC[i*2+1] &= GH->cctk_lsh[i] > widths[i*2+1] && GH->cctk_bbox[i*2+1];