aboutsummaryrefslogtreecommitdiff
path: root/src/SetupPGV.c
diff options
context:
space:
mode:
authortradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-09-18 18:56:27 +0000
committertradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2000-09-18 18:56:27 +0000
commit6cc8c0b3ae3c76d82fc0ac5640c1a973d8cdc333 (patch)
treed8a585f0176251a0ed857d0e564678a51002f3fb /src/SetupPGV.c
parent034262f86f5adee6ca3c24f9e4425d88cc26b571 (diff)
The connectivity and the extras structure for CCTK_ARRAY variables
are now freed in DestroyPGH(). This fixes BR 436. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@272 b61c5cb5-eaca-4651-9a7a-d64986f99364
Diffstat (limited to 'src/SetupPGV.c')
-rw-r--r--src/SetupPGV.c36
1 files changed, 5 insertions, 31 deletions
diff --git a/src/SetupPGV.c b/src/SetupPGV.c
index b1efb2f..ea88e00 100644
--- a/src/SetupPGV.c
+++ b/src/SetupPGV.c
@@ -1440,7 +1440,7 @@ pGA *PUGH_SetupGArray(void *parent,
pComm *groupcomm,
const char *name,
int id,
- int arrayid,
+ int arrayid,
int varsize,
int vtype,
int stagger)
@@ -1467,9 +1467,6 @@ pGA *PUGH_SetupGArray(void *parent,
this->padddata = (void *) calloc(1, varsize);
this->data = this->padddata;
- /* FIXME : workaround */
- this->first_array_in_group = 0;
-
if(this->name && this->padddata)
{
strcpy(this->name, name);
@@ -1508,25 +1505,15 @@ pGA *PUGH_SetupGArray(void *parent,
@@*/
void PUGH_DestroyGArray(pGA **GA)
{
- pGH *pughGH;
-
-
if(GA && *GA)
{
+ /* free storage if still allocated */
if((*GA)->storage != PUGH_NOSTORAGE)
{
PUGH_DisableGArrayDataStorage(*GA);
}
- /* destroy group comm buffers only once per group */
- /* FIXME : workaround - the first test should be done more cleanly. */
- if((*GA)->first_array_in_group && (*GA)->groupcomm && (*GA)->groupcomm->first_var == (*GA)->id)
- {
- if ((*GA)->groupcomm->commflag != PUGH_NOCOMM)
- {
- PUGH_DisableGArrayGroupComm((pGH *) (*GA)->parent, (*GA)->id, (*GA)->groupcomm);
- }
- PUGH_DestroyComm(&(*GA)->groupcomm);
- }
+
+ /* free comm buffer if created before */
if((*GA)->comm)
{
if ((*GA)->comm->commflag != PUGH_NOCOMM)
@@ -1536,20 +1523,7 @@ void PUGH_DestroyGArray(pGA **GA)
PUGH_DestroyComm(&(*GA)->comm);
}
- /* get the pGH the variable belongs to */
- pughGH = (pGH *) (pGH *) (*GA)->parent;
-
- /* free the connectivity and extras structure
- but only if they were not shared with others */
- if((*GA)->connectivity != pughGH->Connectivity[(*GA)->connectivity->dim-1])
- {
- PUGH_DestroyConnectivity(&(*GA)->connectivity);
- }
- if((*GA)->extras != pughGH->GFExtras[(*GA)->extras->dim-1])
- {
- PUGH_DestroyPGExtras(&(*GA)->extras);
- }
-
+ /* free allocated resources */
free((*GA)->name);
free((*GA)->padddata);
free(*GA);