aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2004-06-21 09:07:51 +0000
committertradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2004-06-21 09:07:51 +0000
commit5975ab9ce7d2c8a287859da1f68579ba6233b82d (patch)
tree14394b828b913560619e4c069ee6d4d82ab5a098
parent1a48e6db2432c1b86f836f2b8695ccff09ad6a90 (diff)
Check on each processor that there are enough interior points.
This is related to PR CactusPUGH/1726 "Periodic boundaries without MPI are broken". git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@445 b61c5cb5-eaca-4651-9a7a-d64986f99364
-rw-r--r--src/SetupPGV.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/SetupPGV.c b/src/SetupPGV.c
index 7a94029..9f4ebe8 100644
--- a/src/SetupPGV.c
+++ b/src/SetupPGV.c
@@ -36,6 +36,7 @@ static int PUGH_SetupPGExtrasMemory(int dim, int total_procs, pGExtras *this);
static int PUGH_SetupPGExtrasOwnership(int dim,
int *perme,
int this_proc,
+ int nprocs,
pGExtras *this);
static int PUGH_SetupPGExtrasStaggering(int dim, int this_proc, pGExtras *this);
static int PUGH_SetupBoundingBox(int is_gf,
@@ -104,7 +105,7 @@ 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, this);
+ PUGH_SetupPGExtrasOwnership(dim, perme, this_proc, total_procs, this);
PUGH_SetupPGExtrasStaggering(dim, this_proc, this);
}
}
@@ -855,16 +856,20 @@ static int PUGH_SetupPGExtrasSizes(int is_gf,
this->npoints = this->rnpoints[this_proc];
/* Set up the maxskew */
- maxpoints=this->npoints;
- minpoints=this->npoints;
- avgpoints=0;
+ minpoints = maxpoints = avgpoints = 0;
for (proc = 0; proc < total_procs; proc++)
{
- maxpoints = (maxpoints<this->rnpoints[proc]) ? this->rnpoints[proc] : maxpoints;
- minpoints = (minpoints>this->rnpoints[proc]) ? this->rnpoints[proc] : minpoints;
+ if (minpoints > this->rnpoints[proc])
+ {
+ minpoints = this->rnpoints[proc];
+ }
+ if (maxpoints < this->rnpoints[proc])
+ {
+ maxpoints = this->rnpoints[proc];
+ }
avgpoints += this->rnpoints[proc];
}
- avgpoints = avgpoints/total_procs;
+ avgpoints /= total_procs;
this->maxskew = avgpoints > 0 ? 100*(maxpoints-minpoints)/avgpoints : 0;
@@ -886,6 +891,7 @@ static int PUGH_SetupPGExtrasSizes(int is_gf,
static int PUGH_SetupPGExtrasOwnership(int dim,
int *perme,
int this_proc,
+ int nprocs,
pGExtras *this)
{
int tmp;
@@ -914,20 +920,22 @@ static int PUGH_SetupPGExtrasOwnership(int dim,
{
if(perme[dir])
{
+ this->ownership[PUGH_VERTEXCTR][0][dir] = this->nghostzones[dir];
+ this->ownership[PUGH_VERTEXCTR][1][dir] =
+ this->lnsize[dir] - this->nghostzones[dir];
+
/* sanity check for periodic BC */
- if (this->nsize[dir] < 3*this->nghostzones[dir])
+ if (this->ownership[PUGH_VERTEXCTR][1][dir] -
+ this->ownership[PUGH_VERTEXCTR][0][dir] < this->nghostzones[dir])
{
CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,
"Not enough interior grid points in dimension %d ! "
"Please set the number of global grid points (currently "
- "%d) to something >= 3 * the number of ghostzones "
- "(currently %d) !",
- dir, this->nsize[dir], this->nghostzones[dir]);
+ "%d) to something >= (nprocs+2) * the number of ghostzones "
+ "(currently (%d+2)*%d=%d) !",
+ dir, this->nsize[dir], nprocs, this->nghostzones[dir],
+ (nprocs+2) * this->nghostzones[dir]);
}
-
- this->ownership[PUGH_VERTEXCTR][0][dir] = this->nghostzones[dir];
- this->ownership[PUGH_VERTEXCTR][1][dir] =
- this->lnsize[dir] - this->nghostzones[dir];
}
}