aboutsummaryrefslogtreecommitdiff
path: root/src/SetupPGH.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/SetupPGH.c')
-rw-r--r--src/SetupPGH.c55
1 files changed, 20 insertions, 35 deletions
diff --git a/src/SetupPGH.c b/src/SetupPGH.c
index 459c4f2..174cd6c 100644
--- a/src/SetupPGH.c
+++ b/src/SetupPGH.c
@@ -235,51 +235,36 @@ void PUGH_DestroyPGH (pGH **GHin)
CCTK_GroupData(group,&pgroup);
- if (pgroup.grouptype == CCTK_ARRAY || pgroup.grouptype == CCTK_GF)
- {
- GA = (pGA *) GH->variables[variable][0];
+ GA = (pGA *) GH->variables[variable][0];
- /* Destroy group comm buffers */
- if (GA->groupcomm)
+ /* Destroy group comm buffers */
+ if (GA->groupcomm)
+ {
+ if (GA->groupcomm->commflag != PUGH_NOCOMM)
{
- if (GA->groupcomm->commflag != PUGH_NOCOMM)
- {
- PUGH_DisableGArrayGroupComm (GH, variable, GA->groupcomm);
- }
- PUGH_DestroyComm (&GA->groupcomm);
+ 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);
- }
+ /* 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++)
{
- switch(pgroup.grouptype)
- {
- case CCTK_GF:
- case CCTK_ARRAY:
- PUGH_DestroyGArray(&(((pGA ***)GH->variables)[variable][i]));
- break;
- case CCTK_SCALAR:
- if (GH->variables[variable][i])
- {
- free(GH->variables[variable][i]);
- }
- break;
- }
+ PUGH_DestroyGArray(&(((pGA ***)GH->variables)[variable][i]));
}
free(GH->variables[variable]);
}