[cig-commits] r11864 - in long/3D/Gale/trunk: . src/StGermain/Base/Automation/src src/StGermain/Discretisation/Mesh/src src/StgFEM/Discretisation/src src/StgFEM/SLE/ProvidedSystems/StokesFlow/src src/StgFEM/SLE/SystemSetup/src

walter at geodynamics.org walter at geodynamics.org
Fri Apr 25 00:24:41 PDT 2008


Author: walter
Date: 2008-04-25 00:24:41 -0700 (Fri, 25 Apr 2008)
New Revision: 11864

Modified:
   long/3D/Gale/trunk/
   long/3D/Gale/trunk/src/StGermain/Base/Automation/src/VariableCondition.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Grid.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c
   long/3D/Gale/trunk/src/StgFEM/Discretisation/src/FeEquationNumber.c
   long/3D/Gale/trunk/src/StgFEM/SLE/ProvidedSystems/StokesFlow/src/Stokes_SLE_UzawaSolver.c
   long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/ForceVector.c
   long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/SolutionVector.c
   long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/StiffnessMatrix.c
Log:
 r2113 at earth:  boo | 2008-04-25 00:10:24 -0700
 A whole bunch of memory fixes



Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
   - 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2111
   + 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2113

Modified: long/3D/Gale/trunk/src/StGermain/Base/Automation/src/VariableCondition.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Base/Automation/src/VariableCondition.c	2008-04-25 03:18:48 UTC (rev 11863)
+++ long/3D/Gale/trunk/src/StGermain/Base/Automation/src/VariableCondition.c	2008-04-25 07:24:41 UTC (rev 11864)
@@ -352,9 +352,16 @@
 	self->_readDictionary( self, self->dictionary );
 	
 	/* Obtain the set */
+	if(self->_set!=NULL)
+	  Stg_Class_Delete(self->_set);
 	self->_set = self->_getSet(self);
 	if (self->_set)
-		IndexSet_GetMembers(self->_set, &self->indexCount, &self->indexTbl);
+	  {
+	    if(self->indexTbl!=NULL)
+	      Memory_Free(self->indexTbl);
+	    IndexSet_GetMembers(self->_set, &self->indexCount,
+				&self->indexTbl);
+	  }
 	else
 	{
 		self->indexCount = 0;
@@ -364,7 +371,9 @@
 	/* Only build the index related tables if there are active BCs */
 	if ( self->indexCount ) {
 		/* Build the variable to condition table */
-		self->vcVarCountTbl = Memory_Alloc_Array( VariableCondition_VariableIndex, self->indexCount, "VC->vcVarCountTbl" );
+	  if(self->vcVarCountTbl!=NULL)
+	    Memory_Free(self->vcVarCountTbl);
+	  self->vcVarCountTbl = Memory_Alloc_Array( VariableCondition_VariableIndex, self->indexCount, "VC->vcVarCountTbl" );
 		
 		for (i = 0; i < self->indexCount; i++)
 		{
@@ -372,6 +381,8 @@
 			self->vcVarCountTbl[i] = self->_getVariableCount(self, self->indexTbl[i]);
 		}
 
+		if(self->vcTbl!=NULL)
+		  Memory_Free(self->vcTbl);
 		self->vcTbl = Memory_Alloc_2DComplex( VariableCondition_Tuple, self->indexCount, self->vcVarCountTbl, "VC->vcTbl" );
 		for ( i = 0; i < self->indexCount; i++ )
 		{
@@ -394,11 +405,15 @@
 	}	
 
 	self->valueCount = self->_getValueCount(self);
-	self->valueTbl = Memory_Alloc_Array( VariableCondition_Value, self->valueCount, "VC->valueTbl" );
+	if (self->valueTbl!=NULL)
+	  Memory_Free(self->valueTbl);	
+self->valueTbl = Memory_Alloc_Array( VariableCondition_Value, self->valueCount, "VC->valueTbl" );
 	for (val_I = 0; val_I < self->valueCount; val_I++)
 		self->valueTbl[val_I] = self->_getValue(self, val_I);
 
 	/* Build mapping. */
+	if(self->mapping!=NULL)
+	  Stg_Class_Delete(self->mapping);
 	self->mapping = UIntMap_New();
 	for( i = 0; i < self->indexCount; i++ )
 		UIntMap_Insert( self->mapping, self->indexTbl[i], i );

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Grid.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Grid.c	2008-04-25 03:18:48 UTC (rev 11863)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Grid.c	2008-04-25 07:24:41 UTC (rev 11864)
@@ -145,6 +145,9 @@
 	if( self->nDims ) {
 		unsigned	d_i;
 
+		KillArray(self->sizes);
+		KillArray(self->basis);
+
 		self->sizes = Memory_Alloc_Array( unsigned, self->nDims, "Grid::sizes" );
 		self->basis = Memory_Alloc_Array( unsigned, self->nDims, "Grid::basis" );
 		memcpy( self->sizes, sizes, self->nDims * sizeof(unsigned) );

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c	2008-04-25 03:18:48 UTC (rev 11863)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c	2008-04-25 07:24:41 UTC (rev 11864)
@@ -278,6 +278,9 @@
 		}
 	}
 
+	if(perDim)
+	  Memory_Free(dimSep);
+
 	return minSep;
 }
 

Modified: long/3D/Gale/trunk/src/StgFEM/Discretisation/src/FeEquationNumber.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/Discretisation/src/FeEquationNumber.c	2008-04-25 03:18:48 UTC (rev 11863)
+++ long/3D/Gale/trunk/src/StgFEM/Discretisation/src/FeEquationNumber.c	2008-04-25 07:24:41 UTC (rev 11864)
@@ -2195,10 +2195,10 @@
 				while ( (ownerProc+1) < nProc ) {
 					if ( eqNum >= self->_lowestGlobalEqNums[ownerProc+1] ) {
 						ownerProc++;
-					}	
+					}
 					else {
 						break;
-					}	
+					}
 				}
 			}
 			/* otherwise count back from current */
