aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2004-06-26 17:42:34 +0000
committertradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2004-06-26 17:42:34 +0000
commit69f40164f33675a75b5a36f67d5d2872feb39bd8 (patch)
treeb71c4c1f6c22f745e7440261eca15eef2751d40b
parent5975ab9ce7d2c8a287859da1f68579ba6233b82d (diff)
Store the directional stagger indices in the pGV structure rather than just the
staggering code. And use this former later on - this closes PR CactusPUGH 1549: "Staggered grids crash PUGH". git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@446 b61c5cb5-eaca-4651-9a7a-d64986f99364
-rw-r--r--src/Comm.c8
-rw-r--r--src/FinishReceiveGA.c4
-rw-r--r--src/PostReceiveGA.c8
-rw-r--r--src/PostSendGA.c13
-rw-r--r--src/SetupPGV.c11
-rw-r--r--src/include/pGV.h2
6 files changed, 25 insertions, 21 deletions
diff --git a/src/Comm.c b/src/Comm.c
index 2159a83..0c36af8 100644
--- a/src/Comm.c
+++ b/src/Comm.c
@@ -984,15 +984,15 @@ static int PUGH_SyncSingleProc(pGH *pughGH, pComm *comm)
if (GA->connectivity->perme[face / 2])
{
/* get the index ranges for the nested loops */
- istart_from = GA->extras->overlap[GA->stagger][0][face];
- iend_from = GA->extras->overlap[GA->stagger][1][face];
+ istart_from = GA->extras->overlap[GA->stagger[face>>1]][0][face];
+ iend_from = GA->extras->overlap[GA->stagger[face>>1]][1][face];
if (face & 1)
{
- istart_to = GA->extras->ghosts[GA->stagger][0][face - 1];
+ istart_to = GA->extras->ghosts[GA->stagger[face>>1]][0][face - 1];
}
else
{
- istart_to = GA->extras->ghosts[GA->stagger][0][face + 1];
+ istart_to = GA->extras->ghosts[GA->stagger[face>>1]][0][face + 1];
}
/* set iterators to the start vector */
diff --git a/src/FinishReceiveGA.c b/src/FinishReceiveGA.c
index d483e4f..31b469b 100644
--- a/src/FinishReceiveGA.c
+++ b/src/FinishReceiveGA.c
@@ -84,8 +84,8 @@ void FinishReceiveGA(pGH *pughGH, int dir, pComm *comm)
comm->n_vars, GA->name);
#endif
- istart = GA->extras->ghosts[GA->stagger][0][dir];
- iend = GA->extras->ghosts[GA->stagger][1][dir];
+ istart = GA->extras->ghosts[GA->stagger[dir>>1]][0][dir];
+ iend = GA->extras->ghosts[GA->stagger[dir>>1]][1][dir];
iterator = GA->extras->iterator;
/* set iterator to the start vector */
diff --git a/src/PostReceiveGA.c b/src/PostReceiveGA.c
index ef856a2..c061b70 100644
--- a/src/PostReceiveGA.c
+++ b/src/PostReceiveGA.c
@@ -102,19 +102,19 @@ void PostReceiveGA(pGH *pughGH, int dir, pComm *comm)
switch (GA->vtype)
{
case CCTK_VARIABLE_CHAR:
- recv_dt = pughGH->recv_char_dt[GA->stagger];
+ recv_dt = pughGH->recv_char_dt[GA->stagger[dir>>1]];
break;
case CCTK_VARIABLE_INT:
- recv_dt = pughGH->recv_int_dt[GA->stagger];
+ recv_dt = pughGH->recv_int_dt[GA->stagger[dir>>1]];
break;
case CCTK_VARIABLE_REAL:
- recv_dt = pughGH->recv_real_dt[GA->stagger];
+ recv_dt = pughGH->recv_real_dt[GA->stagger[dir>>1]];
break;
case CCTK_VARIABLE_COMPLEX:
- recv_dt = pughGH->recv_complex_dt[GA->stagger];
+ recv_dt = pughGH->recv_complex_dt[GA->stagger[dir>>1]];
break;
default:
diff --git a/src/PostSendGA.c b/src/PostSendGA.c
index 3eda977..0d021b8 100644
--- a/src/PostSendGA.c
+++ b/src/PostSendGA.c
@@ -102,9 +102,8 @@ void PostSendGA(pGH *pughGH, int dir, pComm *comm)
if (pughGH->commmodel == PUGH_ALLOCATEDBUFFERS)
{
-
- istart = GA->extras->overlap[GA->stagger][0][dir];
- iend = GA->extras->overlap[GA->stagger][1][dir];
+ istart = GA->extras->overlap[GA->stagger[dir>>1]][0][dir];
+ iend = GA->extras->overlap[GA->stagger[dir>>1]][1][dir];
iterator = GA->extras->iterator;
/* set iterator to the start vector */
@@ -194,19 +193,19 @@ void PostSendGA(pGH *pughGH, int dir, pComm *comm)
{
case CCTK_VARIABLE_CHAR:
- send_dt = pughGH->send_char_dt[GA->stagger];
+ send_dt = pughGH->send_char_dt[GA->stagger[dir>>1]];
break;
case CCTK_VARIABLE_INT:
- send_dt = pughGH->send_int_dt[GA->stagger];
+ send_dt = pughGH->send_int_dt[GA->stagger[dir>>1]];
break;
case CCTK_VARIABLE_REAL:
- send_dt = pughGH->send_real_dt[GA->stagger];
+ send_dt = pughGH->send_real_dt[GA->stagger[dir>>1]];
break;
case CCTK_VARIABLE_COMPLEX:
- send_dt = pughGH->send_complex_dt[GA->stagger];
+ send_dt = pughGH->send_complex_dt[GA->stagger[dir>>1]];
break;
default:
diff --git a/src/SetupPGV.c b/src/SetupPGV.c
index 9f4ebe8..b81864e 100644
--- a/src/SetupPGV.c
+++ b/src/SetupPGV.c
@@ -1374,15 +1374,16 @@ pGA *PUGH_SetupGArray(void *parent,
int arrayid,
int varsize,
int vtype,
- int stagger,
+ int staggercode,
int vector_size,
int vector_entry,
pGA *vector_base)
{
+ int dim;
pGA *this;
- this = calloc(1, sizeof(pGA));
+ this = calloc(1, sizeof(pGA));
if(this)
{
this->extras = extras;
@@ -1392,7 +1393,11 @@ pGA *PUGH_SetupGArray(void *parent,
this->parent = parent;
this->varsize = varsize;
this->vtype = vtype;
- this->stagger = stagger;
+ this->stagger = calloc (this->extras->dim, sizeof (int));
+ for (dim = 0; dim < this->extras->dim; dim++)
+ {
+ this->stagger[dim] = CCTK_StaggerDirIndex (dim, staggercode);
+ }
this->id = id;
this->arrayid = arrayid;
this->storage = PUGH_NOSTORAGE;
diff --git a/src/include/pGV.h b/src/include/pGV.h
index 250a653..13d3214 100644
--- a/src/include/pGV.h
+++ b/src/include/pGV.h
@@ -95,7 +95,7 @@ typedef struct PGA
void *padddata; /* Storage for the data. */
void *data; /* See the note above. */
int storage; /* Do we have storage or not? */
- int stagger; /* Only Vertex Centered now... */
+ int *stagger; /* [dim] directional stagger indicies */
void *parent; /* The GH to which I belong */
/* Note this is struct PGH whic is