[cig-commits] r14822 - in short/3D/PyLith/branches/pylith-swig: pylith/faults unittests/pytests/faults

brad at geodynamics.org brad at geodynamics.org
Wed Apr 29 17:46:29 PDT 2009


Author: brad
Date: 2009-04-29 17:46:29 -0700 (Wed, 29 Apr 2009)
New Revision: 14822

Modified:
   short/3D/PyLith/branches/pylith-swig/pylith/faults/Fault.py
   short/3D/PyLith/branches/pylith-swig/pylith/faults/FaultCohesive.py
   short/3D/PyLith/branches/pylith-swig/pylith/faults/FaultCohesiveKin.py
   short/3D/PyLith/branches/pylith-swig/unittests/pytests/faults/TestFaultCohesiveKin.py
Log:
Worked on updating fault Python unit tests.

Modified: short/3D/PyLith/branches/pylith-swig/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/faults/Fault.py	2009-04-30 00:11:39 UTC (rev 14821)
+++ short/3D/PyLith/branches/pylith-swig/pylith/faults/Fault.py	2009-04-30 00:46:29 UTC (rev 14822)
@@ -161,10 +161,10 @@
     ModuleFault.initialize(self, 
                            self.mesh, self.upDir, self.normalDir, self.matDB)
 
-    if None != self.output:
-      self.output.initialize(normalizer, self.faultQuadrature)
-      self.output.writeInfo()
-      self.output.open(totalTime, numTimeSteps)
+    #if None != self.output:
+    #  self.output.initialize(normalizer, self.faultQuadrature)
+    #  self.output.writeInfo()
+    #  self.output.open(totalTime, numTimeSteps)
 
     self._logger.eventEnd(logEvent)
     return
@@ -178,7 +178,7 @@
     self._logger.eventBegin(logEvent)
 
     self._info.log("Writing fault data.")
-    self.output.writeData(t+dt, fields)
+    #self.output.writeData(t+dt, fields)
 
     self._logger.eventEnd(logEvent)
     return

Modified: short/3D/PyLith/branches/pylith-swig/pylith/faults/FaultCohesive.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/faults/FaultCohesive.py	2009-04-30 00:11:39 UTC (rev 14821)
+++ short/3D/PyLith/branches/pylith-swig/pylith/faults/FaultCohesive.py	2009-04-30 00:46:29 UTC (rev 14822)
@@ -46,8 +46,8 @@
 
   import pyre.inventory
 
-  useFaultMesh = pyre.inventory.bool("use_fault_mesh", default=False)
-  useFaultMesh.meta['tip'] = "If true, use fault mesh to define fault; " \
+  useMesh = pyre.inventory.bool("use_fault_mesh", default=False)
+  useMesh.meta['tip'] = "If true, use fault mesh to define fault; " \
       "otherwise, use group of vertices to define fault."
 
   # Future, improved implementation
@@ -58,9 +58,9 @@
   #faultMeshImporter.meta['tip'] = "Importer for fault mesh."
 
   # Current kludge
-  faultMeshFilename = pyre.inventory.str("fault_mesh_filename",
-                                         default="fault.inp")
-  faultMeshFilename.meta['tip'] = "Filename for fault mesh UCD file."
+  meshFilename = pyre.inventory.str("fault_mesh_filename",
+                                    default="fault.inp")
+  meshFilename.meta['tip'] = "Filename for fault mesh UCD file."
 
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
@@ -80,12 +80,12 @@
     Setup members using inventory.
     """
     Fault._configure(self)
-    ModuleFaultCohesive.useFaultMesh(self, self.inventory.useFaultMesh)
+    ModuleFaultCohesive.useFaultMesh(self, self.inventory.useMesh)
     #ModuleFaultCohesive.faultMeshImporter(self, 
     #                                      self.inventory.faultMeshImporter)
     # TEMPORARY
     ModuleFaultCohesive.faultMeshFilename(self, 
-                                          self.inventory.faultMeshFilename)
+                                          self.inventory.meshFilename)
     return
 
   

Modified: short/3D/PyLith/branches/pylith-swig/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/faults/FaultCohesiveKin.py	2009-04-30 00:11:39 UTC (rev 14821)
+++ short/3D/PyLith/branches/pylith-swig/pylith/faults/FaultCohesiveKin.py	2009-04-30 00:46:29 UTC (rev 14822)
@@ -174,9 +174,9 @@
     Get vertex field.
     """
     if None == fields:
-      field = ModuleFaultCohesiveKin.vertexField(name)
+      field = ModuleFaultCohesiveKin.vertexField(self, name)
     else:
-      field = ModuleFaultCohesiveKin.vertexField(name, fields)
+      field = ModuleFaultCohesiveKin.vertexField(self, name, fields)
     return field
 
 
