[cig-commits] r22030 - in short/3D/PyLith/trunk: modulesrc/bc modulesrc/faults modulesrc/feassemble modulesrc/friction modulesrc/materials modulesrc/meshio modulesrc/problems modulesrc/topology modulesrc/utils pylith/apps pylith/bc pylith/faults pylith/feassemble pylith/materials pylith/meshio pylith/perf pylith/problems pylith/topology
brad at geodynamics.org
brad at geodynamics.org
Fri May 10 14:33:21 PDT 2013
Author: brad
Date: 2013-05-10 14:33:21 -0700 (Fri, 10 May 2013)
New Revision: 22030
Modified:
short/3D/PyLith/trunk/modulesrc/bc/bc.i
short/3D/PyLith/trunk/modulesrc/faults/faults.i
short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.i
short/3D/PyLith/trunk/modulesrc/friction/friction.i
short/3D/PyLith/trunk/modulesrc/materials/materials.i
short/3D/PyLith/trunk/modulesrc/meshio/meshio.i
short/3D/PyLith/trunk/modulesrc/problems/problems.i
short/3D/PyLith/trunk/modulesrc/topology/topology.i
short/3D/PyLith/trunk/modulesrc/utils/petsc.i
short/3D/PyLith/trunk/modulesrc/utils/petsc_memory.i
short/3D/PyLith/trunk/modulesrc/utils/utils.i
short/3D/PyLith/trunk/pylith/apps/PetscApplication.py
short/3D/PyLith/trunk/pylith/apps/PyLithApp.py
short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py
short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
short/3D/PyLith/trunk/pylith/bc/DirichletBC.py
short/3D/PyLith/trunk/pylith/bc/DirichletBoundary.py
short/3D/PyLith/trunk/pylith/bc/Neumann.py
short/3D/PyLith/trunk/pylith/bc/PointForce.py
short/3D/PyLith/trunk/pylith/faults/Fault.py
short/3D/PyLith/trunk/pylith/faults/FaultCohesiveDyn.py
short/3D/PyLith/trunk/pylith/faults/FaultCohesiveImpulses.py
short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
short/3D/PyLith/trunk/pylith/faults/FaultCohesiveTract.py
short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicit.py
short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicitLgDeform.py
short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicitTet4.py
short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicitTri3.py
short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicit.py
short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicitCUDA.py
short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicitLgDeform.py
short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py
short/3D/PyLith/trunk/pylith/materials/Material.py
short/3D/PyLith/trunk/pylith/meshio/CellFilter.py
short/3D/PyLith/trunk/pylith/meshio/DataWriter.py
short/3D/PyLith/trunk/pylith/meshio/DataWriterVTKMesh.py
short/3D/PyLith/trunk/pylith/meshio/OutputManager.py
short/3D/PyLith/trunk/pylith/meshio/OutputManagerMesh.py
short/3D/PyLith/trunk/pylith/meshio/OutputSoln.py
short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
short/3D/PyLith/trunk/pylith/problems/Explicit.py
short/3D/PyLith/trunk/pylith/problems/Formulation.py
short/3D/PyLith/trunk/pylith/problems/GreensFns.py
short/3D/PyLith/trunk/pylith/problems/Implicit.py
short/3D/PyLith/trunk/pylith/problems/Problem.py
short/3D/PyLith/trunk/pylith/problems/Solver.py
short/3D/PyLith/trunk/pylith/problems/SolverLinear.py
short/3D/PyLith/trunk/pylith/problems/SolverLumped.py
short/3D/PyLith/trunk/pylith/problems/TimeDependent.py
short/3D/PyLith/trunk/pylith/topology/Distributor.py
short/3D/PyLith/trunk/pylith/topology/Mesh.py
short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
short/3D/PyLith/trunk/pylith/topology/RefineUniform.py
short/3D/PyLith/trunk/pylith/topology/SubMesh.py
Log:
Use weak references to remove circular references. Improve PETSc memory cleanup. Remove some old ALE stuff.
Modified: short/3D/PyLith/trunk/modulesrc/bc/bc.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/bc.i 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/modulesrc/bc/bc.i 2013-05-10 21:33:21 UTC (rev 22030)
@@ -37,8 +37,6 @@
%exception {
try {
$action
- } catch (const ALE::Exception& err) {
- SWIG_exception(SWIG_RuntimeError, err.message());
} catch (const std::exception& err) {
SWIG_exception(SWIG_RuntimeError, err.what());
} // try/catch
Modified: short/3D/PyLith/trunk/modulesrc/faults/faults.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/faults.i 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/modulesrc/faults/faults.i 2013-05-10 21:33:21 UTC (rev 22030)
@@ -46,8 +46,6 @@
%exception {
try {
$action
- } catch (const ALE::Exception& err) {
- SWIG_exception(SWIG_RuntimeError, err.message());
} catch (const std::exception& err) {
SWIG_exception(SWIG_RuntimeError, err.what());
} // try/catch
Modified: short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.i 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.i 2013-05-10 21:33:21 UTC (rev 22030)
@@ -55,8 +55,6 @@
%exception {
try {
$action
- } catch (const ALE::Exception& err) {
- SWIG_exception(SWIG_RuntimeError, err.message());
} catch (const std::exception& err) {
SWIG_exception(SWIG_RuntimeError, err.what());
} // try/catch
Modified: short/3D/PyLith/trunk/modulesrc/friction/friction.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/friction/friction.i 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/modulesrc/friction/friction.i 2013-05-10 21:33:21 UTC (rev 22030)
@@ -42,8 +42,6 @@
%exception {
try {
$action
- } catch (const ALE::Exception& err) {
- SWIG_exception(SWIG_RuntimeError, err.message());
} catch (const std::exception& err) {
SWIG_exception(SWIG_RuntimeError, err.what());
} // try/catch
Modified: short/3D/PyLith/trunk/modulesrc/materials/materials.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/materials.i 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/modulesrc/materials/materials.i 2013-05-10 21:33:21 UTC (rev 22030)
@@ -50,8 +50,6 @@
%exception {
try {
$action
- } catch (const ALE::Exception& err) {
- SWIG_exception(SWIG_RuntimeError, err.message());
} catch (const std::exception& err) {
SWIG_exception(SWIG_RuntimeError, err.what());
} // try/catch
Modified: short/3D/PyLith/trunk/modulesrc/meshio/meshio.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/meshio.i 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/modulesrc/meshio/meshio.i 2013-05-10 21:33:21 UTC (rev 22030)
@@ -50,8 +50,6 @@
%exception {
try {
$action
- } catch (const ALE::Exception& err) {
- SWIG_exception(SWIG_RuntimeError, err.message());
} catch (const std::exception& err) {
SWIG_exception(SWIG_RuntimeError, err.what());
} // try/catch
Modified: short/3D/PyLith/trunk/modulesrc/problems/problems.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/problems/problems.i 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/modulesrc/problems/problems.i 2013-05-10 21:33:21 UTC (rev 22030)
@@ -41,8 +41,6 @@
%exception {
try {
$action
- } catch (const ALE::Exception& err) {
- SWIG_exception(SWIG_RuntimeError, err.message());
} catch (const std::exception& err) {
SWIG_exception(SWIG_RuntimeError, err.what());
} // try/catch
Modified: short/3D/PyLith/trunk/modulesrc/topology/topology.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/topology.i 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/modulesrc/topology/topology.i 2013-05-10 21:33:21 UTC (rev 22030)
@@ -38,8 +38,6 @@
%exception {
try {
$action
- } catch (const ALE::Exception& err) {
- SWIG_exception(SWIG_RuntimeError, err.message());
} catch (const std::exception& err) {
SWIG_exception(SWIG_RuntimeError, err.what());
} // try/catch
Modified: short/3D/PyLith/trunk/modulesrc/utils/petsc.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/utils/petsc.i 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/modulesrc/utils/petsc.i 2013-05-10 21:33:21 UTC (rev 22030)
@@ -22,7 +22,6 @@
// Header files for module C++ code
%{
#include <petsc.h>
-#include <ALE.hh>
%}
%include "exception.i"
@@ -39,7 +38,7 @@
// Interfaces
%include "petsc_general.i"
-%include "petsc_memory.i"
+//%include "petsc_memory.i" // was ALE memory logging stuff
// End of file
Modified: short/3D/PyLith/trunk/modulesrc/utils/petsc_memory.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/utils/petsc_memory.i 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/modulesrc/utils/petsc_memory.i 2013-05-10 21:33:21 UTC (rev 22030)
@@ -16,37 +16,5 @@
// ======================================================================
//
-// ----------------------------------------------------------------------
-namespace ALE {
- class MemoryLogger {
- protected:
- MemoryLogger();
- public:
- /** Return the global logger
- *
- * @returns the logger
- */
- static MemoryLogger& singleton();
- int debug();
- void setDebug(int debug);
- public:
- void stagePush(const char *name);
- void stagePop();
- void logAllocation(const char *className, int bytes);
- void logAllocation(const char *stage, const char *className, int bytes);
- void logDeallocation(const char *className, int bytes);
- void logDeallocation(const char *stage, const char *className, int bytes);
- public:
- int getNumAllocations();
- int getNumAllocations(const char *stage);
- int getNumDeallocations();
- int getNumDeallocations(const char *stage);
- int getAllocationTotal();
- int getAllocationTotal(const char *stage);
- int getDeallocationTotal();
- int getDeallocationTotal(const char *stage);
- void show();
- };
-}
// End of file
Modified: short/3D/PyLith/trunk/modulesrc/utils/utils.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/utils/utils.i 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/modulesrc/utils/utils.i 2013-05-10 21:33:21 UTC (rev 22030)
@@ -34,8 +34,6 @@
%exception {
try {
$action
- } catch (const ALE::Exception& err) {
- SWIG_exception(SWIG_RuntimeError, err.message());
} catch (const std::exception& err) {
SWIG_exception(SWIG_RuntimeError, err.what());
} // try/catch
Modified: short/3D/PyLith/trunk/pylith/apps/PetscApplication.py
===================================================================
--- short/3D/PyLith/trunk/pylith/apps/PetscApplication.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/apps/PetscApplication.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -39,8 +39,7 @@
# Dummy facility for passing options to PETSc
from pylith.utils.PetscManager import PetscManager
- petsc = pyre.inventory.facility("petsc", family="petsc_manager",
- factory=PetscManager)
+ petsc = pyre.inventory.facility("petsc", family="petsc_manager", factory=PetscManager)
petsc.meta['tip'] = "Manager for PETSc options."
Modified: short/3D/PyLith/trunk/pylith/apps/PyLithApp.py
===================================================================
--- short/3D/PyLith/trunk/pylith/apps/PyLithApp.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/apps/PyLithApp.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -141,9 +141,6 @@
if self.perfLogger.verbose:
self.perfLogger.show()
- mesh.deallocate() # :KUDGE: TEMPORARY (required due to circular references)
- del mesh # long-term solution should be to just delete the mesh
- del self.problem # long-term solution should be to just delete the problem
return
Modified: short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -97,16 +97,16 @@
logEvent = "%sverify" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
- BoundaryCondition.verifyConfiguration(self, self.mesh)
+ BoundaryCondition.verifyConfiguration(self, self.mesh())
Integrator.verifyConfiguration(self)
- if self.bcQuadrature.cellDim() != self.mesh.dimension()-1:
+ if self.bcQuadrature.cellDim() != self.mesh().dimension()-1:
raise ValueError, \
"Quadrature scheme and mesh are incompatible.\n" \
"Dimension for quadrature: %d\n" \
"Dimension of mesh boundary '%s': %d" % \
(self.bcQuadrature.cellDim,
- self.label(), self.mesh.dimension()-1)
- ModuleAbsorbingDampers.verifyConfiguration(self, self.mesh)
+ self.label(), self.mesh().dimension()-1)
+ ModuleAbsorbingDampers.verifyConfiguration(self, self.mesh())
self._eventLogger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -116,7 +116,8 @@
"""
Setup boundary condition.
"""
- self.mesh = mesh
+ import weakref
+ self.mesh = weakref.ref(mesh)
return
@@ -124,7 +125,7 @@
"""
Initialize boundary condition.
"""
- ModuleBoundaryCondition.initialize(self, self.mesh, self.upDir)
+ ModuleBoundaryCondition.initialize(self, self.mesh(), self.upDir)
return
@@ -155,14 +156,6 @@
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/trunk/pylith/bc/DirichletBC.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/DirichletBC.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/bc/DirichletBC.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -79,7 +79,7 @@
logEvent = "%sverify" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
- BoundaryCondition.verifyConfiguration(self, self.mesh)
+ BoundaryCondition.verifyConfiguration(self, self.mesh())
self._eventLogger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/bc/DirichletBoundary.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/DirichletBoundary.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/bc/DirichletBoundary.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -105,7 +105,7 @@
self._eventLogger.eventBegin(logEvent)
DirichletBC.verifyConfiguration(self)
- self.output.verifyConfiguration(self.mesh)
+ self.output.verifyConfiguration(self.mesh())
self._eventLogger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/bc/Neumann.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/Neumann.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/bc/Neumann.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -104,17 +104,17 @@
logEvent = "%sverify" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
- BoundaryCondition.verifyConfiguration(self, self.mesh)
+ BoundaryCondition.verifyConfiguration(self, self.mesh())
Integrator.verifyConfiguration(self)
- if self.bcQuadrature.cellDim() != self.mesh.dimension()-1:
+ if self.bcQuadrature.cellDim() != self.mesh().dimension()-1:
raise ValueError, \
"Quadrature scheme and mesh are incompatible.\n" \
"Dimension for quadrature: %d\n" \
"Dimension of mesh boundary '%s': %d" % \
(self.bcQuadrature.cellDim(),
- self.label(), self.mesh.dimension()-1)
- self.output.verifyConfiguration(self.mesh)
- ModuleNeumann.verifyConfiguration(self, self.mesh)
+ self.label(), self.mesh().dimension()-1)
+ self.output.verifyConfiguration(self.mesh())
+ ModuleNeumann.verifyConfiguration(self, self.mesh())
self._eventLogger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/bc/PointForce.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/PointForce.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/bc/PointForce.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -67,7 +67,7 @@
logEvent = "%sverify" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
- BoundaryCondition.verifyConfiguration(self, self.mesh)
+ BoundaryCondition.verifyConfiguration(self, self.mesh())
self._eventLogger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/Fault.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/faults/Fault.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -124,7 +124,8 @@
"""
Setup fault.
"""
- self.mesh = mesh
+ import weakref
+ self.mesh = weakref.ref(mesh)
self.faultQuadrature.preinitialize(mesh.coordsys().spaceDim())
@@ -141,7 +142,7 @@
logEvent = "%sverify" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
- faultDim = self.mesh.dimension() - 1
+ faultDim = self.mesh().dimension() - 1
if faultDim != self.faultQuadrature.cell.cellDim:
raise ValueError, \
"Quadrature is incompatible with fault surface.\n" \
@@ -149,7 +150,7 @@
(self.faultQuadrature.cell.cellDim, faultDim)
if None != self.output:
- self.output.verifyConfiguration(self.mesh)
+ self.output.verifyConfiguration(self.mesh())
self._eventLogger.eventEnd(logEvent)
return
@@ -163,8 +164,7 @@
self._eventLogger.eventBegin(logEvent)
self.faultQuadrature.initialize()
- ModuleFault.initialize(self,
- self.mesh, self.upDir)
+ ModuleFault.initialize(self, self.mesh(), self.upDir)
if None != self.output:
self.output.initialize(normalizer, self.faultQuadrature)
@@ -261,12 +261,4 @@
return
- def _cleanup(self):
- """
- Deallocate locally managed data structures.
- """
- self.deallocate()
- return
-
-
# End of file
Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveDyn.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveDyn.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveDyn.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -144,7 +144,7 @@
FaultCohesive.verifyConfiguration(self)
Integrator.verifyConfiguration(self)
- ModuleFaultCohesiveDyn.verifyConfiguration(self, self.mesh)
+ ModuleFaultCohesiveDyn.verifyConfiguration(self, self.mesh())
self._eventLogger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveImpulses.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveImpulses.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveImpulses.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -142,7 +142,7 @@
FaultCohesive.verifyConfiguration(self)
Integrator.verifyConfiguration(self)
- ModuleFaultCohesiveImpulses.verifyConfiguration(self, self.mesh)
+ ModuleFaultCohesiveImpulses.verifyConfiguration(self, self.mesh())
self._eventLogger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -137,7 +137,7 @@
FaultCohesive.verifyConfiguration(self)
Integrator.verifyConfiguration(self)
- ModuleFaultCohesiveKin.verifyConfiguration(self, self.mesh)
+ ModuleFaultCohesiveKin.verifyConfiguration(self, self.mesh())
for eqsrc in self.eqsrcs.components():
eqsrc.verifyConfiguration()
Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveTract.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveTract.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveTract.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -89,7 +89,7 @@
FaultCohesive.verifyConfiguration(self)
Integrator.verifyConfiguration(self)
- ModuleFaultCohesiveTract.verifyConfiguration(self, self.mesh)
+ ModuleFaultCohesiveTract.verifyConfiguration(self, self.mesh())
self._eventLogger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicit.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicit.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -53,7 +53,7 @@
self._eventLogger.eventBegin(logEvent)
IntegratorElasticity.initialize(self, totalTime, numTimeSteps, normalizer)
- ModuleElasticityExplicit.initialize(self, self.mesh)
+ ModuleElasticityExplicit.initialize(self, self.mesh())
self._initializeOutput(totalTime, numTimeSteps, normalizer)
self._eventLogger.eventEnd(logEvent)
@@ -63,7 +63,7 @@
# PRIVATE METHODS ////////////////////////////////////////////////////
def _verifyConfiguration(self):
- ModuleElasticityExplicit.verifyConfiguration(self, self.mesh)
+ ModuleElasticityExplicit.verifyConfiguration(self, self.mesh())
return
Modified: short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicitLgDeform.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicitLgDeform.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicitLgDeform.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -56,7 +56,7 @@
self._eventLogger.eventBegin(logEvent)
IntegratorElasticityLgDeform.initialize(self, totalTime, numTimeSteps, normalizer)
- ModuleElasticityExplicitLgDeform.initialize(self, self.mesh)
+ ModuleElasticityExplicitLgDeform.initialize(self, self.mesh())
self._initializeOutput(totalTime, numTimeSteps, normalizer)
self._eventLogger.eventEnd(logEvent)
@@ -66,7 +66,7 @@
# PRIVATE METHODS ////////////////////////////////////////////////////
def _verifyConfiguration(self):
- ModuleElasticityExplicitLgDeform.verifyConfiguration(self, self.mesh)
+ ModuleElasticityExplicitLgDeform.verifyConfiguration(self, self.mesh())
return
Modified: short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicitTet4.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicitTet4.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicitTet4.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -53,7 +53,7 @@
self._eventLogger.eventBegin(logEvent)
IntegratorElasticity.initialize(self, totalTime, numTimeSteps, normalizer)
- ModuleElasticityExplicitTet4.initialize(self, self.mesh)
+ ModuleElasticityExplicitTet4.initialize(self, self.mesh())
self._initializeOutput(totalTime, numTimeSteps, normalizer)
self._eventLogger.eventEnd(logEvent)
@@ -63,7 +63,7 @@
# PRIVATE METHODS ////////////////////////////////////////////////////
def _verifyConfiguration(self):
- ModuleElasticityExplicitTet4.verifyConfiguration(self, self.mesh)
+ ModuleElasticityExplicitTet4.verifyConfiguration(self, self.mesh())
return
Modified: short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicitTri3.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicitTri3.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/feassemble/ElasticityExplicitTri3.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -53,7 +53,7 @@
self._eventLogger.eventBegin(logEvent)
IntegratorElasticity.initialize(self, totalTime, numTimeSteps, normalizer)
- ModuleElasticityExplicitTri3.initialize(self, self.mesh)
+ ModuleElasticityExplicitTri3.initialize(self, self.mesh())
self._initializeOutput(totalTime, numTimeSteps, normalizer)
self._eventLogger.eventEnd(logEvent)
@@ -63,7 +63,7 @@
# PRIVATE METHODS ////////////////////////////////////////////////////
def _verifyConfiguration(self):
- ModuleElasticityExplicitTri3.verifyConfiguration(self, self.mesh)
+ ModuleElasticityExplicitTri3.verifyConfiguration(self, self.mesh())
return
Modified: short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicit.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicit.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -53,7 +53,7 @@
self._eventLogger.eventBegin(logEvent)
IntegratorElasticity.initialize(self, totalTime, numTimeSteps, normalizer)
- ModuleElasticityImplicit.initialize(self, self.mesh)
+ ModuleElasticityImplicit.initialize(self, self.mesh())
self._initializeOutput(totalTime, numTimeSteps, normalizer)
self._eventLogger.eventEnd(logEvent)
@@ -63,7 +63,7 @@
# PRIVATE METHODS ////////////////////////////////////////////////////
def _verifyConfiguration(self):
- ModuleElasticityImplicit.verifyConfiguration(self, self.mesh)
+ ModuleElasticityImplicit.verifyConfiguration(self, self.mesh())
return
Modified: short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicitCUDA.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicitCUDA.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicitCUDA.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -53,7 +53,7 @@
self._eventLogger.eventBegin(logEvent)
IntegratorElasticity.initialize(self, totalTime, numTimeSteps, normalizer)
- ModuleElasticityImplicit.initialize(self, self.mesh)
+ ModuleElasticityImplicit.initialize(self, self.mesh())
self._initializeOutput(totalTime, numTimeSteps, normalizer)
self._eventLogger.eventEnd(logEvent)
Modified: short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicitLgDeform.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicitLgDeform.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/feassemble/ElasticityImplicitLgDeform.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -55,7 +55,7 @@
IntegratorElasticityLgDeform.initialize(self, totalTime, numTimeSteps,
normalizer)
- ModuleElasticityImplicitLgDeform.initialize(self, self.mesh)
+ ModuleElasticityImplicitLgDeform.initialize(self, self.mesh())
self._initializeOutput(totalTime, numTimeSteps, normalizer)
self._eventLogger.eventEnd(logEvent)
@@ -65,7 +65,7 @@
# PRIVATE METHODS ////////////////////////////////////////////////////
def _verifyConfiguration(self):
- ModuleElasticityImplicitLgDeform.verifyConfiguration(self, self.mesh)
+ ModuleElasticityImplicitLgDeform.verifyConfiguration(self, self.mesh())
return
Modified: short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/feassemble/IntegratorElasticity.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -53,7 +53,8 @@
"""
Setup integrator.
"""
- self.mesh = mesh
+ import weakref
+ self.mesh = weakref.ref(mesh)
self.output = material.output
self.availableFields = material.availableFields
self.materialObj = material
@@ -78,15 +79,15 @@
Integrator.verifyConfiguration(self)
self.materialObj.verifyConfiguration()
- if self.mesh.dimension() != self.materialObj.dimension():
+ if self.mesh().dimension() != self.materialObj.dimension():
raise ValueError("Mesh dimension is '%d' but material '%s' of type " \
"'%s' applies to dimension '%d'." % \
- (self.mesh.dimension(),
+ (self.mesh().dimension(),
self.materialObj.label(),
self.materialObj,
self.materialObj.dimension()))
self._verifyConfiguration()
- self.output.verifyConfiguration(self.mesh)
+ self.output.verifyConfiguration(self.mesh())
self._eventLogger.eventEnd(logEvent)
return
@@ -160,9 +161,9 @@
Get cell field.
"""
if None == fields:
- field = self.cellField(name, self.mesh)
+ field = self.cellField(name, self.mesh())
else:
- field = self.cellField(name, self.mesh, fields)
+ field = self.cellField(name, self.mesh(), fields)
return field
Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -121,8 +121,9 @@
Do pre-initialization setup.
"""
self._setupLogging()
- self.mesh = mesh
- self.quadrature.preinitialize(self.mesh.coordsys().spaceDim())
+ import weakref
+ self.mesh = weakref.ref(mesh)
+ self.quadrature.preinitialize(mesh.coordsys().spaceDim())
from pylith.topology.topology import MeshOps_numMaterialCells
self.ncells = MeshOps_numMaterialCells(mesh, self.id())
return
@@ -135,9 +136,9 @@
logEvent = "%sverify" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
- if self.quadrature.cellDim() != self.mesh.dimension() or \
- self.quadrature.spaceDim() != self.mesh.coordsys().spaceDim() or \
- self.quadrature.cell.numCorners != self.mesh.coneSize():
+ if self.quadrature.cellDim() != self.mesh().dimension() or \
+ self.quadrature.spaceDim() != self.mesh().coordsys().spaceDim() or \
+ self.quadrature.cell.numCorners != self.mesh().coneSize():
raise ValueError, \
"Quadrature scheme for material '%s' and mesh are incompatible.\n" \
" Quadrature reference cell:\n" \
@@ -151,8 +152,8 @@
(self.label(),
self.quadrature.cellDim(), self.quadrature.spaceDim(),
self.quadrature.cell.numCorners,
- self.mesh.dimension(), self.mesh.coordsys().spaceDim(),
- self.mesh.coneSize())
+ self.mesh().dimension(), self.mesh().coordsys().spaceDim(),
+ self.mesh().coneSize())
self._eventLogger.eventEnd(logEvent)
return
@@ -171,7 +172,7 @@
"""
Get mesh associated with data fields.
"""
- return (self.mesh, "material-id", self.id())
+ return (self.mesh(), "material-id", self.id())
# PRIVATE METHODS ////////////////////////////////////////////////////
@@ -237,12 +238,4 @@
return
- def _cleanup(self):
- """
- Deallocate locally managed data structures.
- """
- self.deallocate()
- return
-
-
# End of file
Modified: short/3D/PyLith/trunk/pylith/meshio/CellFilter.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/CellFilter.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/meshio/CellFilter.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -96,14 +96,6 @@
return
- def _cleanup(self):
- """
- Deallocate locally managed data structures.
- """
- self.deallocate()
- return
-
-
# FACTORIES ////////////////////////////////////////////////////////////
def output_cell_filter():
Modified: short/3D/PyLith/trunk/pylith/meshio/DataWriter.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/DataWriter.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/meshio/DataWriter.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -58,14 +58,4 @@
return
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _cleanup(self):
- """
- Deallocate locally managed data structures.
- """
- self.deallocate()
- return
-
-
# End of file
Modified: short/3D/PyLith/trunk/pylith/meshio/DataWriterVTKMesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/DataWriterVTKMesh.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/meshio/DataWriterVTKMesh.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -51,8 +51,7 @@
DataWriterVTK.initialize(self, normalizer)
timeScale = normalizer.timeScale()
- timeConstantN = normalizer.nondimensionalize(self.timeConstant,
- timeScale)
+ timeConstantN = normalizer.nondimensionalize(self.timeConstant, timeScale)
ModuleDataWriterVTK.filename(self, self.filename)
ModuleDataWriterVTK.timeScale(self, timeScale.value)
Modified: short/3D/PyLith/trunk/pylith/meshio/OutputManager.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputManager.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputManager.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -398,14 +398,6 @@
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/trunk/pylith/meshio/OutputManagerMesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputManagerMesh.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputManagerMesh.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -116,6 +116,7 @@
ModuleOutputManager.appendVertexField(self, t, field, mesh)
return
+
def _appendCellField(self, t, field, label, labelId):
"""
Call C++ appendCellField();
Modified: short/3D/PyLith/trunk/pylith/meshio/OutputSoln.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputSoln.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputSoln.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -87,7 +87,8 @@
logEvent = "%sinit" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
- self.mesh = mesh
+ import weakref
+ self.mesh = weakref.ref(mesh)
OutputManagerMesh.initialize(self, normalizer)
self._eventLogger.eventEnd(logEvent)
@@ -98,7 +99,7 @@
"""
Get mesh associated with data fields.
"""
- return (self.mesh, None, None)
+ return (self.mesh(), None, None)
def getVertexField(self, name, fields):
Modified: short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
===================================================================
--- short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -226,8 +226,6 @@
def processMemDict(self, memDict, indent = 0, namePrefix = '',
includeDealloc = True):
- from pylith.utils.petsc import MemoryLogger
- logger = MemoryLogger.singleton()
output = []
total = 0
codeTotal = 0
@@ -242,22 +240,22 @@
total += mem
codeTotal += codeMem
else:
- mem = logger.getAllocationTotal(fullname)
+ mem = 0 #logger.getAllocationTotal(fullname)
if includeDealloc:
- mem -= logger.getDeallocationTotal(fullname)
+ mem -= 0 #logger.getDeallocationTotal(fullname)
total += m
codeTotal += mem
output.append(self.memLine('Model', name, m, indent))
- if logger.getAllocationTotal(fullname):
+ if False: #logger.getAllocationTotal(fullname):
output.append(self.memLine('Code', name, mem, indent))
if namePrefix:
- mem = logger.getAllocationTotal(namePrefix)
+ mem = 0 #logger.getAllocationTotal(namePrefix)
if includeDealloc:
- mem -= logger.getDeallocationTotal(namePrefix)
+ mem -= 0 #logger.getDeallocationTotal(namePrefix)
else:
- mem = logger.getAllocationTotal()
+ mem = 0 #logger.getAllocationTotal()
if includeDealloc:
- mem -= logger.getDeallocationTotal()
+ mem -= 0 #logger.getDeallocationTotal()
if mem == 0:
mem = codeTotal
output.append(self.prefix(indent)+'-'*(60-indent))
@@ -280,12 +278,10 @@
output.extend(self.processMemDict(self.memory, includeDealloc = \
self.includeDealloc)[0])
- from pylith.utils.petsc import MemoryLogger
- logger = MemoryLogger.singleton()
- output.append(self.memLine('Code', 'Total Alloced',
- logger.getAllocationTotal('default'), 1))
- output.append(self.memLine('Code', 'Total Dealloced',
- logger.getDeallocationTotal('default'), 1))
+ output.append(self.memLine('Code', 'Total Alloced', 0))
+ #logger.getAllocationTotal('default'), 1))
+ output.append(self.memLine('Code', 'Total Dealloced', 0))
+ #logger.getDeallocationTotal('default'), 1))
print '\n'.join(output)
return
Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -109,10 +109,10 @@
self._initialize(dimension, normalizer)
- from pylith.utils.petsc import MemoryLogger
- logger = MemoryLogger.singleton()
- logger.setDebug(0)
- logger.stagePush("Problem")
+ #from pylith.utils.petsc import MemoryLogger
+ #memoryLogger = MemoryLogger.singleton()
+ #memoryLogger.setDebug(0)
+ #memoryLogger.stagePush("Problem")
# Allocate other fields, reusing layout from dispIncr
if 0 == comm.rank:
@@ -145,12 +145,12 @@
accelerationT.zero()
self._debug.log(resourceUsageString())
- logger.stagePop()
+ #memoryLogger.stagePop()
if 0 == comm.rank:
self._info.log("Creating lumped Jacobian matrix.")
from pylith.topology.topology import MeshField
- jacobian = MeshField(self.mesh)
+ jacobian = MeshField(self.mesh())
jacobian.newSection(jacobian.VERTICES_FIELD, dimension)
jacobian.allocate()
jacobian.label("jacobian")
@@ -158,14 +158,14 @@
self.jacobian = jacobian
self._debug.log(resourceUsageString())
- logger.stagePush("Problem")
+ #memoryLogger.stagePush("Problem")
if 0 == comm.rank:
self._info.log("Initializing solver.")
self.solver.initialize(self.fields, self.jacobian, self)
self._debug.log(resourceUsageString())
- logger.stagePop()
- logger.setDebug(0)
+ #memoryLogger.stagePop()
+ #memoryLogger.setDebug(0)
self._eventLogger.eventEnd(logEvent)
return
@@ -288,7 +288,7 @@
self._eventLogger.eventBegin(logEvent)
if self.dtStable is None:
- self.dtStable = self.timeStep.timeStep(self.mesh, self.integratorsMesh + self.integratorsSubMesh)
+ self.dtStable = self.timeStep.timeStep(self.mesh(), self.integratorsMesh + self.integratorsSubMesh)
self._eventLogger.eventEnd(logEvent)
return self.dtStable
Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -171,8 +171,9 @@
comm = mpi_comm_world()
self.timeStep.preinitialize()
-
- self.mesh = mesh
+
+ import weakref
+ self.mesh = weakref.ref(mesh)
self.integratorsMesh = []
self.integratorsSubMesh = []
self.constraints = []
@@ -206,7 +207,7 @@
for constraint in self.constraints:
constraint.verifyConfiguration()
for output in self.output.components():
- output.verifyConfiguration(self.mesh)
+ output.verifyConfiguration(self.mesh())
self._eventLogger.eventEnd(logEvent)
return
@@ -240,8 +241,7 @@
logEvent = "%stimestep" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
- dt = self.timeStep.timeStep(self.mesh,
- self.integratorsMesh + self.integratorsSubMesh)
+ dt = self.timeStep.timeStep(self.mesh(), self.integratorsMesh + self.integratorsSubMesh)
self._eventLogger.eventEnd(logEvent)
return dt
@@ -371,7 +371,7 @@
self.matrixType = "aijcusp"
for constraint in self.constraints:
numDimConstrained = constraint.numDimConstrained()
- if numDimConstrained > 0 and self.mesh.dimension() != numDimConstrained:
+ if numDimConstrained > 0 and self.mesh().dimension() != numDimConstrained:
self.blockMatrixOkay = False
return
@@ -394,13 +394,12 @@
raise TypeError, \
"Could not use '%s' as an integrator for material '%s'. " \
"Functionality missing." % (integrator.name, material.label())
- integrator.preinitialize(self.mesh, material)
+ integrator.preinitialize(self.mesh(), material)
self.integratorsMesh.append(integrator)
self._debug.log(resourceUsageString())
if 0 == comm.rank:
- self._info.log("Added elasticity integrator for material '%s'." % \
- material.label())
+ self._info.log("Added elasticity integrator for material '%s'." % material.label())
return
@@ -419,7 +418,7 @@
self._info.log("Pre-initializing boundary conditions.")
self._debug.log(resourceUsageString())
for bc in boundaryConditions.components():
- bc.preinitialize(self.mesh)
+ bc.preinitialize(self.mesh())
foundType = False
if implementsIntegrator(bc):
foundType = True
@@ -457,7 +456,7 @@
if 0 == comm.rank:
self._info.log("Pre-initializing interior interfaces.")
for ic in interfaceConditions.components():
- ic.preinitialize(self.mesh)
+ ic.preinitialize(self.mesh())
foundType = False
if implementsIntegrator(ic):
foundType = True
@@ -492,7 +491,7 @@
totalTime = self.timeStep.totalTime
from pylith.topology.SolutionFields import SolutionFields
- self.fields = SolutionFields(self.mesh)
+ self.fields = SolutionFields(self.mesh())
self._debug.log(resourceUsageString())
if 0 == comm.rank:
@@ -514,7 +513,7 @@
if 0 == comm.rank:
self._info.log("Setting up solution output.")
for output in self.output.components():
- output.initialize(self.mesh, normalizer)
+ output.initialize(self.mesh(), normalizer)
output.writeInfo()
output.open(totalTime, numTimeSteps)
self._debug.log(resourceUsageString())
@@ -522,10 +521,10 @@
# Setup fields
if 0 == comm.rank:
self._info.log("Creating solution field.")
- from pylith.utils.petsc import MemoryLogger
- memoryLogger = MemoryLogger.singleton()
- memoryLogger.setDebug(0)
- memoryLogger.stagePush("Problem")
+ #from pylith.utils.petsc import MemoryLogger
+ #memoryLogger = MemoryLogger.singleton()
+ #memoryLogger.setDebug(0)
+ #memoryLogger.stagePush("Problem")
self.fields.add("dispIncr(t->t+dt)", "displacement_increment")
self.fields.add("disp(t)", "displacement")
self.fields.add("residual", "residual")
@@ -570,13 +569,12 @@
for integrator in self.integratorsMesh + self.integratorsSubMesh:
integrator.checkConstraints(solution)
+ #memoryLogger.stagePop()
- memoryLogger.stagePop()
-
# This also creates a global order.
solution.createScatterMesh(solution.mesh())
- memoryLogger.stagePush("Problem")
+ #memoryLogger.stagePush("Problem")
dispT = self.fields.get("disp(t)")
dispT.vectorFieldType(dispT.VECTOR)
dispT.scale(lengthScale.value)
@@ -585,8 +583,8 @@
residual.vectorFieldType(residual.VECTOR)
residual.scale(lengthScale.value)
- memoryLogger.stagePop()
- memoryLogger.setDebug(0)
+ #memoryLogger.stagePop()
+ #memoryLogger.setDebug(0)
self._debug.log(resourceUsageString())
return
@@ -611,7 +609,7 @@
if self.viewJacobian:
from pylith.mpi.Communicator import Communicator
- comm = Communicator(self.mesh.comm())
+ comm = Communicator(self.mesh().comm())
self.jacobianViewer.view(self.jacobian, t, comm)
self._debug.log(resourceUsageString())
Modified: short/3D/PyLith/trunk/pylith/problems/GreensFns.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/GreensFns.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/problems/GreensFns.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -90,9 +90,9 @@
if 0 == comm.rank:
self._info.log("Pre-initializing problem.")
- self.mesh = mesh
- self.formulation.preinitialize(mesh, self.materials, self.bc,
- self.interfaces, self.gravityField)
+ import weakref
+ self.mesh = weakref.ref(mesh)
+ self.formulation.preinitialize(mesh, self.materials, self.bc, self.interfaces, self.gravityField)
# Find fault for impulses
found = False
Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -126,10 +126,10 @@
self._initialize(dimension, normalizer)
- from pylith.utils.petsc import MemoryLogger
- memoryLogger = MemoryLogger.singleton()
- memoryLogger.setDebug(0)
- memoryLogger.stagePush("Problem")
+ #from pylith.utils.petsc import MemoryLogger
+ #memoryLogger = MemoryLogger.singleton()
+ #memoryLogger.setDebug(0)
+ #memoryLogger.stagePush("Problem")
# Allocate other fields, reusing layout from dispIncr
if 0 == comm.rank:
@@ -152,7 +152,7 @@
velocityT.zero()
self._debug.log(resourceUsageString())
- memoryLogger.stagePop()
+ #memoryLogger.stagePop()
# Allocates memory for nonzero pattern and Jacobian
if 0 == comm.rank:
@@ -164,14 +164,14 @@
self.jacobian.zero() # TEMPORARY, to get correct memory usage
self._debug.log(resourceUsageString())
- memoryLogger.stagePush("Problem")
+ #memoryLogger.stagePush("Problem")
if 0 == comm.rank:
self._info.log("Initializing solver.")
self.solver.initialize(self.fields, self.jacobian, self)
self._debug.log(resourceUsageString())
- memoryLogger.stagePop()
- memoryLogger.setDebug(0)
+ #memoryLogger.stagePop()
+ #memoryLogger.setDebug(0)
return
Modified: short/3D/PyLith/trunk/pylith/problems/Problem.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Problem.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/problems/Problem.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -148,17 +148,17 @@
comm = mpi_comm_world()
if 0 == comm.rank:
self._info.log("Verifying compatibility of problem configuration.")
- if self.dimension != self.mesh.dimension():
+ if self.dimension != self.mesh().dimension():
raise ValueError, \
"Spatial dimension of problem is '%d' but mesh contains cells " \
"for spatial dimension '%d'." % \
- (self.dimension, self.mesh.dimension())
+ (self.dimension, self.mesh().dimension())
- if self.dimension != self.mesh.coordsys().spaceDim():
+ if self.dimension != self.mesh().coordsys().spaceDim():
raise ValueError, \
"Spatial dimension of problem is '%d' but mesh coordinate system " \
"is for spatial dimension '%d'." % \
- (self.dimension, self.mesh.coordsys().spaceDim())
+ (self.dimension, self.mesh().coordsys().spaceDim())
# Check to make sure ids of materials and interfaces are unique
materialIds = {}
@@ -186,7 +186,7 @@
# Check to make sure material-id for each cell matches the id of a material
import numpy
idValues = numpy.array(materialIds.keys(), dtype=numpy.int32)
- self.mesh.checkMaterialIds(idValues)
+ self.mesh().checkMaterialIds(idValues)
return
Modified: short/3D/PyLith/trunk/pylith/problems/Solver.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Solver.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/problems/Solver.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -96,14 +96,6 @@
return
- def _cleanup(self):
- """
- Deallocate PETSc and local data structures.
- """
- self.deallocate()
- return
-
-
# FACTORIES ////////////////////////////////////////////////////////////
def solver():
Modified: short/3D/PyLith/trunk/pylith/problems/SolverLinear.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/SolverLinear.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/problems/SolverLinear.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -76,14 +76,6 @@
return
- def _cleanup(self):
- """
- Deallocate PETSc and local data structures.
- """
- self.deallocate()
- return
-
-
# FACTORIES ////////////////////////////////////////////////////////////
def solver():
Modified: short/3D/PyLith/trunk/pylith/problems/SolverLumped.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/SolverLumped.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/problems/SolverLumped.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -77,14 +77,6 @@
return
- def _cleanup(self):
- """
- Deallocate PETSc and local data structures.
- """
- self.deallocate()
- return
-
-
# FACTORIES ////////////////////////////////////////////////////////////
def solver():
Modified: short/3D/PyLith/trunk/pylith/problems/TimeDependent.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/TimeDependent.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/problems/TimeDependent.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -90,9 +90,9 @@
if 0 == comm.rank:
self._info.log("Pre-initializing problem.")
- self.mesh = mesh
- self.formulation.preinitialize(mesh, self.materials, self.bc,
- self.interfaces, self.gravityField)
+ import weakref
+ self.mesh = weakref.ref(mesh)
+ self.formulation.preinitialize(mesh, self.materials, self.bc, self.interfaces, self.gravityField)
return
Modified: short/3D/PyLith/trunk/pylith/topology/Distributor.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Distributor.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/topology/Distributor.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -82,12 +82,12 @@
newMesh = Mesh(mesh.dimension())
ModuleDistributor.distribute(newMesh, mesh, self.partitioner)
- from pylith.utils.petsc import MemoryLogger
- sieveLogger = MemoryLogger.singleton()
+ #from pylith.utils.petsc import MemoryLogger
+ #memoryLogger = MemoryLogger.singleton()
- sieveLogger.stagePush(mesh.memLoggingStage)
- mesh.deallocate()
- sieveLogger.stagePop()
+ #memoryLogger.stagePush(mesh.memLoggingStage)
+ mesh.cleanup()
+ #memoryLogger.stagePop()
if self.writePartition:
self.dataWriter.initialize(normalizer)
Modified: short/3D/PyLith/trunk/pylith/topology/Mesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Mesh.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/topology/Mesh.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -85,9 +85,7 @@
return groups
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _cleanup(self):
+ def cleanup(self):
"""
Deallocate locally managed data structures.
"""
Modified: short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshImporter.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/topology/MeshImporter.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -131,7 +131,7 @@
# Refine mesh (if necessary)
newMesh = self.refiner.refine(mesh)
if not newMesh == mesh:
- mesh.deallocate()
+ mesh.cleanup()
newMesh.memLoggingStage = "RefinedMesh"
# Nondimensionalize mesh (coordinates of vertices).
Modified: short/3D/PyLith/trunk/pylith/topology/RefineUniform.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/RefineUniform.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/topology/RefineUniform.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -68,12 +68,12 @@
newMesh.coordsys(mesh.coordsys())
ModuleRefineUniform.refine(self, newMesh, mesh, self.levels)
if not newMesh == mesh:
- from pylith.utils.petsc import MemoryLogger
- sieveLogger = MemoryLogger.singleton()
+ #from pylith.utils.petsc import MemoryLogger
+ #memoryLogger = MemoryLogger.singleton()
- sieveLogger.stagePush(mesh.memLoggingStage)
- mesh.deallocate()
- sieveLogger.stagePop()
+ #memoryLogger.stagePush(mesh.memLoggingStage)
+ mesh.cleanup()
+ #memoryLogger.stagePop()
self._eventLogger.eventEnd(logEvent)
return newMesh
Modified: short/3D/PyLith/trunk/pylith/topology/SubMesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/SubMesh.py 2013-05-10 19:08:21 UTC (rev 22029)
+++ short/3D/PyLith/trunk/pylith/topology/SubMesh.py 2013-05-10 21:33:21 UTC (rev 22030)
@@ -54,14 +54,4 @@
return Communicator(ModuleSubMesh.comm(self))
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _cleanup(self):
- """
- Deallocate locally managed data structures.
- """
- self.deallocate()
- return
-
-
# End of file
More information about the CIG-COMMITS
mailing list