[cig-commits] r16261 - in short/3D/PyLith/trunk: libsrc/faults libsrc/feassemble libsrc/problems modulesrc/problems pylith/problems unittests/libtests/faults unittests/libtests/feassemble

brad at geodynamics.org brad at geodynamics.org
Sat Feb 13 19:31:35 PST 2010


Author: brad
Date: 2010-02-13 19:31:34 -0800 (Sat, 13 Feb 2010)
New Revision: 16261

Modified:
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDynL.cc
   short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc
   short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
   short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc
   short/3D/PyLith/trunk/libsrc/problems/Formulation.cc
   short/3D/PyLith/trunk/libsrc/problems/Formulation.hh
   short/3D/PyLith/trunk/modulesrc/problems/Formulation.i
   short/3D/PyLith/trunk/pylith/problems/Formulation.py
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.hh
Log:
Started work on setting up computation of velocity field when needed.

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDynL.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDynL.cc	2010-02-12 20:30:59 UTC (rev 16260)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveDynL.cc	2010-02-14 03:31:34 UTC (rev 16261)
@@ -13,7 +13,9 @@
 #include <portinfo>
 
 #include "FaultCohesiveDynL.hh" // implementation of object methods
+
 #include "CohesiveTopology.hh" // USES CohesiveTopology
+
 #include "pylith/feassemble/Quadrature.hh" // USES Quadrature
 #include "pylith/feassemble/CellGeometry.hh" // USES CellGeometry
 #include "pylith/topology/Mesh.hh" // USES Mesh
@@ -23,9 +25,11 @@
 #include "pylith/topology/Jacobian.hh" // USES Jacobian
 #include "pylith/topology/SolutionFields.hh" // USES SolutionFields
 #include "pylith/friction/FrictionModel.hh" // USES FrictionModel
+
 #include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
 #include "spatialdata/spatialdb/SpatialDB.hh" // USES SpatialDB
 #include "spatialdata/units/Nondimensional.hh" // USES Nondimensional
+
 #include <cmath> // USES pow(), sqrt()
 #include <strings.h> // USES strcasecmp()
 #include <cstring> // USES strlen()
@@ -33,6 +37,7 @@
 #include <cassert> // USES assert()
 #include <sstream> // USES std::ostringstream
 #include <stdexcept> // USES std::runtime_error
+
 // Precomputing geometry significantly increases storage but gives a
 // slight speed improvement.
 //#define PRECOMPUTE_GEOMETRY
@@ -45,43 +50,53 @@
 // ----------------------------------------------------------------------
 // Default constructor.
 pylith::faults::FaultCohesiveDynL::FaultCohesiveDynL(void) :
