[cig-commits] r9111 - in short/3D/PyLith/trunk: pylith/faults pylith/meshio pylith/problems unittests/pytests/faults unittests/pytests/topology

brad at geodynamics.org brad at geodynamics.org
Tue Jan 22 11:49:54 PST 2008


Author: brad
Date: 2008-01-22 11:49:54 -0800 (Tue, 22 Jan 2008)
New Revision: 9111

Modified:
   short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
   short/3D/PyLith/trunk/pylith/meshio/OutputManager.py
   short/3D/PyLith/trunk/pylith/problems/Formulation.py
   short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py
   short/3D/PyLith/trunk/unittests/pytests/topology/TestMeshGenSimple.py
Log:
Added OutputManager.preinitialize(). Moved setting data provider to preinitialize().

Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2008-01-22 19:38:43 UTC (rev 9110)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2008-01-22 19:49:54 UTC (rev 9111)
@@ -95,6 +95,7 @@
     assert(None != self.cppHandle)
     self.eqsrc.preinitialize()
     self.cppHandle.eqsrc = self.eqsrc.cppHandle
+    self.output.preinitialize(self)
     return
   
 
@@ -104,7 +105,6 @@
     """
     FaultCohesive.verifyConfiguration(self)
     Integrator.verifyConfiguration(self)
-    self.output.dataProvider = self
     self.output.verifyConfiguration()
     return
 

Modified: short/3D/PyLith/trunk/pylith/meshio/OutputManager.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/OutputManager.py	2008-01-22 19:38:43 UTC (rev 9110)
+++ short/3D/PyLith/trunk/pylith/meshio/OutputManager.py	2008-01-22 19:49:54 UTC (rev 9111)
@@ -108,11 +108,19 @@
     return
 
 
+  def preinitialize(self, dataProvider):
+    """
+    Do
+    """
+    self._setupLogging()
+    self.dataProvider = dataProvider
+    return
+  
+
   def verifyConfiguration(self):
     """
     Verify compatibility of configuration.
     """
-    self._setupLogging()
     if None == self.dataProvider:
       raise ValueError("Need to set 'dataProvider' in OutputManager.")
     self._verifyFields(self.dataProvider.availableFields)

Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py	2008-01-22 19:38:43 UTC (rev 9110)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py	2008-01-22 19:49:54 UTC (rev 9111)
@@ -156,6 +156,11 @@
               "Could not determine whether interface condition '%s' is an " \
               "integrator or a constraint." % ic.name
     self._debug.log(resourceUsageString())
+
+    self._info.log("Pre-initializing output.")
+    for output in self.output.bin:
+      output.preinitialize(self)
+
     self._logger.eventEnd(logEvent)
     return
 
@@ -172,7 +177,6 @@
     for constraint in self.constraints:
       constraint.verifyConfiguration()
     for output in self.output.bin:
-      output.dataProvider = self
       output.verifyConfiguration()
 
     self._logger.eventEnd(logEvent)

Modified: short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py	2008-01-22 19:38:43 UTC (rev 9110)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py	2008-01-22 19:49:54 UTC (rev 9111)
@@ -288,6 +288,7 @@
     fault.adjustTopology(mesh)
     fault.preinitialize(mesh)
     fault.timeStep(dt)
+    fault.verifyConfiguration()
     fault.initialize()
 
     # Setup fields

Modified: short/3D/PyLith/trunk/unittests/pytests/topology/TestMeshGenSimple.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/topology/TestMeshGenSimple.py	2008-01-22 19:38:43 UTC (rev 9110)
+++ short/3D/PyLith/trunk/unittests/pytests/topology/TestMeshGenSimple.py	2008-01-22 19:49:54 UTC (rev 9111)
@@ -49,24 +49,29 @@
     from spatialdata.geocoords.CSCart import CSCart
     io.coordsys = CSCart()
     mesh.coordsys = CSCart()
-    io.initialize()
-    io.open(mesh)
+    self.mesh = mesh
+    
     from pyre.units.time import s
     t = 0.0*s
-    io.openTimeStep(t)
-    io.closeTimeStep()
-    io.close()
+    io.preinitialize(self)
+    io.initialize()
+    io.writeData(t)
 
     from pylith.topology.Distributor import Distributor
     distributor = Distributor()
     distributor.partitioner = "chaco"
     newMesh = distributor.distribute(mesh)
+    self.mesh = newMesh
     io.writer.filename = 'newMesh.vtk'
-    io.open(newMesh)
-    io.openTimeStep(t)
-    io.closeTimeStep()
-    io.close()
+    io.writeData(t)
     return
 
 
+  def getDataMesh(self):
+    """
+    Get mesh.
+    """
+    return self.mesh
+  
+
 # End of file 



More information about the cig-commits mailing list