[cig-commits] r7010 - in short/3D/PyLith/trunk: modulesrc/feassemble pylith/feassemble unittests/pytests/feassemble

brad at geodynamics.org brad at geodynamics.org
Wed May 30 21:06:50 PDT 2007


Author: brad
Date: 2007-05-30 21:06:50 -0700 (Wed, 30 May 2007)
New Revision: 7010

Modified:
   short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
   short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
   short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityExplicit.py
Log:
Fixed bugs in getting stable time step from integrator through bindings. Started layout for rest of Python unit tests for explicit elasticity integrator.

Modified: short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src	2007-05-31 00:45:17 UTC (rev 7009)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src	2007-05-31 04:06:50 UTC (rev 7010)
@@ -595,6 +595,30 @@
       Integrator_timeStep_set(self.thisptr, dt)
 
 
+  property stableTimeStep:
+    def __get__(self):
+      """
+      Get stable time step.
+      """
+      # create shim for method 'stableTimeStep'
+      #embed{ double Integrator_stableTimeStep_get(void* objVptr)
+      double result = 0.0;
+      try {
+        assert(0 != objVptr);
+        result =
+          ((pylith::feassemble::Integrator*) objVptr)->stableTimeStep();
+      } catch (const std::exception& err) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        const_cast<char*>(err.what()));
+      } catch (...) {
+        PyErr_SetString(PyExc_RuntimeError,
+                        "Caught unknown C++ exception.");
+      } // try/catch
+      return result;
+      #}embed
+      return Integrator_stableTimeStep_get(self.thisptr)
+
+
   property needNewJacobian:
     def __get__(self):
       """

Modified: short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Integrator.py	2007-05-31 00:45:17 UTC (rev 7009)
+++ short/3D/PyLith/trunk/pylith/feassemble/Integrator.py	2007-05-31 04:06:50 UTC (rev 7010)
@@ -85,7 +85,8 @@
     Get stable time step for advancing from time t to time t+dt.
     """
     assert(None != self.cppHandle)
-    return self.cppHandle.getStableTimeStep()
+    from pyre.units.time import second
+    return self.cppHandle.stableTimeStep*second
 
 
   def integrateResidual(self, residual, fields):

Modified: short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityExplicit.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityExplicit.py	2007-05-31 00:45:17 UTC (rev 7009)
+++ short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityExplicit.py	2007-05-31 04:06:50 UTC (rev 7010)
@@ -52,4 +52,69 @@
     return
 
 
+  def test_setMesh(self):
+    """
+    Test setMesh().
+    """
+    raise NotImplementedError("Unit test not implemented.")
+    return
+
+  
+  def test_timeStep(self):
+    """
+    Test timeStep().
+    """
+    from pyre.units.time import second
+    dt = 2.4*second
+    integrator = ElasticityExplicit()
+    integrator.timeStep = dt
+    self.assertEqual(dt, integrator.timeStep)
+    return
+
+  
+  def test_stableTimeStep(self):
+    """
+    Test stableTimeStep().
+    """
+    from pyre.units.time import second
+    dt = 2.3*second
+    integrator = ElasticityExplicit()
+    integrator.timeStep(dt)
+    self.assertEqual(dt, integrator.stableTimeStep())
+    return
+
+  
+  def test_integrateResidual(self):
+    """
+    Test integrateResidual().
+    """
+    raise NotImplementedError("Unit test not implemented.")
+    return
+
+  
+  def test_needNewJacobian(self):
+    """
+    Test needNewJacobian().
+    """
+    integrator = ElasticityExplicit()
+    self.assertEqual(False, integrator.needNewJacobian())
+    return
+
+  
+  def test_integrateJacobian(self):
+    """
+    Test integrateJacobian().
+    """
+    raise NotImplementedError("Unit test not implemented.")
+    return
+
+  
+  def test_updateState(self):
+    """
+    Test updateState().
+    """
+    raise NotImplementedError("Unit test not implemented.")
+    return
+  
+
 # End of file 



More information about the cig-commits mailing list