[cig-commits] r22360 - in short/3D/PyLith/branches/v1.7-trunk: libsrc/pylith/meshio pylith/bc pylith/faults pylith/feassemble pylith/materials pylith/meshio pylith/problems pylith/topology pylith/utils
brad at geodynamics.org
brad at geodynamics.org
Tue Jun 18 14:27:00 PDT 2013
Author: brad
Date: 2013-06-18 14:27:00 -0700 (Tue, 18 Jun 2013)
New Revision: 22360
Modified:
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterVTK.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/OutputSolnPoints.cc
short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/OutputSolnPoints.hh
short/3D/PyLith/branches/v1.7-trunk/pylith/bc/AbsorbingDampers.py
short/3D/PyLith/branches/v1.7-trunk/pylith/bc/BoundaryCondition.py
short/3D/PyLith/branches/v1.7-trunk/pylith/bc/DirichletBC.py
short/3D/PyLith/branches/v1.7-trunk/pylith/bc/DirichletBoundary.py
short/3D/PyLith/branches/v1.7-trunk/pylith/bc/Neumann.py
short/3D/PyLith/branches/v1.7-trunk/pylith/bc/PointForce.py
short/3D/PyLith/branches/v1.7-trunk/pylith/faults/Fault.py
short/3D/PyLith/branches/v1.7-trunk/pylith/faults/FaultCohesiveDyn.py
short/3D/PyLith/branches/v1.7-trunk/pylith/faults/FaultCohesiveImpulses.py
short/3D/PyLith/branches/v1.7-trunk/pylith/faults/FaultCohesiveKin.py
short/3D/PyLith/branches/v1.7-trunk/pylith/faults/FaultCohesiveTract.py
short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicit.py
short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicitLgDeform.py
short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicitTet4.py
short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicitTri3.py
short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityImplicit.py
short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityImplicitCUDA.py
short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityImplicitLgDeform.py
short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/IntegratorElasticity.py
short/3D/PyLith/branches/v1.7-trunk/pylith/materials/Material.py
short/3D/PyLith/branches/v1.7-trunk/pylith/meshio/OutputManager.py
short/3D/PyLith/branches/v1.7-trunk/pylith/meshio/OutputSoln.py
short/3D/PyLith/branches/v1.7-trunk/pylith/problems/Explicit.py
short/3D/PyLith/branches/v1.7-trunk/pylith/problems/Formulation.py
short/3D/PyLith/branches/v1.7-trunk/pylith/problems/GreensFns.py
short/3D/PyLith/branches/v1.7-trunk/pylith/problems/Problem.py
short/3D/PyLith/branches/v1.7-trunk/pylith/problems/TimeDependent.py
short/3D/PyLith/branches/v1.7-trunk/pylith/topology/Distributor.py
short/3D/PyLith/branches/v1.7-trunk/pylith/topology/Mesh.py
short/3D/PyLith/branches/v1.7-trunk/pylith/topology/MeshImporter.py
short/3D/PyLith/branches/v1.7-trunk/pylith/topology/RefineUniform.py
short/3D/PyLith/branches/v1.7-trunk/pylith/utils/PetscComponent.py
Log:
Small fixes to improve memory management (backport from trunk).
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterVTK.cc 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/DataWriterVTK.cc 2013-06-18 21:27:00 UTC (rev 22360)
@@ -167,7 +167,7 @@
void
pylith::meshio::DataWriterVTK<mesh_type,field_type>::closeTimeStep(void)
{ // closeTimeStep
- PetscViewerDestroy(&_viewer); _viewer = 0;
+ PetscViewerDestroy(&_viewer);
_wroteVertexHeader = false;
_wroteCellHeader = false;
} // closeTimeStep
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/OutputSolnPoints.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/OutputSolnPoints.cc 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/OutputSolnPoints.cc 2013-06-18 21:27:00 UTC (rev 22360)
@@ -34,7 +34,8 @@
pylith::meshio::OutputSolnPoints::OutputSolnPoints(void) :
_mesh(0),
_pointsMesh(0),
- _interpolator(0)
+ _interpolator(0),
+ _dm(0)
{ // constructor
} // constructor
@@ -52,17 +53,12 @@
{ // deallocate
OutputManager<topology::Mesh, topology::Field<topology::Mesh> >::deallocate();
+ PetscErrorCode err = 0;
if (_interpolator) {
- assert(_mesh);
- const ALE::Obj<SieveMesh>& sieveMesh = _mesh->sieveMesh();
- DM dm;
- PetscErrorCode err = 0;
-
- err = DMMeshCreate(sieveMesh->comm(), &dm);CHECK_PETSC_ERROR(err);
- err = DMMeshSetMesh(dm, sieveMesh);CHECK_PETSC_ERROR(err);
- err = DMMeshInterpolationDestroy(dm, &_interpolator);CHECK_PETSC_ERROR(err);
- err = DMDestroy(&dm);CHECK_PETSC_ERROR(err);
+ assert(_dm);
+ err = DMMeshInterpolationDestroy(_dm, &_interpolator);CHECK_PETSC_ERROR(err);
} // if
+ err = DMDestroy(&_dm);CHECK_PETSC_ERROR(err);
_mesh = 0; // :TODO: Use shared pointer
delete _pointsMesh; _pointsMesh = 0;
@@ -116,20 +112,19 @@
assert(csMesh->spaceDim() == spaceDim);
// Setup interpolator object
- DM dm;
PetscErrorCode err = 0;
assert(!_mesh->sieveMesh().isNull());
- err = DMMeshCreate(_mesh->sieveMesh()->comm(), &dm);CHECK_PETSC_ERROR(err);
- err = DMMeshSetMesh(dm, _mesh->sieveMesh());CHECK_PETSC_ERROR(err);
- err = DMMeshInterpolationCreate(dm, &_interpolator);CHECK_PETSC_ERROR(err);
+ err = DMDestroy(&_dm);CHECK_PETSC_ERROR(err);
+ err = DMMeshCreate(_mesh->sieveMesh()->comm(), &_dm);CHECK_PETSC_ERROR(err);
+ err = DMMeshSetMesh(_dm, _mesh->sieveMesh());CHECK_PETSC_ERROR(err);
+ err = DMMeshInterpolationCreate(_dm, &_interpolator);CHECK_PETSC_ERROR(err);
- err = DMMeshInterpolationSetDim(dm, spaceDim, _interpolator);CHECK_PETSC_ERROR(err);
+ err = DMMeshInterpolationSetDim(_dm, spaceDim, _interpolator);CHECK_PETSC_ERROR(err);
- err = DMMeshInterpolationAddPoints(dm, numPoints, (PetscReal*)&pointsNondim[0], _interpolator);CHECK_PETSC_ERROR(err);
+ err = DMMeshInterpolationAddPoints(_dm, numPoints, (PetscReal*)&pointsNondim[0], _interpolator);CHECK_PETSC_ERROR(err);
const PetscBool pointsAllProcs = PETSC_TRUE;
- err = DMMeshInterpolationSetUp(dm, _interpolator, pointsAllProcs);CHECK_PETSC_ERROR(err);
- err = DMDestroy(&dm);CHECK_PETSC_ERROR(err);
+ err = DMMeshInterpolationSetUp(_dm, _interpolator, pointsAllProcs);CHECK_PETSC_ERROR(err);
// Create mesh corresponding to points.
const int meshDim = 0;
@@ -271,23 +266,18 @@
PetscVec fieldInterpVec = fieldInterp.vector(context);
assert(fieldInterpVec);
- DM dm;
SectionReal section;
PetscErrorCode err = 0;
-
- err = DMMeshCreate(sieveMesh->comm(), &dm);CHECK_PETSC_ERROR(err);
- err = DMMeshSetMesh(dm, sieveMesh);CHECK_PETSC_ERROR(err);
- err = DMMeshInterpolationSetDof(dm, fiberDim,
- _interpolator);CHECK_PETSC_ERROR(err);
+ assert(_dm);
+ err = DMMeshInterpolationSetDof(_dm, fiberDim, _interpolator);CHECK_PETSC_ERROR(err);
+
err = SectionRealCreate(sieveMesh->comm(), §ion);CHECK_PETSC_ERROR(err);
err = SectionRealSetSection(section, field.section());CHECK_PETSC_ERROR(err);
err = SectionRealSetBundle(section, sieveMesh);CHECK_PETSC_ERROR(err);
- err = DMMeshInterpolationEvaluate(dm, section, fieldInterpVec,
- _interpolator);CHECK_PETSC_ERROR(err);
+ err = DMMeshInterpolationEvaluate(_dm, section, fieldInterpVec, _interpolator);CHECK_PETSC_ERROR(err);
err = SectionRealDestroy(§ion);CHECK_PETSC_ERROR(err);
- err = DMDestroy(&dm);CHECK_PETSC_ERROR(err);
fieldInterp.scatterVectorToSection(context);
Modified: short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/OutputSolnPoints.hh
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/OutputSolnPoints.hh 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/libsrc/pylith/meshio/OutputSolnPoints.hh 2013-06-18 21:27:00 UTC (rev 22360)
@@ -135,6 +135,7 @@
topology::Mesh* _mesh; ///< Domain mesh.
topology::Mesh* _pointsMesh; ///< Mesh for points (no cells).
PetscDMMeshInterpolationInfo _interpolator; ///< Field interpolator.
+ DM _dm; ///< PETSc DM for interpolator;
}; // OutputSolnPoints
Modified: short/3D/PyLith/branches/v1.7-trunk/pylith/bc/AbsorbingDampers.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/bc/AbsorbingDampers.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/bc/AbsorbingDampers.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/bc/BoundaryCondition.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/bc/BoundaryCondition.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/bc/BoundaryCondition.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/bc/DirichletBC.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/bc/DirichletBC.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/bc/DirichletBC.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -79,8 +79,8 @@
logEvent = "%sverify" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
- BoundaryCondition.verifyConfiguration(self, self.mesh)
- spaceDim = self.mesh.coordsys().spaceDim()
+ BoundaryCondition.verifyConfiguration(self, self.mesh())
+ spaceDim = self.mesh().coordsys().spaceDim()
for d in self.bcDOF:
if d < 0 or d >= spaceDim:
raise ValueError("Attempting to constrain DOF (%d) that doesn't exist. Space dimension is %d." % \
Modified: short/3D/PyLith/branches/v1.7-trunk/pylith/bc/DirichletBoundary.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/bc/DirichletBoundary.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/bc/DirichletBoundary.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/bc/Neumann.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/bc/Neumann.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/bc/Neumann.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/bc/PointForce.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/bc/PointForce.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/bc/PointForce.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/faults/Fault.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/faults/Fault.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/faults/FaultCohesiveDyn.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/faults/FaultCohesiveDyn.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/faults/FaultCohesiveDyn.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/faults/FaultCohesiveImpulses.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/faults/FaultCohesiveImpulses.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/faults/FaultCohesiveImpulses.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/faults/FaultCohesiveKin.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/faults/FaultCohesiveKin.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/faults/FaultCohesiveTract.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/faults/FaultCohesiveTract.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/faults/FaultCohesiveTract.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -117,7 +117,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/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicit.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicit.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicit.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicitLgDeform.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicitLgDeform.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicitLgDeform.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicitTet4.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicitTet4.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicitTet4.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicitTri3.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicitTri3.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityExplicitTri3.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/feassemble/ElasticityImplicit.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityImplicit.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityImplicit.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/feassemble/ElasticityImplicitCUDA.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityImplicitCUDA.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityImplicitCUDA.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/feassemble/ElasticityImplicitLgDeform.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityImplicitLgDeform.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/ElasticityImplicitLgDeform.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/feassemble/IntegratorElasticity.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/IntegratorElasticity.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/feassemble/IntegratorElasticity.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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
@@ -140,6 +141,14 @@
return
+ def cleanup(self):
+ """
+ Deallocate locally managed data structures.
+ """
+ self.deallocate()
+ return
+
+
def getDataMesh(self):
"""
Get mesh associated with data fields.
@@ -152,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/branches/v1.7-trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/materials/Material.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/materials/Material.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/meshio/OutputManager.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/meshio/OutputManager.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/meshio/OutputManager.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -108,8 +108,9 @@
"""
Setup output manager.
"""
+ import weakref
self._setupLogging()
- self.dataProvider = dataProvider
+ self.dataProvider = weakref.ref(dataProvider)
return
@@ -117,19 +118,19 @@
"""
Verify compatibility of configuration.
"""
- if None == self.dataProvider:
+ if None == self.dataProvider():
raise ValueError("Need to set 'dataProvider' in OutputManager.")
- self._verifyFields(self.dataProvider.availableFields)
+ self._verifyFields(self.dataProvider().availableFields)
- if not "getDataMesh" in dir(self.dataProvider):
+ if not "getDataMesh" in dir(self.dataProvider()):
raise TypeError("Data provider must have a 'getDataMesh' function.")
if len(self.vertexInfoFields) > 0 or len(self.vertexDataFields) > 0:
- if not "getVertexField" in dir(self.dataProvider):
+ if not "getVertexField" in dir(self.dataProvider()):
raise TypeError("Data provider must have a 'getVertexField' function.")
if len(self.cellInfoFields) > 0 or len(self.cellDataFields) > 0:
- if not "getCellField" in dir(self.dataProvider):
+ if not "getCellField" in dir(self.dataProvider()):
raise TypeError("Data provider must have a 'getCellField' function.")
return
@@ -182,7 +183,7 @@
len(self.cellDataFields) > 0:
nsteps = self._estimateNumSteps(totalTime, numTimeSteps)
- (mesh, label, labelId) = self.dataProvider.getDataMesh()
+ (mesh, label, labelId) = self.dataProvider().getDataMesh()
self._open(mesh, nsteps, label, labelId)
self._eventLogger.eventEnd(logEvent)
@@ -216,15 +217,15 @@
if len(self.vertexInfoFields) > 0 or len(self.cellInfoFields) > 0:
t = 0.0
self.open(totalTime=0.0, numTimeSteps=0)
- (mesh, label, labelId) = self.dataProvider.getDataMesh()
+ (mesh, label, labelId) = self.dataProvider().getDataMesh()
self._openTimeStep(t, mesh, label, labelId)
for name in self.vertexInfoFields:
- field = self.dataProvider.getVertexField(name)
+ field = self.dataProvider().getVertexField(name)
self._appendVertexField(t, field, mesh)
for name in self.cellInfoFields:
- field = self.dataProvider.getCellField(name)
+ field = self.dataProvider().getCellField(name)
self._appendCellField(t, field, label, labelId)
self._closeTimeStep()
@@ -245,15 +246,15 @@
( len(self.vertexDataFields) > 0 or \
len(self.cellDataFields) ) > 0:
- (mesh, label, labelId) = self.dataProvider.getDataMesh()
+ (mesh, label, labelId) = self.dataProvider().getDataMesh()
self._openTimeStep(t, mesh, label, labelId)
for name in self.vertexDataFields:
- field = self.dataProvider.getVertexField(name, fields)
+ field = self.dataProvider().getVertexField(name, fields)
self._appendVertexField(t, field, mesh)
for name in self.cellDataFields:
- field = self.dataProvider.getCellField(name, fields)
+ field = self.dataProvider().getCellField(name, fields)
self._appendCellField(t, field, label, labelId)
self._closeTimeStep()
@@ -349,12 +350,12 @@
if not fieldCategory in available.keys():
raise ValueError, \
"Key '%s' not found in available fields dictionary for " \
- "object '%s'." % (fieldCategory, self.dataProvider.name)
+ "object '%s'." % (fieldCategory, self.dataProvider().name)
for dataCategory in ["info", "data"]:
if not dataCategory in available[fieldCategory].keys():
raise ValueError, \
"Key '%s' not found in available fields dictionary for " \
- "object '%s'." % (fieldCategory, self.dataProvider.name)
+ "object '%s'." % (fieldCategory, self.dataProvider().name)
notavailable = []
for name in requested[fieldCategory][dataCategory]:
@@ -365,7 +366,7 @@
"Requested fields not available for output.\n" \
"Data provider: '%s'\n" \
"Field type: '%s'\n" \
- "Data type: '%s'\n" % (self.dataProvider.name,
+ "Data type: '%s'\n" % (self.dataProvider().name,
fieldCategory, dataCategory)
msg += "Available fields: "
for name in available[fieldCategory][dataCategory]:
@@ -404,14 +405,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/branches/v1.7-trunk/pylith/meshio/OutputSoln.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/meshio/OutputSoln.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/meshio/OutputSoln.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/problems/Explicit.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/problems/Explicit.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -152,7 +152,7 @@
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")
@@ -290,7 +290,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/branches/v1.7-trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/problems/Formulation.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/problems/Formulation.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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,7 +241,7 @@
logEvent = "%stimestep" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
- dt = self.timeStep.timeStep(self.mesh,
+ dt = self.timeStep.timeStep(self.mesh(),
self.integratorsMesh + self.integratorsSubMesh)
self._eventLogger.eventEnd(logEvent)
@@ -371,7 +372,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,7 +395,7 @@
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())
@@ -419,7 +420,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 +458,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 +493,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 +515,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())
@@ -588,7 +589,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())
@@ -685,6 +686,12 @@
self.jacobian.cleanup()
if not self.fields is None:
self.fields.cleanup()
+ if not self.integratorsMesh is None:
+ for integrator in self.integratorsMesh:
+ integrator.cleanup()
+ if not self.integratorsSubMesh is None:
+ for integrator in self.integratorsSubMesh:
+ integrator.cleanup()
return
Modified: short/3D/PyLith/branches/v1.7-trunk/pylith/problems/GreensFns.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/problems/GreensFns.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/problems/GreensFns.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/problems/Problem.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/problems/Problem.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/problems/Problem.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/problems/TimeDependent.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/problems/TimeDependent.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/problems/TimeDependent.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -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/branches/v1.7-trunk/pylith/topology/Distributor.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/topology/Distributor.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/topology/Distributor.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -86,7 +86,7 @@
sieveLogger = MemoryLogger.singleton()
sieveLogger.stagePush(mesh.memLoggingStage)
- mesh.deallocate()
+ mesh.cleanup()
sieveLogger.stagePop()
if self.writePartition:
Modified: short/3D/PyLith/branches/v1.7-trunk/pylith/topology/Mesh.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/topology/Mesh.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/topology/Mesh.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -85,9 +85,7 @@
return groups
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _cleanup(self):
+ def cleanup(self):
"""
Deallocate locally managed data structures.
"""
Modified: short/3D/PyLith/branches/v1.7-trunk/pylith/topology/MeshImporter.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/topology/MeshImporter.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/topology/MeshImporter.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -89,8 +89,8 @@
Hook for creating mesh.
"""
from pylith.utils.profiling import resourceUsageString
- from pylith.mpi.Communicator import mpi_comm_world
- comm = mpi_comm_world()
+ from pylith.mpi.Communicator import petsc_comm_world
+ comm = petsc_comm_world()
self._setupLogging()
logEvent = "%screate" % self._loggingPrefix
@@ -120,7 +120,7 @@
self._adjustTopology(mesh, faults)
# Distribute mesh
- if mesh.getComm().size > 1:
+ if comm.size > 1:
if 0 == comm.rank:
self._info.log("Distributing mesh.")
mesh = self.distributor.distribute(mesh, normalizer)
@@ -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/branches/v1.7-trunk/pylith/topology/RefineUniform.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/topology/RefineUniform.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/topology/RefineUniform.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -72,7 +72,7 @@
sieveLogger = MemoryLogger.singleton()
sieveLogger.stagePush(mesh.memLoggingStage)
- mesh.deallocate()
+ mesh.cleanup()
sieveLogger.stagePop()
self._eventLogger.eventEnd(logEvent)
Modified: short/3D/PyLith/branches/v1.7-trunk/pylith/utils/PetscComponent.py
===================================================================
--- short/3D/PyLith/branches/v1.7-trunk/pylith/utils/PetscComponent.py 2013-06-18 21:21:03 UTC (rev 22359)
+++ short/3D/PyLith/branches/v1.7-trunk/pylith/utils/PetscComponent.py 2013-06-18 21:27:00 UTC (rev 22360)
@@ -84,6 +84,8 @@
"""
Deallocate locally managed data structures.
"""
+ if "deallocate" in dir(self):
+ self.deallocate()
return
More information about the CIG-COMMITS
mailing list