[cig-commits] r8373 - in short/3D/PyLith/trunk: . libsrc/feassemble
modulesrc/bc modulesrc/faults modulesrc/feassemble
pylith/feassemble pylith/problems
unittests/libtests/feassemble unittests/pytests/bc
unittests/pytests/faults unittests/pytests/feassemble
brad at geodynamics.org
brad at geodynamics.org
Mon Dec 3 16:46:26 PST 2007
Author: brad
Date: 2007-12-03 16:46:25 -0800 (Mon, 03 Dec 2007)
New Revision: 8373
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/Integrator.hh
short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.hh
short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src
short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
short/3D/PyLith/trunk/pylith/problems/Explicit.py
short/3D/PyLith/trunk/pylith/problems/Implicit.py
short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc
short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc
short/3D/PyLith/trunk/unittests/pytests/bc/TestAbsorbingDampers.py
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:
Adjusted interface to Integrator::updateState() to allow use of optimized restrict()/update() with custom atlases in FieldsManager.
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/TODO 2007-12-04 00:46:25 UTC (rev 8373)
@@ -6,12 +6,10 @@
1. Fix memory imbalance associated with distribution.
- 2. Fix cohesive cell creation (hex8 and tet4).
+ 2. Fix problems with buildbot on darwin? (is binary ok?)
- 3. Fix problems with buildbot on darwin? (is binary ok?)
+ 3. Add check to make sure every material in mesh has a material model.
- 4. Add check to make sure every material in mesh has a material model.
-
Add check for overlapping of material ids for bulk and cohesive
cells.
Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityExplicit.cc 2007-12-04 00:46:25 UTC (rev 8373)
@@ -235,8 +235,7 @@
CALL_MEMBER_FN(*this, elasticityResidualFn)(stress);
// Assemble cell contribution into field
-//#ifdef FASTER
-#if 0
+#ifdef FASTER
mesh->updateAdd(residual, residualAtlasTag, c_index, _cellVector);
#else
mesh->updateAdd(residual, *c_iter, _cellVector);
Modified: short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/libsrc/feassemble/ElasticityImplicit.cc 2007-12-04 00:46:25 UTC (rev 8373)
@@ -260,8 +260,7 @@
#endif
// Assemble cell contribution into field
PetscLogEventBegin(updateEvent,0,0,0,0);
-//#ifdef FASTER
-#if 0
+#ifdef FASTER
mesh->updateAdd(residual, residualAtlasTag, c_index, _cellVector);
#else
mesh->updateAdd(residual, *c_iter, _cellVector);
Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.hh 2007-12-04 00:46:25 UTC (rev 8373)
@@ -122,12 +122,12 @@
/** Update state variables as needed.
*
* @param t Current time
- * @param field Current solution field.
+ * @param fields Solution fields
* @param mesh Finite-element mesh
*/
virtual
void updateState(const double t,
- const ALE::Obj<real_section_type>& field,
+ topology::FieldsManager* const fields,
const ALE::Obj<Mesh>& mesh);
/** Verify configuration is acceptable.
Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.icc 2007-12-04 00:46:25 UTC (rev 8373)
@@ -48,8 +48,9 @@
void
pylith::feassemble::Integrator::updateState(
const double t,
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh) {}
+ topology::FieldsManager* const fields,
+ const ALE::Obj<Mesh>& mesh) {
+} // updateState
#endif
Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc 2007-12-04 00:46:25 UTC (rev 8373)
@@ -18,12 +18,13 @@
#include "CellGeometry.hh" // USES CellGeometry
#include "pylith/materials/ElasticMaterial.hh" // USES ElasticMaterial
+#include "pylith/topology/FieldsManager.hh" // USES FieldsManager
#include "pylith/utils/array.hh" // USES double_array
#include <assert.h> // USES assert()
#include <stdexcept> // USES std::runtime_error
-//#define FASTER
+#define FASTER
// ----------------------------------------------------------------------
// Constructor
@@ -65,12 +66,12 @@
void
pylith::feassemble::IntegratorElasticity::updateState(
const double t,
- const ALE::Obj<real_section_type>& disp,
+ topology::FieldsManager* const fields,
const ALE::Obj<Mesh>& mesh)
{ // updateState
assert(0 != _quadrature);
assert(0 != _material);
- assert(!disp.isNull());
+ assert(0 != fields);
// No need to update state if using elastic behavior
if (!_material->usesUpdateState())
@@ -96,8 +97,9 @@
assert(0);
// Get cell information
+ const int materialId = _material->id();
const ALE::Obj<Mesh::label_sequence>& cells =
- mesh->getLabelStratum("material-id", _material->id());
+ mesh->getLabelStratum("material-id", materialId);
assert(!cells.isNull());
const Mesh::label_sequence::iterator cellsEnd = cells->end();
@@ -121,9 +123,9 @@
totalStrain[iQuad] = 0.0;
} // for
+ const ALE::Obj<real_section_type>& disp = fields->getSolution();
#ifdef FASTER
- fields->createCustomAtlas("material-id", materialId);
- const int dispAtlasTag = fields.getSolnFieldAtlasTag(materialId);
+ const int dispAtlasTag = fields->getSolutionAtlasTag(materialId);
#endif
// Loop over cells
Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.hh 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.hh 2007-12-04 00:46:25 UTC (rev 8373)
@@ -71,11 +71,11 @@
/** Update state variables as needed.
*
* @param t Current time
- * @param field Current solution field.
+ * @param fields Solution fields
* @param mesh Finite-element mesh
*/
void updateState(const double t,
- const ALE::Obj<real_section_type>& field,
+ topology::FieldsManager* const fields,
const ALE::Obj<Mesh>& mesh);
/** Verify configuration is acceptable.
Modified: short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/modulesrc/bc/bc.pyxe.src 2007-12-04 00:46:25 UTC (rev 8373)
@@ -533,21 +533,21 @@
return
- def updateState(self, t, field, mesh):
+ def updateState(self, t, fields, mesh):
"""
Update state variables as needed.
"""
# create shim for method 'updateState'
- #embed{ void AbsorbingDampers_updateState(void* objVptr, double t, void* fieldVptr, void* meshVptr)
+ #embed{ void AbsorbingDampers_updateState(void* objVptr, double t, void* fieldsVptr, void* meshVptr)
try {
assert(0 != objVptr);
- assert(0 != fieldVptr);
+ assert(0 != fieldsVptr);
assert(0 != meshVptr);
- ALE::Obj<pylith::real_section_type>* field =
- (ALE::Obj<pylith::real_section_type>*) fieldVptr;
+ pylith::topology::FieldsManager* fields =
+ (pylith::topology::FieldsManager*) fieldsVptr;
ALE::Obj<ALE::Mesh>* mesh =
(ALE::Obj<ALE::Mesh>*) meshVptr;
- ((pylith::bc::AbsorbingDampers*) objVptr)->updateState(t, *field, *mesh);
+ ((pylith::bc::AbsorbingDampers*) objVptr)->updateState(t, fields, *mesh);
} catch (const std::exception& err) {
PyErr_SetString(PyExc_RuntimeError,
const_cast<char*>(err.what()));
@@ -559,12 +559,15 @@
"Caught unknown C++ exception.");
} // try/catch
#}embed
+ if fields.name != "pylith_topology_FieldsManager":
+ raise TypeError, \
+ "Argument 'fields' must be extension module type 'FieldsManager'."
if mesh.name != "pylith_topology_Mesh":
raise TypeError, \
"Argument 'mesh' must be extension module type 'Mesh'."
AbsorbingDampers_updateState(self.thisptr,
t,
- PyCObject_AsVoidPtr(field),
+ ptrFromHandle(fields),
ptrFromHandle(mesh))
return
Modified: short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src 2007-12-04 00:46:25 UTC (rev 8373)
@@ -390,21 +390,21 @@
return
- def updateState(self, t, field, mesh):
+ def updateState(self, t, fields, mesh):
"""
Update state variables as needed.
"""
# create shim for method 'updateState'
- #embed{ void FaultCohesiveKin_updateState(void* objVptr, double t, void* fieldVptr, void* meshVptr)
+ #embed{ void FaultCohesiveKin_updateState(void* objVptr, double t, void* fieldsVptr, void* meshVptr)
try {
assert(0 != objVptr);
- assert(0 != fieldVptr);
+ assert(0 != fieldsVptr);
assert(0 != meshVptr);
- ALE::Obj<pylith::real_section_type>* field =
- (ALE::Obj<pylith::real_section_type>*) fieldVptr;
+ pylith::topology::FieldsManager* fields =
+ (pylith::topology::FieldsManager*) fieldsVptr;
ALE::Obj<ALE::Mesh>* mesh =
(ALE::Obj<ALE::Mesh>*) meshVptr;
- ((pylith::faults::FaultCohesiveKin*) objVptr)->updateState(t, *field, *mesh);
+ ((pylith::faults::FaultCohesiveKin*) objVptr)->updateState(t, fields, *mesh);
} catch (const std::exception& err) {
PyErr_SetString(PyExc_RuntimeError,
const_cast<char*>(err.what()));
@@ -416,12 +416,15 @@
"Caught unknown C++ exception.");
} // try/catch
#}embed
+ if fields.name != "pylith_topology_FieldsManager":
+ raise TypeError, \
+ "Argument 'fields' must be extension module type 'FieldsManager'."
if mesh.name != "pylith_topology_Mesh":
raise TypeError, \
"Argument 'mesh' must be extension module type 'Mesh'."
FaultCohesiveKin_updateState(self.thisptr,
t,
- PyCObject_AsVoidPtr(field),
+ ptrFromHandle(fields),
ptrFromHandle(mesh))
return
Modified: short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src 2007-12-04 00:46:25 UTC (rev 8373)
@@ -1006,6 +1006,9 @@
"Caught unknown C++ exception.");
} // try/catch
#}embed
+ if fields.name != "pylith_topology_FieldsManager":
+ raise TypeError, \
+ "Argument 'fields' must be extension module type 'FieldsManager'."
if mesh.name != "pylith_topology_Mesh":
raise TypeError, \
"Argument 'mesh' must be extension module type 'Mesh'."
@@ -1017,21 +1020,21 @@
return
- def updateState(self, t, field, mesh):
+ def updateState(self, t, fields, mesh):
"""
Update state variables as needed.
"""
# create shim for method 'updateState'
- #embed{ void Integrator_updateState(void* objVptr, double t, void* fieldVptr, void* meshVptr)
+ #embed{ void Integrator_updateState(void* objVptr, double t, void* fieldsVptr, void* meshVptr)
try {
assert(0 != objVptr);
- assert(0 != fieldVptr);
+ assert(0 != fieldsVptr);
assert(0 != meshVptr);
- ALE::Obj<pylith::real_section_type>* field =
- (ALE::Obj<pylith::real_section_type>*) fieldVptr;
+ pylith::topology::FieldsManager* fields =
+ (pylith::topology::FieldsManager*) fieldsVptr;
ALE::Obj<ALE::Mesh>* mesh =
(ALE::Obj<ALE::Mesh>*) meshVptr;
- ((pylith::feassemble::Integrator*) objVptr)->updateState(t, *field, *mesh);
+ ((pylith::feassemble::Integrator*) objVptr)->updateState(t, fields, *mesh);
} catch (const std::exception& err) {
PyErr_SetString(PyExc_RuntimeError,
const_cast<char*>(err.what()));
@@ -1043,12 +1046,15 @@
"Caught unknown C++ exception.");
} // try/catch
#}embed
+ if fields.name != "pylith_topology_FieldsManager":
+ raise TypeError, \
+ "Argument 'fields' must be extension module type 'FieldsManager'."
if mesh.name != "pylith_topology_Mesh":
raise TypeError, \
"Argument 'mesh' must be extension module type 'Mesh'."
Integrator_updateState(self.thisptr,
t,
- PyCObject_AsVoidPtr(field),
+ ptrFromHandle(fields),
ptrFromHandle(mesh))
return
Modified: short/3D/PyLith/trunk/pylith/feassemble/Integrator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/feassemble/Integrator.py 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/pylith/feassemble/Integrator.py 2007-12-04 00:46:25 UTC (rev 8373)
@@ -150,7 +150,7 @@
return
- def updateState(self, t, field):
+ def updateState(self, t, fields):
"""
Update state variables as needed.
"""
@@ -158,7 +158,7 @@
assert(None != self.cppHandle)
self._logger.eventBegin(logEvent)
- self.cppHandle.updateState(t.value, field, self.mesh.cppHandle)
+ self.cppHandle.updateState(t.value, fields.cppHandle, self.mesh.cppHandle)
self._logger.eventEnd(logEvent)
return
Modified: short/3D/PyLith/trunk/pylith/problems/Explicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/pylith/problems/Explicit.py 2007-12-04 00:46:25 UTC (rev 8373)
@@ -158,7 +158,7 @@
self._info.log("Updating integrators states.")
for integrator in self.integrators:
- integrator.updateState(t, self.fields.getReal("dispT"))
+ integrator.updateState(t, self.fields.cppHandle)
Formulation.poststep(self, t, dt, totalTime)
return
Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py 2007-12-04 00:46:25 UTC (rev 8373)
@@ -195,7 +195,7 @@
self._info.log("Updating integrators states.")
self._debug.log(resourceUsageString())
for integrator in self.integrators:
- integrator.updateState(t+dt, disp)
+ integrator.updateState(t+dt, self.fields.cppHandle)
self._debug.log(resourceUsageString())
# If finishing first time step, then switch from solving for total
Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc 2007-12-04 00:46:25 UTC (rev 8373)
@@ -160,7 +160,7 @@
const ALE::Obj<real_section_type>& dispT = fields.getReal("dispT");
CPPUNIT_ASSERT(!dispT.isNull());
const double t = 1.0;
- integrator.updateState(t, dispT, mesh);
+ integrator.updateState(t, &fields, mesh);
} // testUpdateState
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc 2007-12-04 00:46:25 UTC (rev 8373)
@@ -151,7 +151,7 @@
fields.getReal("dispTBctpdt");
CPPUNIT_ASSERT(!dispTBctpdt.isNull());
const double t = 1.0;
- integrator.updateState(t, dispTBctpdt, mesh);
+ integrator.updateState(t, &fields, mesh);
} // testUpdateState
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/unittests/pytests/bc/TestAbsorbingDampers.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/bc/TestAbsorbingDampers.py 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/unittests/pytests/bc/TestAbsorbingDampers.py 2007-12-04 00:46:25 UTC (rev 8373)
@@ -152,9 +152,8 @@
"""
(mesh, bc, fields) = self._initialize()
- dispT = fields.getReal("dispT")
t = 0.50*second
- bc.updateState(t, dispT)
+ bc.updateState(t, fields)
# We should really add something here to check to make sure things
# actually initialized correctly
Modified: short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/unittests/pytests/faults/TestFaultCohesiveKin.py 2007-12-04 00:46:25 UTC (rev 8373)
@@ -181,9 +181,8 @@
"""
(mesh, fault, fields) = self._initialize()
- disp = fields.getReal("disp")
t = 1.0*second
- fault.updateState(t, disp)
+ fault.updateState(t, 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 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityExplicit.py 2007-12-04 00:46:25 UTC (rev 8373)
@@ -177,9 +177,8 @@
"""
(mesh, integrator, fields) = self._initialize()
- dispT = fields.getReal("dispT")
t = 3.45*second
- integrator.updateState(t, dispT)
+ integrator.updateState(t, 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 2007-12-04 00:29:08 UTC (rev 8372)
+++ short/3D/PyLith/trunk/unittests/pytests/feassemble/TestElasticityImplicit.py 2007-12-04 00:46:25 UTC (rev 8373)
@@ -172,9 +172,8 @@
"""
(mesh, integrator, fields) = self._initialize()
- dispTBctpdt = fields.getReal("dispTBctpdt")
t = 0.27*year
- integrator.updateState(t, dispTBctpdt)
+ integrator.updateState(t, fields)
# We should really add something here to check to make sure things
# actually initialized correctly
More information about the cig-commits
mailing list