@@ -185,9 +185,9 @@
     Get cell field.
     """
     if None == fields:
-      field = ModuleFaultCohesiveKin.cellField(name)
+      field = ModuleFaultCohesiveKin.cellField(self, name)
     else:
-      field = ModuleFaultCohesiveKin.cellField(name, fields)
+      field = ModuleFaultCohesiveKin.cellField(self, name, fields)
     return field
 
 

Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/faults/TestFaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/faults/TestFaultCohesiveKin.py	2009-04-30 00:11:39 UTC (rev 14821)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/faults/TestFaultCohesiveKin.py	2009-04-30 00:46:29 UTC (rev 14822)
@@ -58,12 +58,12 @@
     """
     Test useFaultMesh().
     """
-    fault = FaultCohesive()
+    fault = FaultCohesiveKin()
     fault._configure()
-    self.assertEqual(False, fault.useFaultMesh)
 
-    fault.useFaultMesh = True;
-    self.assertEqual(True, fault.useFaultMesh)
+    fault.useFaultMesh(True);
+
+    # No test of result
     return
 
 
@@ -71,13 +71,13 @@
     """
     Test faultMeshFilename().
     """
-    fault = FaultCohesive()
+    fault = FaultCohesiveKin()
     fault._configure()
-    self.assertEqual("fault.inp", fault.faultMeshFilename)
 
     filename = "SanAndreas.inp"
-    fault.faultMeshFilename = filename
-    self.assertEqual(filename, fault.faultMeshFilename)
+    fault.faultMeshFilename(filename)
+
+    # No test of result
     return
 
 
@@ -89,17 +89,18 @@
     neither set the input fields or verify the results.
     """
     cs = CSCart()
-    cs.spaceDim = 2
+    cs.inventory.spaceDim = 2
+    cs._configure()
     
     from spatialdata.units.Nondimensional import Nondimensional
     normalizer = Nondimensional()
-    normalizer.initialize()
+    normalizer._configure()
 
     from pylith.meshio.MeshIOAscii import MeshIOAscii
     importer = MeshIOAscii()
     importer.inventory.filename = "data/tri3.mesh"
     importer.inventory.coordsys = cs
-    improter._configure()
+    importer._configure()
     mesh = importer.read(normalizer, debug=False, interpolate=False)
 
     fault = FaultCohesiveKin()
@@ -135,7 +136,8 @@
     dt = 2.4
     (mesh, fault, fields) = self._initialize()
     fault.timeStep(dt)
-    self.assertEqual(dt, fault.timeStep())
+
+    # No test of result
     return
 
   
@@ -261,7 +263,9 @@
 
     # Setup mesh
     cs = CSCart()
-    cs.spaceDim = 2
+    cs.inventory.spaceDim = 2
+    cs._configure()
+
     from pylith.meshio.MeshIOAscii import MeshIOAscii
     importer = MeshIOAscii()
     importer.inventory.filename = "data/tri3.mesh"
@@ -285,16 +289,20 @@
     from spatialdata.spatialdb.SimpleDB import SimpleDB
     from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
     ioFinalSlip = SimpleIOAscii()
-    ioFinalSlip.filename = "data/tri3_finalslip.spatialdb"
+    ioFinalSlip.inventory.filename = "data/tri3_finalslip.spatialdb"
+    ioFinalSlip._configure()
     dbFinalSlip = SimpleDB()
-    dbFinalSlip.iohandler = ioFinalSlip
-    dbFinalSlip.label = "final slip"
+    dbFinalSlip.inventory.iohandler = ioFinalSlip
+    dbFinalSlip.inventory.label = "final slip"
+    dbFinalSlip._configure()
     
     ioSlipTime = SimpleIOAscii()
-    ioSlipTime.filename = "data/tri3_sliptime.spatialdb"
+    ioSlipTime.inventory.filename = "data/tri3_sliptime.spatialdb"
+    ioSlipTime._configure()
     dbSlipTime = SimpleDB()
-    dbSlipTime.iohandler = ioSlipTime
-    dbSlipTime.label = "slip time"
+    dbSlipTime.inventory.iohandler = ioSlipTime
+    dbSlipTime.inventory.label = "slip time"
+    dbSlipTime._configure()
     
     from pylith.faults.StepSlipFn import StepSlipFn
     slipfn = StepSlipFn()
@@ -336,12 +344,12 @@
     # Setup fields
     from pylith.topology.SolutionFields import SolutionFields
     fields = SolutionFields(mesh)
-    fields.add("residual")
-    fields.add("solution")
-    fields.add("disp")
+    fields.add("residual", "residual")
+    fields.add("solution", "displacement")
+    fields.add("disp", "displacement")
     fields.solutionName("solution")
     residual = fields.get("residual")
-    residual.newSection(residual.VERTICES_FIELD, cs.spaceDim)
+    residual.newSection(residual.VERTICES_FIELD, cs.spaceDim())
     residual.allocate()
     residual.zero()
     fields.copyLayout("residual")



More information about the CIG-COMMITS mailing list