[cig-commits] r6328 - in short/3D/PyLith/trunk: . modulesrc/materials pylith/materials unittests/pytests/materials

brad at geodynamics.org brad at geodynamics.org
Wed Mar 21 08:46:14 PDT 2007


Author: brad
Date: 2007-03-21 08:46:14 -0700 (Wed, 21 Mar 2007)
New Revision: 6328

Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/modulesrc/materials/materials.pyxe.src
   short/3D/PyLith/trunk/pylith/materials/Material.py
   short/3D/PyLith/trunk/unittests/pytests/materials/TestMaterial.py
   short/3D/PyLith/trunk/unittests/pytests/materials/testmaterials.py
Log:
Fixed material Python unit tests.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2007-03-21 05:45:30 UTC (rev 6327)
+++ short/3D/PyLith/trunk/TODO	2007-03-21 15:46:14 UTC (rev 6328)
@@ -6,10 +6,6 @@
   petsc module
   ParameterManager
 
-0. Finish implementing materials with 3-D linear, isotropic elastic material
-   a. unit tests for C++ level [DONE]
-   b. unit tests for Python level
-
 1. Finish implementing ExplicitElasticity
    a. C++
    b. Python object

Modified: short/3D/PyLith/trunk/modulesrc/materials/materials.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/materials.pyxe.src	2007-03-21 05:45:30 UTC (rev 6327)
+++ short/3D/PyLith/trunk/modulesrc/materials/materials.pyxe.src	2007-03-21 15:46:14 UTC (rev 6328)
@@ -86,7 +86,7 @@
       raise TypeError, \
             "Argument must be extension module type " \
             "'spatialdata::geocoords::CoordSys'."
-    if not quadrature.name == "pylith_feassemble_quadrature":
+    if not quadrature.name == "pylith_feassemble_Quadrature":
       raise TypeError, \
             "Argument must be extension module type " \
             "'pylith::feassemble::Quadrature'."
@@ -137,7 +137,7 @@
                         "Caught unknown C++ exception.");
       } // try/catch
       #}embed
-      if not db.name == "spatialdata_spatialdb_SpatialDB":
+      if not value.name == "spatialdata_spatialdb_SpatialDB":
         raise TypeError, \
               "Argument must be extension module type " \
               "'spatialdata::spatialdb::SpatialDB'."

Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py	2007-03-21 05:45:30 UTC (rev 6327)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py	2007-03-21 15:46:14 UTC (rev 6328)
@@ -93,8 +93,8 @@
     self.db.initialize()
     self.cppHandle.id = self.id
     self.cppHandle.label = self.label
-    self.cppHandle.db = self.db
-    self.cppHandle.initialize(mesh.cppHandle. mesh.coordsys.cppHandle,
+    self.cppHandle.db = self.db.cppHandle
+    self.cppHandle.initialize(mesh.cppHandle, mesh.coordsys.cppHandle,
                               self.quadrature.cppHandle)
     return
 

Modified: short/3D/PyLith/trunk/unittests/pytests/materials/TestMaterial.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/materials/TestMaterial.py	2007-03-21 05:45:30 UTC (rev 6327)
+++ short/3D/PyLith/trunk/unittests/pytests/materials/TestMaterial.py	2007-03-21 15:46:14 UTC (rev 6328)
@@ -29,18 +29,27 @@
     WARNING: This is not a rigorous test of initialize() because we
     don't verify the results.
     """
-    from pylith.utils.PetscManager import PetscManager
-    petsc = PetscManager()
-    petsc.initialize()
-
     from pylith.materials.ElasticIsotropic3D import ElasticIsotropic3D
     material = ElasticIsotropic3D()
 
+    from pylith.feassemble.quadrature.Quadrature1D import Quadrature1D
+    quadrature = Quadrature1D()
+    from pylith.feassemble.FIATSimplex import FIATSimplex
+    cell = FIATSimplex()
+    cell.shape = "line"
+    cell.order = 1
+    cell.degree = 1
+    quadrature.cell = cell
+    quadrature.minJacobian = 1.0e-4
+    quadrature.initialize()
+    material.quadrature = quadrature
+
     from spatialdata.spatialdb.SimpleDB import SimpleDB
     from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
     iohandler = SimpleIOAscii()
     iohandler.filename = "data/matinitialize.spatialdb"
     db = SimpleDB()
+    db.label = "material properties"
     db.iohandler = iohandler
     material.db = db
     material.label = "my material"
@@ -50,13 +59,16 @@
     importer = MeshIOAscii()
     importer.filename = "data/twoelems.mesh"
     mesh = importer.read()
+
+    from spatialdata.geocoords.CSCart import CSCart
+    cs = CSCart()
+    cs.spaceDim = 1
+    mesh.coordsys = cs
     
     material.initialize(mesh)
 
     # We should really add something here to check to make sure things
     # actually initialized correctly    
-
-    petsc.finalize()
     return
 
 

Modified: short/3D/PyLith/trunk/unittests/pytests/materials/testmaterials.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/materials/testmaterials.py	2007-03-21 05:45:30 UTC (rev 6327)
+++ short/3D/PyLith/trunk/unittests/pytests/materials/testmaterials.py	2007-03-21 15:46:14 UTC (rev 6328)
@@ -37,7 +37,13 @@
     """
     Run the application.
     """
+    from pylith.utils.PetscManager import PetscManager
+    petsc = PetscManager()
+    petsc.initialize()
+
     unittest.TextTestRunner(verbosity=2).run(self._suite())
+
+    petsc.finalize()
     return
 
 



More information about the cig-commits mailing list