aboutsummaryrefslogtreecommitdiff
path: root/src/Storage.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/Storage.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/Storage.c')
-rw-r--r--src/Storage.c153
1 files changed, 85 insertions, 68 deletions
diff --git a/src/Storage.c b/src/Storage.c
index c3f8b6f..066fe18 100644
--- a/src/Storage.c
+++ b/src/Storage.c
@@ -316,43 +316,52 @@ int PUGH_EnableGroupStorage (const cGH *GH, const char *groupname)
{
first_var = CCTK_FirstVarIndexI (group);
- /* get the group info from its index */
- CCTK_GroupData (group, &pgroup);
-
- retval = PUGH_EnableGArrayGroupStorage (pughGH,
- first_var,
- pgroup.numvars,
- pgroup.numtimelevels);
- if (!CCTK_Equals(storage_verbose,"no") && retval == 0)
+ if (first_var >= 0)
{
- /* get GA pointer of first var in group */
- GA = (pGA *) pughGH->variables[first_var][0];
- if (pgroup.grouptype == CCTK_GF)
- {
- totalnumberGF += pgroup.numvars * pgroup.numtimelevels;
- }
- else
- {
- totalnumberGA += pgroup.numvars * pgroup.numtimelevels;
- }
- totalstorage += (GA->extras->npoints * GA->varsize *
- pgroup.numtimelevels * pgroup.numvars) /
- (float) (1024*1024);
- if (totalstorage > maxstorage)
- {
- numberGF = totalnumberGF;
- numberGA = totalnumberGA;
- maxstorage = totalstorage;
- }
- /* Report on memory usage */
- if (CCTK_Equals(storage_verbose,"yes"))
+ /* get the group info from its index */
+ CCTK_GroupData (group, &pgroup);
+
+ retval = PUGH_EnableGArrayGroupStorage (pughGH,
+ first_var,
+ pgroup.numvars,
+ pgroup.numtimelevels);
+ if (!CCTK_Equals(storage_verbose,"no") && retval == 0)
{
- CCTK_VInfo (CCTK_THORNSTRING, "Switched memory on for group '%s'"
- " [GFs: %d GAs: %d Total Size: %6.2fMB]",
- groupname, totalnumberGF, totalnumberGA, totalstorage);
+ /* get GA pointer of first var in group */
+ GA = (pGA *) pughGH->variables[first_var][0];
+ if (pgroup.grouptype == CCTK_GF)
+ {
+ totalnumberGF += pgroup.numvars * pgroup.numtimelevels;
+ }
+ else
+ {
+ totalnumberGA += pgroup.numvars * pgroup.numtimelevels;
+ }
+ totalstorage += (GA->extras->npoints * GA->varsize *
+ pgroup.numtimelevels * pgroup.numvars) /
+ (float) (1024*1024);
+ if (totalstorage > maxstorage)
+ {
+ numberGF = totalnumberGF;
+ numberGA = totalnumberGA;
+ maxstorage = totalstorage;
+ }
+
+ /* Report on memory usage */
+ if (CCTK_Equals(storage_verbose,"yes"))
+ {
+ CCTK_VInfo (CCTK_THORNSTRING, "Switched memory on for group '%s'"
+ " [GFs: %d GAs: %d Total Size: %6.2fMB]",
+ groupname, totalnumberGF, totalnumberGA, totalstorage);
+ }
}
}
+ else
+ {
+ /* don't know what to say here; 0 seems safe */
+ retval = 0;
+ }
}
else
@@ -956,28 +965,32 @@ int PUGH_GroupStorageIncrease(const cGH *GH, int n_groups,const int *groups,cons
first_var = CCTK_FirstVarIndexI (groups[group]);
- /* Enable all timelevels or just some */
- if(timelevels[group] == -1)
+ if (first_var >= 0)
{
- tlevels = pgroup.numtimelevels;
- }
- else
- {
- tlevels = timelevels[group];
- }
- previous = PUGHi_EnableGArrayGroupStorage (pughGH,
- first_var,
- pgroup.numvars,
- pgroup.numtimelevels,
- tlevels);
+ /* Enable all timelevels or just some */
+ if(timelevels[group] == -1)
+ {
+ tlevels = pgroup.numtimelevels;
+ }
+ else
+ {
+ tlevels = timelevels[group];
+ }
+
+ previous = PUGHi_EnableGArrayGroupStorage (pughGH,
+ first_var,
+ pgroup.numvars,
+ pgroup.numtimelevels,
+ tlevels);
- if(status)
- {
- status[group] = previous;
- }
+ if(status)
+ {
+ status[group] = previous;
+ }
- retval += previous;
+ retval += previous;
+ }
}
}
@@ -1066,28 +1079,32 @@ int PUGH_GroupStorageDecrease(const cGH *GH, int n_groups,const int *groups,cons
first_var = CCTK_FirstVarIndexI (groups[group]);
- /* Disable all timelevels or just some */
- if(timelevels[group] == -1)
+ if (first_var >= 0)
{
- tlevels = 0;
- }
- else
- {
- tlevels = timelevels[group];
- }
- previous = PUGHi_DisableGArrayGroupStorage (pughGH,
- first_var,
- pgroup.numvars,
- pgroup.numtimelevels,
- tlevels);
+ /* Disable all timelevels or just some */
+ if(timelevels[group] == -1)
+ {
+ tlevels = 0;
+ }
+ else
+ {
+ tlevels = timelevels[group];
+ }
- if(status)
- {
- status[group] = previous;
- }
+ previous = PUGHi_DisableGArrayGroupStorage (pughGH,
+ first_var,
+ pgroup.numvars,
+ pgroup.numtimelevels,
+ tlevels);
+
+ if(status)
+ {
+ status[group] = previous;
+ }
- retval += previous;
+ retval += previous;
+ }
}
}