From 5975ab9ce7d2c8a287859da1f68579ba6233b82d Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 21 Jun 2004 09:07:51 +0000 Subject: 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 --- src/SetupPGV.c | 38 +++++++++++++++++++++++--------------- 1 file 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 = (maxpointsrnpoints[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]; } } -- cgit v1.2.3