diff options
author | lanfer <lanfer@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 2000-03-27 16:35:29 +0000 |
---|---|---|
committer | lanfer <lanfer@b61c5cb5-eaca-4651-9a7a-d64986f99364> | 2000-03-27 16:35:29 +0000 |
commit | 55597e84a8e74d89e59b2f6877ce1e9e69ba3d34 (patch) | |
tree | 84164cebbaaab0da0f21f53b190d0171a0899f89 | |
parent | cf061a2821736574b21d5d52b051ce172f67748c (diff) |
staggering with PGV
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@186 b61c5cb5-eaca-4651-9a7a-d64986f99364
-rw-r--r-- | src/GHExtension.c | 12 | ||||
-rw-r--r-- | src/SetupPGV.c | 137 |
2 files changed, 50 insertions, 99 deletions
diff --git a/src/GHExtension.c b/src/GHExtension.c index 95980fb..5676a29 100644 --- a/src/GHExtension.c +++ b/src/GHExtension.c @@ -234,14 +234,6 @@ int pugh_ScheduleTraverseGH(cGH *GH, } } - /*$for (istag=0;istag<3;istag++) { - for (idir=0;idir<GH->cctk_dim;idir++) - printf("GHEx: LSSH[%d][%d] (%d): %d OSoben: %d \n", - istag,idir,CCTK_LSSH_IDX(istag,idir), - GH->cctk_lssh[CCTK_LSSH_IDX(istag,idir)], - mypGH->ownership[istag][1][idir]); - } $*/ - for(var = 0; var < mypGH->nvariables; var++) { @@ -256,8 +248,8 @@ int pugh_ScheduleTraverseGH(cGH *GH, GH->data[var][level] = mypGH->variables[var][level]; break; case CCTK_GF : - GH->data[var][level] = - ((pGA ***)(mypGH->variables))[var][level]->data; + GH->data[var][level] = + ((pGA ***)(mypGH->variables))[var][level]->data; break; case CCTK_ARRAY : GH->data[var][level] = diff --git a/src/SetupPGV.c b/src/SetupPGV.c index b77bdd2..1ddca74 100644 --- a/src/SetupPGV.c +++ b/src/SetupPGV.c @@ -159,6 +159,8 @@ pGExtras *pugh_SetupPGExtras(int dim, total_procs, nprocs, this_proc,this); pugh_SetupPGExtrasOwnership(dim, perme, stagger, sh, nghosts, total_procs, nprocs, this_proc, this); + pugh_SetupPGExtrasStaggering(dim, perme, stagger, sh, nghosts, + total_procs, nprocs, this_proc, this); } } @@ -1051,111 +1053,68 @@ int pugh_SetupPGExtrasOwnership(int dim, } - /* if staggering, set up ownership, overlaps, ghosts */ - if(stagger == PUGH_STAGGER) + return 0; +} + +int pugh_SetupPGExtrasStaggering(int dim, + int *perme, + int stagger, + int *sh, + int *nghosts, + int total_procs, + int *nprocs, + int this_proc, + pGExtras *this) +{ + int s,d,k,dir; + int *upperbnd; + + upperbnd = (int*) malloc(dim*sizeof(int)); + + + for (d=0;d<dim;d++) + { + upperbnd[d] = (this->ub[this_proc][d] == this->nsize[d]-1) ? 1 : 0; + } + + /* copy ownership/ghost/overlap from the default PUGH_VERTEXCTR */ + for(s=1;s<PUGH_NSTAGGER;s++) { - /* copy ownership from PUGH_VERTEXCTR */ - for(i = 1; i < PUGH_NSTAGGER; i++) + for(d=0;d<dim;d++) { - for(j = 0; j < dim; j++) + for(k=0;k<2;k++) { - for(k = 0; k < 2; k++) - { - this->ownership[i][k][j] = this->ownership[PUGH_VERTEXCTR][k][j]; - } - } - } - - /* correct ownership for staggered grids */ - for(i = 0; i < PUGH_NSTAGGER; i++) - { - for (idir = 0; idir < dim; idir++) - { - if(this->ub[this_proc][idir] != this->nsize[idir]-1) - { - this->ownership[i][1][idir] --; - } - else + this->ownership[s][k][d] = this->ownership[0][k][d]; + for (dir=0;dir<2*dim;dir++) { - if(i == PUGH_FACECTR(idir)) - { - this->ownership[i][1][idir] --; - } + this->overlap[s][k][dir][d] = this->overlap[0][k][dir][d]; + this->ghosts [s][k][dir][d] = this->ghosts [0][k][dir][d]; } } - } - - /* set overlaps for staggered grids */ - for(staglcv = 0; staglcv < PUGH_NSTAGGER; staglcv++) - { - for(dir = 0; dir < 2*dim; dir++) + + /* decrease ownership at upper bound */ + if(upperbnd[d]) { - for (idir = 0; idir < dim; idir++) - { - istart = 0; - iend = this->lnsize[idir]; - if(staglcv == PUGH_FACECTR(idir)) - { - iend --; - } - if(dir == 2*idir) - { - istart = this->nghostzones[idir]; - iend = 2 * this->nghostzones[idir]; - if(staglcv != PUGH_FACECTR(idir)) - { - istart ++; - iend ++; - } - } - if(dir == 2*idir+1) - { - istart = this->lnsize[idir] - 2 * this->nghostzones[idir] -1; - iend = istart + this->nghostzones[idir]; - } - - this->overlap[staglcv][0][dir][idir] = istart; - this->overlap[staglcv][1][dir][idir] = iend; - } + this->ownership[s][1][d] --; } } - - /* set ghosts for staggered grids */ - for(staglcv = 0; staglcv < PUGH_NSTAGGER; staglcv++) + + /* correct overlaps */ + for(dir=0;dir<2*dim;dir++) { - for(dir = 0; dir < 2*dim; dir++) + for (d=0;d<dim;d++) { - for(idir=0;idir<dim;idir++) + /* if we are at a upper physical bnd && at a upperface (1,3,5) + && we are in the dir direction decrease by one */ + if((upperbnd[d])&&((dir+1)%2==0)&&(dir==2*d+1)) { - istart = 0; - iend = this->lnsize[idir]; - if(staglcv == PUGH_FACECTR(idir)) - { - iend --; - } - if(dir == 2*idir) - { - istart = 0; - iend = this->nghostzones[idir]; - } - if(dir == 2*idir+1) - { - istart = this->lnsize[idir] - this->nghostzones[idir]; - iend = this->lnsize[idir]; - if(staglcv == PUGH_FACECTR(idir)) - { - istart --; - iend --; - } - } - this->ghosts[staglcv][0][dir][idir] = istart; - this->ghosts[staglcv][1][dir][idir] = iend; + this->overlap[s][0][dir][d]--; + this->overlap[s][1][dir][d]--; } } } } - - return 0; + return(0); } /*@@ |