aboutsummaryrefslogtreecommitdiff
path: root/src/SetupGroup.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/SetupGroup.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/SetupGroup.c')
-rw-r--r--src/SetupGroup.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/src/SetupGroup.c b/src/SetupGroup.c
index 7a93391..fa4a922 100644
--- a/src/SetupGroup.c
+++ b/src/SetupGroup.c
@@ -131,36 +131,44 @@ static int PUGH_SetupGAGroup (pGH *newGH,
if (gtype == CCTK_ARRAY || gtype == CCTK_SCALAR)
{
- /* Arrays can't (yet) have periodicity and manual setup,
- so initialize them to zero */
- perme = calloc (dim, sizeof (int));
- nprocs = calloc (dim, sizeof (int));
- if (dim && ! (perme && nprocs))
+ if (n_variables > 0)
{
- CCTK_WARN (0, "Memory allocation error in PUGH_SetupGAGroup");
- }
+ /* Arrays can't (yet) have periodicity and manual setup,
+ so initialize them to zero */
+ perme = calloc (dim, sizeof (int));
+ nprocs = calloc (dim, sizeof (int));
+ if (dim && ! (perme && nprocs))
+ {
+ CCTK_WARN (0, "Memory allocation error in PUGH_SetupGAGroup");
+ }
- PUGH_SetupDefaultTopology (dim, nprocs);
+ PUGH_SetupDefaultTopology (dim, nprocs);
- /* Check that there are enough grid points in this dimension
- * to make parallelising it worthwhile
- */
- for (i = 0 ; i < dim; i++)
- {
- if (abs (nsize[i]) <= 2*ghostsize[i])
+ /* Check that there are enough grid points in this dimension
+ * to make parallelising it worthwhile
+ */
+ for (i = 0 ; i < dim; i++)
{
- nprocs[i] = 1;
+ if (abs (nsize[i]) <= 2*ghostsize[i])
+ {
+ nprocs[i] = 1;
+ }
}
- }
- connectivity = PUGH_SetupConnectivity (dim, newGH->nprocs, nprocs, perme);
+ connectivity = PUGH_SetupConnectivity (dim, newGH->nprocs, nprocs, perme);
- extras = PUGH_SetupPGExtras (0, dim, perme, staggercode, nsize, ghostsize,
- newGH->nprocs, connectivity->nprocs,
- connectivity->neighbours, newGH->myproc);
+ extras = PUGH_SetupPGExtras (0, dim, perme, staggercode, nsize, ghostsize,
+ newGH->nprocs, connectivity->nprocs,
+ connectivity->neighbours, newGH->myproc);
- free (nprocs);
- free (perme);
+ free (nprocs);
+ free (perme);
+ }
+ else
+ {
+ connectivity = NULL;
+ extras = NULL;
+ }
}
else
{