-  _dbInitialTract(0), _friction(0) { // constructor
+  _dbInitialTract(0),
+  _friction(0)
+{ // constructor
+  _needJacobianDiag = true;
+  _needVelocity = true;
 } // constructor
 
 // ----------------------------------------------------------------------
 // Destructor.
-pylith::faults::FaultCohesiveDynL::~FaultCohesiveDynL(void) { // destructor
+pylith::faults::FaultCohesiveDynL::~FaultCohesiveDynL(void)
+{ // destructor
   deallocate();
 } // destructor
 
 // ----------------------------------------------------------------------
 // Deallocate PETSc and local data structures.
-void pylith::faults::FaultCohesiveDynL::deallocate(void) { // deallocate
+void pylith::faults::FaultCohesiveDynL::deallocate(void)
+{ // deallocate
   FaultCohesive::deallocate();
 
-  // :TODO: Use shared pointers for initial database
-  _dbInitialTract = 0;
-
+  _dbInitialTract = 0; // :TODO: Use shared pointer
   _friction = 0; // :TODO: Use shared pointer
 } // deallocate
 
 // ----------------------------------------------------------------------
 // Sets the spatial database for the inital tractions
-void pylith::faults::FaultCohesiveDynL::dbInitialTract(spatialdata::spatialdb::SpatialDB* db) { // dbInitial
+void
+pylith::faults::FaultCohesiveDynL::dbInitialTract(spatialdata::spatialdb::SpatialDB* db)
+{ // dbInitial
   _dbInitialTract = db;
 } // dbInitial
 
 // ----------------------------------------------------------------------
 // Get the friction (constitutive) model.  
-void pylith::faults::FaultCohesiveDynL::frictionModel(friction::FrictionModel* const model) { // frictionModel
+void
+pylith::faults::FaultCohesiveDynL::frictionModel(friction::FrictionModel* const model)
+{ // frictionModel
   _friction = model;
 } // frictionModel
 
 // ----------------------------------------------------------------------
 // Initialize fault. Determine orientation and setup boundary
-void pylith::faults::FaultCohesiveDynL::initialize(const topology::Mesh& mesh,
-                                                   const double upDir[3],
-                                                   const double normalDir[3]) { // initialize
+void
+pylith::faults::FaultCohesiveDynL::initialize(const topology::Mesh& mesh,
+					      const double upDir[3],
+					      const double normalDir[3])
+{ // initialize
   assert(0 != upDir);
   assert(0 != normalDir);
   assert(0 != _quadrature);
@@ -208,7 +223,8 @@
 void pylith::faults::FaultCohesiveDynL::integrateResidual(const topology::Field<
                                                               topology::Mesh>& residual,
                                                           const double t,
-                                                          topology::SolutionFields* const fields) { // integrateResidual
+                                                          topology::SolutionFields* const fields)
+{ // integrateResidual
   assert(0 != fields);
   assert(0 != _quadrature);
   assert(0 != _fields);
@@ -410,7 +426,8 @@
 void pylith::faults::FaultCohesiveDynL::integrateResidualAssembled(const topology::Field<
                                                                        topology::Mesh>& residual,
                                                                    const double t,
-                                                                   topology::SolutionFields* const fields) { // integrateResidualAssembled
+                                                                   topology::SolutionFields* const fields)
+{ // integrateResidualAssembled
   assert(0 != fields);
   assert(0 != _fields);
 
@@ -460,9 +477,12 @@
 // ----------------------------------------------------------------------
 // Compute Jacobian matrix (A) associated with operator that do not
 // require assembly across cells, vertices, or processors.
-void pylith::faults::FaultCohesiveDynL::integrateJacobianAssembled(topology::Jacobian* jacobian,
-                                                                   const double t,
-                                                                   topology::SolutionFields* const fields) { // integrateJacobianAssembled
+void
+pylith::faults::FaultCohesiveDynL::integrateJacobianAssembled(
+				      topology::Jacobian* jacobian,
+				      const double t,
+				      topology::SolutionFields* const fields)
+{ // integrateJacobianAssembled
   assert(0 != jacobian);
   assert(0 != fields);
   assert(0 != _fields);
@@ -599,8 +619,11 @@
 
 // ----------------------------------------------------------------------
 // Update state variables as needed.
-void pylith::faults::FaultCohesiveDynL::updateStateVars(const double t,
-                                                        topology::SolutionFields* const fields) { // updateStateVars
+void
+pylith::faults::FaultCohesiveDynL::updateStateVars(
+				      const double t,
+				      topology::SolutionFields* const fields)
+{ // updateStateVars
   assert(0 != fields);
   assert(0 != _fields);
 
@@ -608,9 +631,12 @@
 
 // ----------------------------------------------------------------------
 // Constrain solution based on friction.
-void pylith::faults::FaultCohesiveDynL::constrainSolnSpace(topology::SolutionFields* const fields,
-                                                           const double t,
-                                                           const topology::Jacobian& jacobian) { // constrainSolnSpace
+void
+pylith::faults::FaultCohesiveDynL::constrainSolnSpace(
+				    topology::SolutionFields* const fields,
+				    const double t,
+				    const topology::Jacobian& jacobian)
+{ // constrainSolnSpace
   assert(0 != fields);
   assert(0 != _quadrature);
   assert(0 != _fields);
@@ -982,7 +1008,9 @@
 
 // ----------------------------------------------------------------------
 // Verify configuration is acceptable.
-void pylith::faults::FaultCohesiveDynL::verifyConfiguration(const topology::Mesh& mesh) const { // verifyConfiguration
+void
+pylith::faults::FaultCohesiveDynL::verifyConfiguration(const topology::Mesh& mesh) const
+{ // verifyConfiguration
   assert(0 != _quadrature);
 
   const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
@@ -1030,7 +1058,8 @@
 // Get vertex field associated with integrator.
 const pylith::topology::Field<pylith::topology::SubMesh>&
 pylith::faults::FaultCohesiveDynL::vertexField(const char* name,
-                                               const topology::SolutionFields* fields) { // vertexField
+                                               const topology::SolutionFields* fields)
+{ // vertexField
   assert(0 != _faultMesh);
   assert(0 != _quadrature);
   assert(0 != _normalizer);
@@ -1144,8 +1173,10 @@
 
 // ----------------------------------------------------------------------
 // Calculate orientation at fault vertices.
-void pylith::faults::FaultCohesiveDynL::_calcOrientation(const double upDir[3],
-                                                         const double normalDir[3]) { // _calcOrientation
+void
+pylith::faults::FaultCohesiveDynL::_calcOrientation(const double upDir[3],
+                                                         const double normalDir[3])
+{ // _calcOrientation
   assert(0 != upDir);
   assert(0 != normalDir);
   assert(0 != _faultMesh);
@@ -1422,8 +1453,10 @@
 // ----------------------------------------------------------------------
 // Compute change in tractions on fault surface using solution.
 // NOTE: We must convert vertex labels to fault vertex labels
-void pylith::faults::FaultCohesiveDynL::_calcTractions(topology::Field<
-    topology::SubMesh>* tractions, const topology::Field<topology::Mesh>& dispT) { // _calcTractionsChange
+void
+pylith::faults::FaultCohesiveDynL::_calcTractions(topology::Field<
+    topology::SubMesh>* tractions, const topology::Field<topology::Mesh>& dispT)
+{ // _calcTractionsChange
   assert(0 != tractions);
   assert(0 != _faultMesh);
   assert(0 != _fields);
@@ -1546,7 +1579,9 @@
 } // _calcTractions
 
 // ----------------------------------------------------------------------
-void pylith::faults::FaultCohesiveDynL::_getInitialTractions(void) { // _getInitialTractions
+void
+pylith::faults::FaultCohesiveDynL::_getInitialTractions(void)
+{ // _getInitialTractions
   assert(0 != _normalizer);
   assert(0 != _quadrature);
 
@@ -1655,7 +1690,9 @@
 // ----------------------------------------------------------------------
 // Update diagonal of Jacobian at conventional vertices i and j
 //  associated with Lagrange vertex k.
-void pylith::faults::FaultCohesiveDynL::_updateJacobianDiagonal(const topology::SolutionFields& fields) { // _updateJacobianDiagonal
+void
+pylith::faults::FaultCohesiveDynL::_updateJacobianDiagonal(const topology::SolutionFields& fields)
+{ // _updateJacobianDiagonal
   assert(0 != _fields);
 
   // Get cohesive cells
@@ -1731,7 +1768,9 @@
 // ----------------------------------------------------------------------
 // Update slip rate associated with Lagrange vertex k corresponding
 // to diffential velocity between conventional vertices i and j.
-void pylith::faults::FaultCohesiveDynL::_updateSlipRate(const topology::SolutionFields& fields) { // _updateSlipRate
+void
+pylith::faults::FaultCohesiveDynL::_updateSlipRate(const topology::SolutionFields& fields)
+{ // _updateSlipRate
   assert(0 != _fields);
 
   // Get cohesive cells
@@ -1826,7 +1865,9 @@
 
 // ----------------------------------------------------------------------
 // Allocate buffer for vector field.
-void pylith::faults::FaultCohesiveDynL::_allocateBufferVertexVectorField(void) { // _allocateBufferVertexVectorField
+void
+pylith::faults::FaultCohesiveDynL::_allocateBufferVertexVectorField(void)
+{ // _allocateBufferVertexVectorField
   assert(0 != _fields);
   if (_fields->hasField("buffer (vector)"))
     return;
@@ -1847,7 +1888,9 @@
 
 // ----------------------------------------------------------------------
 // Allocate buffer for scalar field.
-void pylith::faults::FaultCohesiveDynL::_allocateBufferVertexScalarField(void) { // _allocateBufferVertexScalarField
+void
+pylith::faults::FaultCohesiveDynL::_allocateBufferVertexScalarField(void)
+{ // _allocateBufferVertexScalarField
   assert(0 != _fields);
   if (_fields->hasField("buffer (scalar)"))
     return;

Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc	2010-02-12 20:30:59 UTC (rev 16260)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc	2010-02-14 03:31:34 UTC (rev 16261)
@@ -31,6 +31,8 @@
   _gravityField(0),
   _logger(0),
   _needNewJacobian(true),
+  _needJacobianDiag(false),
+  _needVelocity(false),
   _useSolnIncr(false)
 { // constructor
 } // constructor

Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh	2010-02-12 20:30:59 UTC (rev 16260)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh	2010-02-14 03:31:34 UTC (rev 16261)
@@ -108,6 +108,18 @@
   virtual
   bool needNewJacobian(void) const;
 
+  /** Check whether integrator needs Jacobian diagonal.
+   *
+   * @returns True if integrator needs Jacobian diagonal for computation.
+   */
+  bool needJacobianDiag(void) const;
+
+   /** Check whether integrator needs velocity.
+    *
+    * @returns True if integrator needs velocity for computation.
+    */
+   bool needVelocity(void) const;
+
   /** Set flag for setting constraints for total field solution or
    *  incremental field solution.
    *
@@ -305,6 +317,14 @@
   /// Default is false;
   bool _needNewJacobian;
 
+  /// True if we need to store Jacobian diagonal, false otherwise.
+  /// Default is false;
+  bool _needJacobianDiag;
+
+  /// True if we need to compute velocity field, false otherwise.
+  /// Default is false;
+  bool _needVelocity;
+
   /// Flag indicating whether to set constraints for a total field
   /// solution or an incremental field solution
   bool _useSolnIncr;

Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc	2010-02-12 20:30:59 UTC (rev 16260)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc	2010-02-14 03:31:34 UTC (rev 16261)
@@ -30,6 +30,22 @@
   return _needNewJacobian;
 } // needNewJacobian
 
+// Check whether integrator needs Jacobian diagonal.
+template<typename quadrature_type>
+inline
+bool
+pylith::feassemble::Integrator<quadrature_type>::needJacobianDiag(void) const {
+  return _needJacobianDiag;
+} // needsJacobianDiag
+
+// Check whether integrator needs velocity.
+template<typename quadrature_type>
+inline
+bool
+pylith::feassemble::Integrator<quadrature_type>::needVelocity(void) const {
+  return _needVelocity;
+} // needsVelocity
+
 // Set flag for setting constraints for total field solution or
 template<typename quadrature_type>
 inline

Modified: short/3D/PyLith/trunk/libsrc/problems/Formulation.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Formulation.cc	2010-02-12 20:30:59 UTC (rev 16260)
+++ short/3D/PyLith/trunk/libsrc/problems/Formulation.cc	2010-02-14 03:31:34 UTC (rev 16261)
@@ -31,7 +31,9 @@
   _dt(0.0),
   _jacobian(0),
   _jacobianLumped(0),
-  _fields(0)
+  _fields(0),
+  _needJacobianDiag(false),
+  _needVelocity(false)
 { // constructor
 } // constructor
 
@@ -87,6 +89,43 @@
 } // submeshIntegrators
 
 // ----------------------------------------------------------------------
+// Initialize formulation.
+void
+pylith::problems::Formulation::initialize(void)
+{ // initialize
+
+  // Determine whether we need to store Jacobian diagonal
+  _needJacobianDiag = false;
+  int numIntegrators = _meshIntegrators.size();
+  for (int i=0; i < numIntegrators; ++i) {
+    assert(0 != _meshIntegrators[i]);
+    if (_meshIntegrators[i]->needJacobianDiag())
+      _needJacobianDiag = true;
+  } // for
+  numIntegrators = _submeshIntegrators.size();
+  for (int i=0; i < numIntegrators; ++i) {
+    assert(0 != _submeshIntegrators[i]);
+    if (_submeshIntegrators[i]->needJacobianDiag())
+      _needJacobianDiag = true;
+  } // for
+
+  // Determine whether we need to compute velocity
+  _needVelocity = false;
+  numIntegrators = _meshIntegrators.size();
+  for (int i=0; i < numIntegrators; ++i) {
+    assert(0 != _meshIntegrators[i]);
+    if (_meshIntegrators[i]->needJacobianDiag())
+      _needVelocity = true;
+  } // fpr
+  numIntegrators = _submeshIntegrators.size();
+  for (int i=0; i < numIntegrators; ++i) {
+    assert(0 != _submeshIntegrators[i]);
+    if (_submeshIntegrators[i]->needJacobianDiag())
+      _needVelocity = true;
+  } // for
+} // initialize
+
+// ----------------------------------------------------------------------
 // Update handles and parameters for reforming the Jacobian and
 // residual.
 void
@@ -269,22 +308,21 @@
   // Assemble jacobian.
   _jacobian->assemble("final_assembly");
 
-  // Extract diagonal :KLUDGE: We extract the diagonal even if we
-  // don't need to.
-  if (!_fields->hasField("Jacobian diagonal")) {
-    _fields->add("Jacobian diagonal", "jacobian_diagonal");
-    topology::Field<topology::Mesh>& jacobianDiag = 
-      _fields->get("Jacobian diagonal");
-    const topology::Field<topology::Mesh>& disp = 
-      _fields->get("disp(t)");
-    jacobianDiag.cloneSection(disp);
-    jacobianDiag.createVector();
-    jacobianDiag.createScatter();
+  if (_needJacobianDiag) {
+    if (!_fields->hasField("Jacobian diagonal")) {
+      _fields->add("Jacobian diagonal", "jacobian_diagonal");
+      topology::Field<topology::Mesh>& jacobianDiag = _fields->get(
+          "Jacobian diagonal");
+      const topology::Field<topology::Mesh>& disp = _fields->get("disp(t)");
+      jacobianDiag.cloneSection(disp);
+      jacobianDiag.createVector();
+      jacobianDiag.createScatter();
+    } // if
+  topology::Field<topology::Mesh>& jacobianDiag = _fields->get(
+        "Jacobian diagonal");
+    MatGetDiagonal(_jacobian->matrix(), jacobianDiag.vector());
+    jacobianDiag.scatterVectorToSection();
   } // if
-  topology::Field<topology::Mesh>& jacobianDiag = 
-    _fields->get("Jacobian diagonal");
-  MatGetDiagonal(_jacobian->matrix(), jacobianDiag.vector());
-  jacobianDiag.scatterVectorToSection();  
 } // reformJacobian
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/libsrc/problems/Formulation.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Formulation.hh	2010-02-12 20:30:59 UTC (rev 16260)
+++ short/3D/PyLith/trunk/libsrc/problems/Formulation.hh	2010-02-14 03:31:34 UTC (rev 16261)
@@ -77,6 +77,10 @@
   void submeshIntegrators(IntegratorSubMesh** integrators,
 			  const int numIntegrators);
 
+  /// Initialize formulation.
+  virtual
+  void initialize(void);
+
   /** Update handles and parameters for reforming the Jacobian and
    *  residual.
    *
@@ -155,6 +159,9 @@
   ///< Integrators over lower-dimensional subdomains of the mesh.
   std::vector<IntegratorSubMesh*> _submeshIntegrators;
 
+  bool _needJacobianDiag; ///< Integrator(s) need Jacobian diagonal.
+  bool _needVelocity; ///< Integrator(s) need velocity.
+
 // NOT IMPLEMENTED //////////////////////////////////////////////////////
 private :
 

Modified: short/3D/PyLith/trunk/modulesrc/problems/Formulation.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/problems/Formulation.i	2010-02-12 20:30:59 UTC (rev 16260)
+++ short/3D/PyLith/trunk/modulesrc/problems/Formulation.i	2010-02-14 03:31:34 UTC (rev 16261)
@@ -50,6 +50,10 @@
       void submeshIntegrators(pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >** integrators,
 			      const int numIntegrators);
       
+	  /// Initialize formulation.
+	  virtual
+	  void initialize(void);
+
       /** Update handles and parameters for reforming the Jacobian and
        *  residual.
        *

Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py	2010-02-12 20:30:59 UTC (rev 16260)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py	2010-02-14 03:31:34 UTC (rev 16261)
@@ -197,6 +197,7 @@
       integrator.initialize(totalTime, numTimeSteps, normalizer)
     ModuleFormulation.meshIntegrators(self, self.integratorsMesh)
     ModuleFormulation.submeshIntegrators(self, self.integratorsSubMesh)
+    ModuleFormulation.initialize(self)
     self._debug.log(resourceUsageString())
 
     self._info.log("Initializing constraints.")

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.cc	2010-02-12 20:30:59 UTC (rev 16260)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.cc	2010-02-14 03:31:34 UTC (rev 16261)
@@ -77,6 +77,26 @@
 } // testConstructor
 
 // ----------------------------------------------------------------------
+// Test needJacobianDiag().
+void
+pylith::faults::TestFaultCohesiveDynL::testNeedJacobianDiag(void)
+{ // testNeedJacobianDiag
+  FaultCohesiveDynL fault;
+
+  CPPUNIT_ASSERT_EQUAL(true, fault.needJacobianDiag());
+} // testNeedJacobianDiag
+
+// ----------------------------------------------------------------------
+// Test needVelocity().
+void
+pylith::faults::TestFaultCohesiveDynL::testNeedVelocity(void)
+{ // testNeedVelocity
+  FaultCohesiveDynL fault;
+
+  CPPUNIT_ASSERT_EQUAL(true, fault.needVelocity());
+} // testNeedVelocity
+
+// ----------------------------------------------------------------------
 // Test dbInitialTract().
 void
 pylith::faults::TestFaultCohesiveDynL::testDBInitialTract(void)

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.hh	2010-02-12 20:30:59 UTC (rev 16260)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDynL.hh	2010-02-14 03:31:34 UTC (rev 16261)
@@ -39,21 +39,24 @@
 } // pylith
 
 /// C++ unit testing for FaultCohesiveDynL
-class pylith::faults::TestFaultCohesiveDynL: public CppUnit::TestFixture { // class TestFaultCohesiveDynL
+class pylith::faults::TestFaultCohesiveDynL: public CppUnit::TestFixture
+{ // class TestFaultCohesiveDynL
 
   // CPPUNIT TEST SUITE /////////////////////////////////////////////////
-CPPUNIT_TEST_SUITE( TestFaultCohesiveDynL );
+  CPPUNIT_TEST_SUITE( TestFaultCohesiveDynL );
 
-    CPPUNIT_TEST( testConstructor );
-    CPPUNIT_TEST( testDBInitialTract );
+  CPPUNIT_TEST( testConstructor );
+  CPPUNIT_TEST( testNeedJacobianDiag );
+  CPPUNIT_TEST( testNeedVelocity );
+  CPPUNIT_TEST( testDBInitialTract );
 
-    // Tests in derived classes:
-    // testInitialize()
-    // testConstrainSolnSpaceStick()
-    // testConstrainSolnSpaceSlip()
-    // testConstrainSolnSpaceOpen()
-    // testUpdateStateVars()
-    // testCalcTractions()
+  // Tests in derived classes:
+  // testInitialize()
+  // testConstrainSolnSpaceStick()
+  // testConstrainSolnSpaceSlip()
+  // testConstrainSolnSpaceOpen()
+  // testUpdateStateVars()
+  // testCalcTractions()
 
   CPPUNIT_TEST_SUITE_END();
 
@@ -79,6 +82,12 @@
   /// Test constructor.
   void testConstructor(void);
 
+  /// Test needJacobianDiag().
+  void testNeedJacobianDiag(void);
+
+  /// Test needVelocity().
+  void testNeedVelocity(void);
+
   /// Test dbInitialTract().
   void testDBInitialTract(void);
 

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc	2010-02-12 20:30:59 UTC (rev 16260)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc	2010-02-14 03:31:34 UTC (rev 16261)
@@ -49,6 +49,32 @@
 } // testStableTimeStep
 
 // ----------------------------------------------------------------------
+// Test needJacobianDiag().
+void
+pylith::feassemble::TestIntegrator::testNeedJacobianDiag(void)
+{ // testNeedJacobianDiag
+  ElasticityExplicit integrator;
+
+  CPPUNIT_ASSERT_EQUAL(false, integrator.needJacobianDiag());
+
+  integrator._needJacobianDiag = true;
+  CPPUNIT_ASSERT_EQUAL(true, integrator.needJacobianDiag());
+} // testNeedJacobianDiag
+
+// ----------------------------------------------------------------------
+// Test needVelocity().
+void
+pylith::feassemble::TestIntegrator::testNeedVelocity(void)
+{ // testNeedVelocity
+  ElasticityExplicit integrator;
+
+  CPPUNIT_ASSERT_EQUAL(false, integrator.needVelocity());
+
+  integrator._needVelocity = true;
+  CPPUNIT_ASSERT_EQUAL(true, integrator.needVelocity());
+} // testNeedVelocity
+
+// ----------------------------------------------------------------------
 // Test quadrature().
 void
 pylith::feassemble::TestIntegrator::testQuadrature(void)

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.hh	2010-02-12 20:30:59 UTC (rev 16260)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.hh	2010-02-14 03:31:34 UTC (rev 16261)
@@ -42,6 +42,8 @@
 
   CPPUNIT_TEST( testTimeStep );
   CPPUNIT_TEST( testStableTimeStep );  
+  CPPUNIT_TEST( testNeedJacobianDiag );
+  CPPUNIT_TEST( testNeedVelocity );
 
   CPPUNIT_TEST( testQuadrature );
   CPPUNIT_TEST( testNormalizer );
@@ -64,6 +66,12 @@
   /// Test stableTimeStep().
   void testStableTimeStep(void);
 
+  /// Test needJacobianDiag().
+  void testNeedJacobianDiag(void);
+
+  /// Test needVelocity().
+  void testNeedVelocity(void);
+
   /// Test quadrature().
   void testQuadrature(void);
 



More information about the CIG-COMMITS mailing list