[cig-commits] r15425 - in short/3D/PyLith/trunk: . libsrc/bc libsrc/feassemble libsrc/materials modulesrc/materials pylith/bc pylith/materials pylith/perf
brad at geodynamics.org
brad at geodynamics.org
Sat Jul 4 15:22:52 PDT 2009
Author: brad
Date: 2009-07-04 15:22:51 -0700 (Sat, 04 Jul 2009)
New Revision: 15425
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/libsrc/bc/BoundaryConditionPoints.cc
short/3D/PyLith/trunk/libsrc/bc/TimeDependentPoints.cc
short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc
short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc
short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.hh
short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.icc
short/3D/PyLith/trunk/libsrc/materials/Material.cc
short/3D/PyLith/trunk/modulesrc/materials/ElasticMaterial.i
short/3D/PyLith/trunk/pylith/bc/DirichletBC.py
short/3D/PyLith/trunk/pylith/materials/ElasticMaterial.py
short/3D/PyLith/trunk/pylith/perf/Field.py
Log:
Improved memory model for materials.
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2009-07-03 17:36:47 UTC (rev 15424)
+++ short/3D/PyLith/trunk/TODO 2009-07-04 22:22:51 UTC (rev 15425)
@@ -2,10 +2,6 @@
CURRENT ISSUES/PRIORITIES
======================================================================
-doc/install
- Rocks (SWIG)
- Fink (SWIG)
-
----------------------------------------------------------------------
POST RELEASE 1.4
----------------------------------------------------------------------
@@ -18,7 +14,6 @@
Memory model
C++ Objects with fields
- DirichletBC (BoundaryConditionPoints::_parameters) ACCESSOR DONE
DirichletBoundary (_outputFields)
PointForce (BoundaryConditionPoints::_parameters) ACCESSOR DONE
AbsorbingDampers (_parameters)
@@ -26,8 +21,6 @@
SlipTimeFn (_parameters)
FaultCohesiveKin (_fields)
Quadrature (_geometryFields) [should be NULL]
- IntegratorElasticity (_outputFields)
- ElasticMaterial (_initialFields, _properties, _stateVars)
OutputManager (_fields)
CellFilterAvg (_fieldAvg)
VertexFilterVecNorm (_fieldVecNorm)
Modified: short/3D/PyLith/trunk/libsrc/bc/BoundaryConditionPoints.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/BoundaryConditionPoints.cc 2009-07-03 17:36:47 UTC (rev 15424)
+++ short/3D/PyLith/trunk/libsrc/bc/BoundaryConditionPoints.cc 2009-07-04 22:22:51 UTC (rev 15425)
@@ -61,6 +61,9 @@
{ // _getPoints
typedef topology::Mesh::IntSection::chart_type chart_type;
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("BoundaryConditions");
+
const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
assert(!sieveMesh.isNull());
@@ -82,6 +85,8 @@
++c_iter)
if (groupField->getFiberDimension(*c_iter))
_points[i++] = *c_iter;
+
+ logger.stagePop();
} // _getPoints
Modified: short/3D/PyLith/trunk/libsrc/bc/TimeDependentPoints.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/TimeDependentPoints.cc 2009-07-03 17:36:47 UTC (rev 15424)
+++ short/3D/PyLith/trunk/libsrc/bc/TimeDependentPoints.cc 2009-07-04 22:22:51 UTC (rev 15425)
@@ -108,11 +108,12 @@
strcpy(rateNames[i], name.c_str());
} // for
- delete _parameters;
- _parameters = new topology::Fields<topology::Field<topology::Mesh> >(mesh);
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
logger.stagePush("BoundaryConditions");
+ delete _parameters;
+ _parameters = new topology::Fields<topology::Field<topology::Mesh> >(mesh);
+
// Create section to hold time dependent values
_parameters->add("value", fieldName);
topology::Field<topology::Mesh>& value = _parameters->get("value");
Modified: short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc 2009-07-03 17:36:47 UTC (rev 15424)
+++ short/3D/PyLith/trunk/libsrc/feassemble/IntegratorElasticity.cc 2009-07-04 22:22:51 UTC (rev 15425)
@@ -419,6 +419,7 @@
// should never get here.
topology::Field<topology::Mesh>& buffer =
_outputFields->get("buffer (tensor)");
+
return buffer;
} // cellField
Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc 2009-07-03 17:36:47 UTC (rev 15424)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.cc 2009-07-04 22:22:51 UTC (rev 15425)
@@ -288,44 +288,6 @@
} // stableTimeStepImplicit
// ----------------------------------------------------------------------
-// Get initial stress field.
-const pylith::topology::Field<pylith::topology::Mesh>&
-pylith::materials::ElasticMaterial::initialStressField(void) const
-{ // initialStressField
- if (0 == _initialFields)
- throw std::runtime_error("Request for initial stress field, but no "
- "initial fields exist.");
- assert(0 != _initialFields);
- if (!_initialFields->hasField("initial stress"))
- throw std::runtime_error("Request for initial stress field, but field "
- "does not exist.");
-
- const topology::Field<topology::Mesh>& initialStress =
- _initialFields->get("initial stress");
-
- return initialStress;
-} // initialStressField
-
-// ----------------------------------------------------------------------
-// Get initial strain field.
-const pylith::topology::Field<pylith::topology::Mesh>&
-pylith::materials::ElasticMaterial::initialStrainField(void) const
-{ // initialStrainField
- if (0 == _initialFields)
- throw std::runtime_error("Request for initial strain field, but no "
- "initial fields exist.");
- assert(0 != _initialFields);
- if (!_initialFields->hasField("initial strain"))
- throw std::runtime_error("Request for initial strain field, but field "
- "does not exist.");
-
- const topology::Field<topology::Mesh>& initialStrain =
- _initialFields->get("initial strain");
-
- return initialStrain;
-} // initialStrainField
-
-// ----------------------------------------------------------------------
// Allocate cell arrays.
void
pylith::materials::ElasticMaterial::_allocateCellArrays(void)
@@ -354,6 +316,7 @@
{ // _initializeInitialStress
if (0 == _dbInitialStress)
return;
+
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
logger.stagePush("Materials");
@@ -501,6 +464,9 @@
if (0 == _dbInitialStrain)
return;
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Materials");
+
assert(0 != _initialFields);
_initialFields->add("initial strain", "initial_strain");
topology::Field<topology::Mesh>& initialStrain =
@@ -627,6 +593,8 @@
// Close databases
_dbInitialStrain->close();
+
+ logger.stagePop();
} // _initializeInitialStrain
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.hh 2009-07-03 17:36:47 UTC (rev 15424)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.hh 2009-07-04 22:22:51 UTC (rev 15425)
@@ -182,18 +182,12 @@
virtual
void useElasticBehavior(const bool flag);
- /** Get initial stress field.
+ /** Get initial stress/strain fields.
*
* @returns Initial stress field.
*/
- const topology::Field<topology::Mesh>& initialStressField(void) const;
+ const topology::Fields<topology::Field<topology::Mesh> >* initialFields(void) const;
- /** Get initial strain field.
- *
- * @returns Initial strain field.
- */
- const topology::Field<topology::Mesh>& initialStrainField(void) const;
-
// PROTECTED METHODS //////////////////////////////////////////////////
protected :
Modified: short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.icc 2009-07-03 17:36:47 UTC (rev 15424)
+++ short/3D/PyLith/trunk/libsrc/materials/ElasticMaterial.icc 2009-07-04 22:22:51 UTC (rev 15425)
@@ -42,5 +42,12 @@
return _numVarsQuadPt > 0;
} // usesUpdateProperties
+// Get initial stress/strain fields.
+inline
+const pylith::topology::Fields<pylith::topology::Field<pylith::topology::Mesh> >*
+pylith::materials::ElasticMaterial::initialFields(void) const {
+ return _initialFields;
+} // initialFields
+
// End of file
Modified: short/3D/PyLith/trunk/libsrc/materials/Material.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.cc 2009-07-03 17:36:47 UTC (rev 15424)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.cc 2009-07-04 22:22:51 UTC (rev 15425)
@@ -110,8 +110,8 @@
{ // initialize
assert(0 != _dbProperties);
assert(0 != quadrature);
+
ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- ///logger.setDebug(2);
logger.stagePush("Materials");
// Get quadrature information
@@ -265,8 +265,8 @@
_dbProperties->close();
if (0 != _dbInitialState)
_dbInitialState->close();
+
logger.stagePop();
- ///logger.setDebug(0);
} // initialize
// ----------------------------------------------------------------------
@@ -312,6 +312,9 @@
void
pylith::materials::Material::getField(topology::Field<topology::Mesh> *field, const char* name) const
{ // getField
+ // Logging of allocation is handled by getField() caller since it
+ // manages the memory for the field argument.
+
assert(0 != field);
assert(0 != _properties);
assert(0 != _stateVars);
@@ -366,9 +369,6 @@
propertyScales = 1.0;
_dimProperties(&propertyScales[0], propertyScales.size());
- ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- ///logger.setDebug(2);
- logger.stagePush("Materials");
// Allocate buffer for property field if necessary.
const ALE::Obj<RealSection>& fieldSection = field->section();
bool useCurrentField = !fieldSection.isNull();
@@ -384,16 +384,17 @@
useCurrentField = totalFiberDim == totalFiberDimCurrent;
} // if
if (!useCurrentField) {
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Output");
field->newSection(cells, totalFiberDim);
field->allocate();
+ logger.stagePop();
} // if
assert(!fieldSection.isNull());
field->label(name);
field->scale(propertyScales[propOffset]);
fieldType = _metadata.fieldType(name, Metadata::PROPERTY);
- logger.stagePop();
- ///logger.setDebug(0);
-
+
// Buffer for property at cell's quadrature points
double_array fieldCell(numQuadPts*fiberDim);
double_array propertiesCell(numQuadPts*numPropsQuadPt);
@@ -443,9 +444,6 @@
stateVarScales = 1.0;
_dimStateVars(&stateVarScales[0], stateVarScales.size());
- ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- ///logger.setDebug(2);
- logger.stagePush("Materials");
// Allocate buffer for state variable field if necessary.
const ALE::Obj<RealSection>& fieldSection = field->section();
bool useCurrentField = !fieldSection.isNull();
@@ -461,16 +459,17 @@
useCurrentField = totalFiberDim == totalFiberDimCurrent;
} // if
if (!useCurrentField) {
+ ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+ logger.stagePush("Output");
field->newSection(cells, totalFiberDim);
field->allocate();
+ logger.stagePop();
} // if
assert(!fieldSection.isNull());
fieldType = _metadata.fieldType(name, Metadata::STATEVAR);
field->label(name);
field->scale(stateVarScales[varOffset]);
- logger.stagePop();
- ///logger.setDebug(0);
-
+
// Buffer for state variable at cell's quadrature points
double_array fieldCell(numQuadPts*fiberDim);
double_array stateVarsCell(numQuadPts*numVarsQuadPt);
Modified: short/3D/PyLith/trunk/modulesrc/materials/ElasticMaterial.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/ElasticMaterial.i 2009-07-03 17:36:47 UTC (rev 15424)
+++ short/3D/PyLith/trunk/modulesrc/materials/ElasticMaterial.i 2009-07-04 22:22:51 UTC (rev 15425)
@@ -82,6 +82,12 @@
virtual
void useElasticBehavior(const bool flag);
+ /** Get initial stress/strain fields.
+ *
+ * @returns Initial stress field.
+ */
+ const pylith::topology::Fields<pylith::topology::Field<pylith::topology::Mesh> >* initialFields(void) const;
+
// PROTECTED METHODS //////////////////////////////////////////////
protected :
Modified: short/3D/PyLith/trunk/pylith/bc/DirichletBC.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/DirichletBC.py 2009-07-03 17:36:47 UTC (rev 15424)
+++ short/3D/PyLith/trunk/pylith/bc/DirichletBC.py 2009-07-04 22:22:51 UTC (rev 15425)
@@ -99,7 +99,6 @@
"""
BoundaryCondition.finalize(self)
Constraint.finalize(self)
- self._modelMemoryUse()
return
Modified: short/3D/PyLith/trunk/pylith/materials/ElasticMaterial.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/ElasticMaterial.py 2009-07-03 17:36:47 UTC (rev 15424)
+++ short/3D/PyLith/trunk/pylith/materials/ElasticMaterial.py 2009-07-04 22:22:51 UTC (rev 15425)
@@ -91,4 +91,13 @@
return
-# End of file
+ def _modelMemoryUse(self):
+ """
+ Model allocated memory.
+ """
+ Material._modelMemoryUse(self)
+ self.perfLogger.logFields('Materials', self.initialFields())
+ return
+
+
+# End of file
Modified: short/3D/PyLith/trunk/pylith/perf/Field.py
===================================================================
--- short/3D/PyLith/trunk/pylith/perf/Field.py 2009-07-03 17:36:47 UTC (rev 15424)
+++ short/3D/PyLith/trunk/pylith/perf/Field.py 2009-07-04 22:22:51 UTC (rev 15425)
@@ -37,8 +37,10 @@
# Here we have data + atlas + bc
if not self.label in memDict:
memDict[self.label] = 0
- memDict[self.label] += (self.sizeDouble * self.size) + \
- (2 * self.sizeInt * self.chartSize) + (2 * self.sizeInt * self.chartSize)
+ memDict[self.label] += \
+ (self.sizeDouble * self.size) + \
+ (2 * self.sizeInt * self.chartSize) + \
+ (2 * self.sizeInt * self.chartSize)
return
More information about the CIG-COMMITS
mailing list