[cig-commits] r21558 - in short/3D/PyLith/trunk: libsrc/pylith/bc unittests/libtests/bc
brad at geodynamics.org
brad at geodynamics.org
Mon Mar 18 11:46:25 PDT 2013
Author: brad
Date: 2013-03-18 11:46:25 -0700 (Mon, 18 Mar 2013)
New Revision: 21558
Modified:
short/3D/PyLith/trunk/libsrc/pylith/bc/AbsorbingDampers.cc
short/3D/PyLith/trunk/libsrc/pylith/bc/BCIntegratorSubMesh.cc
short/3D/PyLith/trunk/libsrc/pylith/bc/BoundaryCondition.cc
short/3D/PyLith/trunk/libsrc/pylith/bc/BoundaryConditionPoints.cc
short/3D/PyLith/trunk/libsrc/pylith/bc/DirichletBoundary.cc
short/3D/PyLith/trunk/libsrc/pylith/bc/Neumann.cc
short/3D/PyLith/trunk/libsrc/pylith/bc/TimeDependentPoints.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryConditionPoints.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryMesh.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBCMulti.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundary.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestTimeDependentPoints.cc
Log:
Code cleanup. Removed ALE and Sieve stuff from bc.
Modified: short/3D/PyLith/trunk/libsrc/pylith/bc/AbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/bc/AbsorbingDampers.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/libsrc/pylith/bc/AbsorbingDampers.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -99,8 +99,6 @@
const int numQuadPts = _quadrature->numQuadPts();
const int spaceDim = cellGeometry.spaceDim();
const int fiberDim = numQuadPts * spaceDim;
- ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- logger.stagePush("BoundaryConditions");
delete _parameters;
_parameters = new topology::Fields<topology::Field<topology::SubMesh> >(*_boundaryMesh);
@@ -108,8 +106,6 @@
_parameters->add("damping constants", "damping_constants", topology::FieldBase::FACES_FIELD, fiberDim);
_parameters->get("damping constants").allocate();
- logger.stagePop();
-
// Containers for orientation information
const int orientationSize = spaceDim * spaceDim;
const int jacobianSize = spaceDim * cellDim;
@@ -449,8 +445,8 @@
velocityVisitor.getClosure(&velocityArray, &velocitySize, c);
assert(velocitySize == numBasis*spaceDim);
- const PetscInt doff = dampingConsts.sectionOffset(c);
- assert(numQuadPts*spaceDim == dampingConsts.sectionDof(c));
+ const PetscInt doff = dampingConstsVisitor.sectionOffset(c);
+ assert(numQuadPts*spaceDim == dampingConstsVisitor.sectionDof(c));
#if defined(DETAILED_EVENT_LOGGING)
_logger->eventEnd(restrictEvent);
Modified: short/3D/PyLith/trunk/libsrc/pylith/bc/BCIntegratorSubMesh.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/bc/BCIntegratorSubMesh.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/libsrc/pylith/bc/BCIntegratorSubMesh.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -21,6 +21,7 @@
#include "BCIntegratorSubMesh.hh" // implementation of object methods
#include "pylith/topology/SubMesh.hh" // USES SubMesh
+#include "pylith/topology/Stratum.hh" // USES Stratum
// ----------------------------------------------------------------------
typedef pylith::topology::SubMesh::SieveMesh SieveSubMesh;
@@ -87,32 +88,29 @@
const int numCorners = _quadrature->numBasis();
// Get 'surface' cells (1 dimension lower than top-level cells)
- const ALE::Obj<SieveSubMesh>& sieveSubMesh = _boundaryMesh->sieveMesh();
- assert(!sieveSubMesh.isNull());
- const ALE::Obj<SieveSubMesh::label_sequence>& cells =
- sieveSubMesh->heightStratum(1);
- assert(!cells.isNull());
- const SieveSubMesh::label_sequence::iterator cellsBegin = cells->begin();
- const SieveSubMesh::label_sequence::iterator cellsEnd = cells->end();
+ const PetscDM dmSubMesh = _boundaryMesh->dmMesh();assert(dmSubMesh);
+ topology::Stratum heightStratum(dmSubMesh, topology::Stratum::HEIGHT, 1);
+ const PetscInt cStart = heightStratum.begin();
+ const PetscInt cEnd = heightStratum.end();
+ throw std::logic_error("BCIntegratorSubMesh::verifyConfiguration(mesh) not implemented for PETSc dm.");
+#if 0 // :MATT: Update this for PETSc dm
+
// Make sure surface cells are compatible with quadrature.
- const int boundaryDepth = sieveSubMesh->depth()-1; // depth of bndry cells
- for (SieveSubMesh::label_sequence::iterator c_iter=cellsBegin;
- c_iter != cellsEnd;
- ++c_iter) {
- const int cellNumCorners =
- sieveSubMesh->getNumCellCorners(*c_iter, boundaryDepth);
+ const int boundaryDepth = sieveSubMesh->depth()-1; // depth of bndry cells // UPDATE THIS
+ for (PetscInt c = cStart; c < cEnd; ++c) {
+ const int cellNumCorners = sieveSubMesh->getNumCellCorners(c, boundaryDepth); // UPDATE THIS
if (numCorners != cellNumCorners) {
std::ostringstream msg;
msg << "Quadrature is incompatible with cell for boundary condition '"
<< _label << "'.\n"
- << "Cell " << *c_iter << " has " << cellNumCorners
+ << "Cell " << c << " has " << cellNumCorners
<< " vertices but quadrature reference cell has "
<< numCorners << " vertices.";
throw std::runtime_error(msg.str());
} // if
} // for
-
+#endif
} // verifyConfiguration
Modified: short/3D/PyLith/trunk/libsrc/pylith/bc/BoundaryCondition.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/bc/BoundaryCondition.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/libsrc/pylith/bc/BoundaryCondition.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -50,6 +50,8 @@
void
pylith::bc::BoundaryCondition::verifyConfiguration(const topology::Mesh& mesh) const
{ // verifyConfiguration
+ throw std::logic_error("BoundaryCondition::verifyConfiguration(mesh) not implemented for PETSc dm.");
+#if 0 // :MATT: Update this for PETSc dm.
const ALE::Obj<topology::Mesh::SieveMesh>& sieveMesh = mesh.sieveMesh();
assert(!sieveMesh.isNull());
@@ -59,6 +61,7 @@
<< "' for boundary condition.";
throw std::runtime_error(msg.str());
} // if
+#endif
} // verifyConfiguration
Modified: short/3D/PyLith/trunk/libsrc/pylith/bc/BoundaryConditionPoints.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/bc/BoundaryConditionPoints.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/libsrc/pylith/bc/BoundaryConditionPoints.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -67,9 +67,6 @@
{ // _getPoints
typedef topology::Mesh::IntSection::chart_type chart_type;
- ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- logger.stagePush("BoundaryConditions");
-
PetscDM dmMesh = mesh.dmMesh();assert(dmMesh);
PetscDMLabel label = NULL;
PetscIS pointIS = NULL;
@@ -92,8 +89,6 @@
for(PetscInt p = 0; p < numPoints; ++p) {_points[p] = points[p];}
err = ISRestoreIndices(pointIS, &points);CHECK_PETSC_ERROR(err);
err = ISDestroy(&pointIS);CHECK_PETSC_ERROR(err);
-
- logger.stagePop();
} // _getPoints
Modified: short/3D/PyLith/trunk/libsrc/pylith/bc/DirichletBoundary.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/bc/DirichletBoundary.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/libsrc/pylith/bc/DirichletBoundary.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -87,9 +87,6 @@
assert(cs);
const int spaceDim = cs->spaceDim();
- ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- logger.stagePush("BoundaryConditions");
-
if (!_outputFields) {
_outputFields = new topology::Fields<topology::Field<topology::SubMesh> >(*_boundaryMesh);
} // if
@@ -106,8 +103,6 @@
bufferScalar.scale(timeScale);
bufferScalar.allocate();
- logger.stagePop();
-
if (0 == strcasecmp(name, "initial_value"))
return _bufferVector("initial", "initial_displacement", lengthScale);
else if (0 == strcasecmp(name, "rate_of_change"))
Modified: short/3D/PyLith/trunk/libsrc/pylith/bc/Neumann.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/bc/Neumann.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/libsrc/pylith/bc/Neumann.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -70,13 +70,8 @@
pylith::bc::Neumann::initialize(const topology::Mesh& mesh,
const PylithScalar upDir[3])
{ // initialize
- ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- logger.stagePush("BoundaryConditions");
-
_queryDatabases();
_paramsLocalToGlobal(upDir);
-
- logger.stagePop();
} // initialize
// ----------------------------------------------------------------------
@@ -454,8 +449,8 @@
_normalizer->nondimensionalize(&valuesCell[0], valuesCell.size(), scale);
// Update section
- const PetscInt voff = valueField.sectionOffset(c);
- const PetscInt vdof = valueField.sectionDof(c);
+ const PetscInt voff = valueVisitor.sectionOffset(c);
+ const PetscInt vdof = valueVisitor.sectionDof(c);
assert(numQuadPts*querySize == vdof);
for(PetscInt d = 0; d < vdof; ++d)
valueArray[voff+d] = valuesCell[d];
Modified: short/3D/PyLith/trunk/libsrc/pylith/bc/TimeDependentPoints.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/bc/TimeDependentPoints.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/libsrc/pylith/bc/TimeDependentPoints.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -113,9 +113,6 @@
strcpy(rateNames[i], name.c_str());
} // for
- ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
- logger.stagePush("BoundaryConditions");
-
delete _parameters;
_parameters = new topology::Fields<topology::Field<topology::Mesh> >(mesh);
@@ -215,8 +212,6 @@
} // for
delete[] valueNames; valueNames = 0;
delete[] rateNames; rateNames = 0;
-
- logger.stagePop();
} // _queryDatabases
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -36,8 +36,6 @@
#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
#include "spatialdata/spatialdb/SimpleIOAscii.hh" // USES SimpleIOAscii
-#include <stdexcept> // USES std::runtime_erro
-
// ----------------------------------------------------------------------
CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestAbsorbingDampers );
@@ -382,129 +380,125 @@
CPPUNIT_ASSERT(_data);
CPPUNIT_ASSERT(_quadrature);
- try {
- // Setup mesh
- meshio::MeshIOAscii iohandler;
- iohandler.filename(_data->meshFilename);
- iohandler.read(mesh);
+ // Setup mesh
+ meshio::MeshIOAscii iohandler;
+ iohandler.filename(_data->meshFilename);
+ iohandler.read(mesh);
- // Set coordinate system
- spatialdata::geocoords::CSCart cs;
- cs.setSpaceDim(mesh->dimension());
- cs.initialize();
- mesh->coordsys(&cs);
+ // Set coordinate system
+ spatialdata::geocoords::CSCart cs;
+ cs.setSpaceDim(mesh->dimension());
+ cs.initialize();
+ mesh->coordsys(&cs);
- spatialdata::units::Nondimensional normalizer;
- normalizer.lengthScale(_data->lengthScale);
- normalizer.pressureScale(_data->pressureScale);
- normalizer.densityScale(_data->densityScale);
- normalizer.timeScale(_data->timeScale);
- mesh->nondimensionalize(normalizer);
+ spatialdata::units::Nondimensional normalizer;
+ normalizer.lengthScale(_data->lengthScale);
+ normalizer.pressureScale(_data->pressureScale);
+ normalizer.densityScale(_data->densityScale);
+ normalizer.timeScale(_data->timeScale);
+ mesh->nondimensionalize(normalizer);
- // Set up quadrature
- _quadrature->initialize(_data->basis, _data->numQuadPts, _data->numBasis,
- _data->basisDerivRef, _data->numQuadPts,
- _data->numBasis, _data->cellDim,
- _data->quadPts, _data->numQuadPts, _data->cellDim,
- _data->quadWts, _data->numQuadPts,
- _data->spaceDim);
+ // Set up quadrature
+ _quadrature->initialize(_data->basis, _data->numQuadPts, _data->numBasis,
+ _data->basisDerivRef, _data->numQuadPts,
+ _data->numBasis, _data->cellDim,
+ _data->quadPts, _data->numQuadPts, _data->cellDim,
+ _data->quadWts, _data->numQuadPts,
+ _data->spaceDim);
- // Set up database
- spatialdata::spatialdb::SimpleDB db("TestAbsorbingDampers");
- spatialdata::spatialdb::SimpleIOAscii dbIO;
- dbIO.filename(_data->spatialDBFilename);
- db.ioHandler(&dbIO);
- db.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
+ // Set up database
+ spatialdata::spatialdb::SimpleDB db("TestAbsorbingDampers");
+ spatialdata::spatialdb::SimpleIOAscii dbIO;
+ dbIO.filename(_data->spatialDBFilename);
+ db.ioHandler(&dbIO);
+ db.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
- const PylithScalar upDir[] = { 0.0, 0.0, 1.0 };
+ const PylithScalar upDir[] = { 0.0, 0.0, 1.0 };
- bc->quadrature(_quadrature);
- bc->timeStep(_data->dt);
- bc->label(_data->label);
- bc->db(&db);
- bc->normalizer(normalizer);
- bc->createSubMesh(*mesh);
- bc->initialize(*mesh, upDir);
+ bc->quadrature(_quadrature);
+ bc->timeStep(_data->dt);
+ bc->label(_data->label);
+ bc->db(&db);
+ bc->normalizer(normalizer);
+ bc->createSubMesh(*mesh);
+ bc->initialize(*mesh, upDir);
- //bc->_boundaryMesh->view("BOUNDARY MESH");
+ //bc->_boundaryMesh->view("BOUNDARY MESH");
- // Setup fields
- CPPUNIT_ASSERT(fields);
- fields->add("residual", "residual");
- fields->add("dispIncr(t->t+dt)", "displacement_increment");
- fields->add("disp(t)", "displacement");
- fields->add("disp(t-dt)", "displacement");
- fields->add("velocity(t)", "velocity");
- fields->solutionName("dispIncr(t->t+dt)");
+ // Setup fields
+ CPPUNIT_ASSERT(fields);
+ fields->add("residual", "residual");
+ fields->add("dispIncr(t->t+dt)", "displacement_increment");
+ fields->add("disp(t)", "displacement");
+ fields->add("disp(t-dt)", "displacement");
+ fields->add("velocity(t)", "velocity");
+ fields->solutionName("dispIncr(t->t+dt)");
- topology::Field<topology::Mesh>& residual = fields->get("residual");
- PetscDM dmMesh = mesh->dmMesh();
- PetscInt vStart, vEnd;
- PetscErrorCode err;
+ topology::Field<topology::Mesh>& residual = fields->get("residual");
+ PetscDM dmMesh = mesh->dmMesh();
+ PetscInt vStart, vEnd;
+ PetscErrorCode err;
- CPPUNIT_ASSERT(dmMesh);
- err = DMPlexGetDepthStratum(dmMesh, 0, &vStart, &vEnd);CHECK_PETSC_ERROR(err);
- residual.newSection(pylith::topology::FieldBase::VERTICES_FIELD, _data->spaceDim);
- residual.allocate();
- residual.zero();
- residual.scale(normalizer.lengthScale());
- fields->copyLayout("residual");
+ CPPUNIT_ASSERT(dmMesh);
+ err = DMPlexGetDepthStratum(dmMesh, 0, &vStart, &vEnd);CHECK_PETSC_ERROR(err);
+ residual.newSection(pylith::topology::FieldBase::VERTICES_FIELD, _data->spaceDim);
+ residual.allocate();
+ residual.zero();
+ residual.scale(normalizer.lengthScale());
+ fields->copyLayout("residual");
- const int totalNumVertices = vEnd - vStart;
- const int fieldSize = _data->spaceDim * totalNumVertices;
- PetscSection dispTIncrSection = fields->get("dispIncr(t->t+dt)").petscSection();
- PetscVec dispTIncrVec = fields->get("dispIncr(t->t+dt)").localVector();
- PetscSection dispTSection = fields->get("disp(t)").petscSection();
- PetscVec dispTVec = fields->get("disp(t)").localVector();
- PetscSection dispTmdtSection = fields->get("disp(t-dt)").petscSection();
- PetscVec dispTmdtVec = fields->get("disp(t-dt)").localVector();
- PetscSection velSection = fields->get("velocity(t)").petscSection();
- PetscVec velVec = fields->get("velocity(t)").localVector();
- PetscScalar *dispTIncrArray, *dispTArray, *dispTmdtArray, *velArray;
- const int spaceDim = _data->spaceDim;
- const PylithScalar dt = _data->dt;
+ const int totalNumVertices = vEnd - vStart;
+ const int fieldSize = _data->spaceDim * totalNumVertices;
+ PetscSection dispTIncrSection = fields->get("dispIncr(t->t+dt)").petscSection();
+ PetscVec dispTIncrVec = fields->get("dispIncr(t->t+dt)").localVector();
+ PetscSection dispTSection = fields->get("disp(t)").petscSection();
+ PetscVec dispTVec = fields->get("disp(t)").localVector();
+ PetscSection dispTmdtSection = fields->get("disp(t-dt)").petscSection();
+ PetscVec dispTmdtVec = fields->get("disp(t-dt)").localVector();
+ PetscSection velSection = fields->get("velocity(t)").petscSection();
+ PetscVec velVec = fields->get("velocity(t)").localVector();
+ PetscScalar *dispTIncrArray, *dispTArray, *dispTmdtArray, *velArray;
+ const int spaceDim = _data->spaceDim;
+ const PylithScalar dt = _data->dt;
- CPPUNIT_ASSERT(dispTIncrSection);CPPUNIT_ASSERT(dispTIncrVec);
- CPPUNIT_ASSERT(dispTSection);CPPUNIT_ASSERT(dispTVec);
- CPPUNIT_ASSERT(dispTmdtSection);CPPUNIT_ASSERT(dispTmdtVec);
- CPPUNIT_ASSERT(velSection);CPPUNIT_ASSERT(velVec);
- err = VecGetArray(dispTIncrVec, &dispTIncrArray);CHECK_PETSC_ERROR(err);
- err = VecGetArray(dispTVec, &dispTArray);CHECK_PETSC_ERROR(err);
- err = VecGetArray(dispTmdtVec, &dispTmdtArray);CHECK_PETSC_ERROR(err);
- err = VecGetArray(velVec, &velArray);CHECK_PETSC_ERROR(err);
- for(PetscInt v = vStart; v < vEnd; ++v) {
- PetscInt dof, off;
+ CPPUNIT_ASSERT(dispTIncrSection);CPPUNIT_ASSERT(dispTIncrVec);
+ CPPUNIT_ASSERT(dispTSection);CPPUNIT_ASSERT(dispTVec);
+ CPPUNIT_ASSERT(dispTmdtSection);CPPUNIT_ASSERT(dispTmdtVec);
+ CPPUNIT_ASSERT(velSection);CPPUNIT_ASSERT(velVec);
+ err = VecGetArray(dispTIncrVec, &dispTIncrArray);CHECK_PETSC_ERROR(err);
+ err = VecGetArray(dispTVec, &dispTArray);CHECK_PETSC_ERROR(err);
+ err = VecGetArray(dispTmdtVec, &dispTmdtArray);CHECK_PETSC_ERROR(err);
+ err = VecGetArray(velVec, &velArray);CHECK_PETSC_ERROR(err);
+ for(PetscInt v = vStart; v < vEnd; ++v) {
+ PetscInt dof, off;
- err = PetscSectionGetDof(dispTIncrSection, v, &dof);CHECK_PETSC_ERROR(err);
- err = PetscSectionGetOffset(dispTIncrSection, v, &off);CHECK_PETSC_ERROR(err);
- for(PetscInt d = 0; d < dof; ++d) {
- dispTIncrArray[off+d] = _data->fieldTIncr[(v - vStart)*spaceDim+d];
- }
- err = PetscSectionGetDof(dispTSection, v, &dof);CHECK_PETSC_ERROR(err);
- err = PetscSectionGetOffset(dispTSection, v, &off);CHECK_PETSC_ERROR(err);
- for(PetscInt d = 0; d < dof; ++d) {
- dispTIncrArray[off+d] = _data->fieldT[(v - vStart)*spaceDim+d];
- }
- err = PetscSectionGetDof(dispTmdtSection, v, &dof);CHECK_PETSC_ERROR(err);
- err = PetscSectionGetOffset(dispTmdtSection, v, &off);CHECK_PETSC_ERROR(err);
- for(PetscInt d = 0; d < dof; ++d) {
- dispTIncrArray[off+d] = _data->fieldTmdt[(v - vStart)*spaceDim+d];
- }
- err = PetscSectionGetDof(velSection, v, &dof);CHECK_PETSC_ERROR(err);
- err = PetscSectionGetOffset(velSection, v, &off);CHECK_PETSC_ERROR(err);
- for(PetscInt d = 0; d < dof; ++d) {
- velArray[off+d] = (_data->fieldTIncr[(v - vStart)*spaceDim+d] +
- _data->fieldT[(v - vStart)*spaceDim+d] -
- _data->fieldTmdt[(v - vStart)*spaceDim+d]) / (2*dt);
- }
- } // for
- err = VecRestoreArray(dispTIncrVec, &dispTIncrArray);CHECK_PETSC_ERROR(err);
- err = VecRestoreArray(dispTVec, &dispTArray);CHECK_PETSC_ERROR(err);
- err = VecRestoreArray(dispTmdtVec, &dispTmdtArray);CHECK_PETSC_ERROR(err);
- err = VecRestoreArray(velVec, &velArray);CHECK_PETSC_ERROR(err);
- } catch (const ALE::Exception& err) {
- throw std::runtime_error(err.msg());
- } // catch
+ err = PetscSectionGetDof(dispTIncrSection, v, &dof);CHECK_PETSC_ERROR(err);
+ err = PetscSectionGetOffset(dispTIncrSection, v, &off);CHECK_PETSC_ERROR(err);
+ for(PetscInt d = 0; d < dof; ++d) {
+ dispTIncrArray[off+d] = _data->fieldTIncr[(v - vStart)*spaceDim+d];
+ }
+ err = PetscSectionGetDof(dispTSection, v, &dof);CHECK_PETSC_ERROR(err);
+ err = PetscSectionGetOffset(dispTSection, v, &off);CHECK_PETSC_ERROR(err);
+ for(PetscInt d = 0; d < dof; ++d) {
+ dispTIncrArray[off+d] = _data->fieldT[(v - vStart)*spaceDim+d];
+ }
+ err = PetscSectionGetDof(dispTmdtSection, v, &dof);CHECK_PETSC_ERROR(err);
+ err = PetscSectionGetOffset(dispTmdtSection, v, &off);CHECK_PETSC_ERROR(err);
+ for(PetscInt d = 0; d < dof; ++d) {
+ dispTIncrArray[off+d] = _data->fieldTmdt[(v - vStart)*spaceDim+d];
+ }
+ err = PetscSectionGetDof(velSection, v, &dof);CHECK_PETSC_ERROR(err);
+ err = PetscSectionGetOffset(velSection, v, &off);CHECK_PETSC_ERROR(err);
+ for(PetscInt d = 0; d < dof; ++d) {
+ velArray[off+d] = (_data->fieldTIncr[(v - vStart)*spaceDim+d] +
+ _data->fieldT[(v - vStart)*spaceDim+d] -
+ _data->fieldTmdt[(v - vStart)*spaceDim+d]) / (2*dt);
+ }
+ } // for
+ err = VecRestoreArray(dispTIncrVec, &dispTIncrArray);CHECK_PETSC_ERROR(err);
+ err = VecRestoreArray(dispTVec, &dispTArray);CHECK_PETSC_ERROR(err);
+ err = VecRestoreArray(dispTmdtVec, &dispTmdtArray);CHECK_PETSC_ERROR(err);
+ err = VecRestoreArray(velVec, &velArray);CHECK_PETSC_ERROR(err);
} // _initialize
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryConditionPoints.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryConditionPoints.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryConditionPoints.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -25,6 +25,7 @@
#include "data/PointForceDataTri3.hh" // USES PointForceDataTri3
#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/topology/Stratum.hh" // USES Stratum
#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
@@ -33,9 +34,6 @@
CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestBoundaryConditionPoints );
// ----------------------------------------------------------------------
-typedef pylith::topology::Mesh::SieveMesh SieveMesh;
-
-// ----------------------------------------------------------------------
// Test _getPoints().
void
pylith::bc::TestBoundaryConditionPoints::testGetPoints(void)
@@ -58,10 +56,9 @@
bc.label(data.label);
bc.BoundaryConditionPoints::_getPoints(mesh);
- const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
- CPPUNIT_ASSERT(!sieveMesh.isNull());
-
- const int numCells = sieveMesh->heightStratum(0)->size();
+ const PetscDM dmMesh = mesh.dmMesh();CPPUNIT_ASSERT(dmMesh);
+ topology::Stratum heightStratum(dmMesh, topology::Stratum::HEIGHT, 0);
+ const PetscInt numCells = heightStratum.size();
const size_t numPoints = data.numForcePts;
// Check points
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryMesh.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryMesh.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -30,10 +30,6 @@
#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
// ----------------------------------------------------------------------
-typedef pylith::topology::SubMesh::SieveMesh SieveMesh;
-typedef pylith::topology::SubMesh::SieveMesh SieveSubMesh;
-
-// ----------------------------------------------------------------------
// Setup testing data.
void
pylith::bc::TestBoundaryMesh::setUp(void)
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBC.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -27,6 +27,7 @@
#include "pylith/topology/Mesh.hh" // USES Mesh
#include "pylith/topology/Field.hh" // USES Field
#include "pylith/topology/Fields.hh" // USES Fields
+#include "pylith/topology/Stratum.hh" // USES Stratum
#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
@@ -66,15 +67,16 @@
void
pylith::bc::TestDirichletBC::testInitialize(void)
{ // testInitialize
+ CPPUNIT_ASSERT(_data);
+
topology::Mesh mesh;
DirichletBC bc;
_initialize(&mesh, &bc);
- CPPUNIT_ASSERT(0 != _data);
- const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
- CPPUNIT_ASSERT(!sieveMesh.isNull());
-
- const int numCells = sieveMesh->heightStratum(0)->size();
+ const PetscDM dmMesh = mesh.dmMesh();CPPUNIT_ASSERT(dmMesh);
+ topology::Stratum heightStratum(dmMesh, topology::Stratum::HEIGHT, 0);
+ const PetscInt numCells = heightStratum.size();
+
const int numFixedDOF = _data->numFixedDOF;
const size_t numPoints = _data->numConstrainedPts;
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBCMulti.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBCMulti.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBCMulti.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -27,17 +27,12 @@
#include "pylith/topology/Mesh.hh" // USES Mesh
#include "pylith/topology/Field.hh" // USES Field
#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
-#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
#include "spatialdata/spatialdb/SimpleIOAscii.hh" // USES SimpleIOAscii
// ----------------------------------------------------------------------
-typedef pylith::topology::Mesh::SieveMesh SieveMesh;
-typedef pylith::topology::Mesh::RealSection RealSection;
-
-// ----------------------------------------------------------------------
// Setup testing data.
void
pylith::bc::TestDirichletBCMulti::setUp(void)
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundary.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundary.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundary.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -26,6 +26,7 @@
#include "pylith/topology/Mesh.hh" // USES Mesh
#include "pylith/topology/SubMesh.hh" // USES SubMesh
+#include "pylith/topology/Stratum.hh" // USES Stratum
#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
@@ -38,9 +39,6 @@
CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletBoundary );
// ----------------------------------------------------------------------
-typedef pylith::topology::SubMesh::SieveMesh SieveMesh;
-
-// ----------------------------------------------------------------------
// Setup testing data.
void
pylith::bc::TestDirichletBoundary::setUp(void)
@@ -73,30 +71,19 @@
DirichletBoundary bc;
_initialize(&mesh, &bc);
- CPPUNIT_ASSERT(0 != _data);
+ CPPUNIT_ASSERT(_data);
- const int numCells = mesh.sieveMesh()->heightStratum(0)->size();
+ const PetscDM dmMesh = mesh.dmMesh();CPPUNIT_ASSERT(dmMesh);
const int numFixedDOF = _data->numFixedDOF;
const size_t numBoundary = _data->numConstrainedPts;
- // Check vertices in boundary mesh
- const ALE::Obj<SieveMesh>& sieveMesh = bc._boundaryMesh->sieveMesh();
- const ALE::Obj<SieveMesh::label_sequence>& vertices =
- sieveMesh->depthStratum(0);
- const SieveMesh::label_sequence::iterator verticesEnd = vertices->end();
+ // Check vertices in boundary mesh.
+ const PetscDM dmSubMesh = bc._boundaryMesh->dmMesh();CPPUNIT_ASSERT(dmSubMesh);
+ topology::Stratum depthStratum(dmSubMesh, topology::Stratum::DEPTH, 0);
+ CPPUNIT_ASSERT_EQUAL(PetscInt(numBoundary), depthStratum.size());
- // Check cells
- const int offset = numCells;
- if (numFixedDOF > 0) {
- int i = 0;
- for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
- v_iter != verticesEnd;
- ++v_iter, ++i) {
- CPPUNIT_ASSERT_EQUAL(_data->constrainedPoints[i]+offset, *v_iter);
- } // for
- CPPUNIT_ASSERT_EQUAL(int(numBoundary), i);
- } // if
+ // :TODO: Check cells in boundary mesh.
} // testInitialize
// ----------------------------------------------------------------------
@@ -104,8 +91,8 @@
pylith::bc::TestDirichletBoundary::_initialize(topology::Mesh* mesh,
DirichletBoundary* const bc) const
{ // _initialize
- CPPUNIT_ASSERT(0 != _data);
- CPPUNIT_ASSERT(0 != bc);
+ CPPUNIT_ASSERT(_data);
+ CPPUNIT_ASSERT(bc);
meshio::MeshIOAscii iohandler;
iohandler.filename(_data->meshFilename);
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -631,40 +631,36 @@
CPPUNIT_ASSERT(mesh);
CPPUNIT_ASSERT(bc);
- try {
- // Set up mesh
- meshio::MeshIOAscii iohandler;
- iohandler.filename(_data->meshFilename);
- iohandler.read(mesh);
+ // Set up mesh
+ meshio::MeshIOAscii iohandler;
+ iohandler.filename(_data->meshFilename);
+ iohandler.read(mesh);
- // Set up coordinates
- spatialdata::geocoords::CSCart cs;
- cs.setSpaceDim(mesh->dimension());
- cs.initialize();
- mesh->coordsys(&cs);
+ // Set up coordinates
+ spatialdata::geocoords::CSCart cs;
+ cs.setSpaceDim(mesh->dimension());
+ cs.initialize();
+ mesh->coordsys(&cs);
- spatialdata::units::Nondimensional normalizer;
- normalizer.lengthScale(_data->lengthScale);
- normalizer.pressureScale(_data->pressureScale);
- normalizer.densityScale(_data->densityScale);
- normalizer.timeScale(_data->timeScale);
- mesh->nondimensionalize(normalizer);
+ spatialdata::units::Nondimensional normalizer;
+ normalizer.lengthScale(_data->lengthScale);
+ normalizer.pressureScale(_data->pressureScale);
+ normalizer.densityScale(_data->densityScale);
+ normalizer.timeScale(_data->timeScale);
+ mesh->nondimensionalize(normalizer);
- // Set up quadrature
- _quadrature->initialize(_data->basis, _data->numQuadPts, _data->numBasis,
- _data->basisDerivRef, _data->numQuadPts,
- _data->numBasis, _data->cellDim,
- _data->quadPts, _data->numQuadPts, _data->cellDim,
- _data->quadWts, _data->numQuadPts,
- _data->spaceDim);
+ // Set up quadrature
+ _quadrature->initialize(_data->basis, _data->numQuadPts, _data->numBasis,
+ _data->basisDerivRef, _data->numQuadPts,
+ _data->numBasis, _data->cellDim,
+ _data->quadPts, _data->numQuadPts, _data->cellDim,
+ _data->quadWts, _data->numQuadPts,
+ _data->spaceDim);
- bc->quadrature(_quadrature);
- bc->label(_data->label);
- bc->normalizer(normalizer);
- bc->createSubMesh(*mesh);
- } catch (const ALE::Exception& err) {
- throw std::runtime_error(err.msg());
- } // catch
+ bc->quadrature(_quadrature);
+ bc->label(_data->label);
+ bc->normalizer(normalizer);
+ bc->createSubMesh(*mesh);
} // _preinitialize
// ----------------------------------------------------------------------
@@ -679,37 +675,33 @@
CPPUNIT_ASSERT(fields);
CPPUNIT_ASSERT(_quadrature);
- try {
- _preinitialize(mesh, bc);
+ _preinitialize(mesh, bc);
- // Set up database
- spatialdata::spatialdb::SimpleDB db("TestNeumann");
- spatialdata::spatialdb::SimpleIOAscii dbIO;
- dbIO.filename(_data->spatialDBFilename);
- db.ioHandler(&dbIO);
- db.queryType(spatialdata::spatialdb::SimpleDB::LINEAR);
+ // Set up database
+ spatialdata::spatialdb::SimpleDB db("TestNeumann");
+ spatialdata::spatialdb::SimpleIOAscii dbIO;
+ dbIO.filename(_data->spatialDBFilename);
+ db.ioHandler(&dbIO);
+ db.queryType(spatialdata::spatialdb::SimpleDB::LINEAR);
- const PylithScalar upDir[] = { 0.0, 0.0, 1.0 };
+ const PylithScalar upDir[] = { 0.0, 0.0, 1.0 };
- bc->dbInitial(&db);
- bc->initialize(*mesh, upDir);
+ bc->dbInitial(&db);
+ bc->initialize(*mesh, upDir);
- // Set up fields
- CPPUNIT_ASSERT(0 != fields);
- fields->add("residual", "residual");
- fields->add("disp(t), bc(t+dt)", "displacement");
- fields->solutionName("disp(t), bc(t+dt)");
+ // Set up fields
+ CPPUNIT_ASSERT(0 != fields);
+ fields->add("residual", "residual");
+ fields->add("disp(t), bc(t+dt)", "displacement");
+ fields->solutionName("disp(t), bc(t+dt)");
- topology::Field<topology::Mesh>& residual = fields->get("residual");
- residual.newSection(topology::FieldBase::VERTICES_FIELD, _data->spaceDim);
- residual.allocate();
- residual.scale(_data->lengthScale);
- residual.zero();
+ topology::Field<topology::Mesh>& residual = fields->get("residual");
+ residual.newSection(topology::FieldBase::VERTICES_FIELD, _data->spaceDim);
+ residual.allocate();
+ residual.scale(_data->lengthScale);
+ residual.zero();
- fields->copyLayout("residual");
- } catch (const ALE::Exception& err) {
- throw std::runtime_error(err.msg());
- } // catch
+ fields->copyLayout("residual");
} // _initialize
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestTimeDependentPoints.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestTimeDependentPoints.cc 2013-03-18 18:46:00 UTC (rev 21557)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestTimeDependentPoints.cc 2013-03-18 18:46:25 UTC (rev 21558)
@@ -36,10 +36,6 @@
CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestTimeDependentPoints );
// ----------------------------------------------------------------------
-typedef pylith::topology::Mesh::SieveMesh SieveMesh;
-typedef pylith::topology::Mesh::RealSection RealSection;
-
-// ----------------------------------------------------------------------
namespace pylith {
namespace bc {
namespace _TestTimeDependentPoints {
More information about the CIG-COMMITS
mailing list