[cig-commits] r22083 - in short/3D/PyLith/trunk: doc/developer libsrc/pylith/bc libsrc/pylith/feassemble libsrc/pylith/topology
brad at geodynamics.org
brad at geodynamics.org
Thu May 16 08:58:49 PDT 2013
Author: brad
Date: 2013-05-16 08:58:48 -0700 (Thu, 16 May 2013)
New Revision: 22083
Added:
short/3D/PyLith/trunk/doc/developer/update_1.8to2.0.sh
Modified:
short/3D/PyLith/trunk/libsrc/pylith/bc/AbsorbingDampers.cc
short/3D/PyLith/trunk/libsrc/pylith/bc/AbsorbingDampers.hh
short/3D/PyLith/trunk/libsrc/pylith/bc/BCIntegratorSubMesh.cc
short/3D/PyLith/trunk/libsrc/pylith/bc/BCIntegratorSubMesh.hh
short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicit.cc
short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitLgDeform.cc
short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.cc
short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.cc
short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicit.cc
short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicitLgDeform.cc
short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.cc
short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.hh
short/3D/PyLith/trunk/libsrc/pylith/topology/VisitorSubMesh.hh
short/3D/PyLith/trunk/libsrc/pylith/topology/VisitorSubMesh.icc
Log:
Cache some expensive visitors and index sets for improved performance.
Added: short/3D/PyLith/trunk/doc/developer/update_1.8to2.0.sh
===================================================================
--- short/3D/PyLith/trunk/doc/developer/update_1.8to2.0.sh (rev 0)
+++ short/3D/PyLith/trunk/doc/developer/update_1.8to2.0.sh 2013-05-16 15:58:48 UTC (rev 22083)
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+cat<<EOF > rmtemplates.sed
+s/CellFilterAvgMesh/CellFilterAvg/g
+s/DataWriterVTKMesh/DataWriterVTK/g
+s/DataWriterVTKSubMesh/DataWriterVTK/g
+s/DataWriterVTKSubSubMesh/DataWriterVTK/g
+s/DataWriterHDF5Mesh/DataWriterHDF5/g
+s/DataWriterHDF5SubMesh/DataWriterHDF5/g
+s/DataWriterHDF5SubSubMesh/DataWriterHDF5/g
+s/DataWriterHDF5ExtMesh/DataWriterHDF5Ext/g
+s/DataWriterHDF5ExtSubMesh/DataWriterHDF5Ext/g
+s/DataWriterHDF5ExtSubSubMesh/DataWriterHDF5Ext/g
+EOF
+
+for f in `find . -name "*.cfg"`; do
+ sed -f rmtemplates.sed $f > tmp && mv -f tmp $f
+done
+rm rmtemplates.sed
Modified: short/3D/PyLith/trunk/libsrc/pylith/bc/AbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/bc/AbsorbingDampers.cc 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/bc/AbsorbingDampers.cc 2013-05-16 15:58:48 UTC (rev 22083)
@@ -47,6 +47,7 @@
// ----------------------------------------------------------------------
// Default constructor.
pylith::bc::AbsorbingDampers::AbsorbingDampers(void) :
+ _velocityVisitor(0),
_db(0)
{ // constructor
} // constructor
@@ -65,6 +66,7 @@
{ // deallocate
PYLITH_METHOD_BEGIN;
+ delete _velocityVisitor; _velocityVisitor = 0;
BCIntegratorSubMesh::deallocate();
_db = 0; // :TODO: Use shared pointer
@@ -262,16 +264,17 @@
// Get subsections
const PetscDM dmSubMesh = _boundaryMesh->dmMesh();assert(dmSubMesh);
- topology::SubMeshIS submeshIS(*_boundaryMesh);
// Use _cellVector for cell residual.
- topology::VecVisitorSubMesh residualVisitor(residual, submeshIS);
-
- topology::VecVisitorSubMesh velocityVisitor(fields->get("velocity(t)"), submeshIS);
-
- submeshIS.deallocate();
+ assert(_submeshIS);
+ if (!_residualVisitor) {
+ _residualVisitor = new topology::VecVisitorSubMesh(residual, *_submeshIS);assert(_residualVisitor);
+ } // if
+ if (!_velocityVisitor) {
+ _velocityVisitor = new topology::VecVisitorSubMesh(fields->get("velocity(t)"), *_submeshIS);assert(_velocityVisitor);
+ } // if
-topology::CoordsVisitor coordsVisitor(dmSubMesh);
+ topology::CoordsVisitor coordsVisitor(dmSubMesh);
// Get 'surface' cells (1 dimension lower than top-level cells)
topology::Stratum cellsStratum(dmSubMesh, topology::Stratum::HEIGHT, 1);
@@ -305,7 +308,7 @@
// Restrict input fields to cell
PetscScalar *velocityCell = NULL;
PetscInt velocitySize = 0;
- velocityVisitor.getClosure(&velocityCell, &velocitySize, c);assert(velocityCell);assert(numBasis*spaceDim == velocitySize);
+ _velocityVisitor->getClosure(&velocityCell, &velocitySize, c);assert(velocityCell);assert(numBasis*spaceDim == velocitySize);
const PetscInt doff = dampingConstsVisitor.sectionOffset(c);
assert(numQuadPts*spaceDim == dampingConstsVisitor.sectionDof(c));
@@ -334,9 +337,9 @@
} // for
} // for
} // for
- velocityVisitor.restoreClosure(&velocityCell, &velocitySize, c);
+ _velocityVisitor->restoreClosure(&velocityCell, &velocitySize, c);
- residualVisitor.setClosure(&_cellVector[0], _cellVector.size(), c, ADD_VALUES);
+ _residualVisitor->setClosure(&_cellVector[0], _cellVector.size(), c, ADD_VALUES);
#if defined(DETAILED_EVENT_LOGGING)
PetscLogFlops(numQuadPts*(1+numBasis*(1+numBasis*(3*spaceDim))));
@@ -402,14 +405,15 @@
PetscScalar* dampingConstsArray = dampingConstsVisitor.localArray();
// Get subsections
- topology::SubMeshIS submeshIS(*_boundaryMesh);
// Use _cellVector for cell values.
- topology::VecVisitorSubMesh residualVisitor(residual, submeshIS);
+ assert(_submeshIS);
+ if (!_residualVisitor) {
+ _residualVisitor = new topology::VecVisitorSubMesh(residual, *_submeshIS);assert(_residualVisitor);
+ } // if
+ if (!_velocityVisitor) {
+ _velocityVisitor = new topology::VecVisitorSubMesh(fields->get("velocity(t)"), *_submeshIS);assert(_velocityVisitor);
+ } // if
- topology::VecVisitorSubMesh velocityVisitor(fields->get("velocity(t)"), submeshIS);
-
- submeshIS.deallocate();
-
topology::CoordsVisitor coordsVisitor(dmSubMesh);
_logger->eventEnd(setupEvent);
@@ -439,7 +443,7 @@
// Restrict input fields to cell
PetscScalar *velocityCell = NULL;
PetscInt velocitySize;
- velocityVisitor.getClosure(&velocityCell, &velocitySize, c);assert(velocityCell);assert(velocitySize == numBasis*spaceDim);
+ _velocityVisitor->getClosure(&velocityCell, &velocitySize, c);assert(velocityCell);assert(velocitySize == numBasis*spaceDim);
const PetscInt doff = dampingConstsVisitor.sectionOffset(c);
assert(numQuadPts*spaceDim == dampingConstsVisitor.sectionDof(c));
@@ -469,9 +473,9 @@
valIJ * velocityCell[iBasis*spaceDim+iDim];
} // for
} // for
- velocityVisitor.restoreClosure(&velocityCell, &velocitySize, c);
+ _velocityVisitor->restoreClosure(&velocityCell, &velocitySize, c);
- residualVisitor.setClosure(&_cellVector[0], _cellVector.size(), c, ADD_VALUES);
+ _residualVisitor->setClosure(&_cellVector[0], _cellVector.size(), c, ADD_VALUES);
#if defined(DETAILED_EVENT_LOGGING)
PetscLogFlops(numQuadPts*(1+numBasis+numBasis*(1+spaceDim*3)));
@@ -535,10 +539,11 @@
// Get sparse matrix
const topology::Field& solution = fields->solution();
- topology::SubMeshIS submeshIS(*_boundaryMesh);
const PetscMat jacobianMat = jacobian->matrix();assert(jacobianMat);
- topology::MatVisitorSubMesh jacobianVisitor(jacobianMat, solution, submeshIS);
- submeshIS.deallocate();
+ if (!_jacobianMatVisitor) {
+ assert(_submeshIS);
+ _jacobianMatVisitor = new topology::MatVisitorSubMesh(jacobianMat, solution, *_submeshIS);assert(_jacobianMatVisitor);
+ } // if
// Get parameters used in integration.
const PylithScalar dt = _dt;
@@ -609,7 +614,7 @@
#endif
// Assemble cell contribution into PETSc Matrix
- jacobianVisitor.setClosure(&_cellMatrix[0], _cellMatrix.size(), c, ADD_VALUES);
+ _jacobianMatVisitor->setClosure(&_cellMatrix[0], _cellMatrix.size(), c, ADD_VALUES);
#if defined(DETAILED_EVENT_LOGGING)
_logger->eventEnd(updateEvent);
@@ -675,10 +680,10 @@
topology::VecVisitorMesh dampingConstsVisitor(dampingConsts);
PetscScalar* dampingConstsArray = dampingConstsVisitor.localArray();
- topology::SubMeshIS submeshIS(*_boundaryMesh);
- topology::VecVisitorSubMesh jacobianVisitor(*jacobian, submeshIS);
-
- submeshIS.deallocate();
+ if (!_jacobianMatVisitor) {
+ assert(_submeshIS);
+ _jacobianVecVisitor = new topology::VecVisitorSubMesh(*jacobian, *_submeshIS);assert(_jacobianVecVisitor);
+ } // if
topology::CoordsVisitor coordsVisitor(dmSubMesh);
@@ -735,7 +740,7 @@
} // for
} // for
- jacobianVisitor.setClosure(&_cellVector[0], _cellVector.size(), c, ADD_VALUES);
+ _jacobianVecVisitor->setClosure(&_cellVector[0], _cellVector.size(), c, ADD_VALUES);
#if defined(DETAILED_EVENT_LOGGING)
PetscLogFlops(numQuadPts*(4+numBasis+numBasis*(1+spaceDim*2)));
Modified: short/3D/PyLith/trunk/libsrc/pylith/bc/AbsorbingDampers.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/bc/AbsorbingDampers.hh 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/bc/AbsorbingDampers.hh 2013-05-16 15:58:48 UTC (rev 22083)
@@ -149,6 +149,8 @@
// PRIVATE MEMBERS ////////////////////////////////////////////////////
private :
+ topology::VecVisitorSubMesh* _velocityVisitor; ///< Cache velocity field visitor.
+
spatialdata::spatialdb::SpatialDB* _db; ///< Spatial database w/parameters
// NOT IMPLEMENTED ////////////////////////////////////////////////////
Modified: short/3D/PyLith/trunk/libsrc/pylith/bc/BCIntegratorSubMesh.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/bc/BCIntegratorSubMesh.cc 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/bc/BCIntegratorSubMesh.cc 2013-05-16 15:58:48 UTC (rev 22083)
@@ -24,6 +24,7 @@
#include "pylith/topology/Fields.hh" // USES Fields
#include "pylith/topology/Field.hh" // USES Field
#include "pylith/topology/Stratum.hh" // USES Stratum
+#include "pylith/topology/VisitorSubMesh.hh" // USES VecVisitorSubMesh, MatVisitorSubMesh
#include "pylith/feassemble/Quadrature.hh" // USES Quadrature
@@ -31,6 +32,10 @@
// Default constructor.
pylith::bc::BCIntegratorSubMesh::BCIntegratorSubMesh(void) :
_boundaryMesh(0),
+ _submeshIS(0),
+ _residualVisitor(0),
+ _jacobianMatVisitor(0),
+ _jacobianVecVisitor(0),
_parameters(0)
{ // constructor
} // constructor
@@ -53,6 +58,12 @@
feassemble::Integrator::deallocate();
delete _boundaryMesh; _boundaryMesh = 0;
+
+ delete _residualVisitor; _residualVisitor = 0;
+ delete _jacobianMatVisitor; _jacobianMatVisitor = 0;
+ delete _jacobianVecVisitor; _jacobianVecVisitor = 0;
+ delete _submeshIS; _submeshIS = 0; // Must destroy visitors first
+
delete _parameters; _parameters = 0;
PYLITH_METHOD_END;
@@ -71,6 +82,9 @@
_boundaryMesh = new topology::Mesh(mesh, _label.c_str());
assert(_boundaryMesh);
+ // Create index set for submesh.
+ delete _submeshIS; _submeshIS = new topology::SubMeshIS(*_boundaryMesh);assert(_submeshIS);
+
PYLITH_METHOD_END;
} // createSubMesh
Modified: short/3D/PyLith/trunk/libsrc/pylith/bc/BCIntegratorSubMesh.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/bc/BCIntegratorSubMesh.hh 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/bc/BCIntegratorSubMesh.hh 2013-05-16 15:58:48 UTC (rev 22083)
@@ -85,6 +85,10 @@
protected :
topology::Mesh* _boundaryMesh; ///< Boundary mesh.
+ topology::SubMeshIS* _submeshIS; ///< Cache index set for submesh.
+ topology::VecVisitorSubMesh* _residualVisitor; ///< Cache residual field visitor.
+ topology::MatVisitorSubMesh* _jacobianMatVisitor; ///< Cache jacobian matrix visitor.
+ topology::VecVisitorSubMesh* _jacobianVecVisitor; ///< Cache jacobian field visitor.
/// Parameters for boundary condition.
topology::Fields* _parameters;
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicit.cc 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicit.cc 2013-05-16 15:58:48 UTC (rev 22083)
@@ -206,9 +206,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Setup field visitors.
topology::VecVisitorMesh accVisitor(fields->get("acceleration(t)"));
@@ -438,9 +438,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Get parameters used in integration.
const PylithScalar dt = _dt;
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitLgDeform.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitLgDeform.cc 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitLgDeform.cc 2013-05-16 15:58:48 UTC (rev 22083)
@@ -199,9 +199,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Setup field visitors.
scalar_array dispAdjCell(numBasis*spaceDim);
@@ -389,9 +389,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Get parameters used in integration.
const PylithScalar dt = _dt;
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.cc 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.cc 2013-05-16 15:58:48 UTC (rev 22083)
@@ -192,9 +192,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Setup field visitors.
topology::VecVisitorMesh accVisitor(fields->get("acceleration(t)"));
@@ -482,9 +482,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Get parameters used in integration.
const PylithScalar dt = _dt;
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.cc 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.cc 2013-05-16 15:58:48 UTC (rev 22083)
@@ -191,9 +191,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Setup field visitors.
topology::VecVisitorMesh accVisitor(fields->get("acceleration(t)"));
@@ -444,9 +444,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Get parameters used in integration.
const PylithScalar dt = _dt;
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicit.cc 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicit.cc 2013-05-16 15:58:48 UTC (rev 22083)
@@ -171,9 +171,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Setup field visitors.
topology::VecVisitorMesh dispVisitor(fields->get("disp(t)"));
@@ -352,9 +352,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Setup field visitors.
topology::VecVisitorMesh dispVisitor(fields->get("disp(t)"));
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicitLgDeform.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicitLgDeform.cc 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicitLgDeform.cc 2013-05-16 15:58:48 UTC (rev 22083)
@@ -174,9 +174,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Setup field visitors.
topology::VecVisitorMesh dispVisitor(fields->get("disp(t)"));
@@ -358,9 +358,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Setup field visitors.
topology::VecVisitorMesh dispVisitor(fields->get("disp(t)"));
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.cc 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.cc 2013-05-16 15:58:48 UTC (rev 22083)
@@ -47,6 +47,7 @@
// Constructor
pylith::feassemble::IntegratorElasticity::IntegratorElasticity(void) :
_material(0),
+ _materialIS(0),
_outputFields(0)
{ // constructor
} // constructor
@@ -67,8 +68,9 @@
Integrator::deallocate();
+ _material = 0; // :TODO: Use shared pointer.
+ delete _materialIS; _materialIS = 0;
delete _outputFields; _outputFields = 0;
- _material = 0; // :TODO: Use shared pointer.
PYLITH_METHOD_END;
} // deallocate
@@ -79,8 +81,9 @@
pylith::feassemble::IntegratorElasticity::material(materials::ElasticMaterial* m)
{ // material
_material = m;
- if (_material)
+ if (_material) {
_material->timeStep(_dt);
+ } // if
} // material
// ----------------------------------------------------------------------
@@ -108,6 +111,12 @@
_initializeLogger();
+ // Setup index set for material.
+ PetscDM dmMesh = mesh.dmMesh();assert(dmMesh);
+ if (!_materialIS) {
+ delete _materialIS; _materialIS = new topology::StratumIS(dmMesh, "material-id", _material->id());assert(_materialIS);
+ } // if
+
// Compute geometry for quadrature operations.
_quadrature->initializeGeometry();
@@ -183,9 +192,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Setup visitors.
topology::VecVisitorMesh dispVisitor(fields->get("disp(t)"));
@@ -256,11 +265,12 @@
throw std::runtime_error(msg.str());
} // if
- const int numCorners = _quadrature->refGeometry().numCorners();
PetscDM dmMesh = mesh.dmMesh();assert(dmMesh);
topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
const PetscInt* cells = materialIS.points();
const PetscInt numCells = materialIS.size();
+
+ const int numCorners = _quadrature->refGeometry().numCorners();
PetscInt vStart, vEnd;
PetscErrorCode err;
@@ -452,9 +462,9 @@
// Get cell information
PetscDM dmMesh = mesh.dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
int_array cellsTmp(cells, numCells);
@@ -518,9 +528,9 @@
// Get cell information
PetscDM dmMesh = fields->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Setup field visitors.
topology::VecVisitorMesh dispVisitor(fields->get("disp(t)"));
@@ -594,9 +604,9 @@
// Get cell information
PetscDM dmMesh = field->mesh().dmMesh();assert(dmMesh);
- topology::StratumIS materialIS(dmMesh, "material-id", _material->id());
- const PetscInt* cells = materialIS.points();
- const PetscInt numCells = materialIS.size();
+ assert(_materialIS);
+ const PetscInt* cells = _materialIS->points();
+ const PetscInt numCells = _materialIS->size();
// Setup visitors.
topology::VecVisitorMesh fieldVisitor(*field);
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.hh 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.hh 2013-05-16 15:58:48 UTC (rev 22083)
@@ -242,9 +242,10 @@
// PROTECTED MEMBERS ////////////////////////////////////////////////////
protected :
- /// Elastic material associated with integrator
- materials::ElasticMaterial* _material;
+
+ materials::ElasticMaterial* _material; ///< Material associated with integrator.
+ topology::StratumIS* _materialIS; ///< Index set for material cells.
topology::Fields* _outputFields; ///< Buffers for output.
Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/VisitorSubMesh.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/VisitorSubMesh.hh 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/VisitorSubMesh.hh 2013-05-16 15:58:48 UTC (rev 22083)
@@ -70,12 +70,6 @@
/// Clear cached data.
void clear(void);
- /** Get the array of values associated with the local PETSc Vec.
- *
- * @returns Array of values.
- */
- PetscScalar* localArray(void) const;
-
/** Get the PETSc section.
*
* @returns PETSc section.
@@ -142,7 +136,6 @@
PetscDM _dm; ///< Cached PETSc dm for submesh.
PetscVec _localVec; ///< Cached local PETSc Vec.
PetscSection _section; ///< Cached PETSc subsection.
- PetscScalar* _localArray; ///< Cached local array
// NOT IMPLEMENTED //////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/VisitorSubMesh.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/VisitorSubMesh.icc 2013-05-16 15:01:17 UTC (rev 22082)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/VisitorSubMesh.icc 2013-05-16 15:58:48 UTC (rev 22083)
@@ -30,8 +30,7 @@
_field(field),
_dm(NULL),
_section(NULL),
- _localVec(NULL),
- _localArray(NULL)
+ _localVec(NULL)
{ // constructor
initialize(submeshIS);
} // constructor
@@ -60,7 +59,6 @@
PetscSection section = _field.petscSection();assert(section);
const PetscIS subpointIS = submeshIS.indexSet();assert(subpointIS);
err = PetscSectionCreateSubmeshSection(section, subpointIS, &_section);PYLITH_CHECK_ERROR(err);assert(_section);
- err = VecGetArray(_localVec, &_localArray);PYLITH_CHECK_ERROR(err);assert(_localArray);
} // initialize
// ----------------------------------------------------------------------
@@ -71,10 +69,6 @@
{ // clear
PetscErrorCode err = 0;
- if (_localVec) {
- err = VecRestoreArray(_localVec, &_localArray);PYLITH_CHECK_ERROR(err);assert(!_localArray);
- } // if
-
if (_section) {
err = PetscSectionDestroy(&_section);assert(!_section);
} // if
@@ -84,15 +78,6 @@
} // clear
// ----------------------------------------------------------------------
-// Get the local coordinates array associated with the local PETSc Vec.
-inline
-PetscScalar*
-pylith::topology::VecVisitorSubMesh::localArray(void) const
-{ // localArray
- return _localArray;
-} // localArray
-
-// ----------------------------------------------------------------------
// Get fiber dimension of coordinates for point.
inline
PetscInt
More information about the CIG-COMMITS
mailing list