[cig-commits] r14318 - in short/3D/PyLith/branches/pylith-swig: . libsrc libsrc/problems pylith/materials unittests/pytests/materials
brad at geodynamics.org
brad at geodynamics.org
Fri Mar 13 21:26:25 PDT 2009
Author: brad
Date: 2009-03-13 21:26:25 -0700 (Fri, 13 Mar 2009)
New Revision: 14318
Modified:
short/3D/PyLith/branches/pylith-swig/TODO
short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
short/3D/PyLith/branches/pylith-swig/libsrc/problems/Makefile.am
short/3D/PyLith/branches/pylith-swig/pylith/materials/Material.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticIsotropic3D.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticPlaneStrain.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticPlaneStress.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticStress1D.py
short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestMaterial.py
Log:
Updated python tests for elastic materials.
Modified: short/3D/PyLith/branches/pylith-swig/TODO
===================================================================
--- short/3D/PyLith/branches/pylith-swig/TODO 2009-03-14 00:33:59 UTC (rev 14317)
+++ short/3D/PyLith/branches/pylith-swig/TODO 2009-03-14 04:26:25 UTC (rev 14318)
@@ -11,9 +11,6 @@
Cleanup error checking on PETSc calls. Use PetscError as in
Jacobian.
- pytests/materials/TestElasticXXXXXX
- continue adding methods (see ElasticStrain1D)
-
TestMesh.test_view()
TestMesh.test_checkMaterialIds()
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am 2009-03-14 00:33:59 UTC (rev 14317)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am 2009-03-14 04:26:25 UTC (rev 14318)
@@ -14,7 +14,7 @@
utils \
topology \
meshio \
- materials
+ materials \
bc \
feassemble \
faults \
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/problems/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/problems/Makefile.am 2009-03-14 00:33:59 UTC (rev 14317)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/problems/Makefile.am 2009-03-14 04:26:25 UTC (rev 14318)
@@ -15,7 +15,6 @@
subpkginclude_HEADERS = \
Formulation.hh \
- Formulation.icc \
problemsfwd.hh
noinst_HEADERS =
Modified: short/3D/PyLith/branches/pylith-swig/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/materials/Material.py 2009-03-14 00:33:59 UTC (rev 14317)
+++ short/3D/PyLith/branches/pylith-swig/pylith/materials/Material.py 2009-03-14 04:26:25 UTC (rev 14318)
@@ -103,8 +103,7 @@
"""
self._setupLogging()
self.mesh = mesh
- self.quadrature(self.matQuadrature)
- self.matQuadrature.preinitialize(self.mesh.coordsys().dimension())
+ self.quadrature.preinitialize(self.mesh.coordsys().spaceDim())
return
@@ -115,8 +114,8 @@
logEvent = "%sverify" % self._loggingPrefix
self._logger.eventBegin(logEvent)
- if self.matQuadrature.cellDim != self.mesh.dimension() or \
- self.matQuadrature.spaceDim != self.mesh.coordsys.spaceDim():
+ if self.quadrature.cellDim != self.mesh.dimension() or \
+ self.quadrature.spaceDim != self.mesh.coordsys.spaceDim():
raise ValueError, \
"Quadrature scheme for material '%s' and mesh are incompatible.\n" \
"Quadrature cell dimension: %d\n" \
@@ -124,7 +123,7 @@
"Mesh cell dimension: %d\n" \
"Mesh spatial dimension: %d" % \
(self.matLabel,
- self.matQuadrature.cellDim, self.matQuadrature.spaceDim,
+ self.quadrature.cellDim, self.quadrature.spaceDim,
self.mesh.dimension(), self.mesh.coordsys().spaceDim())
self._logger.eventEnd(logEvent)
@@ -152,7 +151,7 @@
self.dbInitialState(self.inventory.dbInitialState)
self.matLabel = self.inventory.label
- self.matQuadrature = self.inventory.quadrature
+ self.quadrature = self.inventory.quadrature
return
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticIsotropic3D.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticIsotropic3D.py 2009-03-14 00:33:59 UTC (rev 14317)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticIsotropic3D.py 2009-03-14 04:26:25 UTC (rev 14318)
@@ -24,13 +24,19 @@
Unit testing of ElasticIsotropic3D object.
"""
+ def setUp(self):
+ """
+ Setup test subject.
+ """
+ self.material = ElasticIsotropic3D()
+ return
+
+
def test_constructor(self):
"""
Test constructor.
"""
- material = ElasticIsotropic3D()
-
- self.assertEqual(3, material.dimension())
+ self.assertEqual(3, self.material.dimension())
return
@@ -38,9 +44,38 @@
"""
Test useElasticBehavior().
"""
- material = ElasticIsotropic3D()
- material.useElasticBehavior(False)
+ self.material.useElasticBehavior(False)
return
+ def testHasStateVars(self):
+ self.failIf(self.material.hasStateVars())
+ return
+
+
+ def testStableTimeStepImplicit(self):
+ maxfloat = 1.0e+30
+ self.assertEqual(maxfloat, self.material.stableTimeStepImplicit())
+ return
+
+
+ def testTensorSize(self):
+ self.assertEqual(6, self.material.tensorSize())
+ return
+
+
+ def testNeedNewJacobian(self):
+ """
+ Test needNewJacobian().
+ """
+ # Default should be False.
+ self.failIf(self.material.needNewJacobian())
+
+ # Changing time step should not require new Jacobian.
+ self.material.timeStep(1.0)
+ self.material.timeStep(2.0)
+ self.failIf(self.material.needNewJacobian())
+ return
+
+
# End of file
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticPlaneStrain.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticPlaneStrain.py 2009-03-14 00:33:59 UTC (rev 14317)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticPlaneStrain.py 2009-03-14 04:26:25 UTC (rev 14318)
@@ -24,13 +24,19 @@
Unit testing of ElasticPlaneStrain object.
"""
+ def setUp(self):
+ """
+ Setup test subject.
+ """
+ self.material = ElasticPlaneStrain()
+ return
+
+
def test_constructor(self):
"""
Test constructor.
"""
- material = ElasticPlaneStrain()
-
- self.assertEqual(2, material.dimension())
+ self.assertEqual(2, self.material.dimension())
return
@@ -38,9 +44,38 @@
"""
Test useElasticBehavior().
"""
- material = ElasticPlaneStrain()
- material.useElasticBehavior(False)
+ self.material.useElasticBehavior(False)
return
+ def testHasStateVars(self):
+ self.failIf(self.material.hasStateVars())
+ return
+
+
+ def testStableTimeStepImplicit(self):
+ maxfloat = 1.0e+30
+ self.assertEqual(maxfloat, self.material.stableTimeStepImplicit())
+ return
+
+
+ def testTensorSize(self):
+ self.assertEqual(3, self.material.tensorSize())
+ return
+
+
+ def testNeedNewJacobian(self):
+ """
+ Test needNewJacobian().
+ """
+ # Default should be False.
+ self.failIf(self.material.needNewJacobian())
+
+ # Changing time step should not require new Jacobian.
+ self.material.timeStep(1.0)
+ self.material.timeStep(2.0)
+ self.failIf(self.material.needNewJacobian())
+ return
+
+
# End of file
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticPlaneStress.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticPlaneStress.py 2009-03-14 00:33:59 UTC (rev 14317)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticPlaneStress.py 2009-03-14 04:26:25 UTC (rev 14318)
@@ -24,13 +24,19 @@
Unit testing of ElasticPlaneStress object.
"""
+ def setUp(self):
+ """
+ Setup test subject.
+ """
+ self.material = ElasticPlaneStress()
+ return
+
+
def test_constructor(self):
"""
Test constructor.
"""
- material = ElasticPlaneStress()
-
- self.assertEqual(2, material.dimension())
+ self.assertEqual(2, self.material.dimension())
return
@@ -38,9 +44,38 @@
"""
Test useElasticBehavior().
"""
- material = ElasticPlaneStress()
- material.useElasticBehavior(False)
+ self.material.useElasticBehavior(False)
return
+ def testHasStateVars(self):
+ self.failIf(self.material.hasStateVars())
+ return
+
+
+ def testStableTimeStepImplicit(self):
+ maxfloat = 1.0e+30
+ self.assertEqual(maxfloat, self.material.stableTimeStepImplicit())
+ return
+
+
+ def testTensorSize(self):
+ self.assertEqual(3, self.material.tensorSize())
+ return
+
+
+ def testNeedNewJacobian(self):
+ """
+ Test needNewJacobian().
+ """
+ # Default should be False.
+ self.failIf(self.material.needNewJacobian())
+
+ # Changing time step should not require new Jacobian.
+ self.material.timeStep(1.0)
+ self.material.timeStep(2.0)
+ self.failIf(self.material.needNewJacobian())
+ return
+
+
# End of file
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticStress1D.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticStress1D.py 2009-03-14 00:33:59 UTC (rev 14317)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestElasticStress1D.py 2009-03-14 04:26:25 UTC (rev 14318)
@@ -24,13 +24,19 @@
Unit testing of ElasticStress1D object.
"""
+ def setUp(self):
+ """
+ Setup test subject.
+ """
+ self.material = ElasticStress1D()
+ return
+
+
def test_constructor(self):
"""
Test constructor.
"""
- material = ElasticStress1D()
-
- self.assertEqual(1, material.dimension())
+ self.assertEqual(1, self.material.dimension())
return
@@ -38,9 +44,38 @@
"""
Test useElasticBehavior().
"""
- material = ElasticStress1D()
- material.useElasticBehavior(False)
+ self.material.useElasticBehavior(False)
return
+ def testHasStateVars(self):
+ self.failIf(self.material.hasStateVars())
+ return
+
+
+ def testStableTimeStepImplicit(self):
+ maxfloat = 1.0e+30
+ self.assertEqual(maxfloat, self.material.stableTimeStepImplicit())
+ return
+
+
+ def testTensorSize(self):
+ self.assertEqual(1, self.material.tensorSize())
+ return
+
+
+ def testNeedNewJacobian(self):
+ """
+ Test needNewJacobian().
+ """
+ # Default should be False.
+ self.failIf(self.material.needNewJacobian())
+
+ # Changing time step should not require new Jacobian.
+ self.material.timeStep(1.0)
+ self.material.timeStep(2.0)
+ self.failIf(self.material.needNewJacobian())
+ return
+
+
# End of file
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestMaterial.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestMaterial.py 2009-03-14 00:33:59 UTC (rev 14317)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/materials/TestMaterial.py 2009-03-14 04:26:25 UTC (rev 14318)
@@ -171,10 +171,9 @@
importer._configure()
mesh = importer.read(normalizer, debug=False, interpolate=False)
- material.preinitialize()
+ material.preinitialize(mesh)
- # We should really add something here to check to make sure things
- # actually initialized correctly
+ # No test of result.
return
More information about the CIG-COMMITS
mailing list