[cig-commits] r19735 - in short/3D/PyLith/branches/v1.6-stable: libsrc/pylith/faults libsrc/pylith/meshio libsrc/pylith/problems libsrc/pylith/topology pylith/bc pylith/faults pylith/materials pylith/meshio pylith/problems pylith/topology pylith/utils

brad at geodynamics.org brad at geodynamics.org
Wed Mar 7 12:16:10 PST 2012


Author: brad
Date: 2012-03-07 12:16:09 -0800 (Wed, 07 Mar 2012)
New Revision: 19735

Modified:
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveLagrange.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/CellFilter.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/Formulation.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/Solver.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/SolverLinear.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/SolverNonlinear.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/Field.cc
   short/3D/PyLith/branches/v1.6-stable/pylith/bc/BoundaryCondition.py
   short/3D/PyLith/branches/v1.6-stable/pylith/faults/Fault.py
   short/3D/PyLith/branches/v1.6-stable/pylith/materials/Material.py
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/CellFilter.py
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriter.py
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/OutputManager.py
   short/3D/PyLith/branches/v1.6-stable/pylith/problems/Solver.py
   short/3D/PyLith/branches/v1.6-stable/pylith/problems/SolverNonlinear.py
   short/3D/PyLith/branches/v1.6-stable/pylith/topology/Mesh.py
   short/3D/PyLith/branches/v1.6-stable/pylith/topology/SubMesh.py
   short/3D/PyLith/branches/v1.6-stable/pylith/utils/PetscComponent.py
