diff options
Diffstat (limited to 'src/SetupGroup.c')
-rw-r--r-- | src/SetupGroup.c | 52 |
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 { |