[cig-commits] r17960 - short/3D/PyLith/trunk/pylith/topology

brad at geodynamics.org brad at geodynamics.org
Wed Feb 23 13:27:12 PST 2011


Author: brad
Date: 2011-02-23 13:27:12 -0800 (Wed, 23 Feb 2011)
New Revision: 17960

Modified:
   short/3D/PyLith/trunk/pylith/topology/Distributor.py
   short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
   short/3D/PyLith/trunk/pylith/topology/RefineUniform.py
Log:
Deallocate meshes when no longer used.

Modified: short/3D/PyLith/trunk/pylith/topology/Distributor.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Distributor.py	2011-02-23 21:22:42 UTC (rev 17959)
+++ short/3D/PyLith/trunk/pylith/topology/Distributor.py	2011-02-23 21:27:12 UTC (rev 17960)
@@ -81,6 +81,7 @@
     from pylith.topology.Mesh import Mesh
     newMesh = Mesh(mesh.dimension())
     ModuleDistributor.distribute(newMesh, mesh, self.partitioner)
+    mesh.deallocate()
 
     if self.writePartition:
       self.dataWriter.initialize(normalizer)

Modified: short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshImporter.py	2011-02-23 21:22:42 UTC (rev 17959)
+++ short/3D/PyLith/trunk/pylith/topology/MeshImporter.py	2011-02-23 21:27:12 UTC (rev 17960)
@@ -123,13 +123,15 @@
         mesh.view("Distributed mesh.")
 
     # Refine mesh (if necessary)
-    mesh = self.refiner.refine(mesh)
+    newMesh = self.refiner.refine(mesh)
+    if not newMesh == mesh:
+      mesh.deallocate()
 
     # Nondimensionalize mesh (coordinates of vertices).
-    mesh.nondimensionalize(normalizer)
+    newMesh.nondimensionalize(normalizer)
 
     self._eventLogger.eventEnd(logEvent)    
-    return mesh
+    return newMesh
 
 
   # PRIVATE METHODS ////////////////////////////////////////////////////

Modified: short/3D/PyLith/trunk/pylith/topology/RefineUniform.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/RefineUniform.py	2011-02-23 21:22:42 UTC (rev 17959)
+++ short/3D/PyLith/trunk/pylith/topology/RefineUniform.py	2011-02-23 21:27:12 UTC (rev 17960)
@@ -67,10 +67,9 @@
     newMesh.debug(mesh.debug())
     newMesh.coordsys(mesh.coordsys())
     ModuleRefineUniform.refine(self, newMesh, mesh, self.levels)
+    if not newMesh == mesh:
+      mesh.deallocate()
 
-    if mesh != newMesh:
-      mesh.deallocate();
-
     self._eventLogger.eventEnd(logEvent)
     return newMesh
 



More information about the CIG-COMMITS mailing list