diff options
Diffstat (limited to 'src/SetupPGV.c')
-rw-r--r-- | src/SetupPGV.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/SetupPGV.c b/src/SetupPGV.c index 8475475..49c87ea 100644 --- a/src/SetupPGV.c +++ b/src/SetupPGV.c @@ -21,6 +21,8 @@ #include "pugh.h" #include "pughi.h" + + static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusPUGH_PUGH_SetupPGV_c); @@ -39,6 +41,7 @@ static int PUGH_SetupPGExtrasOwnership(int dim, int *perme, int this_proc, int nprocs, + int **neighbours, pGExtras *this); static int PUGH_SetupPGExtrasStaggering(int dim, int this_proc, pGExtras *this); static int PUGH_SetupBoundingBox(int is_gf, @@ -92,6 +95,7 @@ pGExtras *PUGH_SetupPGExtras(int is_gf, int *nghosts, int total_procs, int *nprocs, + int **neighbours, int this_proc) { pGExtras *this; @@ -107,7 +111,8 @@ pGExtras *PUGH_SetupPGExtras(int is_gf, PUGH_SetupPGExtrasSizes(is_gf, dim, stagger, sh, nghosts, total_procs, nprocs, this_proc,this); - PUGH_SetupPGExtrasOwnership(dim, perme, this_proc, total_procs, this); + PUGH_SetupPGExtrasOwnership(dim, perme, this_proc, total_procs, + neighbours, this); PUGH_SetupPGExtrasStaggering(dim, this_proc, this); } } @@ -903,6 +908,7 @@ static int PUGH_SetupPGExtrasOwnership(int dim, int *perme, int this_proc, int nprocs, + int **neighbours, pGExtras *this) { int tmp; @@ -917,27 +923,27 @@ static int PUGH_SetupPGExtrasOwnership(int dim, */ for (dir = 0 ; dir < dim; dir++) { - this->ownership[PUGH_VERTEXCTR][0][dir] = - (this->lb[this_proc][dir] == 0 ? 0 : this->nghostzones[dir]); - this->ownership[PUGH_VERTEXCTR][1][dir] = - (this->ub[this_proc][dir] == this->nsize[dir]-1 ? - this->lnsize[dir] : this->lnsize[dir] - this->nghostzones[dir]); - this->bbox[2*dir+0] = this->lb[this_proc][dir] == 0; - this->bbox[2*dir+1] = this->ub[this_proc][dir] == this->nsize[dir]-1; - } - - /* correct for periodic identification : Tue Jun 17 08:40:15 CDT 1997 */ - for (dir = 0; dir < dim; dir++) - { - if(perme[dir]) - { + /* Setup ownership and bbox using neighbours. */ + if (neighbours[this_proc][2*dir] == -1 + || neighbours[this_proc][2*dir+1] == -1) { + this->ownership[PUGH_VERTEXCTR][0][dir] = + (this->lb[this_proc][dir] == 0 ? 0 : this->nghostzones[dir]); + this->ownership[PUGH_VERTEXCTR][1][dir] = + (this->ub[this_proc][dir] == this->nsize[dir]-1 ? + this->lnsize[dir] : this->lnsize[dir] - this->nghostzones[dir]); + this->bbox[2*dir+0] = this->lb[this_proc][dir] == 0; + this->bbox[2*dir+1] = this->ub[this_proc][dir] == this->nsize[dir]-1; + } else { this->ownership[PUGH_VERTEXCTR][0][dir] = this->nghostzones[dir]; this->ownership[PUGH_VERTEXCTR][1][dir] = this->lnsize[dir] - this->nghostzones[dir]; this->bbox[2*dir+0] = 0; this->bbox[2*dir+1] = 0; + } - /* sanity check for periodic BC */ + /* Do sanity check for periodic BC */ + if(perme[dir]) + { if (this->ownership[PUGH_VERTEXCTR][1][dir] - this->ownership[PUGH_VERTEXCTR][0][dir] < this->nghostzones[dir]) { |