aboutsummaryrefslogtreecommitdiff
path: root/src/SetupPGV.c
diff options
context:
space:
mode:
authorschnetter <schnetter@b61c5cb5-eaca-4651-9a7a-d64986f99364>2005-09-26 00:27:59 +0000
committerschnetter <schnetter@b61c5cb5-eaca-4651-9a7a-d64986f99364>2005-09-26 00:27:59 +0000
commit1c77c3689546128269a540049eac430a92fec400 (patch)
treee9432e6890ed9404ef25586d7d36140168584e05 /src/SetupPGV.c
parente7a3e95d815446986410cf338fea46503f1a7100 (diff)
Improve periodic boundaries on small domains: allow the number of
ghost zones to be larger than the number of interior points if there is only one processor in the corresponding direction. This is necessary to allow two ghost zones when there is only one interior grid point, which is often used to set up lower-dimensional domains. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@469 b61c5cb5-eaca-4651-9a7a-d64986f99364
Diffstat (limited to 'src/SetupPGV.c')
-rw-r--r--src/SetupPGV.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/SetupPGV.c b/src/SetupPGV.c
index 49c87ea..b01403b 100644
--- a/src/SetupPGV.c
+++ b/src/SetupPGV.c
@@ -846,7 +846,7 @@ static int PUGH_SetupPGExtrasSizes(int is_gf,
}
else
{
- this->nsize[dir] = abs(sh[dir]);
+ this->nsize[dir] = sh[dir];
}
}
@@ -944,14 +944,20 @@ static int PUGH_SetupPGExtrasOwnership(int dim,
/* 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])
+ const int is_single_proc_in_dim
+ = (this->lb[this_proc][dir] == 0
+ && this->ub[this_proc][dir] == this->nsize[dir]-1);
+ if (! is_single_proc_in_dim
+ && 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 >= (nprocs+2) * the number of ghostzones "
- "(currently (%d+2)*%d=%d) !",
+ "(currently (%d+2)*%d=%d), "
+ "or make sure that there is only one processor in this "
+ "dimension.",
dir, this->nsize[dir], nprocs, this->nghostzones[dir],
(nprocs+2) * this->nghostzones[dir]);
}
@@ -1256,15 +1262,15 @@ pComm *PUGH_SetupGArrayGroupComm(pGH *pughGH,
#endif
this->docomm = malloc (2 * dim * sizeof (int));
- if(this->buffer_sz &&
- this->send_buffer &&
- this->recv_buffer &&
+ if((dim==0 || this->buffer_sz) &&
+ (dim==0 || this->send_buffer) &&
+ (dim==0 || this->recv_buffer) &&
#ifdef CCTK_MPI
- this->sreq &&
- this->rreq &&
- this->sstatus &&
+ (dim==0 || this->sreq) &&
+ (dim==0 || this->rreq) &&
+ (dim==0 || this->sstatus) &&
#endif
- this->docomm)
+ (dim==0 || this->docomm))
{
this->commflag = PUGH_NOCOMM;
this->first_var = first_var;