aboutsummaryrefslogtreecommitdiff
path: root/src/SetupPGH.c
diff options
context:
space:
mode:
authorlanfer <lanfer@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-01-14 09:18:24 +0000
committerlanfer <lanfer@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-01-14 09:18:24 +0000
commit3bb7ea7ddaa14ea6484177a4ae198d8f95721fd7 (patch)
treed48bd2e15c4048132c54a24c455257ea31c2adb3 /src/SetupPGH.c
parente9f2c18d9497fddaf932455fe8b3616734fb89d4 (diff)
bug fix - thanks Malcolm
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@148 b61c5cb5-eaca-4651-9a7a-d64986f99364
Diffstat (limited to 'src/SetupPGH.c')
-rw-r--r--src/SetupPGH.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/SetupPGH.c b/src/SetupPGH.c
index c07cfa0..bdffe21 100644
--- a/src/SetupPGH.c
+++ b/src/SetupPGH.c
@@ -24,6 +24,7 @@ void BoundingBox(pGH *GH, int *nproc, int staggertype);
void Neighbours1D(pGH *GH, int *nproc, int *maxpoints, int *minpoints, double *avgpoints);
void Neighbours3D(pGH *GH, int *nproc, int *maxpoints, int *minpoints, double *avgpoints);
void DestroyPGF(pGH *GH, pGF **GFin);
+void pGH_DumpInfo(pGH *GH);
/*@@
@routine SetupPGH
@@ -616,8 +617,9 @@ void pGH_SetupOwnership(pGH *GH,int dim) {
void pGH_SetupStaggering(pGH *GH, int dim) {
int s,d,k,i,dir;
-
- int upperbnd[dim];
+ int *upperbnd;
+
+ upperbnd = (int*) malloc(dim*sizeof(int));
for (d=0;d<dim;d++)
upperbnd[d] = (GH->ub[GH->myproc][d] == GH->nsize[d]-1) ? 1 : 0;
@@ -642,8 +644,6 @@ void pGH_SetupStaggering(pGH *GH, int dim) {
if(upperbnd[d])
{
GH->ownership[s][1][d] --;
- printf(" upperbnd[%d] = %d\n",d,upperbnd[d]);
- printf(" SetupPGH: OS[%d][1][%d] %d\n",s,d, GH->ownership[s][1][d]);
}
}
}
@@ -655,15 +655,12 @@ void pGH_SetupStaggering(pGH *GH, int dim) {
{
for (d=0;d<dim;d++)
{
+ /* 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))
{
GH->overlap[s][0][dir][d]--;
GH->overlap[s][1][dir][d]--;
- printf(" upperbnd[%d] = %d\n",d,upperbnd[d]);
- printf(" OL[%d][0/1][%d][%d]: %d %d -> %d %d \n",
- s,dir,d,
- GH->overlap[0][0][dir][d],GH->overlap[0][1][dir][d],
- GH->overlap[s][0][dir][d],GH->overlap[s][1][dir][d]);
}
}
}
@@ -675,7 +672,9 @@ void pGH_SetupStaggering(pGH *GH, int dim) {
for(dir=0;dir<2*dim;dir++)
{
for (d=0;d<dim;d++)
- {
+ {
+ /* 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))
{
GH->ghosts[s][0][dir][d]--;
@@ -768,3 +767,23 @@ void DestroyPGH(pGH **GHin)
fflush(stdout);
}
+void pGH_DumpInfo(pGH *GH) {
+ int i,j,k;
+ printf("INFO: \n");
+ printf(" myproc: %d/%d \n",GH->myproc,GH->nprocs);
+ printf(" ownership: \n");
+ for (i=0;i<PUGH_NSTAGGER;i++)
+ for (j=0;j<GH->dim;j++)
+ printf(" GH->ownership[%d][0/1][%d]: %d %d \n",
+ i,j,GH->ownership[i][0][j],GH->ownership[i][1][j]);
+ for (i=0;i<PUGH_NSTAGGER;i++)
+ for (j=0;j<GH->dim;j++)
+ for (k=0;k<2*GH->dim;k++)
+ printf(" GH->ghosts[%d][0/1][%d][%d]: %d %d \n",
+ i,k,j,GH->ghosts[i][0][k][j],GH->ghosts[i][1][k][j]);
+ for (i=0;i<PUGH_NSTAGGER;i++)
+ for (j=0;j<GH->dim;j++)
+ for (k=0;k<2*GH->dim;k++)
+ printf(" GH->overlap[%d][0/1][%d][%d]: %d %d \n",
+ i,k,j,GH->overlap[i][0][j][k],GH->overlap[i][1][k][j]);
+}