@@ -2210,7 +2210,7 @@
 					}
 					else {
 						break;
-					}	
+					}
 				}
 			}
 		}
@@ -2430,7 +2430,18 @@
 	}
 
 	/* Store stuff on class. */
+	if(self->destinationArray!=NULL)
+	  Memory_Free(self->destinationArray);
+
 	self->destinationArray = dstArray;
+
+	if(self->locationMatrix!=NULL)
+	  {
+	    for( e_i = 0; e_i < nDomainEls; e_i++ )
+	      Memory_Free(self->locationMatrix[e_i]);
+	    Memory_Free(self->locationMatrix);
+	  }
+	    
 	self->locationMatrix = locMat;
 	self->locationMatrixBuilt = True;
 	self->remappingActivated = False;
@@ -2445,6 +2456,9 @@
 	MPI_Bcast( &self->globalSumUnconstrainedDofs, 1, MPI_UNSIGNED, nProcs - 1, comm );
 
 	/* Construct lowest global equation number list. */
+
+	if(self->_lowestGlobalEqNums!=NULL)
+	  Memory_Free(self->_lowestGlobalEqNums);
 	self->_lowestGlobalEqNums = AllocArray( int, nProcs );
 	MPI_Allgather( &self->firstOwnedEqNum, 1, MPI_UNSIGNED, self->_lowestGlobalEqNums, 1, MPI_UNSIGNED, comm );
 

Modified: long/3D/Gale/trunk/src/StgFEM/SLE/ProvidedSystems/StokesFlow/src/Stokes_SLE_UzawaSolver.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/SLE/ProvidedSystems/StokesFlow/src/Stokes_SLE_UzawaSolver.c	2008-04-25 03:18:48 UTC (rev 11863)
+++ long/3D/Gale/trunk/src/StgFEM/SLE/ProvidedSystems/StokesFlow/src/Stokes_SLE_UzawaSolver.c	2008-04-25 07:24:41 UTC (rev 11864)
@@ -242,6 +242,16 @@
 		self->pcSolver = NULL;
 
  	Journal_DPrintfL( self->debug, 2, "Allocate the auxillary vectors pTemp, r, s, fTemp and vStar.\n" ); 
+	if(self->pTempVec!=NULL)
+	  FreeObject( self->pTempVec );
+	if(self->rVec!=NULL)
+	  FreeObject( self->rVec ); 
+	if(self->sVec!=NULL)
+	  FreeObject( self->sVec );
+	if(self->fTempVec!=NULL)
+	  FreeObject( self->fTempVec );
+	if(self->vStarVec!=NULL)
+	  FreeObject( self->vStarVec );
 	Vector_Duplicate( sle->pSolnVec->vector, (void**)&self->pTempVec );
 	Vector_SetLocalSize( self->pTempVec, Vector_GetLocalSize( sle->pSolnVec->vector ) );
 	Vector_Duplicate( sle->pSolnVec->vector, (void**)&self->rVec );

Modified: long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/ForceVector.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/ForceVector.c	2008-04-25 03:18:48 UTC (rev 11863)
+++ long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/ForceVector.c	2008-04-25 07:24:41 UTC (rev 11864)
@@ -318,6 +318,8 @@
 	/* Allocate the vector */
 	Journal_DPrintfL( self->debug, 2, "Allocating the L.A. Force Vector with %d local entries.\n", self->localSize );
 #ifdef HAVE_PETSC
+	if(self->vector!=NULL)
+	  Stg_Class_Delete(self->vector);
 	self->vector = (Vector*)PETScVector_New( "" );
 #else
 #error *** No linear algebra package found.

Modified: long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/SolutionVector.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/SolutionVector.c	2008-04-25 03:18:48 UTC (rev 11863)
+++ long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/SolutionVector.c	2008-04-25 07:24:41 UTC (rev 11864)
@@ -280,6 +280,8 @@
 
 	/* Allocate the vector */
 #ifdef HAVE_PETSC
+	if(self->vector!=NULL)
+	  Stg_Class_Delete(self->vector);
 	self->vector = PETScVector_New( "" );
 #else
 	assert( 0 );

Modified: long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/StiffnessMatrix.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/StiffnessMatrix.c	2008-04-25 03:18:48 UTC (rev 11863)
+++ long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/StiffnessMatrix.c	2008-04-25 07:24:41 UTC (rev 11864)
@@ -609,7 +609,11 @@
 	Journal_DPrintfL( self->debug, 1, "row nodeLocalCount %d\n", FeMesh_GetNodeLocalSize( rFeMesh ) );
 	Journal_DPrintfL( self->debug, 1, "column nodeLocalCount %d\n", FeMesh_GetNodeLocalSize( cFeMesh ) );
 	
+	if(self->diagonalNonZeroIndices!=NULL)
+	  Memory_Free(self->diagonalNonZeroIndices);
 	self->diagonalNonZeroIndices = Memory_Alloc_Array  ( Index, self->rowLocalSize, "diagonalNonZeroIndices" );
+	if(self->offDiagonalNonZeroIndices!=NULL)
+	  Memory_Free(self->offDiagonalNonZeroIndices);
 	self->offDiagonalNonZeroIndices = Memory_Alloc_Array  ( Index, self->rowLocalSize, "offDiagonalNonZeroIndices" );
 	for ( rowNode_lI = 0; rowNode_lI < self->rowLocalSize; rowNode_lI++ ) { 
 		self->diagonalNonZeroIndices[rowNode_lI] = 0;



More information about the cig-commits mailing list