[cig-commits] r7056 - in short/3D/PyLith/trunk: libsrc/feassemble libsrc/materials unittests/libtests/feassemble

brad at geodynamics.org brad at geodynamics.org
Mon Jun 4 08:39:59 PDT 2007


Author: brad
Date: 2007-06-04 08:39:58 -0700 (Mon, 04 Jun 2007)
New Revision: 7056

Modified:
   short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc
   short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc
   short/3D/PyLith/trunk/libsrc/materials/Material.hh
   short/3D/PyLith/trunk/libsrc/materials/Material.icc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc
Log:
Fixed bugs where needNewJacobian was not reset for elasticity integrators and materials after Jacobian was computed. Updated cooresponding unit tests.

Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc	2007-06-04 02:45:37 UTC (rev 7055)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc	2007-06-04 15:39:58 UTC (rev 7056)
@@ -380,6 +380,9 @@
     if (err)
       throw std::runtime_error("Update to PETSc Mat failed.");
   } // for
+
+  _needNewJacobian = false;
+  _material->resetNeedNewJacobian();
 } // integrateJacobian
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc	2007-06-04 02:45:37 UTC (rev 7055)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc	2007-06-04 15:39:58 UTC (rev 7056)
@@ -556,6 +556,8 @@
     if (err)
       throw std::runtime_error("Update to PETSc Mat failed.");
   } // for
+  _needNewJacobian = false;
+  _material->resetNeedNewJacobian();
 } // integrateJacobian
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/libsrc/materials/Material.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.hh	2007-06-04 02:45:37 UTC (rev 7055)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.hh	2007-06-04 15:39:58 UTC (rev 7056)
@@ -139,6 +139,10 @@
    */
   bool needNewJacobian(void) const;
 
+  /// Reset flag indicating whether Jacobian matrix must be reformed for
+  /// current state.
+  void resetNeedNewJacobian(void);
+
   // PROTECTED METHODS //////////////////////////////////////////////////
 protected :
 

Modified: short/3D/PyLith/trunk/libsrc/materials/Material.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.icc	2007-06-04 02:45:37 UTC (rev 7055)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.icc	2007-06-04 15:39:58 UTC (rev 7056)
@@ -77,7 +77,15 @@
 bool
 pylith::materials::Material::needNewJacobian(void) const {
   return _needNewJacobian;
-}
+} // needNewJacobian
 
+/// Reset flag indicating whether Jacobian matrix must be reformed for
+/// current state.
+inline
+void
+pylith::materials::Material::resetNeedNewJacobian(void) {
+  _needNewJacobian = false;
+} // resetNeedNewJacobian
 
+
 // End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc	2007-06-04 02:45:37 UTC (rev 7055)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc	2007-06-04 15:39:58 UTC (rev 7056)
@@ -160,6 +160,7 @@
   ElasticityExplicit integrator;
   topology::FieldsManager fields(mesh);
   _initialize(&mesh, &integrator, &fields);
+  integrator._needNewJacobian = true;
 
   const ALE::Obj<pylith::real_section_type>& dispTpdt = 
     fields.getReal("dispTpdt");
@@ -170,6 +171,8 @@
   CPPUNIT_ASSERT(0 == err);
 
   integrator.integrateJacobian(&jacobian, &fields, mesh);
+  CPPUNIT_ASSERT_EQUAL(false, integrator.needNewJacobian());
+
   err = MatAssemblyBegin(jacobian, MAT_FINAL_ASSEMBLY);
   CPPUNIT_ASSERT(0 == err);
   err = MatAssemblyEnd(jacobian, MAT_FINAL_ASSEMBLY);

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc	2007-06-04 02:45:37 UTC (rev 7055)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc	2007-06-04 15:39:58 UTC (rev 7056)
@@ -161,6 +161,7 @@
   ElasticityImplicit integrator;
   topology::FieldsManager fields(mesh);
   _initialize(&mesh, &integrator, &fields);
+  integrator._needNewJacobian = true;
 
   const ALE::Obj<pylith::real_section_type>& dispTBctpdt = 
     fields.getReal("dispTBctpdt");
@@ -171,6 +172,8 @@
   CPPUNIT_ASSERT(0 == err);
 
   integrator.integrateJacobian(&jacobian, &fields, mesh);
+  CPPUNIT_ASSERT_EQUAL(false, integrator.needNewJacobian());
+
   err = MatAssemblyBegin(jacobian, MAT_FINAL_ASSEMBLY);
   CPPUNIT_ASSERT(0 == err);
   err = MatAssemblyEnd(jacobian, MAT_FINAL_ASSEMBLY);



More information about the cig-commits mailing list