[cig-commits] r7040 - in short/3D/PyLith/trunk: . libsrc/feassemble
libsrc/materials unittests/libtests/feassemble
unittests/libtests/materials
brad at geodynamics.org
brad at geodynamics.org
Fri Jun 1 16:04:02 PDT 2007
Author: brad
Date: 2007-06-01 16:04:01 -0700 (Fri, 01 Jun 2007)
New Revision: 7040
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc
short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc
short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.hh
short/3D/PyLith/trunk/libsrc/materials/Material.hh
short/3D/PyLith/trunk/libsrc/materials/Material.icc
short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.hh
short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.icc
short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc
short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc
short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.cc
short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.hh
short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.cc
short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.hh
Log:
Cleaned up setting time step and needNewJacobian flag for MaxwellIsotropic3D and elasticity integrators. Made unit tests of timeStep() and needNewJacobian() more rigorouse.
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/TODO 2007-06-01 23:04:01 UTC (rev 7040)
@@ -2,7 +2,7 @@
MAIN PRIORITIES (Brad)
======================================================================
-a. Incorporate Quad/Hex basis stuff
+0. Incorporate Quad/Hex basis stuff
1. Simple tests with analytical solutions
Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc 2007-06-01 23:04:01 UTC (rev 7040)
@@ -53,6 +53,8 @@
_dtm1 = dt;
_dt = dt;
assert(_dt == _dtm1); // For now, don't allow variable time step
+ if (0 != _material)
+ _material->timeStep(_dt);
} // timeStep
// ----------------------------------------------------------------------
@@ -61,6 +63,8 @@
pylith::feassemble::ElasticityExplicit::material(materials::ElasticMaterial* m)
{ // material
_material = m;
+ if (0 != _material)
+ _material->timeStep(_dt);
} // material
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc 2007-06-01 23:04:01 UTC (rev 7040)
@@ -53,6 +53,8 @@
_dtm1 = dt;
_dt = dt;
assert(_dt == _dtm1); // For now, don't allow variable time step
+ if (0 != _material)
+ _material->timeStep(_dt);
} // timeStep
// ----------------------------------------------------------------------
@@ -61,6 +63,8 @@
pylith::feassemble::ElasticityImplicit::material(materials::ElasticMaterial* m)
{ // material
_material = m;
+ if (0 != _material)
+ _material->timeStep(_dt);
} // material
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.hh 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.hh 2007-06-01 23:04:01 UTC (rev 7040)
@@ -145,11 +145,6 @@
/// Not implemented
const ElasticityImplicit& operator=(const ElasticityImplicit&);
-// PROTECTED MEMBERS ////////////////////////////////////////////////////
-protected :
-
- bool _needNewJacobian;
-
// PRIVATE MEMBERS //////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/trunk/libsrc/materials/Material.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.hh 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.hh 2007-06-01 23:04:01 UTC (rev 7040)
@@ -113,8 +113,14 @@
* @param dt Current time step.
*/
virtual
- void timestep(const double dt);
+ void timeStep(const double dt);
+ /** Get current time step.
+ *
+ * @returns Current time step.
+ */
+ double timeStep(void) const;
+
/** Initialize material by getting physical property parameters from
* database.
*
Modified: short/3D/PyLith/trunk/libsrc/materials/Material.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.icc 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.icc 2007-06-01 23:04:01 UTC (rev 7040)
@@ -59,10 +59,17 @@
// Set current time step.
inline
void
-pylith::materials::Material::timestep(const double dt) {
+pylith::materials::Material::timeStep(const double dt) {
_dt = dt;
}
+// Get current time step.
+inline
+double
+pylith::materials::Material::timeStep(void) const {
+ return _dt;
+} // timeStep
+
/* Get flag indicating whether Jacobian matrix must be reformed for
* current state.
*/
Modified: short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.hh 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.hh 2007-06-01 23:04:01 UTC (rev 7040)
@@ -53,7 +53,7 @@
*
* @param dt Current time step.
*/
- void timestep(const double dt);
+ void timeStep(const double dt);
// PROTECTED METHODS //////////////////////////////////////////////////
protected :
Modified: short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.icc 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/libsrc/materials/MaxwellIsotropic3D.icc 2007-06-01 23:04:01 UTC (rev 7040)
@@ -17,12 +17,12 @@
// Set current time step.
inline
void
-pylith::materials::MaxwellIsotropic3D::timestep(const double dt) {
+pylith::materials::MaxwellIsotropic3D::timeStep(const double dt) {
// Jacobian needs to be reformed if the time step size changes.
if (_dt > 0.0 && dt != _dt)
_needNewJacobian = true;
_dt = dt;
-} // timestep
+} // timeStep
// End of file
Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc 2007-06-01 23:04:01 UTC (rev 7040)
@@ -81,6 +81,10 @@
integrator.material(&material);
CPPUNIT_ASSERT_EQUAL(id, integrator._material->id());
CPPUNIT_ASSERT_EQUAL(label, std::string(integrator._material->label()));
+ CPPUNIT_ASSERT_EQUAL(integrator._dt, integrator._material->timeStep());
+ const double dt = 2.0;
+ integrator.timeStep(dt);
+ CPPUNIT_ASSERT_EQUAL(dt, integrator._material->timeStep());
} // testMaterial
// ----------------------------------------------------------------------
@@ -261,7 +265,6 @@
_material->id(_data->matId);
_material->label(_data->matLabel);
- _material->timestep(_data->dt);
_material->db(&db);
_material->initialize(*mesh, &cs, _quadrature);
Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc 2007-06-01 23:04:01 UTC (rev 7040)
@@ -81,6 +81,10 @@
integrator.material(&material);
CPPUNIT_ASSERT_EQUAL(id, integrator._material->id());
CPPUNIT_ASSERT_EQUAL(label, std::string(integrator._material->label()));
+ CPPUNIT_ASSERT_EQUAL(integrator._dt, integrator._material->timeStep());
+ const double dt = 2.0;
+ integrator.timeStep(dt);
+ CPPUNIT_ASSERT_EQUAL(dt, integrator._material->timeStep());
} // testMaterial
// ----------------------------------------------------------------------
@@ -262,7 +266,6 @@
_material->id(_data->matId);
_material->label(_data->matLabel);
- _material->timestep(_data->dt);
_material->db(&db);
_material->initialize(*mesh, &cs, _quadrature);
Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.cc 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.cc 2007-06-01 23:04:01 UTC (rev 7040)
@@ -75,14 +75,14 @@
// ----------------------------------------------------------------------
// Test timestep()
void
-pylith::materials::TestMaterial::testTimestep(void)
-{ // testTimestep
+pylith::materials::TestMaterial::testTimeStep(void)
+{ // testTimeStep
const double dt = 2.0;
ElasticIsotropic3D material;
- material.timestep(dt);
+ material.timeStep(dt);
- CPPUNIT_ASSERT_EQUAL(dt, material._dt);
-} // testTimestep
+ CPPUNIT_ASSERT_EQUAL(dt, material.timeStep());
+} // testTimeStep
// ----------------------------------------------------------------------
// Test needNewJacobian()
Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.hh 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestMaterial.hh 2007-06-01 23:04:01 UTC (rev 7040)
@@ -41,7 +41,7 @@
CPPUNIT_TEST( testDB );
CPPUNIT_TEST( testID );
CPPUNIT_TEST( testLabel );
- CPPUNIT_TEST( testTimestep );
+ CPPUNIT_TEST( testTimeStep );
CPPUNIT_TEST( testNeedNewJacobian );
CPPUNIT_TEST( testInitialize );
CPPUNIT_TEST_SUITE_END();
@@ -58,8 +58,8 @@
/// Test label()
void testLabel(void);
- /// Test timestep()
- void testTimestep(void);
+ /// Test timeStep()
+ void testTimeStep(void);
/// Test needNewJacobian()
void testNeedNewJacobian(void);
Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.cc 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.cc 2007-06-01 23:04:01 UTC (rev 7040)
@@ -92,5 +92,24 @@
material.updateState(totalStrain);
} // testUpdateState
+// ----------------------------------------------------------------------
+// Test timeStep()
+void
+pylith::materials::TestMaxwellIsotropic3D::testTimeStep(void)
+{ // testTimeStep
+ MaxwellIsotropic3D material;
+ CPPUNIT_ASSERT_EQUAL(false, material._needNewJacobian);
+
+ const double dt1 = 1.0;
+ material.timeStep(dt1);
+ CPPUNIT_ASSERT_EQUAL(dt1, material.timeStep());
+ CPPUNIT_ASSERT_EQUAL(false, material.needNewJacobian());
+
+ const double dt2 = 2.0;
+ CPPUNIT_ASSERT_EQUAL(dt2, material.timeStep());
+ CPPUNIT_ASSERT_EQUAL(true, material.needNewJacobian());
+} // testTimeStep
+
+
// End of file
Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.hh 2007-06-01 21:59:44 UTC (rev 7039)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestMaxwellIsotropic3D.hh 2007-06-01 23:04:01 UTC (rev 7040)
@@ -45,6 +45,7 @@
CPPUNIT_TEST( testCalcStress );
CPPUNIT_TEST( testCalcElasticConsts );
CPPUNIT_TEST( testUpdateState );
+ CPPUNIT_TEST( testTimeStep );
CPPUNIT_TEST_SUITE_END();
// PUBLIC METHODS /////////////////////////////////////////////////////
@@ -71,6 +72,9 @@
/// Test updateState()
void testUpdateState(void);
+ /// Test timeStep()
+ void testTimeStep(void);
+
}; // class TestMaxwellIsotropic3D
#endif // pylith_materials_testmaxwellisotropic3d_hh
More information about the cig-commits
mailing list