Log:
Cleanup of memory deallocation routines. Fixed some small bugs in Python cleanup routines.

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveLagrange.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveLagrange.cc	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/faults/FaultCohesiveLagrange.cc	2012-03-07 20:16:09 UTC (rev 19735)
@@ -581,11 +581,11 @@
 				   topology::Jacobian* const jacobian,
 				   topology::SolutionFields* const fields)
 { // calcPreconditioner
-  assert(0 != precondMatrix);
-  assert(0 != jacobian);
-  assert(0 != fields);
-  assert(0 != _fields);
-  assert(0 != _logger);
+  assert(precondMatrix);
+  assert(jacobian);
+  assert(fields);
+  assert(_fields);
+  assert(_logger);
 
   /** We have A = [K L^T]
    *              [L   0]
@@ -737,7 +737,7 @@
     _logger->eventEnd(updateEvent);
 #endif
   } // for
-  err = MatDestroy(&jacobianNP); CHECK_PETSC_ERROR(err);
+  err = MatDestroy(&jacobianNP);CHECK_PETSC_ERROR(err);
   PetscLogFlops(numVertices*spaceDim*6);
 
 #if !defined(DETAILED_EVENT_LOGGING)

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/CellFilter.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/CellFilter.cc	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/CellFilter.cc	2012-03-07 20:16:09 UTC (rev 19735)
@@ -42,7 +42,7 @@
 pylith::meshio::CellFilter<mesh_type, field_type>::CellFilter(const CellFilter& f) :
   _quadrature(0)
 { // copy constructor
-  if (0 != f._quadrature)
+  if (f._quadrature)
     _quadrature = new feassemble::Quadrature<mesh_type>(*f._quadrature);
 } // copy constructor
 
@@ -62,7 +62,7 @@
 pylith::meshio::CellFilter<mesh_type, field_type>::quadrature(const feassemble::Quadrature<mesh_type>* q)
 { // quadrature
   delete _quadrature; 
-  _quadrature = (0 != q) ? new feassemble::Quadrature<mesh_type>(*q) : 0;
+  _quadrature = (q) ? new feassemble::Quadrature<mesh_type>(*q) : 0;
 } // quadrature
 
 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/Formulation.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/Formulation.cc	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/Formulation.cc	2012-03-07 20:16:09 UTC (rev 19735)
@@ -61,9 +61,9 @@
 
 #if 0   // :KLUDGE: Assume Solver deallocates matrix.
   PetscErrorCode err = 0;
-  if (0 != _customConstraintPCMat) {
-    err = PetscObjectDereference((PetscObject) _customConstraintPCMat);
-    _customConstraintPCMat = 0; CHECK_PETSC_ERROR(err);
+  if (_customConstraintPCMat) {
+    err = PetscObjectDereference((PetscObject) _customConstraintPCMat);CHECK_PETSC_ERROR(err);
+    _customConstraintPCMat = 0;
   } // if
 #else
   _customConstraintPCMat = 0;
@@ -319,7 +319,7 @@
   // Assemble jacobian.
   _jacobian->assemble("final_assembly");
 
-  if (0 != _customConstraintPCMat) {
+  if (_customConstraintPCMat) {
     // Recalculate preconditioner.
     numIntegrators = _meshIntegrators.size();
     for (int i=0; i < numIntegrators; ++i)

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/Solver.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/Solver.cc	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/Solver.cc	2012-03-07 20:16:09 UTC (rev 19735)
@@ -89,12 +89,14 @@
 { // deallocate
   _formulation = 0; // Handle only, do not manage memory.
   delete _logger; _logger = 0;
-  if (0 != _jacobianPC) {
-    PetscErrorCode err = MatDestroy(&_jacobianPC);CHECK_PETSC_ERROR(err);
-  } // if
-  if (0 != _jacobianPCFault) {
-    PetscErrorCode err = MatDestroy(&_jacobianPCFault);CHECK_PETSC_ERROR(err);
-  } // if
+
+  PetscErrorCode err = 0;
+  err = MatDestroy(&_jacobianPC);CHECK_PETSC_ERROR(err);
+  err = MatDestroy(&_jacobianPCFault);CHECK_PETSC_ERROR(err);
+
+  _ctx.pc = 0; // KSP PC (managed separately)
+  _ctx.A = 0; // Jacobian (managed separately)
+  _ctx.faultA  = 0; // Handle to _jacobianPCFault
 } // deallocate
   
 // ----------------------------------------------------------------------
@@ -104,7 +106,7 @@
 				     const topology::Jacobian& jacobian,
 				     Formulation* const formulation)
 { // initialize
-  assert(0 != formulation);
+  assert(formulation);
   _formulation = formulation;
 
   // Make global preconditioner matrix
@@ -123,6 +125,7 @@
 
     PetscInt M, N, m, n;
     PetscErrorCode err = 0;
+    err = MatDestroy(&_jacobianPC);CHECK_PETSC_ERROR(err);
     err = MatGetSize(jacobianMat, &M, &N);CHECK_PETSC_ERROR(err);
     err = MatGetLocalSize(jacobianMat, &m, &n);CHECK_PETSC_ERROR(err);
     err = MatCreateShell(fields.mesh().comm(), m, n, M, N, &_ctx, &_jacobianPC);
@@ -178,9 +181,7 @@
                                               solutionSection, spaceDim);
     assert(!lagrangeGlobalOrder.isNull());
 
-    if (_jacobianPCFault) {
-      err = MatDestroy(&_jacobianPCFault); CHECK_PETSC_ERROR(err);
-    } // if
+    err = MatDestroy(&_jacobianPCFault); CHECK_PETSC_ERROR(err);
     PetscInt nrows = lagrangeGlobalOrder->getLocalSize();
     PetscInt ncols = nrows;
 
@@ -190,20 +191,11 @@
     err = MatSetType(_jacobianPCFault, MATAIJ);
     err = MatSetFromOptions(_jacobianPCFault); CHECK_PETSC_ERROR(err);
     
-#if 1
     // Allocate just the diagonal.
     err = MatSeqAIJSetPreallocation(_jacobianPCFault, 1, 
 				    PETSC_NULL); CHECK_PETSC_ERROR(err);
     err = MatMPIAIJSetPreallocation(_jacobianPCFault, 1, PETSC_NULL, 
 				    0, PETSC_NULL); CHECK_PETSC_ERROR(err);
-#else
-    // Allocate full matrix (overestimate).
-    err = MatSeqAIJSetPreallocation(_jacobianPCFault, ncols, 
-				    PETSC_NULL); CHECK_PETSC_ERROR(err);
-    err = MatMPIAIJSetPreallocation(_jacobianPCFault, ncols, PETSC_NULL, 
-				    0, PETSC_NULL); CHECK_PETSC_ERROR(err);
-#endif
-    
     // Set preconditioning matrix in formulation
     formulation->customPCMatrix(_jacobianPCFault);
 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/SolverLinear.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/SolverLinear.cc	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/SolverLinear.cc	2012-03-07 20:16:09 UTC (rev 19735)
@@ -54,10 +54,7 @@
 { // deallocate
   Solver::deallocate();
 
-  if (0 != _ksp) {
-    PetscErrorCode err = KSPDestroy(&_ksp); _ksp = 0;
-    CHECK_PETSC_ERROR(err);
-  } // if
+  PetscErrorCode err = KSPDestroy(&_ksp);CHECK_PETSC_ERROR(err);
 } // deallocate
   
 // ----------------------------------------------------------------------
@@ -68,23 +65,20 @@
 				   const topology::Jacobian& jacobian,
 				   Formulation* formulation)
 { // initialize
-  assert(0 != formulation);
+  assert(formulation);
 
   _initializeLogger();
   Solver::initialize(fields, jacobian, formulation);
 
   PetscErrorCode err = 0;
-  if (0 != _ksp) {
-    err = KSPDestroy(&_ksp); _ksp = 0;
-    CHECK_PETSC_ERROR(err);
-  } // if    
-  err = KSPCreate(fields.mesh().comm(), &_ksp); CHECK_PETSC_ERROR(err);
-  err = KSPSetInitialGuessNonzero(_ksp, PETSC_FALSE); CHECK_PETSC_ERROR(err);
-  err = KSPSetFromOptions(_ksp); CHECK_PETSC_ERROR(err);
+  err = KSPDestroy(&_ksp);CHECK_PETSC_ERROR(err);
+  err = KSPCreate(fields.mesh().comm(), &_ksp);CHECK_PETSC_ERROR(err);
+  err = KSPSetInitialGuessNonzero(_ksp, PETSC_FALSE);CHECK_PETSC_ERROR(err);
+  err = KSPSetFromOptions(_ksp);CHECK_PETSC_ERROR(err);
 
   if (formulation->splitFields()) {
     PetscPC pc = 0;
-    err = KSPGetPC(_ksp, &pc); CHECK_PETSC_ERROR(err);
+    err = KSPGetPC(_ksp, &pc);CHECK_PETSC_ERROR(err);
     _setupFieldSplit(&pc, formulation, jacobian, fields);
   } // if
 } // initialize
@@ -116,10 +110,10 @@
   const PetscMat jacobianMat = jacobian->matrix();
   if (!jacobian->valuesChanged()) {
     err = KSPSetOperators(_ksp, jacobianMat, jacobianMat, 
-			  SAME_PRECONDITIONER); CHECK_PETSC_ERROR(err);
+			  SAME_PRECONDITIONER);CHECK_PETSC_ERROR(err);
   } else {
     err = KSPSetOperators(_ksp, jacobianMat, jacobianMat, 
-			  DIFFERENT_NONZERO_PATTERN); CHECK_PETSC_ERROR(err);
+			  DIFFERENT_NONZERO_PATTERN);CHECK_PETSC_ERROR(err);
   } // else
   jacobian->resetValuesChanged();
 
@@ -144,12 +138,10 @@
     assert(solutionSection->getNumSpaces() == num);
 
     MatStructure flag;
-    err = KSPGetOperators(ksps[num-1], &A, 
-			  PETSC_NULL, &flag); CHECK_PETSC_ERROR(err);
-    err = PetscObjectReference((PetscObject) A); CHECK_PETSC_ERROR(err);
-    err = KSPSetOperators(ksps[num-1], A, _jacobianPCFault, 
-			  flag); CHECK_PETSC_ERROR(err);
-    err = PetscFree(ksps); CHECK_PETSC_ERROR(err);
+    err = KSPGetOperators(ksps[num-1], &A, PETSC_NULL, &flag);CHECK_PETSC_ERROR(err);
+    err = PetscObjectReference((PetscObject) A);CHECK_PETSC_ERROR(err);
+    err = KSPSetOperators(ksps[num-1], A, _jacobianPCFault, flag);CHECK_PETSC_ERROR(err);
+    err = PetscFree(ksps);CHECK_PETSC_ERROR(err);
   } // if
 #endif
 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/SolverNonlinear.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/SolverNonlinear.cc	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/problems/SolverNonlinear.cc	2012-03-07 20:16:09 UTC (rev 19735)
@@ -62,10 +62,7 @@
 { // deallocate
   Solver::deallocate();
 
-  if (0 != _snes) {
-    PetscErrorCode err = SNESDestroy(&_snes); _snes = 0;
-    CHECK_PETSC_ERROR(err);
-  } // if
+  PetscErrorCode err = SNESDestroy(&_snes);CHECK_PETSC_ERROR(err);
 } // deallocate
   
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/Field.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/Field.cc	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/topology/Field.cc	2012-03-07 20:16:09 UTC (rev 19735)
@@ -75,17 +75,11 @@
   for (typename scatter_map_type::iterator s_iter=_scatters.begin();
        s_iter != scattersEnd;
        ++s_iter) {
-    if (s_iter->second.vector) {
-      err = VecDestroy(&s_iter->second.vector);CHECK_PETSC_ERROR(err);
-    } // if
+    std::cout << "SCATTER DESTROY, label: " << label() << ", context: " << s_iter->first << std::endl;
 
-    if (s_iter->second.scatter) {
-      err = VecScatterDestroy(&s_iter->second.scatter);CHECK_PETSC_ERROR(err);
-    } // if
-
-    if (s_iter->second.scatterVec) {
-      err = VecDestroy(&s_iter->second.scatterVec);CHECK_PETSC_ERROR(err);
-    } // if
+    err = VecDestroy(&s_iter->second.vector);CHECK_PETSC_ERROR(err);
+    err = VecScatterDestroy(&s_iter->second.scatter);CHECK_PETSC_ERROR(err);
+    err = VecDestroy(&s_iter->second.scatterVec);CHECK_PETSC_ERROR(err);
   } // for
   _scatters.clear();
 } // deallocate
@@ -365,6 +359,8 @@
 	sinfo.vector = 0;
 	sinfo.scatterVec = 0;
 
+    std::cout << "SCATTER COPY, label: " << label() << ", context: " << s_iter->first << std::endl;
+
 	// Copy scatter
 	sinfo.scatter = s_iter->second.scatter;
 	err = PetscObjectReference((PetscObject) sinfo.scatter);
@@ -763,6 +759,8 @@
     return;
   } // if
 
+    std::cout << "SCATTER CREATE, label: " << label() << ", context: " << context << std::endl;
+
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
   logger.stagePush("GlobalOrder");
 
@@ -835,6 +833,8 @@
     return;
   } // if
 
+  std::cout << "SCATTER CREATE, label: " << label() << ", context: " << context << std::endl;
+
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
   logger.stagePush("GlobalOrder");
 
@@ -919,6 +919,8 @@
     return;
   } // if
 
+    std::cout << "SCATTER CREATE, label: " << label() << ", context: " << context << std::endl;
+
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
   logger.stagePush("GlobalOrder");
 
@@ -990,6 +992,8 @@
     return;
   } // if
 
+    std::cout << "SCATTER CREATE, label: " << label() << ", context: " << context << std::endl;
+
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
   logger.stagePush("GlobalOrder");
 

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/bc/BoundaryCondition.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/bc/BoundaryCondition.py	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/bc/BoundaryCondition.py	2012-03-07 20:16:09 UTC (rev 19735)
@@ -155,6 +155,14 @@
     return
 
 
+  def _cleanup(self):
+    """
+    Deallocate locally managed data structures.
+    """
+    self.deallocate()
+    return
+
+
   def _createModuleObj(self):
     """
     Call constructor for module object for access to C++ object.

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/faults/Fault.py	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/faults/Fault.py	2012-03-07 20:16:09 UTC (rev 19735)
@@ -261,4 +261,13 @@
     return
 
 
+  def _cleanup(self):
+    """
+    Deallocate locally managed data structures.
+    """
+    print "CLEANUP fault"
+    self.deallocate()
+    return
+
+
 # End of file 

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/materials/Material.py	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/materials/Material.py	2012-03-07 20:16:09 UTC (rev 19735)
@@ -237,4 +237,12 @@
     return
   
 
+  def _cleanup(self):
+    """
+    Deallocate locally managed data structures.
+    """
+    self.deallocate()
+    return
+
+
 # End of file 

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/CellFilter.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/CellFilter.py	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/CellFilter.py	2012-03-07 20:16:09 UTC (rev 19735)
@@ -96,6 +96,14 @@
     return
 
 
+  def _cleanup(self):
+    """
+    Deallocate locally managed data structures.
+    """
+    self.deallocate()
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def output_cell_filter():

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriter.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriter.py	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriter.py	2012-03-07 20:16:09 UTC (rev 19735)
@@ -58,4 +58,14 @@
     return
 
 
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _cleanup(self):
+    """
+    Deallocate locally managed data structures.
+    """
+    self.deallocate()
+    return
+
+
 # End of file

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/OutputManager.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/OutputManager.py	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/OutputManager.py	2012-03-07 20:16:09 UTC (rev 19735)
@@ -396,6 +396,14 @@
     return
   
 
+  def _cleanup(self):
+    """
+    Deallocate PETSc and local data structures.
+    """
+    self.deallocate()
+    return
+    
+
   def _open(self):
     raise NotImplementedError("Implement _open() in derived class.")
 

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/problems/Solver.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/problems/Solver.py	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/problems/Solver.py	2012-03-07 20:16:09 UTC (rev 19735)
@@ -70,6 +70,14 @@
     return
 
 
+  def _cleanup(self):
+    """
+    Deallocate PETSc and local data structures.
+    """
+    self.deallocate()
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def solver():

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/problems/SolverNonlinear.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/problems/SolverNonlinear.py	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/problems/SolverNonlinear.py	2012-03-07 20:16:09 UTC (rev 19735)
@@ -69,14 +69,6 @@
     return
 
 
-  def _cleanup(self):
-    """
-    Deallocate PETSc and local data structures.
-    """
-    self.deallocate()
-    return
-
-
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def solver():

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/topology/Mesh.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/topology/Mesh.py	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/topology/Mesh.py	2012-03-07 20:16:09 UTC (rev 19735)
@@ -85,4 +85,14 @@
     return groups
 
 
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _cleanup(self):
+    """
+    Deallocate locally managed data structures.
+    """
+    self.deallocate()
+    return
+
+
 # End of file

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/topology/SubMesh.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/topology/SubMesh.py	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/topology/SubMesh.py	2012-03-07 20:16:09 UTC (rev 19735)
@@ -54,4 +54,14 @@
     return Communicator(ModuleSubMesh.comm(self))
 
 
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _cleanup(self):
+    """
+    Deallocate locally managed data structures.
+    """
+    self.deallocate()
+    return
+
+
 # End of file

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/utils/PetscComponent.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/utils/PetscComponent.py	2012-03-07 02:26:02 UTC (rev 19734)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/utils/PetscComponent.py	2012-03-07 20:16:09 UTC (rev 19735)
@@ -64,13 +64,14 @@
     """
     Deallocate data structures.
     """
+    print "CLEANUP",self.name
     for component in self.components():
       if isinstance(component, PetscComponent):
         component.cleanup()
 
       # Facility arrays are not PetscComponents but have components().
       elif hasattr(component, "components"):
-        for subcomponent in self.components():
+        for subcomponent in component.components():
           if isinstance(subcomponent, PetscComponent):
             subcomponent.cleanup()
 



More information about the CIG-COMMITS mailing list