[cig-commits] r11175 - in short/3D/PyLith/trunk: libsrc/faults libsrc/meshio unittests/pytests/faults unittests/pytests/feassemble

brad at geodynamics.org brad at geodynamics.org
Sat Feb 16 11:45:46 PST 2008


Author: brad
Date: 2008-02-16 11:45:45 -0800 (Sat, 16 Feb 2008)
New Revision: 11175

Modified:
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
   short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc
   short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py
   short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityExplicit.py
   short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityImplicit.py
Log:
Fixed some Python unit tests (need to call integrateResidual() before poststep when doing output). Added some more error checking.

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2008-02-16 01:04:21 UTC (rev 11174)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2008-02-16 19:45:45 UTC (rev 11175)
@@ -420,6 +420,7 @@
 
   if (0 == strcasecmp("slip", name)) {
     *fieldType = VECTOR_FIELD;
+    assert(!_slip.isNull());
     return _slip;
 
   } else if (cohesiveDim > 0 && 0 == strcasecmp("strike_dir", name)) {

Modified: short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc	2008-02-16 01:04:21 UTC (rev 11174)
+++ short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.cc	2008-02-16 19:45:45 UTC (rev 11175)
@@ -144,15 +144,19 @@
 				       const ALE::Obj<ALE::Mesh>& mesh)
 { // writeVertexField
   assert(0 != name);
+  assert(!mesh.isNull());
+  assert(!field.isNull());
 
   try {
     const std::string labelName = 
       (mesh->hasLabel("censored depth")) ? "censored depth" : "depth";
     const ALE::Obj<Mesh::numbering_type>& numbering =
       mesh->getFactory()->getNumbering(mesh, labelName, 0);
+    assert(!numbering.isNull());
 
     const int fiberDim = 
       field->getFiberDimension(*mesh->getLabelStratum(labelName, 0)->begin());
+    assert(fiberDim > 0);
     const int enforceDim = (fieldType != VECTOR_FIELD) ? fiberDim : 3;
 
     if (!_wroteVertexHeader) {
@@ -190,6 +194,8 @@
 				       const ALE::Obj<ALE::Mesh>& mesh)
 { // writeCellField
   assert(0 != name);
+  assert(!mesh.isNull());
+  assert(!field.isNull());
 
   try {
     // Correctly handle boundary and fault meshes
@@ -199,6 +205,7 @@
       (mesh->hasLabel("censored depth")) ? "censored depth" : "depth";
     const ALE::Obj<Mesh::numbering_type>& numbering = 
       mesh->getFactory()->getNumbering(mesh, labelName, depth);
+    assert(!numbering.isNull());
     const int fiberDim = 
       field->getFiberDimension(*mesh->getLabelStratum(labelName, depth)->begin());
     const int enforceDim = (fieldType != VECTOR_FIELD) ? fiberDim : 3;

Modified: short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py	2008-02-16 01:04:21 UTC (rev 11174)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py	2008-02-16 19:45:45 UTC (rev 11175)
@@ -185,9 +185,12 @@
     (mesh, fault, fields) = self._initialize()
 
     t = 0.50*second
+    residual = fields.getReal("residual")
+    fault.integrateResidual(residual, t, fields)
+
     dt = 0.1*second
     totalTime = 5*second
-    #fault.poststep(t, dt, totalTime, fields)
+    fault.poststep(t, dt, totalTime, fields)
 
     # We should really add something here to check to make sure things
     # actually initialized correctly    

Modified: short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityExplicit.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityExplicit.py	2008-02-16 01:04:21 UTC (rev 11174)
+++ short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityExplicit.py	2008-02-16 19:45:45 UTC (rev 11175)
@@ -182,9 +182,13 @@
     (mesh, integrator, fields) = self._initialize()
 
     t = 3.45*second
+
+    residual = fields.getReal("residual")
+    integrator.integrateResidual(residual, t, fields)
+
     dt = 0.02*second
     totalTime = 5.0*second
-    #integrator.poststep(t, dt, totalTime, fields)
+    integrator.poststep(t, dt, totalTime, fields)
 
     # We should really add something here to check to make sure things
     # actually initialized correctly    

Modified: short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityImplicit.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityImplicit.py	2008-02-16 01:04:21 UTC (rev 11174)
+++ short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityImplicit.py	2008-02-16 19:45:45 UTC (rev 11175)
@@ -177,9 +177,13 @@
     (mesh, integrator, fields) = self._initialize()
 
     t = 0.27*year
+
+    residual = fields.getReal("residual")
+    integrator.integrateResidual(residual, t, fields)
+
     dt = 0.01*year
     totalTime = 10*year
-    #integrator.poststep(t, dt, totalTime, fields)
+    integrator.poststep(t, dt, totalTime, fields)
 
     # We should really add something here to check to make sure things
     # actually initialized correctly    



More information about the cig-commits mailing list