aboutsummaryrefslogtreecommitdiff
path: root/src/SetupPGH.c
diff options
context:
space:
mode:
authortradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-03-13 09:54:41 +0000
committertradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-03-13 09:54:41 +0000
commit57df312b3027097a588b3782c9553471b82e3554 (patch)
treee700d69098113649d8b7ffc930a106bbf0fed22a /src/SetupPGH.c
parent9fddfde02b02ae729e3398c576ec804636467d57 (diff)
Completed DestroyPGH(), added DestroyConnectivity() and DestroyPGextras().
This should fix the memory leak in BAM as well as running out of MPI_Type_requests. Thomas git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@177 b61c5cb5-eaca-4651-9a7a-d64986f99364
Diffstat (limited to 'src/SetupPGH.c')
-rw-r--r--src/SetupPGH.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/SetupPGH.c b/src/SetupPGH.c
index 53e7f12..5d20194 100644
--- a/src/SetupPGH.c
+++ b/src/SetupPGH.c
@@ -28,6 +28,10 @@ void DestroyPGF(pGH *GH, pGF **GFin);
void pGH_DumpInfo(pGH *GH);
int SetupDefaultTopology(int dim, int *nprocs);
int pGH_SetupnProcs(pGH *GH,int dim);
+void pugh_DestroyConnectivity(pConnectivity **conn);
+void DestroyPGA(pGA **GA);
+void pugh_DestroyPGExtras(pGExtras **PGExtras);
+
/*@@
@routine PUGH_SetupPGH
@@ -778,7 +782,6 @@ void DestroyPGH(pGH **GHin)
pGH *GH;
cGroup pgroup;
int i;
- int didit;
int variable;
int group;
int this_var;
@@ -786,11 +789,10 @@ void DestroyPGH(pGH **GHin)
GH = *GHin;
#ifdef MPI
+ CACTUS_MPI_ERROR(MPI_Type_free (&GH->pugh_mpi_complex));
CACTUS_MPI_ERROR(MPI_Comm_free(&(GH->PUGH_COMM_WORLD)));
#endif
- didit = 0;
-
/* Great. Now go about the work of destroying me. */
variable = 0;
@@ -806,28 +808,34 @@ void DestroyPGH(pGH **GHin)
for (this_var = 0; this_var < pgroup.numvars; this_var++, variable++)
{
- switch(pgroup.grouptype)
+ for(i = 0; i < pgroup.numtimelevels; i++)
{
- case GROUP_GF:
- for(i = 0; i < pgroup.numtimelevels; i++)
- {
+ switch(pgroup.grouptype)
+ {
+ case GROUP_GF:
DestroyPGF(GH, &(((pGF ***)GH->variables)[variable][i]));
- }
- break;
- case CCTK_ARRAY:
- CCTK_WARN(1,"Need to add code for Destroying an Pugh array");
- break;
- case GROUP_SCALAR:
- for(i = 0; i < pgroup.numtimelevels; i++)
- {
+ break;
+ case CCTK_ARRAY:
+ DestroyPGA(&(((pGA ***)GH->variables)[variable][i]));
+ break;
+ case GROUP_SCALAR:
free(GH->variables[variable][i]);
- }
- break;
+ break;
+ }
}
free(GH->variables[variable]);
}
}
+ for (i=1;i<=GH->dim;i++)
+ {
+ pugh_DestroyConnectivity(&GH->Connectivity[i-1]);
+ pugh_DestroyPGExtras(&GH->GFExtras[i-1]);
+ }
+
+ free(GH->Connectivity);
+ free(GH->GFExtras);
+
free(GH->variables);
free(GH->lb[0]);