[cig-commits] r21798 - in short/3D/PyLith/trunk/libsrc/pylith: feassemble materials meshio
brad at geodynamics.org
brad at geodynamics.org
Wed Apr 10 13:02:15 PDT 2013
Author: brad
Date: 2013-04-10 13:02:14 -0700 (Wed, 10 Apr 2013)
New Revision: 21798
Modified:
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/Integrator.cc
short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.cc
short/3D/PyLith/trunk/libsrc/pylith/feassemble/Quadrature.cc
short/3D/PyLith/trunk/libsrc/pylith/feassemble/QuadratureEngine.cc
short/3D/PyLith/trunk/libsrc/pylith/feassemble/QuadratureRefCell.cc
short/3D/PyLith/trunk/libsrc/pylith/materials/ElasticStrain1D.cc
short/3D/PyLith/trunk/libsrc/pylith/meshio/BinaryIO.cc
short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshBuilder.cc
Log:
Code cleanup.
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicit.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicit.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -66,7 +66,11 @@
void
pylith::feassemble::ElasticityExplicit::deallocate(void)
{ // deallocate
+ PYLITH_METHOD_BEGIN;
+
IntegratorElasticity::deallocate();
+
+ PYLITH_METHOD_END;
} // deallocate
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitLgDeform.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitLgDeform.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitLgDeform.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -64,7 +64,11 @@
void
pylith::feassemble::ElasticityExplicitLgDeform::deallocate(void)
{ // deallocate
+ PYLITH_METHOD_BEGIN;
+
IntegratorElasticityLgDeform::deallocate();
+
+ PYLITH_METHOD_END;
} // deallocate
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTet4.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -70,7 +70,11 @@
void
pylith::feassemble::ElasticityExplicitTet4::deallocate(void)
{ // deallocate
+ PYLITH_METHOD_BEGIN;
+
IntegratorElasticity::deallocate();
+
+ PYLITH_METHOD_END;
} // deallocate
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityExplicitTri3.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -70,7 +70,11 @@
void
pylith::feassemble::ElasticityExplicitTri3::deallocate(void)
{ // deallocate
+ PYLITH_METHOD_BEGIN;
+
IntegratorElasticity::deallocate();
+
+ PYLITH_METHOD_END;
} // deallocate
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicit.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicit.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -66,7 +66,11 @@
void
pylith::feassemble::ElasticityImplicit::deallocate(void)
{ // deallocate
+ PYLITH_METHOD_BEGIN;
+
IntegratorElasticity::deallocate();
+
+ PYLITH_METHOD_END;
} // deallocate
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicitLgDeform.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicitLgDeform.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/ElasticityImplicitLgDeform.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -66,7 +66,11 @@
void
pylith::feassemble::ElasticityImplicitLgDeform::deallocate(void)
{ // deallocate
+ PYLITH_METHOD_BEGIN;
+
IntegratorElasticityLgDeform::deallocate();
+
+ PYLITH_METHOD_END;
} // deallocate
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/Integrator.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/Integrator.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/Integrator.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -56,9 +56,13 @@
void
pylith::feassemble::Integrator<quadrature_type>::deallocate(void)
{ // deallocate
+ PYLITH_METHOD_BEGIN;
+
delete _quadrature; _quadrature = 0;
delete _normalizer; _normalizer = 0;
delete _logger; _logger = 0;
+
+ PYLITH_METHOD_END;
} // deallocate
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/IntegratorElasticity.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -61,10 +61,14 @@
void
pylith::feassemble::IntegratorElasticity::deallocate(void)
{ // deallocate
+ PYLITH_METHOD_BEGIN;
+
Integrator<Quadrature<topology::Mesh> >::deallocate();
delete _outputFields; _outputFields = 0;
_material = 0; // :TODO: Use shared pointer.
+
+ PYLITH_METHOD_END;
} // deallocate
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/Quadrature.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/Quadrature.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/Quadrature.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -61,10 +61,14 @@
void
pylith::feassemble::Quadrature<mesh_type>::deallocate(void)
{ // deallocate
+ PYLITH_METHOD_BEGIN;
+
QuadratureRefCell::deallocate();
delete _engine; _engine = 0;
delete _geometryFields; _geometryFields = 0;
+
+ PYLITH_METHOD_END;
} // deallocate
// ----------------------------------------------------------------------
@@ -76,8 +80,12 @@
_geometryFields(0),
_checkConditioning(q._checkConditioning)
{ // copy constructor
+ PYLITH_METHOD_BEGIN;
+
if (0 != q._engine)
_engine = q._engine->clone();
+
+ PYLITH_METHOD_END;
} // copy constructor
// ----------------------------------------------------------------------
@@ -86,6 +94,8 @@
void
pylith::feassemble::Quadrature<mesh_type>::initializeGeometry(void)
{ // initializeGeometry
+ PYLITH_METHOD_BEGIN;
+
clear();
assert(0 == _engine);
@@ -140,6 +150,8 @@
assert(0 != _engine);
_engine->initialize();
+
+ PYLITH_METHOD_END;
} // initializeGeometry
// ----------------------------------------------------------------------
@@ -150,6 +162,8 @@
const mesh_type& mesh,
const ALE::Obj<typename mesh_type::SieveMesh::label_sequence>& cells)
{ // computeGeometry
+ PYLITH_METHOD_BEGIN;
+
assert(0 != _engine);
typedef typename mesh_type::RealSection RealSection;
@@ -260,6 +274,8 @@
jacobianDetSection->updatePoint(*c_iter, &jacobianDet[0]);
basisDerivSection->updatePoint(*c_iter, &basisDeriv[0]);
} // for
+
+ PYLITH_METHOD_END;
} // computeGeometry
// ----------------------------------------------------------------------
@@ -270,6 +286,8 @@
const mesh_type& mesh,
PetscInt cStart, PetscInt cEnd)
{ // computeGeometry
+ PYLITH_METHOD_BEGIN;
+
assert(0 != _engine);
const char* loggingStage = "Quadrature";
@@ -403,6 +421,8 @@
err = VecRestoreArray(jacobianVec, &jacobianArray);CHECK_PETSC_ERROR(err);
err = VecRestoreArray(jacobianDetVec, &jacobianDetArray);CHECK_PETSC_ERROR(err);
err = VecRestoreArray(basisDerivVec, &basisDerivArray);CHECK_PETSC_ERROR(err);
+
+ PYLITH_METHOD_END;
} // computeGeometry
// ----------------------------------------------------------------------
@@ -410,6 +430,8 @@
void
pylith::feassemble::Quadrature<mesh_type>::retrieveGeometry(const typename mesh_type::SieveMesh::point_type& cell)
{ // retrieveGeometry
+ PYLITH_METHOD_BEGIN;
+
assert(0 != _geometryFields);
assert(0 != _engine);
@@ -439,6 +461,9 @@
_geometryFields->get("determinant basisfunctions").section();
basisDerivSection->restrictPoint(cell, const_cast<PylithScalar*>(&basisDeriv[0]),
basisDeriv.size());
+
+
+ PYLITH_METHOD_END;
} // retrieveGeometry
// ----------------------------------------------------------------------
@@ -447,10 +472,15 @@
void
pylith::feassemble::Quadrature<mesh_type>::clear(void)
{ // clear
+ PYLITH_METHOD_BEGIN;
+
delete _engine; _engine = 0;
// Clear storage of precomputed geometry.
delete _geometryFields; _geometryFields = 0;
+
+
+ PYLITH_METHOD_END;
} // clear
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/QuadratureEngine.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/QuadratureEngine.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/QuadratureEngine.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -23,6 +23,8 @@
#include "CellGeometry.hh" // USES CellGeometry
#include "QuadratureRefCell.hh" // QuadratureRefCell
+#include "pylith/utils/petscerror.h" // USES PYLITH_METHOD_BEGIN/END
+
#include <sstream> // USES std::ostringstream
#include <stdexcept> // USES std::runtime_error
@@ -52,6 +54,8 @@
void
pylith::feassemble::QuadratureEngine::initialize(void)
{ // initialize
+ PYLITH_METHOD_BEGIN;
+
const int numQuadPts = _quadRefCell.numQuadPts();
const int numBasis = _quadRefCell.numBasis();
const int cellDim = _quadRefCell.cellDim();
@@ -70,6 +74,8 @@
_jacobianDet.resize(1);
_basisDeriv.resize(numQuadPts*numBasis*spaceDim);
} // if/else
+
+ PYLITH_METHOD_END;
} // initialize
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/pylith/feassemble/QuadratureRefCell.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/feassemble/QuadratureRefCell.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/feassemble/QuadratureRefCell.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -22,6 +22,8 @@
#include "CellGeometry.hh" // USES CellGeometry
+#include "pylith/utils/petscerror.h" // USES PYLITH_METHOD_BEGIN/END
+
#include <cstring> // USES memcpy()
#include <cassert> // USES assert()
#include <stdexcept> // USES std::runtime_error
@@ -68,7 +70,7 @@
_spaceDim(q._spaceDim),
_geometry(0)
{ // copy constructor
- if (0 != q._geometry)
+ if (q._geometry)
_geometry = q._geometry->clone();
} // copy constructor
@@ -90,6 +92,8 @@
const int numQuadPts4,
const int spaceDim)
{ // initialize
+ PYLITH_METHOD_BEGIN;
+
const int numQuadPts = numQuadPts1;
const int numBasis = numBasis1;
const int cellDim = (numBasis != 1) ? cellDim2 : 0;
@@ -191,6 +195,8 @@
_spaceDim = spaceDim;
} // else
+
+ PYLITH_METHOD_END;
} // initialize
// ----------------------------------------------------------------------
@@ -198,7 +204,11 @@
void
pylith::feassemble::QuadratureRefCell::refGeometry(CellGeometry* const geometry)
{ // refGeometry
- delete _geometry; _geometry = (0 != geometry) ? geometry->clone() : 0;
+ PYLITH_METHOD_BEGIN;
+
+ delete _geometry; _geometry = (geometry) ? geometry->clone() : 0;
+
+ PYLITH_METHOD_END;
} // refGeometry
// ----------------------------------------------------------------------
@@ -206,7 +216,7 @@
const pylith::feassemble::CellGeometry&
pylith::feassemble::QuadratureRefCell::refGeometry(void) const
{ // refGeometry
- assert(0 != _geometry);
+ assert(_geometry);
return *_geometry;
} // refGeometry
Modified: short/3D/PyLith/trunk/libsrc/pylith/materials/ElasticStrain1D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/materials/ElasticStrain1D.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/materials/ElasticStrain1D.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -51,7 +51,7 @@
const int numProperties = 3;
// Physical properties.
- const Metadata::ParamDescription properties[] = {
+ const Metadata::ParamDescription properties[numProperties] = {
{ "density", 1, pylith::topology::FieldBase::SCALAR },
{ "mu", 1, pylith::topology::FieldBase::SCALAR },
{ "lambda", 1, pylith::topology::FieldBase::SCALAR },
@@ -59,7 +59,7 @@
// Values expected in spatial database
const int numDBProperties = 3;
- const char* dbProperties[] = { "density", "vs", "vp" };
+ const char* dbProperties[numDBProperties] = { "density", "vs", "vp" };
} // _ElasticStrain1D
} // materials
@@ -107,9 +107,8 @@
// ----------------------------------------------------------------------
// Compute parameters from values in spatial database.
void
-pylith::materials::ElasticStrain1D::_dbToProperties(
- PylithScalar* const propValues,
- const scalar_array& dbValues)
+pylith::materials::ElasticStrain1D::_dbToProperties(PylithScalar* const propValues,
+ const scalar_array& dbValues)
{ // _dbToProperties
assert(0 != propValues);
const int numDBValues = dbValues.size();
@@ -152,7 +151,7 @@
// Nondimensionalize properties.
void
pylith::materials::ElasticStrain1D::_nondimProperties(PylithScalar* const values,
- const int nvalues) const
+ const int nvalues) const
{ // _nondimProperties
assert(0 != _normalizer);
assert(0 != values);
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/BinaryIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/BinaryIO.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/BinaryIO.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -54,7 +54,7 @@
const int numVals,
const int typesize)
{ // swapByteOrder
- assert(0 != vals);
+ assert(vals);
const int numSwaps = sizeof(typesize) / 2;
for (int iVal=0; iVal < numVals; ++iVal) {
char* buf = (char*) (vals + iVal*typesize);
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshBuilder.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshBuilder.cc 2013-04-10 19:53:04 UTC (rev 21797)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/MeshBuilder.cc 2013-04-10 20:02:14 UTC (rev 21798)
@@ -88,11 +88,6 @@
new SieveMesh::sieve_type(mesh->comm());
sieveMesh->setSieve(sieve);
- // Memory debugging
- ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- //logger.setDebug(1);
-
- logger.stagePush("MeshCreation");
if (0 == commRank || isParallel) {
assert(coordinates->size() == numVertices*spaceDim);
assert(cells.size() == numCells*numCorners);
@@ -140,8 +135,6 @@
std::map<SieveFlexMesh::point_type,SieveFlexMesh::point_type> renumbering;
ALE::ISieveConverter::convertSieve(*s, *sieve, renumbering);
} // if/else
- logger.stagePop();
- logger.stagePush("MeshStratification");
if (!interpolate) {
// Optimized stratification
const ALE::Obj<SieveMesh::label_type>& height =
@@ -162,19 +155,13 @@
} else {
sieveMesh->stratify();
} // if/else
- logger.stagePop();
} else {
- logger.stagePop();
- logger.stagePush("MeshStratification");
sieveMesh->getSieve()->setChart(SieveMesh::sieve_type::chart_type());
sieveMesh->getSieve()->allocate();
sieveMesh->stratify();
- logger.stagePop();
} // if/else
- logger.stagePush("MeshCoordinates");
ALE::SieveBuilder<SieveMesh>::buildCoordinates(sieveMesh, spaceDim, &(*coordinates)[0]);
- logger.stagePop(); // Coordinates
sieveMesh->getFactory()->clear();
}
More information about the CIG-COMMITS
mailing list