aboutsummaryrefslogtreecommitdiff
path: root/src/SetupPGH.c
diff options
context:
space:
mode:
authortradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-09-18 18:50:51 +0000
committertradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-09-18 18:50:51 +0000
commit034262f86f5adee6ca3c24f9e4425d88cc26b571 (patch)
tree240563fa2e9263b7f8631431a468ae9a129520bf /src/SetupPGH.c
parenta8342034415eb8f7434c1668d9f14bcd058f49d9 (diff)
Destroy the comm buffer, connectivity, and extras structure for each group once
before the group's variables are destroyed. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@271 b61c5cb5-eaca-4651-9a7a-d64986f99364
Diffstat (limited to 'src/SetupPGH.c')
-rw-r--r--src/SetupPGH.c45
1 files changed, 38 insertions, 7 deletions
diff --git a/src/SetupPGH.c b/src/SetupPGH.c
index 51963f9..5537fd5 100644
--- a/src/SetupPGH.c
+++ b/src/SetupPGH.c
@@ -102,13 +102,15 @@ pGH *PUGH_SetupPGH(void *callerid,
GH->active = 1;
GH->commmodel = PUGH_ALLOCATEDBUFFERS;
-#if 0
/* create the timer for communication time */
- if(comm_verbose)
+ if(timer_output)
{
GH->comm_time = CCTK_TimerCreateI ();
}
-#endif
+ else
+ {
+ GH->comm_time = -1;
+ }
/* set staggering flag */
/*GH->stagger = staggertype; */
@@ -204,6 +206,7 @@ void PUGH_DestroyPGH(pGH **GHin)
{
/* First remove me from the list. */
pGH *GH;
+ pGA *GA;
cGroup pgroup;
int i;
int variable;
@@ -231,18 +234,46 @@ void PUGH_DestroyPGH(pGH **GHin)
CCTK_GroupData(group,&pgroup);
+ /* destroy group comm buffers */
+ if (pgroup.grouptype == CCTK_ARRAY || pgroup.grouptype == CCTK_GF)
+ {
+ GA = (pGA *) GH->variables[variable][0];
+
+ /* Destroy group comm buffers */
+ if (GA->groupcomm)
+ {
+ if (GA->groupcomm->commflag != PUGH_NOCOMM)
+ {
+ PUGH_DisableGArrayGroupComm (GH, variable, GA->groupcomm);
+ }
+ PUGH_DestroyComm (&GA->groupcomm);
+ }
+
+ /* Destroy the group's connectivity and extras structure
+ for CCTK_ARRAY groups.
+ Remember that the connectivity and extras for CCTK_GF types
+ are shared between all such groups and are destroyed later. */
+ if (GA->connectivity != GH->Connectivity[pgroup.dim-1])
+ {
+ PUGH_DestroyConnectivity (&GA->connectivity);
+ }
+ if (GA->extras != GH->GFExtras[pgroup.dim-1])
+ {
+ PUGH_DestroyPGExtras (&GA->extras);
+ }
+ }
+
for (this_var = 0; this_var < pgroup.numvars; this_var++, variable++)
{
- for(i = 0 ; i < pgroup.numtimelevels;
- i++)
+ for(i = 0 ; i < pgroup.numtimelevels; i++)
{
switch(pgroup.grouptype)
{
- case GROUP_GF:
+ case CCTK_GF:
case CCTK_ARRAY:
PUGH_DestroyGArray(&(((pGA ***)GH->variables)[variable][i]));
break;
- case GROUP_SCALAR:
+ case CCTK_SCALAR:
free(GH->variables[variable][i]);
break;
}