[cig-commits] r13956 - in short/3D/PyLith/branches/pylith-swig: . libsrc libsrc/bc libsrc/feassemble libsrc/topology modulesrc/bc modulesrc/include pylith/bc unittests/libtests/bc unittests/libtests/topology unittests/pytests/bc
brad at geodynamics.org
brad at geodynamics.org
Sun Jan 25 21:47:03 PST 2009
Author: brad
Date: 2009-01-25 21:47:02 -0800 (Sun, 25 Jan 2009)
New Revision: 13956
Added:
short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.cc
short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.hh
short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.icc
short/3D/PyLith/branches/pylith-swig/modulesrc/bc/BoundaryCondition.i
short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBC.i
short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBoundary.i
short/3D/PyLith/branches/pylith-swig/modulesrc/bc/bc.i
short/3D/PyLith/branches/pylith-swig/modulesrc/include/doublearray.i
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBC.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBC.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCHex8.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCHex8.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2b.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2b.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMulti.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMulti.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTet4.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTet4.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTri3.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTri3.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCQuad4.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCQuad4.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTet4.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTet4.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTri3.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTri3.hh
short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletBC.py
Removed:
short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.cc
short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.hh
short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.icc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPoints.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPoints.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsHex8.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsHex8.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2b.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2b.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMulti.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMulti.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTet4.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTet4.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTri3.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTri3.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsQuad4.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsQuad4.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTet4.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTet4.hh
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTri3.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTri3.hh
short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletPoints.py
Modified:
short/3D/PyLith/branches/pylith-swig/TODO
short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
short/3D/PyLith/branches/pylith-swig/libsrc/bc/BoundaryCondition.cc
short/3D/PyLith/branches/pylith-swig/libsrc/bc/BoundaryCondition.hh
short/3D/PyLith/branches/pylith-swig/libsrc/bc/BoundaryCondition.icc
short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.cc
short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.hh
short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.icc
short/3D/PyLith/branches/pylith-swig/libsrc/bc/Makefile.am
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Constraint.hh
short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc
short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh
short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldUniform.cc
short/3D/PyLith/branches/pylith-swig/modulesrc/bc/
short/3D/PyLith/branches/pylith-swig/modulesrc/bc/Makefile.am
short/3D/PyLith/branches/pylith-swig/pylith/bc/BoundaryCondition.py
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/Makefile.am
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestBoundaryCondition.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestBoundaryMesh.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh
short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/testbc.py
Log:
Worked on updating constraint BC with new Mesh and Field objects, plus switching to SWIG.
Modified: short/3D/PyLith/branches/pylith-swig/TODO
===================================================================
--- short/3D/PyLith/branches/pylith-swig/TODO 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/TODO 2009-01-26 05:47:02 UTC (rev 13956)
@@ -12,6 +12,9 @@
FieldsManager (change to SolutionFields)
+ DirichletPoints (Python) - rate == None -> dbRate == 0
+ DirichletBoundary (Python) - rate == None -> dbRate == 0
+
1. Reduce memory use (new labels) [Matt]
2. Nondimensionalize [Brad]
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am 2009-01-26 05:47:02 UTC (rev 13956)
@@ -22,11 +22,9 @@
lib_LTLIBRARIES = libpylith.la
libpylith_la_SOURCES = \
- bc/AbsorbingDampers.cc \
bc/BoundaryCondition.cc \
+ bc/DirichletBC.cc \
bc/DirichletBoundary.cc \
- bc/DirichletPoints.cc \
- bc/Neumann.cc \
faults/BruneSlipFn.cc \
faults/ConstRateSlipFn.cc \
faults/CohesiveTopology.cc \
@@ -105,6 +103,9 @@
topology/RefineUniform.cc \
utils/EventLogger.cc
+# bc/Neumann.cc
+# bc/AbsorbingDampers.cc
+
libpylith_la_LDFLAGS = $(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
libpylith_la_LIBADD = \
-lspatialdata \
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/BoundaryCondition.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/BoundaryCondition.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/BoundaryCondition.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -14,6 +14,10 @@
#include "BoundaryCondition.hh" // implementation of object methods
+#include "pylith/topology/Mesh.hh" // USES Mesh
+
+#include <stdexcept> // USES std::runtime_error()
+
// ----------------------------------------------------------------------
// Default constructor.
pylith::bc::BoundaryCondition::BoundaryCondition(void) :
@@ -32,11 +36,12 @@
// ----------------------------------------------------------------------
// Verify configuration is acceptable.
void
-pylith::bc::BoundaryCondition::verifyConfiguration(const ALE::Obj<Mesh>& mesh) const
+pylith::bc::BoundaryCondition::verifyConfiguration(const topology::Mesh& mesh) const
{ // verifyConfiguration
- assert(!mesh.isNull());
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ assert(!sieveMesh.isNull());
- if (!mesh->hasIntSection(_label)) {
+ if (!sieveMesh->hasIntSection(_label)) {
std::ostringstream msg;
msg << "Mesh missing group of vertices '" << _label
<< " for boundary condition.";
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/BoundaryCondition.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/BoundaryCondition.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/BoundaryCondition.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -20,21 +20,23 @@
#if !defined(pylith_bc_boundarycondition_hh)
#define pylith_bc_boundarycondition_hh
-#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh, real_section_type
-#include "pylith/utils/petscfwd.h" // USES PETScMat
-#include "pylith/utils/array.hh" // USES double_array
+// Include directives ---------------------------------------------------
+#include "pylith/utils/arrayfwd.hh" // USES double_array
#include <string> // HASA std::string
-/// Namespace for pylith package
+// Forward declarations -------------------------------------------------
namespace pylith {
namespace bc {
class BoundaryCondition;
class TestBoundaryCondition; // unit testing
} // bc
+
+ namespace topology {
+ class Mesh; // USES Mesh
+ } // bc
} // pylith
-/// Namespace for spatialdata package
namespace spatialdata {
namespace geocoords {
class CoordSys;
@@ -45,7 +47,7 @@
} // spatialdb
} // spatialdata
-/// C++ abstract base class for BoundaryCondition object.
+// BoundaryCondition ----------------------------------------------------
class pylith::bc::BoundaryCondition
{ // class BoundaryCondition
friend class TestBoundaryCondition; // unit testing
@@ -70,7 +72,7 @@
*
* @returns Label of surface (from mesh generator).
*/
- const std::string& label(void) const;
+ const char* label(void) const;
/** Set database for boundary condition parameters.
*
@@ -80,20 +82,19 @@
/** Verify configuration.
*
- * @param mesh PETSc mesh
+ * @param mesh Finite-element mesh.
*/
virtual
- void verifyConfiguration(const ALE::Obj<Mesh>& mesh) const;
+ void verifyConfiguration(const topology::Mesh& mesh) const;
/** Initialize boundary condition.
*
- * @param mesh PETSc mesh
- * @param cs Coordinate system for mesh
+ * @param mesh Finite-element mesh.
+ * @param upDir Vertical direction (somtimes used in 3-D problems).
*/
virtual
- void initialize(const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* cs,
- const double_array& upDir) = 0;
+ void initialize(const topology::Mesh& mesh,
+ const double upDir[3]) = 0;
// NOT IMPLEMENTED ////////////////////////////////////////////////////
private :
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/BoundaryCondition.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/BoundaryCondition.icc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/BoundaryCondition.icc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -23,9 +23,9 @@
// Get label of boundary condition surface.
inline
-const std::string&
+const char*
pylith::bc::BoundaryCondition::label(void) const {
- return _label;
+ return _label.c_str();
}
// Set database for boundary condition parameters.
Copied: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.cc (from rev 13939, short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,337 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "DirichletBC.hh" // implementation of object methods
+
+#include "pylith/topology/Field.hh" // USES Field
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "spatialdata/spatialdb/SpatialDB.hh" // USES SpatialDB
+#include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
+#include "spatialdata/units/Nondimensional.hh" // USES Nondimensional
+
+#include <cstring> // USES strcpy()
+#include <cassert> // USES assert()
+#include <stdexcept> // USES std::runtime_error
+#include <sstream> // USES std::ostringstream
+
+// ----------------------------------------------------------------------
+// Default constructor.
+pylith::bc::DirichletBC::DirichletBC(void) :
+ _tRef(0.0),
+ _dbRate(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor.
+pylith::bc::DirichletBC::~DirichletBC(void)
+{ // destructor
+ _dbRate = 0; // Don't manage memory
+} // destructor
+
+// ----------------------------------------------------------------------
+// Set indices of fixed degrees of freedom.
+void
+pylith::bc::DirichletBC::fixedDOF(const int* flags,
+ const int size)
+{ // fixedDOF
+ if (size > 0)
+ assert(0 != flags);
+
+ _fixedDOF.resize(size);
+ for (int i=0; i < size; ++i)
+ _fixedDOF[i] = flags[i];
+} // fixedDOF
+
+// ----------------------------------------------------------------------
+// Initialize boundary condition.
+void
+pylith::bc::DirichletBC::initialize(const topology::Mesh& mesh,
+ const double upDir[3])
+{ // initialize
+ const int numFixedDOF = _fixedDOF.size();
+ if (0 == numFixedDOF)
+ return;
+
+ _getPoints(mesh);
+ _setupQueryDatabases();
+ _queryDatabases(mesh);
+} // initialize
+
+// ----------------------------------------------------------------------
+// Set number of degrees of freedom that are constrained at points in field.
+void
+pylith::bc::DirichletBC::setConstraintSizes(const topology::Field& field,
+ const topology::Mesh& mesh)
+{ // setConstraintSizes
+ const int numFixedDOF = _fixedDOF.size();
+ if (0 == numFixedDOF)
+ return;
+
+ const ALE::Obj<SieveRealSection>& section = field.section();
+ assert(!section.isNull());
+
+ const int numPoints = _points.size();
+ _offsetLocal.resize(numPoints);
+ for (int iPoint=0; iPoint < numPoints; ++iPoint) {
+ const int fiberDim = section->getFiberDimension(_points[iPoint]);
+ const int curNumConstraints =
+ section->getConstraintDimension(_points[iPoint]);
+ if (curNumConstraints + numFixedDOF > fiberDim) {
+ std::ostringstream msg;
+ msg
+ << "Found overly constrained point while setting up constraints for\n"
+ << "DirichletBC boundary condition '" << _label << "'.\n"
+ << "Number of DOF at point " << _points[iPoint] << " is " << fiberDim
+ << "\nand number of attempted constraints is "
+ << curNumConstraints+numFixedDOF << ".";
+ throw std::runtime_error(msg.str());
+ } // if
+ _offsetLocal[iPoint] = curNumConstraints;
+ section->addConstraintDimension(_points[iPoint], numFixedDOF);
+ } // for
+} // setConstraintSizes
+
+// ----------------------------------------------------------------------
+// Set which degrees of freedom are constrained at points in field.
+void
+pylith::bc::DirichletBC::setConstraints(const topology::Field& field,
+ const topology::Mesh& mesh)
+{ // setConstraints
+ const int numFixedDOF = _fixedDOF.size();
+ if (0 == numFixedDOF)
+ return;
+
+ const ALE::Obj<SieveRealSection>& section = field.section();
+ assert(!section.isNull());
+
+ const int numPoints = _points.size();
+ for (int iPoint=0; iPoint < numPoints; ++iPoint) {
+ const SieveMesh::point_type point = _points[iPoint];
+
+ // Get list of currently constrained DOF
+ const int* curFixedDOF = section->getConstraintDof(point);
+ const int numTotalConstrained = section->getConstraintDimension(point);
+
+ // Create array holding all constrained DOF
+ int_array allFixedDOF(curFixedDOF, numTotalConstrained);
+
+ // Verify other BC has not already constrained DOF
+ const int numPrevious = _offsetLocal[iPoint];
+ for (int iDOF=0; iDOF < numPrevious; ++iDOF)
+ for (int jDOF=0; jDOF < numFixedDOF; ++jDOF)
+ if (allFixedDOF[iDOF] == _fixedDOF[jDOF]) {
+ std::ostringstream msg;
+ msg << "Found multiple constraints on degrees of freedom at\n"
+ << "point while setting up constraints for DirichletBC\n"
+ << "boundary condition '" << _label << "'.\n"
+ << "Degree of freedom " << _fixedDOF[jDOF]
+ << " is already constrained by another Dirichlet BC.";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ // Add in the ones for this DirichletBC BC
+ for (int iDOF=0; iDOF < numFixedDOF; ++iDOF) {
+ assert(_offsetLocal[iPoint]+iDOF < numTotalConstrained);
+ allFixedDOF[_offsetLocal[iPoint]+iDOF] = _fixedDOF[iDOF];
+ } // for
+
+ // Fill in rest of values not yet set (will be set by
+ // another DirichletBC BC)
+ for (int iDOF=_offsetLocal[iPoint]+numFixedDOF;
+ iDOF < numTotalConstrained;
+ ++iDOF) {
+ assert(iDOF < numTotalConstrained);
+ allFixedDOF[iDOF] = 999;
+ } // for
+
+ // Sort list of constrained DOF
+ // I need these sorted for my update algorithms to work properly
+ std::sort(&allFixedDOF[0], &allFixedDOF[numTotalConstrained]);
+
+ // Update list of constrained DOF
+ section->setConstraintDof(point, &allFixedDOF[0]);
+ } // for
+} // setConstraints
+
+// ----------------------------------------------------------------------
+// Set values in field.
+void
+pylith::bc::DirichletBC::setField(const double t,
+ const topology::Field& field,
+ const topology::Mesh& mesh)
+{ // setField
+ const int numFixedDOF = _fixedDOF.size();
+ if (0 == numFixedDOF)
+ return;
+
+ const ALE::Obj<SieveRealSection>& section = field.section();
+ assert(!section.isNull());
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ assert(!sieveMesh.isNull());
+
+ const int numPoints = _points.size();
+ const int fiberDimension =
+ (numPoints > 0) ? section->getFiberDimension(_points[0]) : 0;
+ double_array allValues(fiberDimension);
+ for (int iPoint=0; iPoint < numPoints; ++iPoint) {
+ const SieveMesh::point_type point = _points[iPoint];
+ assert(fiberDimension == section->getFiberDimension(point));
+ sieveMesh->restrictClosure(section, point, &allValues[0], fiberDimension);
+ for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
+ allValues[_fixedDOF[iDOF]] = _valuesInitial[iPoint*numFixedDOF+iDOF];
+ if (t > _tRef && 0 != _dbRate)
+ for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
+ allValues[_fixedDOF[iDOF]] +=
+ (t-_tRef) * _valuesRate[iPoint*numFixedDOF+iDOF];
+ section->updatePointAll(_points[iPoint], &allValues[0]);
+ } // for
+} // setField
+
+// ----------------------------------------------------------------------
+// Get mesh labels for points associated with Dirichlet BC.
+void
+pylith::bc::DirichletBC::_getPoints(const topology::Mesh& mesh)
+{ // _getPoints
+ typedef SieveMesh::int_section_type::chart_type chart_type;
+
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ assert(!sieveMesh.isNull());
+
+ const ALE::Obj<SieveMesh::int_section_type>& groupField =
+ sieveMesh->getIntSection(_label);
+ if (groupField.isNull()) {
+ std::ostringstream msg;
+ msg << "Could not find group of points '" << _label << "' in mesh.";
+ throw std::runtime_error(msg.str());
+ } // if
+ assert(!groupField.isNull());
+ const chart_type& chart = groupField->getChart();
+ const chart_type::const_iterator& chartEnd = chart.end();
+ const int numPoints = groupField->size();
+ _points.resize(numPoints);
+ int i = 0;
+ for(chart_type::const_iterator c_iter = chart.begin();
+ c_iter != chartEnd;
+ ++c_iter)
+ if (groupField->getFiberDimension(*c_iter))
+ _points[i++] = *c_iter;
+} // _getPoints
+
+// ----------------------------------------------------------------------
+// Setup initial and rate of change databases for querying.
+void
+pylith::bc::DirichletBC::_setupQueryDatabases(void)
+{ // _setupQueryDatabases
+ assert(0 != _db);
+
+ const int numFixedDOF = _fixedDOF.size();
+ char** valueNames = (numFixedDOF > 0) ? new char*[numFixedDOF] : 0;
+ for (int i=0; i < numFixedDOF; ++i) {
+ std::ostringstream name;
+ name << "dof-" << _fixedDOF[i];
+ const int size = 1 + name.str().length();
+ valueNames[i] = new char[size];
+ strcpy(valueNames[i], name.str().c_str());
+ } // for
+
+ // Setup initial database.
+ _db->open();
+ _db->queryVals(const_cast<const char**>(valueNames), numFixedDOF);
+
+ // Setup rate database, if provided.
+ if (0 != _dbRate) {
+ _dbRate->open();
+ _dbRate->queryVals((const char**) valueNames, numFixedDOF);
+ } // if
+ for (int i=0; i < numFixedDOF; ++i) {
+ delete[] valueNames[i]; valueNames[i] = 0;
+ } // for
+ delete[] valueNames; valueNames = 0;
+} // _setupQueryDatabases
+
+// ----------------------------------------------------------------------
+// Query initial and rate of change databases for values.
+void
+pylith::bc::DirichletBC::_queryDatabases(const topology::Mesh& mesh)
+{ // _queryDatabases
+ assert(0 != _db);
+
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ assert(!sieveMesh.isNull());
+
+ const ALE::Obj<SieveRealSection>& coordinates =
+ sieveMesh->getRealSection("coordinates");
+ assert(!coordinates.isNull());
+
+ const spatialdata::geocoords::CoordSys* cs = mesh.coordsys();
+ assert(0 != cs);
+ const int spaceDim = cs->spaceDim();
+
+ assert(0 != _normalizer);
+ const double lengthScale = _normalizer->lengthScale();
+ const double velocityScale =
+ _normalizer->lengthScale() / _normalizer->timeScale();
+
+ const int numPoints = _points.size();
+ const int numFixedDOF = _fixedDOF.size();
+ _valuesInitial.resize(numPoints*numFixedDOF);
+ if (0 != _dbRate)
+ _valuesRate.resize(numPoints*numFixedDOF);
+
+ double_array queryValues(numFixedDOF);
+ double_array vCoordsGlobal(spaceDim);
+ for (int iPoint=0; iPoint < numPoints; ++iPoint) {
+ // Get coordinates of vertex
+ coordinates->restrictPoint(_points[iPoint],
+ &vCoordsGlobal[0], vCoordsGlobal.size());
+ _normalizer->dimensionalize(&vCoordsGlobal[0], vCoordsGlobal.size(),
+ lengthScale);
+ int err = _db->query(&queryValues[0], numFixedDOF,
+ &vCoordsGlobal[0], vCoordsGlobal.size(), cs);
+ if (err) {
+ std::ostringstream msg;
+ msg << "Could not find initial values at (";
+ for (int i=0; i < spaceDim; ++i)
+ msg << " " << vCoordsGlobal[i];
+ msg << ") using spatial database " << _db->label() << ".";
+ throw std::runtime_error(msg.str());
+ } // if
+ for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
+ _valuesInitial[numFixedDOF*iPoint+iDOF] =
+ _normalizer->nondimensionalize(queryValues[iDOF], lengthScale);
+
+ if (0 != _dbRate) {
+ err = _dbRate->query(&queryValues[0], numFixedDOF,
+ &vCoordsGlobal[0], vCoordsGlobal.size(), cs);
+ if (err) {
+ std::ostringstream msg;
+ msg << "Could not find rate values at (";
+ for (int i=0; i < spaceDim; ++i)
+ msg << " " << vCoordsGlobal[i];
+ msg << ") using spatial database " << _dbRate->label() << ".";
+ throw std::runtime_error(msg.str());
+ } // if
+ for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
+ _valuesRate[numFixedDOF*iPoint+iDOF] =
+ _normalizer->nondimensionalize(queryValues[iDOF], velocityScale);
+ } // if
+ } // for
+ _db->close();
+ if (0 != _dbRate)
+ _dbRate->close();
+} // _queryDatabases
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.hh (from rev 13939, short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,164 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file libsrc/bc/DirichletBC.hh
+ *
+ * @brief C++ implementation of Dirichlet (prescribed values at
+ * degrees of freedom) boundary conditions with a set of points.
+ */
+
+#if !defined(pylith_bc_dirichletbc_hh)
+#define pylith_bc_dirichletbc_hh
+
+// Include directives ---------------------------------------------------
+#include "BoundaryCondition.hh" // ISA BoundaryCondition
+#include "pylith/feassemble/Constraint.hh" // ISA Constraint
+
+#include "pylith/utils/array.hh" // HASA std::vector, double_array, int_array
+#define NEWPYLITHMESH 1
+#include "pylith/utils/sievetypes.hh" // HASA SieveMesh::point_type
+
+// Forward declarations -------------------------------------------------
+namespace pylith {
+ namespace bc {
+ class DirichletBC;
+ class TestDirichletBC; // unit testing
+ } // bc
+} // pylith
+
+
+// DirichletBC ------------------------------------------------------
+class pylith::bc::DirichletBC : public BoundaryCondition,
+ public feassemble::Constraint
+{ // class DirichletBC
+ friend class TestDirichletBC; // unit testing
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Default constructor.
+ DirichletBC(void);
+
+ /// Destructor.
+ ~DirichletBC(void);
+
+ /** Set database for rate of change of values.
+ *
+ * @param db Spatial database
+ */
+ void dbRate(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Set indices of fixed degrees of freedom.
+ *
+ * Note: all points associated with boundary condition has same
+ * degrees of freedom fixed.
+ *
+ * Example: [0, 1] to fix x and y degrees of freedom in Cartesian system.
+ *
+ * @param flags Array of indices of fixed degrees of freedom.
+ * @param size Size of array
+ */
+ void fixedDOF(const int* flags,
+ const int size);
+
+ /** Set time at which rate of change begins.
+ *
+ * @param t Reference time.
+ */
+ void referenceTime(const double t);
+
+ /** Initialize boundary condition.
+ *
+ * @param mesh PETSc mesh
+ * @param upDir Vertical direction (somtimes used in 3-D problems).
+ */
+ void initialize(const topology::Mesh& mesh,
+ const double upDir[3]);
+
+ /** Set number of degrees of freedom that are constrained at points in field.
+ *
+ * @param field Solution field
+ * @param mesh PETSc mesh
+ */
+ void setConstraintSizes(const topology::Field& field,
+ const topology::Mesh& mesh);
+
+ /** Set which degrees of freedom are constrained at points in field.
+ *
+ * @param field Solution field
+ * @param mesh PETSc mesh
+ */
+ void setConstraints(const topology::Field& field,
+ const topology::Mesh& mesh);
+
+ /** Set values in field.
+ *
+ * @param t Current time
+ * @param field Solution field
+ * @param mesh PETSc mesh
+ */
+ void setField(const double t,
+ const topology::Field& field,
+ const topology::Mesh& mesh);
+
+ // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
+
+ /** Get mesh labels for points associated with Dirichlet BC.
+ *
+ * @param mesh Finite-element mesh.
+ */
+ void _getPoints(const topology::Mesh& mesh);
+
+ /// Setup initial and rate of change databases for querying.
+ void _setupQueryDatabases(void);
+
+ /** Query initial and rate of change databases for values.
+ *
+ * @param mesh Finite-element mesh.
+ */
+ void _queryDatabases(const topology::Mesh& mesh);
+
+ // NOT IMPLEMENTED ////////////////////////////////////////////////////
+private :
+
+ /// Not implemented
+ DirichletBC(const DirichletBC& m);
+
+ /// Not implemented
+ const DirichletBC& operator=(const DirichletBC& m);
+
+ // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+ double _tRef; /// Time when rate of change for values begins.
+ double_array _valuesInitial; ///< Initial values at points.
+ double_array _valuesRate; ///< Rate of change of values at points.
+
+ std::vector<SieveMesh::point_type> _points; ///< Points for BC
+ int_array _fixedDOF; ///< Indices of fixed degrees of freedom
+
+ /// Offset in list of fixed DOF at point to get to fixed DOF
+ /// associated with this DirichletBC boundary condition.
+ int_array _offsetLocal;
+
+ /// Spatial database with parameters for rate of change values.
+ spatialdata::spatialdb::SpatialDB* _dbRate;
+
+}; // class DirichletBC
+
+#include "DirichletBC.icc" // inline methods
+
+#endif // pylith_bc_dirichletbc_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.icc (from rev 13939, short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.icc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.icc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBC.icc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,32 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(pylith_bc_dirichletbc_hh)
+#error "DirichletBC.icc can only be included from DirichletBC.hh"
+#endif
+
+// Set database for boundary condition parameters.
+inline
+void
+pylith::bc::DirichletBC::dbRate(spatialdata::spatialdb::SpatialDB* const db) {
+ _dbRate = db;
+}
+
+// Set time at which rate of change begins.
+inline
+void
+pylith::bc::DirichletBC::referenceTime(const double t) {
+ _tRef = t;
+} // referenceTime
+
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -14,13 +14,13 @@
#include "DirichletBoundary.hh" // implementation of object methods
-#include "spatialdata/spatialdb/SpatialDB.hh" // USES SpatialDB
+#include "pylith/topology/FieldUniform.hh" // USES FieldUniform
+#include "pylith/topology/Mesh.hh" // USES Mesh
#include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
#include "spatialdata/units/Nondimensional.hh" // USES Nondimensional
#include <Selection.hh> // USES submesh algorithms
-#include <cstring> // USES strcpy()
#include <strings.h> // USES strcasecmp()
#include <cassert> // USES assert()
#include <stdexcept> // USES std::runtime_error
@@ -29,8 +29,7 @@
// ----------------------------------------------------------------------
// Default constructor.
pylith::bc::DirichletBoundary::DirichletBoundary(void) :
- _tRef(0.0),
- _dbRate(0)
+ _tmpField(0)
{ // constructor
} // constructor
@@ -38,350 +37,135 @@
// Destructor.
pylith::bc::DirichletBoundary::~DirichletBoundary(void)
{ // destructor
- _dbRate = 0;
+ delete _tmpField; _tmpField = 0;
} // destructor
// ----------------------------------------------------------------------
// Initialize boundary condition.
void
-pylith::bc::DirichletBoundary::initialize(
- const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* cs,
- const double_array& upDir)
+pylith::bc::DirichletBoundary::initialize(const topology::Mesh& mesh,
+ const double upDir[3])
{ // initialize
- assert(0 != _db);
- assert(0 != _dbRate);
- assert(!mesh.isNull());
- assert(0 != cs);
-
const int numFixedDOF = _fixedDOF.size();
if (0 == numFixedDOF)
return;
- // Extract submesh associated with boundary
- _boundaryMesh =
- ALE::Selection<Mesh>::submeshV<SubMesh>(mesh, mesh->getIntSection(_label));
- if (_boundaryMesh.isNull()) {
- std::ostringstream msg;
- msg << "Could not construct boundary mesh for Dirichlet boundary "
- << "condition '" << _label << "'.";
- throw std::runtime_error(msg.str());
- } // if
- _boundaryMesh->setRealSection("coordinates",
- mesh->getRealSection("coordinates"));
- // Create the parallel overlap
- Obj<SubMesh::send_overlap_type> sendParallelMeshOverlap = _boundaryMesh->getSendOverlap();
- Obj<SubMesh::recv_overlap_type> recvParallelMeshOverlap = _boundaryMesh->getRecvOverlap();
- Mesh::renumbering_type& renumbering = mesh->getRenumbering();
- // Can I figure this out in a nicer way?
- ALE::SetFromMap<std::map<Mesh::point_type,Mesh::point_type> > globalPoints(renumbering);
-
- ALE::OverlapBuilder<>::constructOverlap(globalPoints, renumbering, sendParallelMeshOverlap, recvParallelMeshOverlap);
- _boundaryMesh->setCalculatedOverlap(true);
-
- // Get values for degrees of freedom
- char** valueNames = (numFixedDOF > 0) ? new char*[numFixedDOF] : 0;
- for (int i=0; i < numFixedDOF; ++i) {
- std::ostringstream name;
- name << "dof-" << _fixedDOF[i];
- const int size = 1 + name.str().length();
- valueNames[i] = new char[size];
- strcpy(valueNames[i], name.str().c_str());
- } // for
- _db->open();
- _db->queryVals((const char**) valueNames, numFixedDOF);
- _dbRate->open();
- _dbRate->queryVals((const char**) valueNames, numFixedDOF);
- for (int i=0; i < numFixedDOF; ++i) {
- delete[] valueNames[i]; valueNames[i] = 0;
- } // for
- delete[] valueNames; valueNames = 0;
-
- const ALE::Obj<SubMesh::label_sequence>& vertices =
- _boundaryMesh->depthStratum(0);
- const SubMesh::label_sequence::iterator verticesEnd = vertices->end();
-
- const ALE::Obj<real_section_type>& coordinates =
- mesh->getRealSection("coordinates");
- assert(!coordinates.isNull());
- const int spaceDim = cs->spaceDim();
-
- _values = new real_section_type(_boundaryMesh->comm(),
- _boundaryMesh->debug());
- _values->addSpace(); // initial values
- _values->addSpace(); // rate of change of values
- _values->setChart(real_section_type::chart_type(*std::min_element(vertices->begin(), vertices->end()), *std::max_element(vertices->begin(), vertices->end())+1));
- _values->setFiberDimension(vertices, 2*numFixedDOF);
- _values->setFiberDimension(vertices, numFixedDOF, 0); // initial values
- _values->setFiberDimension(vertices, numFixedDOF, 1); // rate of change
- _boundaryMesh->allocate(_values);
-
- double_array queryValues(2*numFixedDOF);
- double_array vCoordsGlobal(spaceDim);
-
- assert(0 != _normalizer);
- const double lengthScale = _normalizer->lengthScale();
- const double velocityScale =
- _normalizer->lengthScale() / _normalizer->timeScale();
-
- for (SubMesh::label_sequence::iterator v_iter=vertices->begin();
- v_iter != verticesEnd;
- ++v_iter) {
- // Get coordinates of vertex
- coordinates->restrictPoint(*v_iter,
- &vCoordsGlobal[0], vCoordsGlobal.size());
- _normalizer->dimensionalize(&vCoordsGlobal[0], vCoordsGlobal.size(),
- lengthScale);
- int err = _db->query(&queryValues[0], numFixedDOF,
- &vCoordsGlobal[0], vCoordsGlobal.size(), cs);
- if (err) {
- std::ostringstream msg;
- msg << "Could not find values at (";
- for (int i=0; i < spaceDim; ++i)
- msg << " " << vCoordsGlobal[i];
- msg << ") using spatial database " << _db->label() << ".";
- throw std::runtime_error(msg.str());
- } // if
- for (int i=0; i < numFixedDOF; ++i)
- _normalizer->nondimensionalize(queryValues[i], lengthScale);
-
- err = _dbRate->query(&queryValues[numFixedDOF], numFixedDOF,
- &vCoordsGlobal[0], vCoordsGlobal.size(), cs);
- if (err) {
- std::ostringstream msg;
- msg << "Could not find values at (";
- for (int i=0; i < spaceDim; ++i)
- msg << " " << vCoordsGlobal[i];
- msg << ") using spatial database " << _dbRate->label() << ".";
- throw std::runtime_error(msg.str());
- } // if
- for (int i=0; i < numFixedDOF; ++i)
- _normalizer->nondimensionalize(queryValues[numFixedDOF+i], velocityScale);
-
- _values->updatePoint(*v_iter, &queryValues[0]);
- } // for
- _db->close();
- _dbRate->close();
+ _createBoundaryMesh(mesh);
+ _getPoints(mesh);
+ _setupQueryDatabases();
+ _queryDatabases(mesh);
} // initialize
// ----------------------------------------------------------------------
-// Set number of degrees of freedom that are constrained at points in field.
-void
-pylith::bc::DirichletBoundary::setConstraintSizes(
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh)
-{ // setConstraintSizes
- assert(!field.isNull());
- assert(!mesh.isNull());
+// Get vertex field of BC initial or rate of change of values.
+const pylith::topology::Field&
+pylith::bc::DirichletBoundary::vertexField(const char* name,
+ const topology::Mesh& mesh,
+ const topology::SolutionFields& fields)
+{ // getVertexField
+ assert(0 != name);
+ assert(!_boundaryMesh.isNull());
+ assert(0 != _normalizer);
- const int numFixedDOF = _fixedDOF.size();
- if (0 == numFixedDOF)
- return;
-
- const ALE::Obj<SubMesh::label_sequence>& vertices =
+ const ALE::Obj<SieveMesh::label_sequence>& vertices =
_boundaryMesh->depthStratum(0);
- const SubMesh::label_sequence::iterator verticesEnd = vertices->end();
+ assert(!vertices.isNull());
+ const SieveMesh::label_sequence::iterator verticesEnd = vertices->end();
- _offsetLocal = new int_section_type(_boundaryMesh->comm(),
- _boundaryMesh->debug());
- _offsetLocal->setChart(real_section_type::chart_type(*std::min_element(vertices->begin(), vertices->end()), *std::max_element(vertices->begin(), vertices->end())+1));
- _offsetLocal->setFiberDimension(vertices, 1);
- _boundaryMesh->allocate(_offsetLocal);
+ const spatialdata::geocoords::CoordSys* cs = mesh.coordsys();
+ assert(0 != cs);
+ const int spaceDim = cs->spaceDim();
+ double_array values(spaceDim);
- for (SubMesh::label_sequence::iterator v_iter=vertices->begin();
- v_iter != verticesEnd;
- ++v_iter) {
- const int fiberDim = field->getFiberDimension(*v_iter);
- const int curNumConstraints = field->getConstraintDimension(*v_iter);
- if (curNumConstraints + numFixedDOF > fiberDim) {
- std::ostringstream msg;
- msg << "Found overly constrained point while setting up constraints "
- << "for DirichletBoundary boundary condition '" << _label << "'.\n"
- << "Number of DOF at point " << *v_iter << " is " << fiberDim
- << " and number of attempted constraints is "
- << curNumConstraints+numFixedDOF << ".";
- throw std::runtime_error(msg.str());
- } // if
- _offsetLocal->updatePoint(*v_iter, &curNumConstraints);
- field->addConstraintDimension(*v_iter, numFixedDOF);
- } // for
-} // setConstraintSizes
-
-// ----------------------------------------------------------------------
-// Set which degrees of freedom are constrained at points in field.
-void
-pylith::bc::DirichletBoundary::setConstraints(
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh)
-{ // setConstraints
- assert(!field.isNull());
- assert(!mesh.isNull());
-
+ const int numPoints = _points.size();
const int numFixedDOF = _fixedDOF.size();
- if (0 == numFixedDOF)
- return;
- const ALE::Obj<SubMesh::label_sequence>& vertices =
- _boundaryMesh->depthStratum(0);
- const SubMesh::label_sequence::iterator verticesEnd = vertices->end();
+ if (0 == _tmpField) {
+ _tmpField = new topology::FieldUniform(_boundaryMesh, spaceDim);
+ assert(0 != _tmpField);
+ _tmpField->createSection(vertices);
+ } // if
- for (SubMesh::label_sequence::iterator v_iter=vertices->begin();
- v_iter != verticesEnd;
- ++v_iter) {
- // Get list of currently constrained DOF
- const int* curFixedDOF = field->getConstraintDof(*v_iter);
- const int numTotalConstrained = field->getConstraintDimension(*v_iter);
+ if (0 == strcasecmp(name, "initial")) {
+ _tmpField->name("displacement");
+ _tmpField->vectorFieldType(topology::Field::VECTOR);
+ _tmpField->scale(_normalizer->lengthScale());
+ _tmpField->addDimensionOkay(true);
+ _tmpField->zero();
+ const ALE::Obj<SieveRealSection>& section = _tmpField->section();
- // Create array holding all constrained DOF
- int_array allFixedDOF(curFixedDOF, numTotalConstrained);
-
- const int_section_type::value_type* offset =
- _offsetLocal->restrictPoint(*v_iter);
-
- // Verify other BC has not already constrained DOF
- const int numPrevious = offset[0];
- for (int iDOF=0; iDOF < numPrevious; ++iDOF)
- for (int jDOF=0; jDOF < numFixedDOF; ++jDOF)
- if (allFixedDOF[iDOF] == _fixedDOF[jDOF]) {
- std::ostringstream msg;
- msg << "Found multiple constraints on degrees of freedom at\n"
- << "point while setting up constraints for DirichletPoints\n"
- << "boundary condition '" << _label << "'.\n"
- << "Degree of freedom " << _fixedDOF[jDOF]
- << " is already constrained by another Dirichlet BC.";
- throw std::runtime_error(msg.str());
- } // if
-
- // Add in the ones for this DirichletBoundary BC
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF) {
- assert(offset[0]+iDOF < numTotalConstrained);
- allFixedDOF[offset[0]+iDOF] = _fixedDOF[iDOF];
+ for (int iPoint=0; iPoint < numPoints; ++iPoint) {
+ const SieveMesh::point_type point = _points[iPoint];
+ assert(spaceDim == section->getFiberDimension(point));
+ for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
+ values[_fixedDOF[iDOF]] = _valuesInitial[iPoint*numFixedDOF+iDOF];
+ section->updatePointAll(_points[iPoint], &values[0]);
} // for
+ } else if (0 == strcasecmp(name, "rate-of-change")) {
+ _tmpField->name("velocity");
+ _tmpField->vectorFieldType(topology::Field::VECTOR);
+ _tmpField->scale(_normalizer->lengthScale());
+ _tmpField->addDimensionOkay(true);
+ _tmpField->zero();
+ const ALE::Obj<SieveRealSection>& section = _tmpField->section();
- // Fill in rest of values not yet set
- // (will be set by another DirichletBoundary BC)
- for (int iDOF=offset[0]+numFixedDOF; iDOF < numTotalConstrained; ++iDOF) {
- assert(iDOF < numTotalConstrained);
- allFixedDOF[iDOF] = 999;
+ for (int iPoint=0; iPoint < numPoints; ++iPoint) {
+ const SieveMesh::point_type point = _points[iPoint];
+ assert(spaceDim == section->getFiberDimension(point));
+ for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
+ values[_fixedDOF[iDOF]] = _valuesRate[iPoint*numFixedDOF+iDOF];
+ section->updatePointAll(_points[iPoint], &values[0]);
} // for
+ } else {
+ std::ostringstream msg;
+ msg
+ << "Unknown field '" << name << "' requested for Dirichlet boundary BC '"
+ << _label << "'.";
+ throw std::runtime_error(msg.str());
+ } // else
- // Sort list of constrained DOF
- // I need these sorted for my update algorithms to work properly
- std::sort(&allFixedDOF[0], &allFixedDOF[numTotalConstrained]);
+ return *_tmpField;
+} // getVertexField
- // Update list of constrained DOF
- field->setConstraintDof(*v_iter, &allFixedDOF[0]);
- } // for
-} // setConstraints
-
// ----------------------------------------------------------------------
-// Set values in field.
+// Extract submesh associated with boundary.
void
-pylith::bc::DirichletBoundary::setField(const double t,
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh)
-{ // setField
- assert(!field.isNull());
- assert(!mesh.isNull());
+pylith::bc::DirichletBoundary::_createBoundaryMesh(const topology::Mesh& mesh)
+{ // _createBoundaryMesh
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ assert(!sieveMesh.isNull());
- const int numFixedDOF = _fixedDOF.size();
- if (0 == numFixedDOF)
- return;
-
- const ALE::Obj<SubMesh::label_sequence>& vertices =
- _boundaryMesh->depthStratum(0);
- const SubMesh::label_sequence::iterator verticesEnd = vertices->end();
-
- const int fiberDimension =
- (vertices->size() > 0) ? field->getFiberDimension(*vertices->begin()) : 0;
-
- double_array fieldValues(fiberDimension);
-
- for (SubMesh::label_sequence::iterator v_iter=vertices->begin();
- v_iter != verticesEnd;
- ++v_iter) {
- assert(fiberDimension == field->getFiberDimension(*v_iter));
- mesh->restrictClosure(field, *v_iter, &fieldValues[0], fiberDimension);
-
- const real_section_type::value_type* values =
- _values->restrictPoint(*v_iter);
-
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
- fieldValues[_fixedDOF[iDOF]] = values[iDOF];
- if (t > _tRef)
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
- fieldValues[_fixedDOF[iDOF]] += (t-_tRef) * values[numFixedDOF+iDOF];
- field->updatePointAll(*v_iter, &fieldValues[0]);
- } // for
-} // setField
-
-// ----------------------------------------------------------------------
-// Get vertex field of BC initial or rate of change of values.
-const ALE::Obj<pylith::real_section_type>&
-pylith::bc::DirichletBoundary::vertexField(VectorFieldEnum* fieldType,
- const char* name,
- const ALE::Obj<Mesh>& mesh,
- topology::FieldsManager* const fields)
-{ // getVertexField
- assert(0 != fieldType);
- assert(0 != name);
- assert(!_boundaryMesh.isNull());
- assert(!_values.isNull());
- assert(0 != _normalizer);
-
- const ALE::Obj<Mesh::label_sequence>& vertices =
- _boundaryMesh->depthStratum(0);
- const Mesh::label_sequence::iterator verticesEnd = vertices->end();
-
- ALE::Obj<real_section_type> field = 0;
- int fiberDim = 0;
- double scale = 0.0;
- if (0 == strcasecmp(name, "initial")) {
- *fieldType = VECTOR_FIELD;
- field = _values->getFibration(0);
- fiberDim =
- (vertices->size() > 0) ? field->getFiberDimension(*vertices->begin()) : 0;
- scale = _normalizer->lengthScale();
- } else if (0 == strcasecmp(name, "rate-of-change")) {
- *fieldType = VECTOR_FIELD;
- field = _values->getFibration(0);
- fiberDim =
- (vertices->size() > 0) ? field->getFiberDimension(*vertices->begin()) : 0;
- scale = _normalizer->lengthScale() / _normalizer->timeScale();
- } else {
+ const ALE::Obj<SieveMesh::int_section_type>& groupField =
+ sieveMesh->getIntSection(_label);
+ if (groupField.isNull()) {
std::ostringstream msg;
- msg << "Unknown field '" << name << "' requested for Dirichlet BC '"
- << _label << "'.";
+ msg << "Could not find group of points '" << _label << "' in mesh.";
throw std::runtime_error(msg.str());
- } // else
-
- // Allocate buffer if necessary
- if (_buffer.isNull()) {
- _buffer = new real_section_type(_boundaryMesh->comm(),
- _boundaryMesh->debug());
- _buffer->setChart(real_section_type::chart_type(
- *std::min_element(vertices->begin(),
- vertices->end()),
- *std::max_element(vertices->begin(),
- vertices->end())+1));
- _buffer->setFiberDimension(vertices, fiberDim);
- _boundaryMesh->allocate(_buffer);
} // if
+ _boundaryMesh =
+ ALE::Selection<SieveMesh>::submeshV<SieveSubMesh>(sieveMesh, groupField);
+ if (_boundaryMesh.isNull()) {
+ std::ostringstream msg;
+ msg << "Could not construct boundary mesh for Dirichlet boundary "
+ << "condition '" << _label << "'.";
+ throw std::runtime_error(msg.str());
+ } // if
+ _boundaryMesh->setRealSection("coordinates",
+ sieveMesh->getRealSection("coordinates"));
+ // Create the parallel overlap
+ ALE::Obj<SieveSubMesh::send_overlap_type> sendParallelMeshOverlap =
+ _boundaryMesh->getSendOverlap();
+ ALE::Obj<SieveSubMesh::recv_overlap_type> recvParallelMeshOverlap =
+ _boundaryMesh->getRecvOverlap();
+ SieveMesh::renumbering_type& renumbering = sieveMesh->getRenumbering();
+ // Can I figure this out in a nicer way?
+ ALE::SetFromMap<std::map<SieveMesh::point_type,SieveMesh::point_type> > globalPoints(renumbering);
- // dimensionalize values
- double_array values(fiberDim);
- for (Mesh::label_sequence::iterator v_iter=vertices->begin();
- v_iter != verticesEnd;
- ++v_iter) {
- assert(fiberDim == field->getFiberDimension(*v_iter));
- assert(fiberDim == _buffer->getFiberDimension(*v_iter));
- field->restrictPoint(*v_iter, &values[0], values.size());
- _normalizer->dimensionalize(&values[0], values.size(), scale);
- _buffer->updatePointAll(*v_iter, &values[0]);
- } // for
+ ALE::OverlapBuilder<>::constructOverlap(globalPoints, renumbering,
+ sendParallelMeshOverlap,
+ recvParallelMeshOverlap);
+ _boundaryMesh->setCalculatedOverlap(true);
+} // _createBoundaryMesh
- return _buffer;
-} // getVertexField
-
// End of file
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -19,13 +19,10 @@
#if !defined(pylith_bc_dirichletboundary_hh)
#define pylith_bc_dirichletboundary_hh
-#include "BoundaryCondition.hh" // ISA BoundaryCondition
-#include "pylith/feassemble/Constraint.hh" // ISA Constraint
+// Include directives ---------------------------------------------------
+#include "DirichletBC.hh" // ISA DirichletBC
-#include "pylith/utils/array.hh" // USES std::vector, double_array, int_array
-#include "pylith/utils/vectorfields.hh" // USES VectorFieldEnum
-
-/// Namespace for pylith package
+// Forward declarations -------------------------------------------------
namespace pylith {
namespace bc {
class DirichletBoundary;
@@ -33,14 +30,13 @@
} // bc
namespace topology {
- class FieldsManager; // forward declaration
+ class FieldUniform; // USES FieldUniform
+ class SolutionFields; // USES SolutionFields
} // topology
} // pylith
-
-/// C++ implementation of DirichletBoundary boundary conditions.
-class pylith::bc::DirichletBoundary : public BoundaryCondition,
- public feassemble::Constraint
+// DirichletBoundary ----------------------------------------------------
+class pylith::bc::DirichletBoundary : public DirichletBC
{ // class DirichletBoundary
friend class TestDirichletBoundary; // unit testing
@@ -53,69 +49,19 @@
/// Destructor.
~DirichletBoundary(void);
- /** Set database for rate of change of values.
- *
- * @param db Spatial database
- */
- void dbRate(spatialdata::spatialdb::SpatialDB* const db);
-
- /** Set indices of fixed degrees of freedom.
- *
- * Note: all points associated with boundary condition has same
- * degrees of freedom fixed.
- *
- * Example: [0, 1] to fix x and y degrees of freedom in Cartesian system.
- *
- * @param flags Indices of fixed degrees of freedom.
- */
- void fixedDOF(const int_array& flags);
-
- /** Set time at which rate of change begins.
- *
- * @param t Reference time.
- */
- void referenceTime(const double t);
-
/** Initialize boundary condition.
*
- * @param mesh PETSc mesh
- * @param cs Coordinate system for mesh
+ * @param mesh Finite-element mesh.
+ * @param upDir Vertical direction (somtimes used in 3-D problems).
*/
- void initialize(const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* cs,
- const double_array& upDir);
+ void initialize(const topology::Mesh& mesh,
+ const double upDir[3]);
- /** Set number of degrees of freedom that are constrained at points in field.
- *
- * @param field Solution field
- * @param mesh PETSc mesh
- */
- void setConstraintSizes(const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh);
-
- /** Set which degrees of freedom are constrained at points in field.
- *
- * @param field Solution field
- * @param mesh PETSc mesh
- */
- void setConstraints(const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh);
-
- /** Set values in field.
- *
- * @param t Current time
- * @param field Solution field
- * @param mesh PETSc mesh
- */
- void setField(const double t,
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh);
-
/** Get boundary mesh.
*
* @return Boundary mesh.
*/
- const ALE::Obj<SubMesh>& boundaryMesh(void) const;
+ const ALE::Obj<SieveSubMesh>& boundaryMesh(void) const;
/** Get vertex field with BC information.
*
@@ -126,12 +72,20 @@
*
* @returns Field over vertices.
*/
- const ALE::Obj<real_section_type>&
- vertexField(VectorFieldEnum* fieldType,
- const char* name,
- const ALE::Obj<Mesh>& mesh,
- topology::FieldsManager* const fields);
+ const topology::Field&
+ vertexField(const char* name,
+ const topology::Mesh& mesh,
+ const topology::SolutionFields& fields);
+ // PRIVATE METHODS ////////////////////////////////////////////////////
+private :
+
+ /** Extract submesh associated with boundary.
+ *
+ * @param mesh Finite-element mesh.
+ */
+ void _createBoundaryMesh(const topology::Mesh& mesh);
+
// NOT IMPLEMENTED ////////////////////////////////////////////////////
private :
@@ -144,23 +98,9 @@
// PRIVATE MEMBERS ////////////////////////////////////////////////////
private :
- double _tRef; /// Time when rate of change for values begins
+ ALE::Obj<SieveSubMesh> _boundaryMesh; ///< Boundary mesh.
+ topology::FieldUniform* _tmpField; ///< Temporary field for output.
- /// Initial values and rate of change of values at DOF.
- ALE::Obj<real_section_type> _values;
- ALE::Obj<real_section_type> _buffer; ///< Buffer for output.
-
- ALE::Obj<SubMesh> _boundaryMesh; ///< Boundary mesh.
- int_array _fixedDOF; ///< Indices of fixed degrees of freedom
-
- /// Offset in list of fixed DOF at point to get to fixed DOF
- /// associated with this DirichletBoundary boundary condition.
- ALE::Obj<int_section_type> _offsetLocal;
-
- /// Spatial database with parameters for rate of change values.
- spatialdata::spatialdb::SpatialDB* _dbRate;
-
-
}; // class DirichletBoundary
#include "DirichletBoundary.icc" // inline methods
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.icc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletBoundary.icc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -14,39 +14,12 @@
#error "DirichletBoundary.icc can only be included from DirichletBoundary.hh"
#endif
-// Set database for boundary condition parameters.
+// Get boundary mesh.
inline
-void
-pylith::bc::DirichletBoundary::dbRate(
- spatialdata::spatialdb::SpatialDB* const db) {
- _dbRate = db;
-}
-
-// Set indices of fixed degrees of freedom.
-inline
-void
-pylith::bc::DirichletBoundary::fixedDOF(const int_array& flags) {
- const size_t size = flags.size();
- _fixedDOF.resize(size);
- _fixedDOF = flags;
-} // fixedDOF
-
-// Set time at which rate of change begins.
-inline
-void
-pylith::bc::DirichletBoundary::referenceTime(const double t) {
- _tRef = t;
-} // referenceTime
-
- /** Get data mesh.
- *
- * @return Boundary mesh.
- */
-inline
-const ALE::Obj<pylith::SubMesh>&
+const ALE::Obj<pylith::SieveSubMesh>&
pylith::bc::DirichletBoundary::boundaryMesh(void) const {
return _boundaryMesh;
-} // dataMesh
+} // boundaryMesh
// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,276 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "DirichletPoints.hh" // implementation of object methods
-
-#include "spatialdata/spatialdb/SpatialDB.hh" // USES SpatialDB
-#include "spatialdata/geocoords/CoordSys.hh" // USES CoordSys
-#include "spatialdata/units/Nondimensional.hh" // USES Nondimensional
-
-#include <cstring> // USES strcpy()
-#include <cassert> // USES assert()
-#include <stdexcept> // USES std::runtime_error
-#include <sstream> // USES std::ostringstream
-
-// ----------------------------------------------------------------------
-// Default constructor.
-pylith::bc::DirichletPoints::DirichletPoints(void) :
- _tRef(0.0),
- _dbRate(0)
-{ // constructor
-} // constructor
-
-// ----------------------------------------------------------------------
-// Destructor.
-pylith::bc::DirichletPoints::~DirichletPoints(void)
-{ // destructor
- _dbRate = 0;
-} // destructor
-
-// ----------------------------------------------------------------------
-// Initialize boundary condition.
-void
-pylith::bc::DirichletPoints::initialize(
- const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* cs,
- const double_array& upDir)
-{ // initialize
- assert(0 != _db);
- assert(0 != _dbRate);
- assert(!mesh.isNull());
- assert(0 != cs);
-
- const int numFixedDOF = _fixedDOF.size();
- if (0 == numFixedDOF)
- return;
-
- // Get points associated with boundary condition
- const ALE::Obj<int_section_type>& groupField = mesh->getIntSection(_label);
- if (groupField.isNull()) {
- std::ostringstream msg;
- msg << "Could not find group of points '" << _label << "' in mesh.";
- throw std::runtime_error(msg.str());
- } // if
- assert(!groupField.isNull());
- const int_section_type::chart_type& chart = groupField->getChart();
- const int numPoints = groupField->size();
- _points.resize(numPoints);
- int i = 0;
- for(int_section_type::chart_type::const_iterator c_iter = chart.begin();
- c_iter != chart.end();
- ++c_iter) {
- if (groupField->getFiberDimension(*c_iter)) _points[i++] = *c_iter;
- }
-
- // Get values for degrees of freedom
- char** valueNames = (numFixedDOF > 0) ? new char*[numFixedDOF] : 0;
- for (int i=0; i < numFixedDOF; ++i) {
- std::ostringstream name;
- name << "dof-" << _fixedDOF[i];
- const int size = 1 + name.str().length();
- valueNames[i] = new char[size];
- strcpy(valueNames[i], name.str().c_str());
- } // for
- _db->open();
- _db->queryVals((const char**) valueNames, numFixedDOF);
- _dbRate->open();
- _dbRate->queryVals((const char**) valueNames, numFixedDOF);
- for (int i=0; i < numFixedDOF; ++i) {
- delete[] valueNames[i]; valueNames[i] = 0;
- } // for
- delete[] valueNames; valueNames = 0;
-
- const ALE::Obj<real_section_type>& coordinates =
- mesh->getRealSection("coordinates");
- assert(!coordinates.isNull());
- const int spaceDim = cs->spaceDim();
-
- assert(0 != _normalizer);
- const double lengthScale = _normalizer->lengthScale();
- const double velocityScale =
- _normalizer->lengthScale() / _normalizer->timeScale();
-
- _valuesInitial.resize(numPoints*numFixedDOF);
- _valuesRate.resize(numPoints*numFixedDOF);
- double_array queryValues(numFixedDOF);
- double_array vCoordsGlobal(spaceDim);
- for (int iPoint=0; iPoint < numPoints; ++iPoint) {
- // Get coordinates of vertex
- coordinates->restrictPoint(_points[iPoint],
- &vCoordsGlobal[0], vCoordsGlobal.size());
- _normalizer->dimensionalize(&vCoordsGlobal[0], vCoordsGlobal.size(),
- lengthScale);
- int err = _db->query(&queryValues[0], numFixedDOF,
- &vCoordsGlobal[0], vCoordsGlobal.size(), cs);
- if (err) {
- std::ostringstream msg;
- msg << "Could not find values at (";
- for (int i=0; i < spaceDim; ++i)
- msg << " " << vCoordsGlobal[i];
- msg << ") using spatial database " << _db->label() << ".";
- throw std::runtime_error(msg.str());
- } // if
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
- _valuesInitial[numFixedDOF*iPoint+iDOF] =
- _normalizer->nondimensionalize(queryValues[iDOF], lengthScale);
-
- err = _dbRate->query(&queryValues[0], numFixedDOF,
- &vCoordsGlobal[0], vCoordsGlobal.size(), cs);
- if (err) {
- std::ostringstream msg;
- msg << "Could not find values at (";
- for (int i=0; i < spaceDim; ++i)
- msg << " " << vCoordsGlobal[i];
- msg << ") using spatial database " << _dbRate->label() << ".";
- throw std::runtime_error(msg.str());
- } // if
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
- _valuesRate[numFixedDOF*iPoint+iDOF] =
- _normalizer->nondimensionalize(queryValues[iDOF], velocityScale);
- } // for
- _db->close();
- _dbRate->close();
-} // initialize
-
-// ----------------------------------------------------------------------
-// Set number of degrees of freedom that are constrained at points in field.
-void
-pylith::bc::DirichletPoints::setConstraintSizes(
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh)
-{ // setConstraintSizes
- assert(!field.isNull());
- assert(!mesh.isNull());
-
- const int numFixedDOF = _fixedDOF.size();
- if (0 == numFixedDOF)
- return;
-
- const int numPoints = _points.size();
- _offsetLocal.resize(numPoints);
- for (int iPoint=0; iPoint < numPoints; ++iPoint) {
- const int fiberDim = field->getFiberDimension(_points[iPoint]);
- const int curNumConstraints = field->getConstraintDimension(_points[iPoint]);
- if (curNumConstraints + numFixedDOF > fiberDim) {
- std::ostringstream msg;
- msg
- << "Found overly constrained point while setting up constraints for\n"
- << "DirichletPoints boundary condition '" << _label << "'.\n"
- << "Number of DOF at point " << _points[iPoint] << " is " << fiberDim
- << "\nand number of attempted constraints is "
- << curNumConstraints+numFixedDOF << ".";
- throw std::runtime_error(msg.str());
- } // if
- _offsetLocal[iPoint] = curNumConstraints;
- field->addConstraintDimension(_points[iPoint], numFixedDOF);
- } // for
-} // setConstraintSizes
-
-// ----------------------------------------------------------------------
-// Set which degrees of freedom are constrained at points in field.
-void
-pylith::bc::DirichletPoints::setConstraints(
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh)
-{ // setConstraints
- assert(!field.isNull());
- assert(!mesh.isNull());
-
- const int numFixedDOF = _fixedDOF.size();
- if (0 == numFixedDOF)
- return;
-
- const int numPoints = _points.size();
- for (int iPoint=0; iPoint < numPoints; ++iPoint) {
- const Mesh::point_type point = _points[iPoint];
-
- // Get list of currently constrained DOF
- const int* curFixedDOF = field->getConstraintDof(point);
- const int numTotalConstrained = field->getConstraintDimension(point);
-
- // Create array holding all constrained DOF
- int_array allFixedDOF(curFixedDOF, numTotalConstrained);
-
- // Verify other BC has not already constrained DOF
- const int numPrevious = _offsetLocal[iPoint];
- for (int iDOF=0; iDOF < numPrevious; ++iDOF)
- for (int jDOF=0; jDOF < numFixedDOF; ++jDOF)
- if (allFixedDOF[iDOF] == _fixedDOF[jDOF]) {
- std::ostringstream msg;
- msg << "Found multiple constraints on degrees of freedom at\n"
- << "point while setting up constraints for DirichletPoints\n"
- << "boundary condition '" << _label << "'.\n"
- << "Degree of freedom " << _fixedDOF[jDOF]
- << " is already constrained by another Dirichlet BC.";
- throw std::runtime_error(msg.str());
- } // if
-
- // Add in the ones for this DirichletPoints BC
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF) {
- assert(_offsetLocal[iPoint]+iDOF < numTotalConstrained);
- allFixedDOF[_offsetLocal[iPoint]+iDOF] = _fixedDOF[iDOF];
- } // for
-
- // Fill in rest of values not yet set (will be set by
- // another DirichletPoints BC)
- for (int iDOF=_offsetLocal[iPoint]+numFixedDOF;
- iDOF < numTotalConstrained;
- ++iDOF) {
- assert(iDOF < numTotalConstrained);
- allFixedDOF[iDOF] = 999;
- } // for
-
- // Sort list of constrained DOF
- // I need these sorted for my update algorithms to work properly
- std::sort(&allFixedDOF[0], &allFixedDOF[numTotalConstrained]);
-
- // Update list of constrained DOF
- field->setConstraintDof(point, &allFixedDOF[0]);
- } // for
-} // setConstraints
-
-// ----------------------------------------------------------------------
-// Set values in field.
-void
-pylith::bc::DirichletPoints::setField(const double t,
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh)
-{ // setField
- assert(!field.isNull());
- assert(!mesh.isNull());
-
- const int numFixedDOF = _fixedDOF.size();
- if (0 == numFixedDOF)
- return;
-
- const int numPoints = _points.size();
- const int fiberDimension =
- (numPoints > 0) ? field->getFiberDimension(_points[0]) : 0;
- double_array allValues(fiberDimension);
- for (int iPoint=0; iPoint < numPoints; ++iPoint) {
- const Mesh::point_type point = _points[iPoint];
- assert(fiberDimension == field->getFiberDimension(point));
- mesh->restrictClosure(field, point, &allValues[0], fiberDimension);
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
- allValues[_fixedDOF[iDOF]] = _valuesInitial[iPoint*numFixedDOF+iDOF];
- if (t > _tRef)
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
- allValues[_fixedDOF[iDOF]] +=
- (t-_tRef) * _valuesRate[iPoint*numFixedDOF+iDOF];
- field->updatePointAll(_points[iPoint], &allValues[0]);
- } // for
-} // setField
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,142 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/** @file libsrc/bc/DirichletPoints.hh
- *
- * @brief C++ implementation of Dirichlet (prescribed values at
- * degrees of freedom) boundary conditions with a set of points.
- */
-
-#if !defined(pylith_bc_dirichletpoints_hh)
-#define pylith_bc_dirichletpoints_hh
-
-#include "BoundaryCondition.hh" // ISA BoundaryCondition
-#include "pylith/feassemble/Constraint.hh" // ISA Constraint
-
-#include "pylith/utils/array.hh" // USES std::vector, double_array, int_array
-
-/// Namespace for pylith package
-namespace pylith {
- namespace bc {
- class DirichletPoints;
- class TestDirichletPoints; // unit testing
- } // bc
-} // pylith
-
-
-/// C++ implementation of DirichletPoints boundary conditions.
-class pylith::bc::DirichletPoints : public BoundaryCondition,
- public feassemble::Constraint
-{ // class DirichletPoints
- friend class TestDirichletPoints; // unit testing
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Default constructor.
- DirichletPoints(void);
-
- /// Destructor.
- ~DirichletPoints(void);
-
- /** Set database for rate of change of values.
- *
- * @param db Spatial database
- */
- void dbRate(spatialdata::spatialdb::SpatialDB* const db);
-
- /** Set indices of fixed degrees of freedom.
- *
- * Note: all points associated with boundary condition has same
- * degrees of freedom fixed.
- *
- * Example: [0, 1] to fix x and y degrees of freedom in Cartesian system.
- *
- * @param flags Indices of fixed degrees of freedom.
- */
- void fixedDOF(const int_array& flags);
-
- /** Set time at which rate of change begins.
- *
- * @param t Reference time.
- */
- void referenceTime(const double t);
-
- /** Initialize boundary condition.
- *
- * @param mesh PETSc mesh
- * @param cs Coordinate system for mesh
- */
- void initialize(const ALE::Obj<Mesh>& mesh,
- const spatialdata::geocoords::CoordSys* cs,
- const double_array& upDir);
-
- /** Set number of degrees of freedom that are constrained at points in field.
- *
- * @param field Solution field
- * @param mesh PETSc mesh
- */
- void setConstraintSizes(const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh);
-
- /** Set which degrees of freedom are constrained at points in field.
- *
- * @param field Solution field
- * @param mesh PETSc mesh
- */
- void setConstraints(const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh);
-
- /** Set values in field.
- *
- * @param t Current time
- * @param field Solution field
- * @param mesh PETSc mesh
- */
- void setField(const double t,
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh);
-
- // NOT IMPLEMENTED ////////////////////////////////////////////////////
-private :
-
- /// Not implemented
- DirichletPoints(const DirichletPoints& m);
-
- /// Not implemented
- const DirichletPoints& operator=(const DirichletPoints& m);
-
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
-private :
-
- double _tRef; /// Time when rate of change for values begins
- double_array _valuesInitial; ///< Initial values at degrees of freedom
- double_array _valuesRate; ///< Rate of change of Values at degrees of freedom
-
- std::vector<Mesh::point_type> _points; ///< Locations of boundary condition
- int_array _fixedDOF; ///< Indices of fixed degrees of freedom
-
- /// Offset in list of fixed DOF at point to get to fixed DOF
- /// associated with this DirichletPoints boundary condition.
- int_array _offsetLocal;
-
- /// Spatial database with parameters for rate of change values.
- spatialdata::spatialdb::SpatialDB* _dbRate;
-
-}; // class DirichletPoints
-
-#include "DirichletPoints.icc" // inline methods
-
-#endif // pylith_bc_dirichletpoints_hh
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.icc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/DirichletPoints.icc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,42 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#if !defined(pylith_bc_dirichletpoints_hh)
-#error "DirichletPoints.icc can only be included from DirichletPoints.hh"
-#endif
-
-// Set database for boundary condition parameters.
-inline
-void
-pylith::bc::DirichletPoints::dbRate(
- spatialdata::spatialdb::SpatialDB* const db) {
- _dbRate = db;
-}
-
-// Set indices of fixed degrees of freedom.
-inline
-void
-pylith::bc::DirichletPoints::fixedDOF(const int_array& flags) {
- const size_t size = flags.size();
- _fixedDOF.resize(size);
- _fixedDOF = flags;
-} // fixedDOF
-
-// Set time at which rate of change begins.
-inline
-void
-pylith::bc::DirichletPoints::referenceTime(const double t) {
- _tRef = t;
-} // referenceTime
-
-
-// End of file
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/bc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/bc/Makefile.am 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/bc/Makefile.am 2009-01-26 05:47:02 UTC (rev 13956)
@@ -17,10 +17,10 @@
AbsorbingDampers.hh \
BoundaryCondition.hh \
BoundaryCondition.icc \
+ DirichletBC.hh \
+ DirichletBC.icc \
DirichletBoundary.hh \
DirichletBoundary.icc \
- DirichletPoints.hh \
- DirichletPoints.icc \
Neumann.hh
noinst_HEADERS =
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Constraint.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Constraint.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Constraint.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -19,14 +19,19 @@
#if !defined(pylith_feassemble_constraint_hh)
#define pylith_feassemble_constraint_hh
-#include "pylith/utils/sievetypes.hh" // USES real_section_type
+// Include directives ---------------------------------------------------
-/// Namespace for pylith package
+// Forward declarations -------------------------------------------------
namespace pylith {
namespace feassemble {
class Constraint;
class TestConstraint; // unit testing
} // feassemble
+
+ namespace topology {
+ class Field; // USES Field'
+ class Mesh; // USES Mesh
+ } // feassemble
} // pylith
namespace spatialdata {
@@ -35,8 +40,7 @@
} // units
} // spatialdata
-/// C++ abstract base class defining interface for constraints applied
-/// to finite-elements.
+// Constraint -----------------------------------------------------------
class pylith::feassemble::Constraint
{ // class Constraint
friend class TestConstraint; // unit testing
@@ -60,20 +64,20 @@
/** Set number of degrees of freedom that are constrained at points in field.
*
* @param field Solution field
- * @param mesh PETSc mesh
+ * @param mesh Finite-element mesh.
*/
virtual
- void setConstraintSizes(const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh) = 0;
+ void setConstraintSizes(const topology::Field& field,
+ const topology::Mesh& mesh) = 0;
/** Set which degrees of freedom are constrained at points in field.
*
* @param field Solution field
- * @param mesh PETSc mesh
+ * @param mesh Finite-element mesh.
*/
virtual
- void setConstraints(const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh) = 0;
+ void setConstraints(const topology::Field& field,
+ const topology::Mesh& mesh) = 0;
/** Set flag for setting constraints for total field solution or
* incremental field solution.
@@ -87,12 +91,12 @@
*
* @param t Current time
* @param field Solution field
- * @param mesh PETSc mesh
+ * @param mesh Finite-element mesh.
*/
virtual
void setField(const double t,
- const ALE::Obj<real_section_type>& field,
- const ALE::Obj<Mesh>& mesh) = 0;
+ const topology::Field& field,
+ const topology::Mesh& mesh) = 0;
// PROTECTED MEMBERS //////////////////////////////////////////////////
protected :
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -60,6 +60,32 @@
} // newSection
// ----------------------------------------------------------------------
+// Create sieve section and set chart and fiber dimesion.
+void
+pylith::topology::Field::newSection(
+ const ALE::Obj<SieveMesh::label_sequence>& points,
+ const int fiberDim)
+{ // newSection
+ if (fiberDim < 0) {
+ std::ostringstream msg;
+ msg
+ << "Fiber dimension (" << fiberDim << ") for Field '" << _name
+ << "' must be nonnegative.";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ assert(!_mesh.isNull());
+ _section = new SieveRealSection(_mesh->comm(), _mesh->debug());
+
+ const SieveMesh::point_type pointMin =
+ *std::min_element(points->begin(), points->end());
+ const SieveMesh::point_type pointMax =
+ *std::max_element(points->begin(), points->end());
+ _section->setChart(SieveRealSection::chart_type(pointMin, pointMax+1));
+ _section->setFiberDimension(points, fiberDim);
+} // newSection
+
+// ----------------------------------------------------------------------
// Create section given atlas.
void
pylith::topology::Field::copyLayout(const Field& src)
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/Field.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -130,6 +130,15 @@
/// Create sieve section.
void newSection(void);
+ /** Create sieve section and set chart and fiber dimesion.
+
+ *
+ * @param points Mesh points over which to define section.
+ * @param dim Fiber dimension for section.
+ */
+ void newSection(const ALE::Obj<SieveMesh::label_sequence>& points,
+ const int fiberDim);
+
/** Create section with same layout (fiber dimension and
* constraints) as another section. This allows the layout data
* structures to be reused across multiple fields, reducing memory
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldUniform.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldUniform.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/topology/FieldUniform.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -25,6 +25,7 @@
Field(mesh),
_fiberDim(fiberDim)
{ // constructor
+ assert(fiberDim >= 0);
} // constructor
// ----------------------------------------------------------------------
@@ -39,15 +40,7 @@
pylith::topology::FieldUniform::createSection(
const ALE::Obj<SieveMesh::label_sequence>& points)
{ // createSection
- if (_section.isNull())
- newSection();
-
- const SieveMesh::point_type pointMin =
- *std::min_element(points->begin(), points->end());
- const SieveMesh::point_type pointMax =
- *std::max_element(points->begin(), points->end());
- _section->setChart(SieveRealSection::chart_type(pointMin, pointMax+1));
- _section->setFiberDimension(points, _fiberDim);
+ newSection(points, _fiberDim);
_mesh->allocate(_section);
} // createSection
Property changes on: short/3D/PyLith/branches/pylith-swig/modulesrc/bc
___________________________________________________________________
Name: svn:ignore
+ Makefile.in
bc.py
bc_wrap.cxx
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/bc/BoundaryCondition.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/bc/BoundaryCondition.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/bc/BoundaryCondition.i 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/bc/BoundaryCondition.i
+ *
+ * @brief Python interface to C++ BoundaryCondition object.
+ */
+
+namespace pylith {
+ namespace bc {
+
+ class BoundaryCondition
+ { // class BoundaryCondition
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ BoundaryCondition(void);
+
+ /// Destructor.
+ virtual
+ ~BoundaryCondition(void);
+
+ /** Set label of boundary condition surface.
+ *
+ * @param value Label of surface (from mesh generator).
+ */
+ void label(const char* value);
+
+ /** Get label of boundary condition surface.
+ *
+ * @returns Label of surface (from mesh generator).
+ */
+ const char* label(void) const;
+
+ /** Set database for boundary condition parameters.
+ *
+ * @param db Spatial database
+ */
+ void db(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Verify configuration.
+ *
+ * @param mesh Finite-element mesh.
+ */
+ virtual
+ void verifyConfiguration(const pylith::topology::Mesh& mesh) const;
+
+ /** Initialize boundary condition.
+ *
+ * @param mesh Finite-element mesh.
+ * @param upDir Vertical direction (somtimes used in 3-D problems).
+ */
+ virtual
+ void initialize(const pylith::topology::Mesh& mesh,
+ const double upDir[3]) = 0;
+
+ }; // class BoundaryCondition
+
+ } // bc
+} // pylith
+
+
+// End of file
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBC.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBC.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBC.i 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,105 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/bc/DirichletBC.i
+ *
+ * @brief Python interface to C++ DirichletBC object.
+ */
+
+namespace pylith {
+ namespace bc {
+
+ class DirichletBC : public BoundaryCondition,
+ public pylith::feassemble::Constraint
+ { // class DirichletBC
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ DirichletBC(void);
+
+ /// Destructor.
+ ~DirichletBC(void);
+
+ /** Set database for rate of change of values.
+ *
+ * @param db Spatial database
+ */
+ void dbRate(spatialdata::spatialdb::SpatialDB* const db);
+
+ /** Set indices of fixed degrees of freedom.
+ *
+ * Note: all points associated with boundary condition has same
+ * degrees of freedom fixed.
+ *
+ * Example: [0, 1] to fix x and y degrees of freedom in Cartesian system.
+ *
+ * @param flags Array of indices of fixed degrees of freedom.
+ * @param size Size of array.
+ */
+ %apply(int* INPLACE_ARRAY1, int DIM1) {
+ (const int* flags,
+ const int size)
+ };
+ void fixedDOF(const int* flags,
+ const int size);
+ %clear(const int* flags, const int size);
+
+ /** Set time at which rate of change begins.
+ *
+ * @param t Reference time.
+ */
+ void referenceTime(const double t);
+
+ /** Initialize boundary condition.
+ *
+ * @param mesh PETSc mesh
+ * @param upDir Vertical direction (somtimes used in 3-D problems).
+ */
+ void initialize(const pylith::topology::Mesh& mesh,
+ const double upDir[3]);
+
+ /** Set number of degrees of freedom that are constrained at
+ * points in field.
+ *
+ * @param field Solution field
+ * @param mesh PETSc mesh
+ */
+ void setConstraintSizes(const pylith::topology::Field& field,
+ const pylith::topology::Mesh& mesh);
+
+ /** Set which degrees of freedom are constrained at points in field.
+ *
+ * @param field Solution field
+ * @param mesh PETSc mesh
+ */
+ void setConstraints(const pylith::topology::Field& field,
+ const pylith::topology::Mesh& mesh);
+
+ /** Set values in field.
+ *
+ * @param t Current time
+ * @param field Solution field
+ * @param mesh PETSc mesh
+ */
+ void setField(const double t,
+ const pylith::topology::Field& field,
+ const pylith::topology::Mesh& mesh);
+
+ }; // class DirichletBC
+
+ } // bc
+} // pylith
+
+
+// End of file
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBoundary.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBoundary.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/bc/DirichletBoundary.i 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,67 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/bc/DirichletBoundary.i
+ *
+ * @brief Python interface to C++ DirichletBoundary object.
+ */
+
+namespace pylith {
+ namespace bc {
+
+ class DirichletBoundary : public DirichletBC
+ { // class DirichletBoundary
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ DirichletBoundary(void);
+
+ /// Destructor.
+ ~DirichletBoundary(void);
+
+ /** Initialize boundary condition.
+ *
+ * @param mesh Finite-element mesh.
+ * @param upDir Vertical direction (somtimes used in 3-D problems).
+ */
+ void initialize(const pylith::topology::Mesh& mesh,
+ const double upDir[3]);
+
+ /** Get boundary mesh.
+ *
+ * @return Boundary mesh.
+ */
+ const ALE::Obj<pylith::SieveSubMesh>& boundaryMesh(void) const;
+
+ /** Get vertex field with BC information.
+ *
+ * @param fieldType Type of field.
+ * @param name Name of field.
+ * @param mesh Finite-element mesh.
+ * @param fields Solution fields.
+ *
+ * @returns Field over vertices.
+ */
+ const pylith::topology::Field&
+ vertexField(const char* name,
+ const pylith::topology::Mesh& mesh,
+ const pylith::topology::SolutionFields& fields);
+
+ }; // class DirichletBoundary
+
+ } // bc
+} // pylith
+
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/bc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/bc/Makefile.am 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/bc/Makefile.am 2009-01-26 05:47:02 UTC (rev 13956)
@@ -13,40 +13,46 @@
subpackage = bc
include $(top_srcdir)/subpackage.am
-subpkgpyexec_LTLIBRARIES = bcmodule.la
+subpkgpyexec_LTLIBRARIES = _bcmodule.la
-bcmodule_la_LDFLAGS = -module -avoid-version \
+subpkgpyexec_PYTHON = bc.py
+
+swig_sources = \
+ bc.i \
+ BoundaryCondition.i \
+ DirichletBC.i \
+ DirichletBoundary.i
+
+swig_generated = \
+ bc_wrap.cxx \
+ bc.py
+
+_bcmodule_la_LDFLAGS = -module -avoid-version \
$(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
-dist_bcmodule_la_SOURCES = bc.pyxe.src
-nodist_bcmodule_la_SOURCES = \
- bc.pyxe \
- bc.c bc_embed.cpp bc_embed.h
+dist__bcmodule_la_SOURCES = $(swig_sources) $(swig_generated)
-bcmodule_la_LIBADD = \
+_bcmodule_la_LIBADD = \
$(top_builddir)/libsrc/libpylith.la \
-lspatialdata \
- $(PETSC_LIB)
-
+ $(PETSC_LIBS)
if ENABLE_CUBIT
- bcmodule_la_LIBADD += -lnetcdf_c++ -lnetcdf
+ _bcmodule_la_LIBADD += -lnetcdf_c++ -lnetcdf
endif
if NO_UNDEFINED
- bcmodule_la_LIBADD += $(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
+_bcmodule_la_LIBADD += \
+ $(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
endif
-INCLUDES += -I$(PYTHON_INCDIR) $(PETSC_INCLUDE)
+INCLUDES += $(PYTHON_EGG_CPPFLAGS) -I$(NUMPY_INCDIR) -I$(PYTHON_INCDIR) $(PETSC_INCLUDE)
-bc.pyx bc_embed.cpp bc_embed.h: bc.pyxe
- pyrexembed bc.pyxe
-bc.pyxe: $(srcdir)/bc.pyxe.src
- cp $(srcdir)/bc.pyxe.src $@
-bc_embed.cpp: bc_embed.h
-bc_embed.h: bc.pyx
+$(srcdir)/bc_wrap.cxx $(srcdir)/bc.py: $(swig_sources)
+ $(SWIG) -Wall -c++ -python $<
-.pyx.c:
- pyrexc $<
-CLEANFILES = bc.pyxe bc.pyx bc.c *_embed.*
+MAINTAINERCLEANFILES = \
+ $(srcdir)/bc_wrap.cxx \
+ $(srcdir)/bc.py
+
# End of file
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/bc/bc.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/bc/bc.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/bc/bc.i 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// SWIG interface
+%module bc
+
+// Header files for module C++ code
+%{
+#include "pylith/bc/BoundaryCondition.hh"
+#include "pylith/bc/DirichletBC.hh"
+#include "pylith/bc/DirichletBoundary.hh"
+
+#include "pylith/utils/arrayfwd.hh"
+%}
+
+%include "exception.i"
+%exception {
+ try {
+ $action
+ } catch (const std::exception& err) {
+ SWIG_exception(SWIG_RuntimeError, err.what());
+ } // try/catch
+ } // exception
+
+%include "typemaps.i"
+%include "../include/doublearray.i"
+
+// Numpy interface stuff
+%{
+#define SWIG_FILE_WITH_INIT
+%}
+%include "../include/numpy.i"
+%init %{
+import_array();
+%}
+
+// Interfaces
+%include "BoundaryCondition.i"
+%include "DirichletBC.i"
+%include "DirichletBoundary.i"
+
+
+// End of file
+
Added: short/3D/PyLith/branches/pylith-swig/modulesrc/include/doublearray.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/include/doublearray.i (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/include/doublearray.i 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+%{
+static
+int
+convert_doublearray(PyObject* input,
+ double* const values,
+ const int size) {
+ if (!PySequence_Check(input)) {
+ PyErr_SetString(PyExc_TypeError, "Expecting a sequence of floats.");
+ return 0;
+ } // if
+ if (PyObject_Length(input) != size) {
+ PyErr_SetString(PyExc_ValueError, "Sequence size mismatch.");
+ return 0;
+ } // if
+ for (int i=0; i < size; i++) {
+ PyObject *o = PySequence_GetItem(input,i);
+ if (!PyFloat_Check(o)) {
+ Py_XDECREF(o);
+ PyErr_SetString(PyExc_ValueError,"Expecting a sequence of floats.");
+ return 0;
+ } // if
+ values[i] = PyFloat_AsDouble(o);
+ Py_DECREF(o);
+ } // for
+ return 1;
+} // convert_doublearray
+%}
+
+// Map a Python sequence of floats into a C double array.
+%typemap(in) double [ANY] (double values[$1_dim0]) {
+ if (!convert_doublearray($input, values, $1_dim0))
+ return NULL;
+ $1 = &values[0];
+ } // typemap
+
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-swig/pylith/bc/BoundaryCondition.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/bc/BoundaryCondition.py 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/pylith/bc/BoundaryCondition.py 2009-01-26 05:47:02 UTC (rev 13956)
@@ -23,6 +23,7 @@
## Factory: boundary_condition
from pyre.components.Component import Component
+from bc import BoundaryCondition as ModuleBoundaryCondition
# Validator for direction
def validateDir(value):
@@ -42,7 +43,7 @@
# BoundaryCondition class
-class BoundaryCondition(Component):
+class BoundaryCondition(Component, ModuleBoundaryCondition):
"""
Python abstract base class for managing a boundary condition.
@@ -92,8 +93,6 @@
Constructor.
"""
Component.__init__(self, name, facility="boundary_condition")
- self.cppHandle = None
- self.upDir = [0, 0, 1]
return
@@ -101,30 +100,18 @@
"""
Setup boundary condition.
"""
- self._createCppHandle()
- self.cppHandle.label = self.label
+ self._createModuleObj()
+ self.label(self.inventory.label)
+ self.db(self.inventory.db)
self.mesh = mesh
return
- def verifyConfiguration(self):
- """
- Verify compatibility of configuration.
- """
- assert(None != self.cppHandle)
- self.cppHandle.verifyConfiguration(self.mesh.cppHandle)
- return
-
-
def initialize(self, totalTime, numTimeSteps, normalizer):
"""
Initialize boundary condition.
- """
- self.db.initialize()
- self.cppHandle.db = self.db.cppHandle
- self.cppHandle.initialize(self.mesh.cppHandle,
- self.mesh.coordsys.cppHandle,
- self.upDir)
+ """
+ ModuleBoundaryCondition.initialize(self, self.mesh, self.upDir)
return
@@ -135,18 +122,15 @@
Setup members using inventory.
"""
Component._configure(self)
- self.label = self.inventory.label
self.upDir = map(float, self.inventory.upDir)
- self.db = self.inventory.db
return
- def _createCppHandle(self):
+ def _createModuleObj(self):
"""
Create handle to corresponding C++ object.
"""
- raise NotImplementedError("Please implement _createCppHandle() in " \
- "derived class.")
+ raise NotImplementedError("BoundaryCondition is an abstract base class.")
-
+
# End of file
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/Makefile.am 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/Makefile.am 2009-01-26 05:47:02 UTC (rev 13956)
@@ -21,44 +21,47 @@
# Primary source files
testbc_SOURCES = \
- TestAbsorbingDampers.cc \
- TestAbsorbingDampersLine2.cc \
- TestAbsorbingDampersTri3.cc \
- TestAbsorbingDampersQuad4.cc \
- TestAbsorbingDampersTet4.cc \
- TestAbsorbingDampersHex8.cc \
TestBoundaryCondition.cc \
- TestBoundaryMesh.cc \
- TestBoundaryMeshTri3.cc \
- TestBoundaryMeshQuad4.cc \
- TestBoundaryMeshTet4.cc \
- TestBoundaryMeshHex8.cc \
- TestDirichletBoundary.cc \
- TestDirichletBoundaryTri3.cc \
- TestDirichletBoundaryQuad4.cc \
- TestDirichletBoundaryTet4.cc \
- TestDirichletBoundaryHex8.cc \
- TestDirichletBoundaryMulti.cc \
- TestDirichletBoundaryMultiTri3.cc \
- TestDirichletBoundaryMultiTet4.cc \
- TestDirichletPoints.cc \
- TestDirichletPointsLine2.cc \
- TestDirichletPointsLine2b.cc \
- TestDirichletPointsTri3.cc \
- TestDirichletPointsQuad4.cc \
- TestDirichletPointsTet4.cc \
- TestDirichletPointsHex8.cc \
- TestDirichletPointsMulti.cc \
- TestDirichletPointsMultiTri3.cc \
- TestDirichletPointsMultiTet4.cc \
- TestNeumann.cc \
- TestNeumannLine2.cc \
- TestNeumannTri3.cc \
- TestNeumannQuad4.cc \
- TestNeumannTet4.cc \
- TestNeumannHex8.cc \
+ TestDirichletBC.cc \
+ TestDirichletBCLine2.cc \
+ TestDirichletBCLine2b.cc \
+ TestDirichletBCTri3.cc \
+ TestDirichletBCQuad4.cc \
+ TestDirichletBCTet4.cc \
+ TestDirichletBCHex8.cc \
+ TestDirichletBCMulti.cc \
+ TestDirichletBCMultiTri3.cc \
+ TestDirichletBCMultiTet4.cc \
test_bc.cc
+# TestDirichletBoundary.cc \
+# TestDirichletBoundaryTri3.cc
+# TestDirichletBoundaryQuad4.cc \
+# TestDirichletBoundaryTet4.cc \
+# TestDirichletBoundaryHex8.cc \
+# TestDirichletBoundaryMulti.cc \
+# TestDirichletBoundaryMultiTri3.cc \
+# TestDirichletBoundaryMultiTet4.cc
+
+# TestAbsorbingDampers.cc \
+# TestAbsorbingDampersLine2.cc \
+# TestAbsorbingDampersTri3.cc \
+# TestAbsorbingDampersQuad4.cc \
+# TestAbsorbingDampersTet4.cc \
+# TestAbsorbingDampersHex8.cc \
+# TestNeumann.cc \
+# TestNeumannLine2.cc \
+# TestNeumannTri3.cc \
+# TestNeumannQuad4.cc \
+# TestNeumannTet4.cc \
+# TestNeumannHex8.cc
+
+# TestBoundaryMesh.cc \
+# TestBoundaryMeshTri3.cc \
+# TestBoundaryMeshQuad4.cc \
+# TestBoundaryMeshTet4.cc \
+# TestBoundaryMeshHex8.cc
+
noinst_HEADERS = \
TestAbsorbingDampers.hh \
TestAbsorbingDampersLine2.hh \
@@ -80,16 +83,16 @@
TestDirichletBoundaryMulti.hh \
TestDirichletBoundaryMultiTri3.hh \
TestDirichletBoundaryMultiTet4.hh \
- TestDirichletPoints.hh \
- TestDirichletPointsLine2.hh \
- TestDirichletPointsLine2b.hh \
- TestDirichletPointsTri3.hh \
- TestDirichletPointsQuad4.hh \
- TestDirichletPointsTet4.hh \
- TestDirichletPointsHex8.hh \
- TestDirichletPointsMulti.hh \
- TestDirichletPointsMultiTri3.hh \
- TestDirichletPointsMultiTet4.hh \
+ TestDirichletBC.hh \
+ TestDirichletBCLine2.hh \
+ TestDirichletBCLine2b.hh \
+ TestDirichletBCTri3.hh \
+ TestDirichletBCQuad4.hh \
+ TestDirichletBCTet4.hh \
+ TestDirichletBCHex8.hh \
+ TestDirichletBCMulti.hh \
+ TestDirichletBCMultiTri3.hh \
+ TestDirichletBCMultiTet4.hh \
TestNeumann.hh \
TestNeumannLine2.hh \
TestNeumannTri3.hh \
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestBoundaryCondition.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestBoundaryCondition.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestBoundaryCondition.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -14,7 +14,7 @@
#include "TestBoundaryCondition.hh" // Implementation of class methods
-#include "pylith/bc/DirichletPoints.hh" // USES DirichletPoints
+#include "pylith/bc/DirichletBC.hh" // USES DirichletBC
#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
@@ -28,11 +28,11 @@
void
pylith::bc::TestBoundaryCondition::testLabel(void)
{ // testLabel
- const std::string label = "the_database";
- DirichletPoints bc;
+ const std::string& label = "the_database";
+ DirichletBC bc;
bc.label(label.c_str());
- CPPUNIT_ASSERT_EQUAL(label, bc.label());
+ CPPUNIT_ASSERT_EQUAL(label, std::string(bc.label()));
} // testLabel
// ----------------------------------------------------------------------
@@ -40,9 +40,9 @@
void
pylith::bc::TestBoundaryCondition::testDB(void)
{ // testDB
- const std::string label = "my db";
+ const std::string& label = "my db";
spatialdata::spatialdb::SimpleDB db(label.c_str());
- DirichletPoints bc;
+ DirichletBC bc;
bc.db(&db);
CPPUNIT_ASSERT(0 != bc._db);
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestBoundaryMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestBoundaryMesh.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestBoundaryMesh.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -16,11 +16,10 @@
#include "data/BoundaryMeshData.hh" // USES BoundaryMeshData
+#include "pylith/topology/Mesh.hh" // USES Mesh
#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
#include "pylith/faults/FaultCohesiveKin.hh" // USES FaultsCohesiveKin
-#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
-
#include <Selection.hh> // USES submesh algorithms
// ----------------------------------------------------------------------
@@ -46,33 +45,36 @@
{ // testSubmesh
CPPUNIT_ASSERT(0 != _data);
- ALE::Obj<Mesh> mesh;
+ topology::Mesh mesh;
meshio::MeshIOAscii iohandler;
iohandler.filename(_data->filename);
iohandler.read(&mesh);
- CPPUNIT_ASSERT(!mesh.isNull());
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+
const char* label = _data->bcLabel;
- const ALE::Obj<SubMesh>& subMesh =
- ALE::Selection<Mesh>::submeshV<SubMesh>(mesh, mesh->getIntSection(label));
+ const ALE::Obj<SieveSubMesh>& subMesh =
+ ALE::Selection<Mesh>::submeshV<SieveSubMesh>(sieveMesh,
+ sieveMesh->getIntSection(label));
CPPUNIT_ASSERT(!subMesh.isNull());
//subMesh->view("SUBMESH WITHOUT FAULT");
- const ALE::Obj<SubMesh::label_sequence>& vertices = subMesh->depthStratum(0);
- const SubMesh::label_sequence::iterator verticesEnd = vertices->end();
+ const ALE::Obj<SieveSubMesh::label_sequence>& vertices = subMesh->depthStratum(0);
+ const SieveSubMesh::label_sequence::iterator verticesEnd = vertices->end();
CPPUNIT_ASSERT_EQUAL(_data->numVerticesNoFault, int(vertices->size()));
int ipt = 0;
- for (SubMesh::label_sequence::iterator v_iter=vertices->begin();
+ for (SieveSubMesh::label_sequence::iterator v_iter=vertices->begin();
v_iter != verticesEnd;
++v_iter, ++ipt)
CPPUNIT_ASSERT_EQUAL(_data->verticesNoFault[ipt], *v_iter);
- const ALE::Obj<SubMesh::label_sequence>& cells = subMesh->heightStratum(1);
- const SubMesh::label_sequence::iterator cellsEnd = cells->end();
+ const ALE::Obj<SieveSubMesh::label_sequence>& cells = subMesh->heightStratum(1);
+ const SieveSubMesh::label_sequence::iterator cellsEnd = cells->end();
const ALE::Obj<sieve_type>& sieve = subMesh->getSieve();
assert(!sieve.isNull());
@@ -82,12 +84,12 @@
int icell = 0;
int index = 0;
- for (SubMesh::label_sequence::iterator c_iter=cells->begin();
+ for (SieveSubMesh::label_sequence::iterator c_iter=cells->begin();
c_iter != cellsEnd;
++c_iter, ++icell) {
ALE::ISieveTraversal<sieve_type>::orientedClosure(*sieve, *c_iter, ncV);
- const int coneSize = ncV.getSize();
- const Mesh::point_type *cone = ncV.getPoints();
+ const int coneSize = ncV.getSize();
+ const SieveMesh::point_type *cone = ncV.getPoints();
CPPUNIT_ASSERT_EQUAL(_data->numCorners, coneSize);
@@ -104,41 +106,44 @@
{ // testSubmeshFault
CPPUNIT_ASSERT(0 != _data);
- ALE::Obj<Mesh> mesh;
+ topology::Mesh mesh;
meshio::MeshIOAscii iohandler;
iohandler.filename(_data->filename);
iohandler.read(&mesh);
- CPPUNIT_ASSERT(!mesh.isNull());
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+
faults::FaultCohesiveKin fault;
fault.label(_data->faultLabel);
fault.id(_data->faultId);
- fault.adjustTopology(mesh, _flipFault);
+ fault.adjustTopology(sieveMesh, _flipFault);
const char* label = _data->bcLabel;
- const ALE::Obj<SubMesh>& subMesh =
- ALE::Selection<Mesh>::submeshV<SubMesh>(mesh, mesh->getIntSection(label));
+ const ALE::Obj<SieveSubMesh>& subMesh =
+ ALE::Selection<SieveMesh>::submeshV<SieveSubMesh>(sievMesh,
+ sievMesh->getIntSection(label));
CPPUNIT_ASSERT(!subMesh.isNull());
//subMesh->view("Submesh for mesh w/fault");
- const ALE::Obj<SubMesh::label_sequence>& vertices = subMesh->depthStratum(0);
- const SubMesh::label_sequence::iterator verticesEnd = vertices->end();
+ const ALE::Obj<SieveSubMesh::label_sequence>& vertices = subMesh->depthStratum(0);
+ const SieveSubMesh::label_sequence::iterator verticesEnd = vertices->end();
CPPUNIT_ASSERT_EQUAL(_data->numVerticesFault, int(vertices->size()));
int ipt = 0;
- for (SubMesh::label_sequence::iterator v_iter=vertices->begin();
+ for (SieveSubMesh::label_sequence::iterator v_iter=vertices->begin();
v_iter != verticesEnd;
++v_iter, ++ipt)
CPPUNIT_ASSERT_EQUAL(_data->verticesFault[ipt], *v_iter);
- const ALE::Obj<SubMesh::label_sequence>& cells = subMesh->depthStratum(1);
- const SubMesh::label_sequence::iterator cellsEnd = cells->end();
+ const ALE::Obj<SieveSubMesh::label_sequence>& cells = subMesh->depthStratum(1);
+ const SieveSubMesh::label_sequence::iterator cellsEnd = cells->end();
const ALE::Obj<sieve_type>& sieve = subMesh->getSieve();
assert(!sieve.isNull());
const int depth = 1;
- typedef ALE::SieveAlg<Mesh> SieveAlg;
+ typedef ALE::SieveAlg<SieveMesh> SieveAlg;
CPPUNIT_ASSERT_EQUAL(_data->numCells, int(cells->size()));
@@ -146,12 +151,12 @@
int icell = 0;
int index = 0;
- for (SubMesh::label_sequence::iterator c_iter=cells->begin();
+ for (SieveSubMesh::label_sequence::iterator c_iter=cells->begin();
c_iter != cellsEnd;
++c_iter, ++icell) {
ALE::ISieveTraversal<sieve_type>::orientedClosure(*sieve, *c_iter, ncV);
- const int coneSize = ncV.getSize();
- const Mesh::point_type *cone = ncV.getPoints();
+ const int coneSize = ncV.getSize();
+ const SieveMesh::point_type *cone = ncV.getPoints();
CPPUNIT_ASSERT_EQUAL(_data->numCorners, coneSize);
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBC.cc (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPoints.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBC.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBC.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,340 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDirichletBC.hh" // Implementation of class methods
+
+#include "pylith/bc/DirichletBC.hh" // USES DirichletBC
+
+#include "data/DirichletData.hh" // USES DirichletData
+
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/topology/FieldUniform.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
+#include "spatialdata/spatialdb/UniformDB.hh" // USES UniformDB
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletBC );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestDirichletBC::setUp(void)
+{ // setUp
+ _data = 0;
+} // setUp
+
+// ----------------------------------------------------------------------
+// Tear down testing data.
+void
+pylith::bc::TestDirichletBC::tearDown(void)
+{ // tearDown
+ delete _data; _data = 0;
+} // tearDown
+
+// ----------------------------------------------------------------------
+// Test constructor.
+void
+pylith::bc::TestDirichletBC::testConstructor(void)
+{ // testConstructor
+ DirichletBC bc;
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test fixedDOF()
+void
+pylith::bc::TestDirichletBC::testFixedDOF(void)
+{ // testfixedDOF
+ DirichletBC bc;
+
+ const size_t numDOF = 4;
+ const int fixedDOF[] = { 0, 2, 3, 5 };
+ bc.fixedDOF(fixedDOF, numDOF);
+
+ CPPUNIT_ASSERT_EQUAL(numDOF, bc._fixedDOF.size());
+ for (int i=0; i < numDOF; ++i)
+ CPPUNIT_ASSERT_EQUAL(fixedDOF[i], bc._fixedDOF[i]);
+} // testFixedDOF
+
+// ----------------------------------------------------------------------
+// Test initialize().
+void
+pylith::bc::TestDirichletBC::testInitialize(void)
+{ // testInitialize
+ 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 int numFixedDOF = _data->numFixedDOF;
+ const size_t numPoints = _data->numConstrainedPts;
+
+ // Check points
+ const int offset = numCells;
+ if (numFixedDOF > 0) {
+ CPPUNIT_ASSERT_EQUAL(numPoints, bc._points.size());
+ for (int i=0; i < numPoints; ++i)
+ CPPUNIT_ASSERT_EQUAL(_data->constrainedPoints[i]+offset, bc._points[i]);
+ } // if
+
+ // Check values
+ const size_t size = numPoints * numFixedDOF;
+ CPPUNIT_ASSERT_EQUAL(size, bc._valuesInitial.size());
+ const double tolerance = 1.0e-06;
+ for (int i=0; i < size; ++i)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->valuesInitial[i], bc._valuesInitial[i],
+ tolerance);
+
+ CPPUNIT_ASSERT_EQUAL(size, bc._valuesRate.size());
+ for (int i=0; i < size; ++i)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->valueRate, bc._valuesRate[i],
+ tolerance);
+} // testInitialize
+
+// ----------------------------------------------------------------------
+// Test setConstraintSizes().
+void
+pylith::bc::TestDirichletBC::testSetConstraintSizes(void)
+{ // testSetConstraintSizes
+ topology::Mesh mesh;
+ DirichletBC bc;
+ _initialize(&mesh, &bc);
+ CPPUNIT_ASSERT(0 != _data);
+
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+ const ALE::Obj<SieveMesh::label_sequence>& vertices =
+ sieveMesh->depthStratum(0);
+ CPPUNIT_ASSERT(!vertices.isNull());
+
+ const int fiberDim = _data->numDOF;
+ topology::Field field(sieveMesh);
+ field.newSection(vertices, fiberDim);
+ const ALE::Obj<SieveRealSection>& fieldSection = field.section();
+ CPPUNIT_ASSERT(!fieldSection.isNull());
+
+ bc.setConstraintSizes(field, mesh);
+
+ const int numCells = sieveMesh->heightStratum(0)->size();
+ const int offset = numCells;
+ int iConstraint = 0;
+ for (SieveMesh::label_sequence::iterator v_iter = vertices->begin();
+ v_iter != vertices->end();
+ ++v_iter) {
+ if (*v_iter != _data->constrainedPoints[iConstraint] + offset) {
+ CPPUNIT_ASSERT_EQUAL(_data->numDOF,
+ fieldSection->getFiberDimension(*v_iter));
+ CPPUNIT_ASSERT_EQUAL(0,
+ fieldSection->getConstraintDimension(*v_iter));
+ } else {
+ CPPUNIT_ASSERT_EQUAL(_data->numDOF,
+ fieldSection->getFiberDimension(*v_iter));
+ CPPUNIT_ASSERT_EQUAL(_data->numFixedDOF,
+ fieldSection->getConstraintDimension(*v_iter));
+ ++iConstraint;
+ } // if/else
+ } // for
+} // testSetConstraintSizes
+
+// ----------------------------------------------------------------------
+// Test setConstraints().
+void
+pylith::bc::TestDirichletBC::testSetConstraints(void)
+{ // testSetConstraints
+ topology::Mesh mesh;
+ DirichletBC bc;
+ _initialize(&mesh, &bc);
+ CPPUNIT_ASSERT(0 != _data);
+
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+ const ALE::Obj<SieveMesh::label_sequence>& vertices =
+ sieveMesh->depthStratum(0);
+ CPPUNIT_ASSERT(!vertices.isNull());
+
+ const int fiberDim = _data->numDOF;
+ topology::Field field(sieveMesh);
+ field.newSection(vertices, fiberDim);
+ const ALE::Obj<SieveRealSection>& fieldSection = field.section();
+ CPPUNIT_ASSERT(!fieldSection.isNull());
+
+ bc.setConstraintSizes(field, mesh);
+ sieveMesh->allocate(fieldSection);
+ bc.setConstraints(field, mesh);
+
+ const int numCells = sieveMesh->heightStratum(0)->size();
+ const int offset = numCells;
+ int iConstraint = 0;
+ for (SieveMesh::label_sequence::iterator v_iter = vertices->begin();
+ v_iter != vertices->end();
+ ++v_iter) {
+ const int* fixedDOF = fieldSection->getConstraintDof(*v_iter);
+ if (*v_iter != _data->constrainedPoints[iConstraint] + offset) {
+ CPPUNIT_ASSERT_EQUAL(0, fieldSection->getConstraintDimension(*v_iter));
+ //CPPUNIT_ASSERT(0 == fixedDOF);
+ } else {
+ CPPUNIT_ASSERT(0 != fixedDOF);
+ CPPUNIT_ASSERT_EQUAL(_data->numFixedDOF,
+ fieldSection->getConstraintDimension(*v_iter));
+ for (int iDOF=0; iDOF < _data->numFixedDOF; ++iDOF)
+ CPPUNIT_ASSERT_EQUAL(_data->fixedDOF[iDOF], fixedDOF[iDOF]);
+ ++iConstraint;
+ } // if/else
+ } // for
+} // testSetConstraints
+
+// ----------------------------------------------------------------------
+// Test setField().
+void
+pylith::bc::TestDirichletBC::testSetField(void)
+{ // testSetField
+ topology::Mesh mesh;
+ DirichletBC bc;
+ _initialize(&mesh, &bc);
+ CPPUNIT_ASSERT(0 != _data);
+
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+ const ALE::Obj<SieveMesh::label_sequence>& vertices =
+ sieveMesh->depthStratum(0);
+ CPPUNIT_ASSERT(!vertices.isNull());
+
+ const int fiberDim = _data->numDOF;
+ topology::Field field(sieveMesh);
+ field.newSection(vertices, fiberDim);
+ const ALE::Obj<SieveRealSection>& fieldSection = field.section();
+ CPPUNIT_ASSERT(!fieldSection.isNull());
+
+ bc.setConstraintSizes(field, mesh);
+ sieveMesh->allocate(fieldSection);
+ bc.setConstraints(field, mesh);
+
+ const double tolerance = 1.0e-06;
+
+ // All values should be zero.
+ field.zero();
+ for (SieveMesh::label_sequence::iterator v_iter = vertices->begin();
+ v_iter != vertices->end();
+ ++v_iter) {
+ const int fiberDim = fieldSection->getFiberDimension(*v_iter);
+ const SieveRealSection::value_type* values =
+ sieveMesh->restrictClosure(fieldSection, *v_iter);
+ for (int i=0; i < fiberDim; ++i)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, values[i], tolerance);
+ } // for
+
+ // Only unconstrained values should be zero.
+ const double t = 1.0;
+ bc.setField(t, field, mesh);
+
+ // Create list of unconstrained DOF at constrained DOF
+ const int numFreeDOF = _data->numDOF - _data->numFixedDOF;
+ int_array freeDOF(numFreeDOF);
+ int index = 0;
+ for (int iDOF=0; iDOF < _data->numDOF; ++iDOF) {
+ bool free = true;
+ for (int iFixed=0; iFixed < _data->numFixedDOF; ++iFixed)
+ if (iDOF == _data->fixedDOF[iFixed])
+ free = false;
+ if (free)
+ freeDOF[index] = iDOF;
+ } // for
+
+ const int numCells = sieveMesh->heightStratum(0)->size();
+ const int offset = numCells;
+ const int numFixedDOF = _data->numFixedDOF;
+ int iConstraint = 0;
+ for (SieveMesh::label_sequence::iterator v_iter = vertices->begin();
+ v_iter != vertices->end();
+ ++v_iter) {
+ const int fiberDim = fieldSection->getFiberDimension(*v_iter);
+ const SieveRealSection::value_type* values =
+ sieveMesh->restrictClosure(fieldSection, *v_iter);
+
+ if (*v_iter != _data->constrainedPoints[iConstraint] + offset) {
+ // unconstrained point
+ for (int i=0; i < fiberDim; ++i)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, values[i], tolerance);
+ } else {
+ // constrained point
+
+ // check unconstrained DOF
+ for (int iDOF=0; iDOF < numFreeDOF; ++iDOF)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, values[freeDOF[iDOF]], tolerance);
+
+ // check constrained DOF
+ for (int iDOF=0; iDOF < numFixedDOF; ++iDOF) {
+ const int index = iConstraint * numFixedDOF + iDOF;
+ const double valueE = (t > _data->tRef) ?
+ _data->valuesInitial[index] + (t-_data->tRef)*_data->valueRate :
+ _data->valuesInitial[index];
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(valueE, values[_data->fixedDOF[iDOF]],
+ tolerance);
+ } // for
+ ++iConstraint;
+ } // if/else
+ } // for
+} // testSetField
+
+// ----------------------------------------------------------------------
+void
+pylith::bc::TestDirichletBC::_initialize(topology::Mesh* mesh,
+ DirichletBC* const bc) const
+{ // _initialize
+ CPPUNIT_ASSERT(0 != _data);
+ CPPUNIT_ASSERT(0 != bc);
+
+ meshio::MeshIOAscii iohandler;
+ iohandler.filename(_data->meshFilename);
+ iohandler.read(mesh);
+
+ spatialdata::geocoords::CSCart cs;
+ cs.setSpaceDim(mesh->dimension());
+ cs.initialize();
+ mesh->coordsys(&cs);
+
+ spatialdata::spatialdb::SimpleDB db("TestDirichletBC initial");
+ spatialdata::spatialdb::SimpleIOAscii dbIO;
+ dbIO.filename(_data->dbFilename);
+ db.ioHandler(&dbIO);
+ db.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
+
+ spatialdata::spatialdb::UniformDB dbRate("TestDirichletBC rate");
+ const char* names[] = { "dof-0", "dof-1", "dof-2" };
+ const double values[] = { _data->valueRate,
+ _data->valueRate,
+ _data->valueRate };
+ const int numValues = 3;
+ dbRate.setData(names, values, numValues);
+
+ const double upDir[] = { 0.0, 0.0, 1.0 };
+
+ bc->label(_data->label);
+ bc->db(&db);
+ bc->dbRate(&dbRate);
+ bc->referenceTime(_data->tRef);
+ bc->fixedDOF(_data->fixedDOF, _data->numFixedDOF);
+ bc->initialize(*mesh, upDir);
+} // _initialize
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBC.hh (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPoints.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBC.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBC.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,98 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestDirichletBC.hh
+ *
+ * @brief C++ TestDirichletBC object.
+ *
+ * C++ unit testing for DirichletBC.
+ */
+
+#if !defined(pylith_bc_testdirichletbc_hh)
+#define pylith_bc_testdirichletbc_hh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestDirichletBC;
+
+ class DirichletBC;
+ class DirichletData;
+ } // bc
+
+ namespace topology {
+ class Mesh;
+ } // topology
+} // pylith
+
+/// C++ unit testing for DirichletBC.
+class pylith::bc::TestDirichletBC : public CppUnit::TestFixture
+{ // class TestDirichletBC
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestDirichletBC );
+ CPPUNIT_TEST( testConstructor );
+ CPPUNIT_TEST( testFixedDOF );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+ /// Tear down testing data.
+ void tearDown(void);
+
+ /// Test constructor.
+ void testConstructor(void);
+
+ /// Test fixedDOF().
+ void testFixedDOF(void);
+
+ /// Test initialize().
+ void testInitialize(void);
+
+ /// Test setConstraintSizes().
+ void testSetConstraintSizes(void);
+
+ /// Test setConstraints().
+ void testSetConstraints(void);
+
+ /// Test setField().
+ void testSetField(void);
+
+ // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+ DirichletData* _data; ///< Data for testing
+
+ // PRIVATE METHODS ////////////////////////////////////////////////////
+private :
+
+ /** Initialize DirichletBC boundary condition.
+ *
+ * @param mesh Finite-element mesh to initialize.
+ * @param bc DirichletBC boundary condition to initialize.
+ */
+ void _initialize(topology::Mesh* mesh,
+ DirichletBC* const bc) const;
+
+}; // class TestDirichletBC
+
+#endif // pylith_bc_dirichletbc_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCHex8.cc (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsHex8.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCHex8.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCHex8.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDirichletBCHex8.hh" // Implementation of class methods
+
+#include "data/DirichletDataHex8.hh" // USES DirichletDataHex8
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletBCHex8 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestDirichletBCHex8::setUp(void)
+{ // setUp
+ _data = new DirichletDataHex8();
+} // setUp
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCHex8.hh (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsHex8.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCHex8.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCHex8.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestDirichletBCHex8.hh
+ *
+ * @brief C++ TestDirichletBC object.
+ *
+ * C++ unit testing for DirichletBC for mesh with 1-D line cells.
+ */
+
+#if !defined(pylith_bc_testdirichletbchex8_hh)
+#define pylith_bc_testdirichletbchex8_hh
+
+#include "TestDirichletBC.hh" // ISA TestDirichletBC
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestDirichletBCHex8;
+ } // bc
+} // pylith
+
+/// C++ unit testing for DirichletBC for mesh with 3-D hex cells.
+class pylith::bc::TestDirichletBCHex8 : public TestDirichletBC
+{ // class TestDirichletBC
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUB_SUITE( TestDirichletBCHex8, TestDirichletBC );
+ CPPUNIT_TEST( testInitialize );
+ CPPUNIT_TEST( testSetConstraintSizes );
+ CPPUNIT_TEST( testSetConstraints );
+ CPPUNIT_TEST( testSetField );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestDirichletBCHex8
+
+#endif // pylith_bc_dirichletbchex8_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2.cc (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDirichletBCLine2.hh" // Implementation of class methods
+
+#include "data/DirichletDataLine2.hh" // USES DirichletDataLine2
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletBCLine2 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestDirichletBCLine2::setUp(void)
+{ // setUp
+ _data = new DirichletDataLine2();
+} // setUp
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2.hh (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestDirichletBCLine2.hh
+ *
+ * @brief C++ TestDirichletBC object.
+ *
+ * C++ unit testing for DirichletBC for mesh with 1-D line cells.
+ */
+
+#if !defined(pylith_bc_testdirichletbcline2_hh)
+#define pylith_bc_testdirichletbcline2_hh
+
+#include "TestDirichletBC.hh" // ISA TestDirichletBC
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestDirichletBCLine2;
+ } // bc
+} // pylith
+
+/// C++ unit testing for DirichletBC for mesh with 1-D line cells.
+class pylith::bc::TestDirichletBCLine2 : public TestDirichletBC
+{ // class TestDirichletBC
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUB_SUITE( TestDirichletBCLine2, TestDirichletBC );
+ CPPUNIT_TEST( testInitialize );
+ CPPUNIT_TEST( testSetConstraintSizes );
+ CPPUNIT_TEST( testSetConstraints );
+ CPPUNIT_TEST( testSetField );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestDirichletBCLine2
+
+#endif // pylith_bc_dirichletbcline2_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2b.cc (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2b.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2b.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2b.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDirichletBCLine2b.hh" // Implementation of class methods
+
+#include "data/DirichletDataLine2b.hh" // USES DirichletDataLine2b
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletBCLine2b );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestDirichletBCLine2b::setUp(void)
+{ // setUp
+ _data = new DirichletDataLine2b();
+} // setUp
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2b.hh (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2b.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2b.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCLine2b.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestDirichletBCLine2b.hh
+ *
+ * @brief C++ TestDirichletBC object.
+ *
+ * C++ unit testing for DirichletBC for mesh with 1-D line cells.
+ */
+
+#if !defined(pylith_bc_testdirichletbcline2b_hh)
+#define pylith_bc_testdirichletbcline2b_hh
+
+#include "TestDirichletBC.hh" // ISA TestDirichletBC
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestDirichletBCLine2b;
+ } // bc
+} // pylith
+
+/// C++ unit testing for DirichletBC for mesh with 1-D line cells.
+class pylith::bc::TestDirichletBCLine2b : public TestDirichletBC
+{ // class TestDirichletBC
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUB_SUITE( TestDirichletBCLine2b, TestDirichletBC );
+ CPPUNIT_TEST( testInitialize );
+ CPPUNIT_TEST( testSetConstraintSizes );
+ CPPUNIT_TEST( testSetConstraints );
+ CPPUNIT_TEST( testSetField );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestDirichletBCLine2b
+
+#endif // pylith_bc_dirichletbcline2b_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMulti.cc (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMulti.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMulti.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMulti.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,273 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDirichletBCMulti.hh" // Implementation of class methods
+
+#include "pylith/bc/DirichletBC.hh" // USES DirichletBC
+
+#include "data/DirichletDataMulti.hh" // USES DirichletData
+
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/topology/FieldUniform.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
+#include "spatialdata/spatialdb/UniformDB.hh" // USES UniformDB
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestDirichletBCMulti::setUp(void)
+{ // setUp
+ _data = 0;
+} // setUp
+
+// ----------------------------------------------------------------------
+// Tear down testing data.
+void
+pylith::bc::TestDirichletBCMulti::tearDown(void)
+{ // tearDown
+ delete _data; _data = 0;
+} // tearDown
+
+// ----------------------------------------------------------------------
+// Test setConstraintSizes().
+void
+pylith::bc::TestDirichletBCMulti::testSetConstraintSizes(void)
+{ // testSetConstraintSizes
+ topology::Mesh mesh;
+ DirichletBC bcA;
+ DirichletBC bcB;
+ DirichletBC bcC;
+ _initialize(&mesh, &bcA, &bcB, &bcC);
+ CPPUNIT_ASSERT(0 != _data);
+
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+ const ALE::Obj<SieveMesh::label_sequence>& vertices =
+ sieveMesh->depthStratum(0);
+ CPPUNIT_ASSERT(!vertices.isNull());
+
+ const int fiberDim = _data->numDOF;
+ topology::Field field(sieveMesh);
+ field.newSection(vertices, fiberDim);
+ const ALE::Obj<SieveRealSection>& fieldSection = field.section();
+ CPPUNIT_ASSERT(!fieldSection.isNull());
+
+ bcA.setConstraintSizes(field, mesh);
+ bcB.setConstraintSizes(field, mesh);
+ bcC.setConstraintSizes(field, mesh);
+
+ const int numCells = sieveMesh->heightStratum(0)->size();
+ const int offset = numCells;
+ for (SieveMesh::label_sequence::iterator v_iter = vertices->begin();
+ v_iter != vertices->end();
+ ++v_iter) {
+ CPPUNIT_ASSERT_EQUAL(_data->numDOF,
+ fieldSection->getFiberDimension(*v_iter));
+
+ CPPUNIT_ASSERT_EQUAL(_data->constraintSizes[*v_iter-offset],
+ fieldSection->getConstraintDimension(*v_iter));
+ } // for
+} // testSetConstraintSizes
+
+// ----------------------------------------------------------------------
+// Test setConstraints().
+void
+pylith::bc::TestDirichletBCMulti::testSetConstraints(void)
+{ // testSetConstraints
+ topology::Mesh mesh;
+ DirichletBC bcA;
+ DirichletBC bcB;
+ DirichletBC bcC;
+ _initialize(&mesh, &bcA, &bcB, &bcC);
+ CPPUNIT_ASSERT(0 != _data);
+
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+ const ALE::Obj<SieveMesh::label_sequence>& vertices =
+ sieveMesh->depthStratum(0);
+ CPPUNIT_ASSERT(!vertices.isNull());
+
+ const int fiberDim = _data->numDOF;
+ topology::Field field(sieveMesh);
+ field.newSection(vertices, fiberDim);
+ const ALE::Obj<SieveRealSection>& fieldSection = field.section();
+ CPPUNIT_ASSERT(!fieldSection.isNull());
+
+ bcA.setConstraintSizes(field, mesh);
+ bcB.setConstraintSizes(field, mesh);
+ bcC.setConstraintSizes(field, mesh);
+ sieveMesh->allocate(fieldSection);
+ bcA.setConstraints(field, mesh);
+ bcB.setConstraints(field, mesh);
+ bcC.setConstraints(field, mesh);
+
+ const int numCells = sieveMesh->heightStratum(0)->size();
+ const int offset = numCells;
+ int index = 0;
+ for (SieveMesh::label_sequence::iterator v_iter = vertices->begin();
+ v_iter != vertices->end();
+ ++v_iter) {
+ const int numConstrainedDOF = _data->constraintSizes[*v_iter-offset];
+ if (numConstrainedDOF > 0) {
+ const int* fixedDOF = fieldSection->getConstraintDof(*v_iter);
+ for (int iDOF=0; iDOF < numConstrainedDOF; ++iDOF)
+ CPPUNIT_ASSERT_EQUAL(_data->constrainedDOF[index++], fixedDOF[iDOF]);
+ } // if
+ } // for
+} // testSetConstraints
+
+// ----------------------------------------------------------------------
+// Test setField().
+void
+pylith::bc::TestDirichletBCMulti::testSetField(void)
+{ // testSetField
+ topology::Mesh mesh;
+ DirichletBC bcA;
+ DirichletBC bcB;
+ DirichletBC bcC;
+ _initialize(&mesh, &bcA, &bcB, &bcC);
+ CPPUNIT_ASSERT(0 != _data);
+
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+ const ALE::Obj<SieveMesh::label_sequence>& vertices =
+ sieveMesh->depthStratum(0);
+ CPPUNIT_ASSERT(!vertices.isNull());
+
+ const int fiberDim = _data->numDOF;
+ topology::Field field(sieveMesh);
+ field.newSection(vertices, fiberDim);
+ const ALE::Obj<SieveRealSection>& fieldSection = field.section();
+ CPPUNIT_ASSERT(!fieldSection.isNull());
+
+ bcA.setConstraintSizes(field, mesh);
+ bcB.setConstraintSizes(field, mesh);
+ bcC.setConstraintSizes(field, mesh);
+ sieveMesh->allocate(fieldSection);
+ bcA.setConstraints(field, mesh);
+ bcB.setConstraints(field, mesh);
+ bcC.setConstraints(field, mesh);
+
+ const double tolerance = 1.0e-06;
+
+ // All values should be zero.
+ field.zero();
+ for (SieveMesh::label_sequence::iterator v_iter = vertices->begin();
+ v_iter != vertices->end();
+ ++v_iter) {
+ const int fiberDim = fieldSection->getFiberDimension(*v_iter);
+ const SieveRealSection::value_type* values =
+ sieveMesh->restrictClosure(fieldSection, *v_iter);
+ for (int i=0; i < fiberDim; ++i)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, values[i], tolerance);
+ } // for
+
+ // Only unconstrained values should be zero.
+ // Expected values set in _data->field
+ const double t = 10.0;
+ bcA.setField(t, field, mesh);
+ bcB.setField(t, field, mesh);
+ bcC.setField(t, field, mesh);
+
+ int i = 0;
+ for (SieveMesh::label_sequence::iterator v_iter = vertices->begin();
+ v_iter != vertices->end();
+ ++v_iter) {
+ const int fiberDim = fieldSection->getFiberDimension(*v_iter);
+ const SieveRealSection::value_type* values =
+ sieveMesh->restrictClosure(fieldSection, *v_iter);
+ for (int iDOF=0; iDOF < fiberDim; ++iDOF)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->field[i++], values[iDOF], tolerance);
+ } // for
+} // testSetField
+
+// ----------------------------------------------------------------------
+void
+pylith::bc::TestDirichletBCMulti::_initialize(topology::Mesh* mesh,
+ DirichletBC* const bcA,
+ DirichletBC* const bcB,
+ DirichletBC* const bcC) const
+{ // _initialize
+ CPPUNIT_ASSERT(0 != _data);
+ CPPUNIT_ASSERT(0 != bcA);
+ CPPUNIT_ASSERT(0 != bcB);
+ CPPUNIT_ASSERT(0 != bcC);
+
+ meshio::MeshIOAscii iohandler;
+ iohandler.filename(_data->meshFilename);
+ iohandler.read(mesh);
+
+ spatialdata::geocoords::CSCart cs;
+ cs.setSpaceDim(mesh->dimension());
+ cs.initialize();
+ mesh->coordsys(&cs);
+
+ // Setup boundary condition A
+ spatialdata::spatialdb::SimpleDB db("TestDirichletBCMulti initial");
+ spatialdata::spatialdb::SimpleIOAscii dbIO;
+ dbIO.filename(_data->dbFilenameA);
+ db.ioHandler(&dbIO);
+
+ spatialdata::spatialdb::SimpleDB dbRate("TestDirichletBCMulti rate");
+ spatialdata::spatialdb::SimpleIOAscii dbIORate;
+ dbIORate.filename(_data->dbFilenameARate);
+ dbRate.ioHandler(&dbIORate);
+
+ const double upDir[] = { 0.0, 0.0, 1.0 };
+
+ bcA->label(_data->labelA);
+ bcA->db(&db);
+ bcA->dbRate(&dbRate);
+ bcA->referenceTime(_data->tRefA);
+ bcA->fixedDOF(_data->fixedDOFA, _data->numFixedDOFA);
+ bcA->initialize(*mesh, upDir);
+
+ // Setup boundary condition B
+ dbIO.filename(_data->dbFilenameB);
+ db.ioHandler(&dbIO);
+
+ dbIORate.filename(_data->dbFilenameBRate);
+ dbRate.ioHandler(&dbIORate);
+
+ bcB->label(_data->labelB);
+ bcB->db(&db);
+ bcB->dbRate(&dbRate);
+ bcB->referenceTime(_data->tRefB);
+ bcB->fixedDOF(_data->fixedDOFB, _data->numFixedDOFB);
+ bcB->initialize(*mesh, upDir);
+
+ // Setup boundary condition C
+ if (_data->numFixedDOFC > 0.0) {
+ dbIO.filename(_data->dbFilenameC);
+ db.ioHandler(&dbIO);
+
+ dbIORate.filename(_data->dbFilenameCRate);
+ dbRate.ioHandler(&dbIORate);
+
+ bcC->label(_data->labelC);
+ bcC->db(&db);
+ bcC->dbRate(&dbRate);
+ bcC->referenceTime(_data->tRefC);
+ bcC->fixedDOF(_data->fixedDOFC, _data->numFixedDOFC);
+ bcC->initialize(*mesh, upDir);
+ } // if
+} // _initialize
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMulti.hh (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMulti.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMulti.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMulti.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestDirichletBCMulti.hh
+ *
+ * @brief C++ TestDirichletBCMulti object.
+ *
+ * C++ unit testing for DirichletBCMulti.
+ */
+
+#if !defined(pylith_bc_testdirichletbcmulti_hh)
+#define pylith_bc_testdirichletbcmulti_hh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestDirichletBCMulti;
+
+ class DirichletBC;
+ class DirichletDataMulti;
+ } // bc
+
+ namespace topology {
+ class Mesh;
+ } // topology
+} // pylith
+
+/// C++ unit testing for DirichletBCMulti.
+class pylith::bc::TestDirichletBCMulti : public CppUnit::TestFixture
+{ // class TestDirichletBCMulti
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+ /// Tear down testing data.
+ void tearDown(void);
+
+ /// Test setConstraintSizes().
+ void testSetConstraintSizes(void);
+
+ /// Test setConstraints().
+ void testSetConstraints(void);
+
+ /// Test setField().
+ void testSetField(void);
+
+ // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+ DirichletDataMulti* _data; ///< Data for testing
+
+ // PRIVATE METHODS ////////////////////////////////////////////////////
+private :
+
+ /** Initialize DirichletBCMulti boundary condition.
+ *
+ * @param mesh Finite-element mesh to initialize.
+ * @param bcA DirichletBC boundary condition A to initialize.
+ * @param bcB DirichletBC boundary condition B to initialize.
+ * @param bcC DirichletBC boundary condition C to initialize.
+ */
+ void _initialize(topology::Mesh* mesh,
+ DirichletBC* const bcA,
+ DirichletBC* const bcB,
+ DirichletBC* const bcC) const;
+
+}; // class TestDirichletBCMulti
+
+#endif // pylith_bc_dirichletbcmulti_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTet4.cc (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTet4.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTet4.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTet4.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDirichletBCMultiTet4.hh" // Implementation of class methods
+
+#include "data/DirichletDataMultiTet4.hh" // USES DirichletDataMultiTet4
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletBCMultiTet4 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestDirichletBCMultiTet4::setUp(void)
+{ // setUp
+ _data = new DirichletDataMultiTet4();
+} // setUp
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTet4.hh (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTet4.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTet4.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTet4.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestDirichletBCMultiTet4.hh
+ *
+ * @brief C++ TestDirichletBC object.
+ *
+ * C++ unit testing for DirichletBC for mesh with 1-D line cells.
+ */
+
+#if !defined(pylith_bc_testdirichletbcmultitet4_hh)
+#define pylith_bc_testdirichletbcmultitet4_hh
+
+#include "TestDirichletBCMulti.hh" // ISA TestDirichletBC
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestDirichletBCMultiTet4;
+ } // bc
+} // pylith
+
+/// C++ unit testing for DirichletBC for mesh with 2-D tri cells.
+class pylith::bc::TestDirichletBCMultiTet4 : public TestDirichletBCMulti
+{ // class TestDirichletBC
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestDirichletBCMultiTet4 );
+ CPPUNIT_TEST( testSetConstraintSizes );
+ CPPUNIT_TEST( testSetConstraints );
+ CPPUNIT_TEST( testSetField );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestDirichletBCMultiTet4
+
+#endif // pylith_bc_dirichletbcmultitet4_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTri3.cc (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTri3.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTri3.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTri3.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDirichletBCMultiTri3.hh" // Implementation of class methods
+
+#include "data/DirichletDataMultiTri3.hh" // USES DirichletDataMultiTri3
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletBCMultiTri3 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestDirichletBCMultiTri3::setUp(void)
+{ // setUp
+ _data = new DirichletDataMultiTri3();
+} // setUp
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTri3.hh (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTri3.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTri3.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCMultiTri3.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestDirichletBCMultiTri3.hh
+ *
+ * @brief C++ TestDirichletBC object.
+ *
+ * C++ unit testing for DirichletBC for mesh with 1-D line cells.
+ */
+
+#if !defined(pylith_bc_testdirichletbcmultitri3_hh)
+#define pylith_bc_testdirichletbcmultitri3_hh
+
+#include "TestDirichletBCMulti.hh" // ISA TestDirichletBC
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestDirichletBCMultiTri3;
+ } // bc
+} // pylith
+
+/// C++ unit testing for DirichletBC for mesh with 2-D tri cells.
+class pylith::bc::TestDirichletBCMultiTri3 : public TestDirichletBCMulti
+{ // class TestDirichletBC
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestDirichletBCMultiTri3 );
+ CPPUNIT_TEST( testSetConstraintSizes );
+ CPPUNIT_TEST( testSetConstraints );
+ CPPUNIT_TEST( testSetField );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestDirichletBCMultiTri3
+
+#endif // pylith_bc_dirichletbcmultitri3_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCQuad4.cc (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsQuad4.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCQuad4.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCQuad4.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDirichletBCQuad4.hh" // Implementation of class methods
+
+#include "data/DirichletDataQuad4.hh" // USES DirichletDataQuad4
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletBCQuad4 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestDirichletBCQuad4::setUp(void)
+{ // setUp
+ _data = new DirichletDataQuad4();
+} // setUp
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCQuad4.hh (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsQuad4.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCQuad4.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCQuad4.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestDirichletBCQuad4.hh
+ *
+ * @brief C++ TestDirichletBC object.
+ *
+ * C++ unit testing for DirichletBC for mesh with 1-D line cells.
+ */
+
+#if !defined(pylith_bc_testdirichletbcquad4_hh)
+#define pylith_bc_testdirichletbcquad4_hh
+
+#include "TestDirichletBC.hh" // ISA TestDirichletBC
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestDirichletBCQuad4;
+ } // bc
+} // pylith
+
+/// C++ unit testing for DirichletBC for mesh with 2-D quad cells.
+class pylith::bc::TestDirichletBCQuad4 : public TestDirichletBC
+{ // class TestDirichletBC
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUB_SUITE( TestDirichletBCQuad4, TestDirichletBC );
+ CPPUNIT_TEST( testInitialize );
+ CPPUNIT_TEST( testSetConstraintSizes );
+ CPPUNIT_TEST( testSetConstraints );
+ CPPUNIT_TEST( testSetField );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestDirichletBCQuad4
+
+#endif // pylith_bc_dirichletbcquad4_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTet4.cc (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTet4.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTet4.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTet4.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDirichletBCTet4.hh" // Implementation of class methods
+
+#include "data/DirichletDataTet4.hh" // USES DirichletDataTet4
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletBCTet4 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestDirichletBCTet4::setUp(void)
+{ // setUp
+ _data = new DirichletDataTet4();
+} // setUp
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTet4.hh (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTet4.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTet4.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTet4.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestDirichletBCTet4.hh
+ *
+ * @brief C++ TestDirichletBC object.
+ *
+ * C++ unit testing for DirichletBC for mesh with 1-D line cells.
+ */
+
+#if !defined(pylith_bc_testdirichletbctet4_hh)
+#define pylith_bc_testdirichletbcet4_hh
+
+#include "TestDirichletBC.hh" // ISA TestDirichletBC
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestDirichletBCTet4;
+ } // bc
+} // pylith
+
+/// C++ unit testing for DirichletBC for mesh with 3-D tet cells.
+class pylith::bc::TestDirichletBCTet4 : public TestDirichletBC
+{ // class TestDirichletBC
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUB_SUITE( TestDirichletBCTet4, TestDirichletBC );
+ CPPUNIT_TEST( testInitialize );
+ CPPUNIT_TEST( testSetConstraintSizes );
+ CPPUNIT_TEST( testSetConstraints );
+ CPPUNIT_TEST( testSetField );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestDirichletBCTet4
+
+#endif // pylith_bc_dirichletbctet4_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTri3.cc (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTri3.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTri3.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTri3.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDirichletBCTri3.hh" // Implementation of class methods
+
+#include "data/DirichletDataTri3.hh" // USES DirichletDataTri3
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletBCTri3 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestDirichletBCTri3::setUp(void)
+{ // setUp
+ _data = new DirichletDataTri3();
+} // setUp
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTri3.hh (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTri3.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTri3.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletBCTri3.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestDirichletBCTri3.hh
+ *
+ * @brief C++ TestDirichletBC object.
+ *
+ * C++ unit testing for DirichletBC for mesh with 1-D line cells.
+ */
+
+#if !defined(pylith_bc_testdirichletbctri3_hh)
+#define pylith_bc_testdirichletbctri3_hh
+
+#include "TestDirichletBC.hh" // ISA TestDirichletBC
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestDirichletBCTri3;
+ } // bc
+} // pylith
+
+/// C++ unit testing for DirichletBC for mesh with 2-D tri cells.
+class pylith::bc::TestDirichletBCTri3 : public TestDirichletBC
+{ // class TestDirichletBC
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUB_SUITE( TestDirichletBCTri3, TestDirichletBC );
+ CPPUNIT_TEST( testInitialize );
+ CPPUNIT_TEST( testSetConstraintSizes );
+ CPPUNIT_TEST( testSetConstraints );
+ CPPUNIT_TEST( testSetField );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestDirichletBCTri3
+
+#endif // pylith_bc_dirichletbctri3_hh
+
+
+// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPoints.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPoints.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPoints.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,314 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestDirichletPoints.hh" // Implementation of class methods
-
-#include "pylith/bc/DirichletPoints.hh" // USES DirichletPoints
-
-#include "data/DirichletData.hh" // USES DirichletData
-#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
-#include "spatialdata/spatialdb/UniformDB.hh" // USES UniformDB
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletPoints );
-
-// ----------------------------------------------------------------------
-// Setup testing data.
-void
-pylith::bc::TestDirichletPoints::setUp(void)
-{ // setUp
- _data = 0;
-} // setUp
-
-// ----------------------------------------------------------------------
-// Tear down testing data.
-void
-pylith::bc::TestDirichletPoints::tearDown(void)
-{ // tearDown
- delete _data; _data = 0;
-} // tearDown
-
-// ----------------------------------------------------------------------
-// Test constructor.
-void
-pylith::bc::TestDirichletPoints::testConstructor(void)
-{ // testConstructor
- DirichletPoints bc;
-} // testConstructor
-
-// ----------------------------------------------------------------------
-// Test fixedDOF()
-void
-pylith::bc::TestDirichletPoints::testFixedDOF(void)
-{ // testfixedDOF
- DirichletPoints bc;
-
- const size_t numDOF = 4;
- const int dof[] = { 0, 2, 3, 5 };
- int_array fixedDOF(dof, numDOF);
- bc.fixedDOF(fixedDOF);
-
- CPPUNIT_ASSERT_EQUAL(numDOF, bc._fixedDOF.size());
- for (int i=0; i < numDOF; ++i)
- CPPUNIT_ASSERT_EQUAL(fixedDOF[i], bc._fixedDOF[i]);
-} // testFixedDOF
-
-// ----------------------------------------------------------------------
-// Test initialize().
-void
-pylith::bc::TestDirichletPoints::testInitialize(void)
-{ // testInitialize
- ALE::Obj<Mesh> mesh;
- DirichletPoints bc;
- _initialize(&mesh, &bc);
-
- CPPUNIT_ASSERT(0 != _data);
-
- const int numCells = mesh->heightStratum(0)->size();
-
- const int numFixedDOF = _data->numFixedDOF;
- const size_t numPoints = _data->numConstrainedPts;
-
- // Check points
- const int offset = numCells;
- if (numFixedDOF > 0) {
- CPPUNIT_ASSERT_EQUAL(numPoints, bc._points.size());
- for (int i=0; i < numPoints; ++i)
- CPPUNIT_ASSERT_EQUAL(_data->constrainedPoints[i]+offset, bc._points[i]);
- } // if
-
- // Check values
- const size_t size = numPoints * numFixedDOF;
- CPPUNIT_ASSERT_EQUAL(size, bc._valuesInitial.size());
- const double tolerance = 1.0e-06;
- for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->valuesInitial[i], bc._valuesInitial[i],
- tolerance);
-
- CPPUNIT_ASSERT_EQUAL(size, bc._valuesRate.size());
- for (int i=0; i < size; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->valueRate, bc._valuesRate[i],
- tolerance);
-} // testInitialize
-
-// ----------------------------------------------------------------------
-// Test setConstraintSizes().
-void
-pylith::bc::TestDirichletPoints::testSetConstraintSizes(void)
-{ // testSetConstraintSizes
- ALE::Obj<Mesh> mesh;
- DirichletPoints bc;
- _initialize(&mesh, &bc);
-
- const ALE::Obj<real_section_type>& field = mesh->getRealSection("field");
- const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
- field->setChart(mesh->getSieve()->getChart());
- field->setFiberDimension(vertices, _data->numDOF);
- bc.setConstraintSizes(field, mesh);
-
- CPPUNIT_ASSERT(0 != _data);
-
- const int numCells = mesh->heightStratum(0)->size();
- const int offset = numCells;
- int iConstraint = 0;
- for (Mesh::label_sequence::iterator v_iter = vertices->begin();
- v_iter != vertices->end();
- ++v_iter) {
- if (*v_iter != _data->constrainedPoints[iConstraint] + offset) {
- CPPUNIT_ASSERT_EQUAL(_data->numDOF, field->getFiberDimension(*v_iter));
- CPPUNIT_ASSERT_EQUAL(0, field->getConstraintDimension(*v_iter));
- } else {
- CPPUNIT_ASSERT_EQUAL(_data->numDOF, field->getFiberDimension(*v_iter));
- CPPUNIT_ASSERT_EQUAL(_data->numFixedDOF,
- field->getConstraintDimension(*v_iter));
- ++iConstraint;
- } // if/else
- } // for
-} // testSetConstraintSizes
-
-// ----------------------------------------------------------------------
-// Test setConstraints().
-void
-pylith::bc::TestDirichletPoints::testSetConstraints(void)
-{ // testSetConstraints
- ALE::Obj<Mesh> mesh;
- DirichletPoints bc;
- _initialize(&mesh, &bc);
-
- const ALE::Obj<real_section_type>& field = mesh->getRealSection("field");
- const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
- field->setChart(mesh->getSieve()->getChart());
- field->setFiberDimension(vertices, _data->numDOF);
- bc.setConstraintSizes(field, mesh);
- mesh->allocate(field);
- bc.setConstraints(field, mesh);
-
- CPPUNIT_ASSERT(0 != _data);
-
- const int numCells = mesh->heightStratum(0)->size();
- const int offset = numCells;
- int iConstraint = 0;
- for (Mesh::label_sequence::iterator v_iter = vertices->begin();
- v_iter != vertices->end();
- ++v_iter) {
- const int* fixedDOF = field->getConstraintDof(*v_iter);
- if (*v_iter != _data->constrainedPoints[iConstraint] + offset) {
- CPPUNIT_ASSERT_EQUAL(0, field->getConstraintDimension(*v_iter));
- //CPPUNIT_ASSERT(0 == fixedDOF);
- } else {
- CPPUNIT_ASSERT(0 != fixedDOF);
- CPPUNIT_ASSERT_EQUAL(_data->numFixedDOF,
- field->getConstraintDimension(*v_iter));
- for (int iDOF=0; iDOF < _data->numFixedDOF; ++iDOF)
- CPPUNIT_ASSERT_EQUAL(_data->fixedDOF[iDOF], fixedDOF[iDOF]);
- ++iConstraint;
- } // if/else
- } // for
-} // testSetConstraints
-
-// ----------------------------------------------------------------------
-// Test setField().
-void
-pylith::bc::TestDirichletPoints::testSetField(void)
-{ // testSetField
- ALE::Obj<Mesh> mesh;
- DirichletPoints bc;
- _initialize(&mesh, &bc);
-
- const ALE::Obj<real_section_type>& field = mesh->getRealSection("field");
- const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
- field->setChart(mesh->getSieve()->getChart());
- field->setFiberDimension(vertices, _data->numDOF);
- bc.setConstraintSizes(field, mesh);
- mesh->allocate(field);
- bc.setConstraints(field, mesh);
-
- CPPUNIT_ASSERT(0 != _data);
- const double tolerance = 1.0e-06;
-
- // All values should be zero.
- field->zero();
- for (Mesh::label_sequence::iterator v_iter = vertices->begin();
- v_iter != vertices->end();
- ++v_iter) {
- const int fiberDim = field->getFiberDimension(*v_iter);
- const real_section_type::value_type* values =
- mesh->restrictClosure(field, *v_iter);
- for (int i=0; i < fiberDim; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, values[i], tolerance);
- } // for
-
- // Only unconstrained values should be zero.
- const double t = 1.0;
- bc.setField(t, field, mesh);
-
- // Create list of unconstrained DOF at constrained DOF
- const int numFreeDOF = _data->numDOF - _data->numFixedDOF;
- int_array freeDOF(numFreeDOF);
- int index = 0;
- for (int iDOF=0; iDOF < _data->numDOF; ++iDOF) {
- bool free = true;
- for (int iFixed=0; iFixed < _data->numFixedDOF; ++iFixed)
- if (iDOF == _data->fixedDOF[iFixed])
- free = false;
- if (free)
- freeDOF[index] = iDOF;
- } // for
-
- const int numCells = mesh->heightStratum(0)->size();
- const int offset = numCells;
- const int numFixedDOF = _data->numFixedDOF;
- int iConstraint = 0;
- for (Mesh::label_sequence::iterator v_iter = vertices->begin();
- v_iter != vertices->end();
- ++v_iter) {
- const int fiberDim = field->getFiberDimension(*v_iter);
- const real_section_type::value_type* values =
- mesh->restrictClosure(field, *v_iter);
-
- if (*v_iter != _data->constrainedPoints[iConstraint] + offset) {
- // unconstrained point
- for (int i=0; i < fiberDim; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, values[i], tolerance);
- } else {
- // constrained point
-
- // check unconstrained DOF
- for (int iDOF=0; iDOF < numFreeDOF; ++iDOF)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, values[freeDOF[iDOF]], tolerance);
-
- // check constrained DOF
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF) {
- const int index = iConstraint * numFixedDOF + iDOF;
- const double valueE = (t > _data->tRef) ?
- _data->valuesInitial[index] + (t-_data->tRef)*_data->valueRate :
- _data->valuesInitial[index];
- CPPUNIT_ASSERT_DOUBLES_EQUAL(valueE, values[_data->fixedDOF[iDOF]],
- tolerance);
- } // for
- ++iConstraint;
- } // if/else
- } // for
-} // testSetField
-
-// ----------------------------------------------------------------------
-void
-pylith::bc::TestDirichletPoints::_initialize(ALE::Obj<Mesh>* mesh,
- DirichletPoints* const bc) const
-{ // _initialize
- CPPUNIT_ASSERT(0 != _data);
- CPPUNIT_ASSERT(0 != bc);
-
- meshio::MeshIOAscii iohandler;
- iohandler.filename(_data->meshFilename);
- iohandler.read(mesh);
- CPPUNIT_ASSERT(!mesh->isNull());
-
- spatialdata::geocoords::CSCart cs;
- cs.setSpaceDim((*mesh)->getDimension());
- cs.initialize();
-
- spatialdata::spatialdb::SimpleDB db("TestDirichletPoints initial");
- spatialdata::spatialdb::SimpleIOAscii dbIO;
- dbIO.filename(_data->dbFilename);
- db.ioHandler(&dbIO);
- db.queryType(spatialdata::spatialdb::SimpleDB::NEAREST);
-
- spatialdata::spatialdb::UniformDB dbRate("TestDirichletPoints rate");
- const char* names[] = { "dof-0", "dof-1", "dof-2" };
- const double values[] = { _data->valueRate,
- _data->valueRate,
- _data->valueRate };
- const int numValues = 3;
- dbRate.setData(names, values, numValues);
-
- int_array fixedDOF(_data->fixedDOF, _data->numFixedDOF);
- const double upDirVals[] = { 0.0, 0.0, 1.0 };
- double_array upDir(upDirVals, 3);
-
- bc->label(_data->label);
- bc->db(&db);
- bc->dbRate(&dbRate);
- bc->referenceTime(_data->tRef);
- bc->fixedDOF(fixedDOF);
- bc->initialize(*mesh, &cs, upDir);
-} // _initialize
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPoints.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPoints.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPoints.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,96 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/bc/TestDirichletPoints.hh
- *
- * @brief C++ TestDirichletPoints object.
- *
- * C++ unit testing for DirichletPoints.
- */
-
-#if !defined(pylith_bc_testdirichletpoints_hh)
-#define pylith_bc_testdirichletpoints_hh
-
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
-
-/// Namespace for pylith package
-namespace pylith {
- namespace bc {
- class TestDirichletPoints;
-
- class DirichletPoints;
- class DirichletData;
- } // bc
-} // pylith
-
-/// C++ unit testing for DirichletPoints.
-class pylith::bc::TestDirichletPoints : public CppUnit::TestFixture
-{ // class TestDirichletPoints
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUITE( TestDirichletPoints );
- CPPUNIT_TEST( testConstructor );
- CPPUNIT_TEST( testFixedDOF );
- CPPUNIT_TEST_SUITE_END();
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Setup testing data.
- void setUp(void);
-
- /// Tear down testing data.
- void tearDown(void);
-
- /// Test constructor.
- void testConstructor(void);
-
- /// Test fixedDOF().
- void testFixedDOF(void);
-
- /// Test initialize().
- void testInitialize(void);
-
- /// Test setConstraintSizes().
- void testSetConstraintSizes(void);
-
- /// Test setConstraints().
- void testSetConstraints(void);
-
- /// Test setField().
- void testSetField(void);
-
- // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
- DirichletData* _data; ///< Data for testing
-
- // PRIVATE METHODS ////////////////////////////////////////////////////
-private :
-
- /** Initialize DirichletPoints boundary condition.
- *
- * @param mesh PETSc mesh to initialize
- * @param bc DirichletPoints boundary condition to initialize.
- */
- void _initialize(ALE::Obj<Mesh>* mesh,
- DirichletPoints* const bc) const;
-
-}; // class TestDirichletPoints
-
-#endif // pylith_bc_dirichletpoints_hh
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsHex8.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsHex8.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsHex8.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,31 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestDirichletPointsHex8.hh" // Implementation of class methods
-
-#include "data/DirichletDataHex8.hh" // USES DirichletDataHex8
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletPointsHex8 );
-
-// ----------------------------------------------------------------------
-// Setup testing data.
-void
-pylith::bc::TestDirichletPointsHex8::setUp(void)
-{ // setUp
- _data = new DirichletDataHex8();
-} // setUp
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsHex8.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsHex8.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsHex8.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,56 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/bc/TestDirichletPointsHex8.hh
- *
- * @brief C++ TestDirichletPoints object.
- *
- * C++ unit testing for DirichletPoints for mesh with 1-D line cells.
- */
-
-#if !defined(pylith_bc_testdirichletpointshex8_hh)
-#define pylith_bc_testdirichletpointshex8_hh
-
-#include "TestDirichletPoints.hh" // ISA TestDirichletPoints
-
-/// Namespace for pylith package
-namespace pylith {
- namespace bc {
- class TestDirichletPointsHex8;
- } // bc
-} // pylith
-
-/// C++ unit testing for DirichletPoints for mesh with 3-D hex cells.
-class pylith::bc::TestDirichletPointsHex8 : public TestDirichletPoints
-{ // class TestDirichletPoints
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUB_SUITE( TestDirichletPointsHex8, TestDirichletPoints );
- CPPUNIT_TEST( testInitialize );
- CPPUNIT_TEST( testSetConstraintSizes );
- CPPUNIT_TEST( testSetConstraints );
- CPPUNIT_TEST( testSetField );
- CPPUNIT_TEST_SUITE_END();
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Setup testing data.
- void setUp(void);
-
-}; // class TestDirichletPointsHex8
-
-#endif // pylith_bc_dirichletpointshex8_hh
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,31 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestDirichletPointsLine2.hh" // Implementation of class methods
-
-#include "data/DirichletDataLine2.hh" // USES DirichletDataLine2
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletPointsLine2 );
-
-// ----------------------------------------------------------------------
-// Setup testing data.
-void
-pylith::bc::TestDirichletPointsLine2::setUp(void)
-{ // setUp
- _data = new DirichletDataLine2();
-} // setUp
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,56 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/bc/TestDirichletPointsLine2.hh
- *
- * @brief C++ TestDirichletPoints object.
- *
- * C++ unit testing for DirichletPoints for mesh with 1-D line cells.
- */
-
-#if !defined(pylith_bc_testdirichletpointsline2_hh)
-#define pylith_bc_testdirichletpointsline2_hh
-
-#include "TestDirichletPoints.hh" // ISA TestDirichletPoints
-
-/// Namespace for pylith package
-namespace pylith {
- namespace bc {
- class TestDirichletPointsLine2;
- } // bc
-} // pylith
-
-/// C++ unit testing for DirichletPoints for mesh with 1-D line cells.
-class pylith::bc::TestDirichletPointsLine2 : public TestDirichletPoints
-{ // class TestDirichletPoints
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUB_SUITE( TestDirichletPointsLine2, TestDirichletPoints );
- CPPUNIT_TEST( testInitialize );
- CPPUNIT_TEST( testSetConstraintSizes );
- CPPUNIT_TEST( testSetConstraints );
- CPPUNIT_TEST( testSetField );
- CPPUNIT_TEST_SUITE_END();
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Setup testing data.
- void setUp(void);
-
-}; // class TestDirichletPointsLine2
-
-#endif // pylith_bc_dirichletpointsline2_hh
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2b.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2b.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2b.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,31 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestDirichletPointsLine2b.hh" // Implementation of class methods
-
-#include "data/DirichletDataLine2b.hh" // USES DirichletDataLine2b
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletPointsLine2b );
-
-// ----------------------------------------------------------------------
-// Setup testing data.
-void
-pylith::bc::TestDirichletPointsLine2b::setUp(void)
-{ // setUp
- _data = new DirichletDataLine2b();
-} // setUp
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2b.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2b.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsLine2b.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,56 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/bc/TestDirichletPointsLine2b.hh
- *
- * @brief C++ TestDirichletPoints object.
- *
- * C++ unit testing for DirichletPoints for mesh with 1-D line cells.
- */
-
-#if !defined(pylith_bc_testdirichletpointsline2b_hh)
-#define pylith_bc_testdirichletpointsline2b_hh
-
-#include "TestDirichletPoints.hh" // ISA TestDirichletPoints
-
-/// Namespace for pylith package
-namespace pylith {
- namespace bc {
- class TestDirichletPointsLine2b;
- } // bc
-} // pylith
-
-/// C++ unit testing for DirichletPoints for mesh with 1-D line cells.
-class pylith::bc::TestDirichletPointsLine2b : public TestDirichletPoints
-{ // class TestDirichletPoints
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUB_SUITE( TestDirichletPointsLine2b, TestDirichletPoints );
- CPPUNIT_TEST( testInitialize );
- CPPUNIT_TEST( testSetConstraintSizes );
- CPPUNIT_TEST( testSetConstraints );
- CPPUNIT_TEST( testSetField );
- CPPUNIT_TEST_SUITE_END();
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Setup testing data.
- void setUp(void);
-
-}; // class TestDirichletPointsLine2b
-
-#endif // pylith_bc_dirichletpointsline2b_hh
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMulti.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMulti.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMulti.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,253 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestDirichletPointsMulti.hh" // Implementation of class methods
-
-#include "pylith/bc/DirichletPoints.hh" // USES DirichletPoints
-
-#include "data/DirichletDataMulti.hh" // USES DirichletData
-#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
-#include "spatialdata/spatialdb/UniformDB.hh" // USES UniformDB
-
-// ----------------------------------------------------------------------
-// Setup testing data.
-void
-pylith::bc::TestDirichletPointsMulti::setUp(void)
-{ // setUp
- _data = 0;
-} // setUp
-
-// ----------------------------------------------------------------------
-// Tear down testing data.
-void
-pylith::bc::TestDirichletPointsMulti::tearDown(void)
-{ // tearDown
- delete _data; _data = 0;
-} // tearDown
-
-// ----------------------------------------------------------------------
-// Test setConstraintSizes().
-void
-pylith::bc::TestDirichletPointsMulti::testSetConstraintSizes(void)
-{ // testSetConstraintSizes
- ALE::Obj<Mesh> mesh;
- DirichletPoints bcA;
- DirichletPoints bcB;
- DirichletPoints bcC;
- _initialize(&mesh, &bcA, &bcB, &bcC);
-
- const ALE::Obj<real_section_type>& field = mesh->getRealSection("field");
- const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
- field->setChart(mesh->getSieve()->getChart());
- field->setFiberDimension(vertices, _data->numDOF);
- bcA.setConstraintSizes(field, mesh);
- bcB.setConstraintSizes(field, mesh);
- bcC.setConstraintSizes(field, mesh);
-
- CPPUNIT_ASSERT(0 != _data);
-
- const int numCells = mesh->heightStratum(0)->size();
- const int offset = numCells;
- for (Mesh::label_sequence::iterator v_iter = vertices->begin();
- v_iter != vertices->end();
- ++v_iter) {
- CPPUNIT_ASSERT_EQUAL(_data->numDOF, field->getFiberDimension(*v_iter));
-
- CPPUNIT_ASSERT_EQUAL(_data->constraintSizes[*v_iter-offset],
- field->getConstraintDimension(*v_iter));
- } // for
-} // testSetConstraintSizes
-
-// ----------------------------------------------------------------------
-// Test setConstraints().
-void
-pylith::bc::TestDirichletPointsMulti::testSetConstraints(void)
-{ // testSetConstraints
- ALE::Obj<Mesh> mesh;
- DirichletPoints bcA;
- DirichletPoints bcB;
- DirichletPoints bcC;
- _initialize(&mesh, &bcA, &bcB, &bcC);
-
- const ALE::Obj<real_section_type>& field = mesh->getRealSection("field");
- const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
- field->setChart(mesh->getSieve()->getChart());
- field->setFiberDimension(vertices, _data->numDOF);
- bcA.setConstraintSizes(field, mesh);
- bcB.setConstraintSizes(field, mesh);
- bcC.setConstraintSizes(field, mesh);
- mesh->allocate(field);
- bcA.setConstraints(field, mesh);
- bcB.setConstraints(field, mesh);
- bcC.setConstraints(field, mesh);
-
- CPPUNIT_ASSERT(0 != _data);
-
- const int numCells = mesh->heightStratum(0)->size();
- const int offset = numCells;
- int index = 0;
- for (Mesh::label_sequence::iterator v_iter = vertices->begin();
- v_iter != vertices->end();
- ++v_iter) {
- const int numConstrainedDOF = _data->constraintSizes[*v_iter-offset];
- if (numConstrainedDOF > 0) {
- const int* fixedDOF = field->getConstraintDof(*v_iter);
- for (int iDOF=0; iDOF < numConstrainedDOF; ++iDOF)
- CPPUNIT_ASSERT_EQUAL(_data->constrainedDOF[index++], fixedDOF[iDOF]);
- } // if
- } // for
-} // testSetConstraints
-
-// ----------------------------------------------------------------------
-// Test setField().
-void
-pylith::bc::TestDirichletPointsMulti::testSetField(void)
-{ // testSetField
- ALE::Obj<Mesh> mesh;
- DirichletPoints bcA;
- DirichletPoints bcB;
- DirichletPoints bcC;
- _initialize(&mesh, &bcA, &bcB, &bcC);
-
- const ALE::Obj<real_section_type>& field = mesh->getRealSection("field");
- const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
- field->setChart(mesh->getSieve()->getChart());
- field->setFiberDimension(vertices, _data->numDOF);
- bcA.setConstraintSizes(field, mesh);
- bcB.setConstraintSizes(field, mesh);
- bcC.setConstraintSizes(field, mesh);
- mesh->allocate(field);
- bcA.setConstraints(field, mesh);
- bcB.setConstraints(field, mesh);
- bcC.setConstraints(field, mesh);
-
- CPPUNIT_ASSERT(0 != _data);
- const double tolerance = 1.0e-06;
-
- // All values should be zero.
- field->zero();
- for (Mesh::label_sequence::iterator v_iter = vertices->begin();
- v_iter != vertices->end();
- ++v_iter) {
- const int fiberDim = field->getFiberDimension(*v_iter);
- const real_section_type::value_type* values =
- mesh->restrictClosure(field, *v_iter);
- for (int i=0; i < fiberDim; ++i)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, values[i], tolerance);
- } // for
-
- // Only unconstrained values should be zero.
- // Expected values set in _data->field
- const double t = 10.0;
- bcA.setField(t, field, mesh);
- bcB.setField(t, field, mesh);
- bcC.setField(t, field, mesh);
-
- int i = 0;
- for (Mesh::label_sequence::iterator v_iter = vertices->begin();
- v_iter != vertices->end();
- ++v_iter) {
- const int fiberDim = field->getFiberDimension(*v_iter);
- const real_section_type::value_type* values =
- mesh->restrictClosure(field, *v_iter);
- for (int iDOF=0; iDOF < fiberDim; ++iDOF)
- CPPUNIT_ASSERT_DOUBLES_EQUAL(_data->field[i++], values[iDOF], tolerance);
- } // for
-} // testSetField
-
-// ----------------------------------------------------------------------
-void
-pylith::bc::TestDirichletPointsMulti::_initialize(ALE::Obj<Mesh>* mesh,
- DirichletPoints* const bcA,
- DirichletPoints* const bcB,
- DirichletPoints* const bcC) const
-{ // _initialize
- CPPUNIT_ASSERT(0 != _data);
- CPPUNIT_ASSERT(0 != bcA);
- CPPUNIT_ASSERT(0 != bcB);
- CPPUNIT_ASSERT(0 != bcC);
-
- meshio::MeshIOAscii iohandler;
- iohandler.filename(_data->meshFilename);
- iohandler.read(mesh);
- CPPUNIT_ASSERT(!mesh->isNull());
-
- spatialdata::geocoords::CSCart cs;
- cs.setSpaceDim((*mesh)->getDimension());
- cs.initialize();
-
- // Setup boundary condition A
- spatialdata::spatialdb::SimpleDB db("TestDirichletPointsMulti initial");
- spatialdata::spatialdb::SimpleIOAscii dbIO;
- dbIO.filename(_data->dbFilenameA);
- db.ioHandler(&dbIO);
-
- spatialdata::spatialdb::SimpleDB dbRate("TestDirichletPointsMulti rate");
- spatialdata::spatialdb::SimpleIOAscii dbIORate;
- dbIORate.filename(_data->dbFilenameARate);
- dbRate.ioHandler(&dbIORate);
-
- int_array fixedDOFA(_data->fixedDOFA, _data->numFixedDOFA);
- const double upDirVals[] = { 0.0, 0.0, 1.0 };
- double_array upDir(upDirVals, 3);
-
- bcA->label(_data->labelA);
- bcA->db(&db);
- bcA->dbRate(&dbRate);
- bcA->referenceTime(_data->tRefA);
- bcA->fixedDOF(fixedDOFA);
- bcA->initialize(*mesh, &cs, upDir);
-
- // Setup boundary condition B
- dbIO.filename(_data->dbFilenameB);
- db.ioHandler(&dbIO);
-
- dbIORate.filename(_data->dbFilenameBRate);
- dbRate.ioHandler(&dbIORate);
-
- int_array fixedDOFB(_data->fixedDOFB, _data->numFixedDOFB);
-
- bcB->label(_data->labelB);
- bcB->db(&db);
- bcB->dbRate(&dbRate);
- bcB->referenceTime(_data->tRefB);
- bcB->fixedDOF(fixedDOFB);
- bcB->initialize(*mesh, &cs, upDir);
-
- // Setup boundary condition C
- if (_data->numFixedDOFC > 0.0) {
- dbIO.filename(_data->dbFilenameC);
- db.ioHandler(&dbIO);
-
- dbIORate.filename(_data->dbFilenameCRate);
- dbRate.ioHandler(&dbIORate);
-
- int_array fixedDOFC(_data->fixedDOFC, _data->numFixedDOFC);
-
- bcC->label(_data->labelC);
- bcC->db(&db);
- bcC->dbRate(&dbRate);
- bcC->referenceTime(_data->tRefC);
- bcC->fixedDOF(fixedDOFC);
- bcC->initialize(*mesh, &cs, upDir);
- } // if
-} // _initialize
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMulti.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMulti.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMulti.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,85 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/bc/TestDirichletPointsMulti.hh
- *
- * @brief C++ TestDirichletPointsMulti object.
- *
- * C++ unit testing for DirichletPointsMulti.
- */
-
-#if !defined(pylith_bc_testdirichletpointsmulti_hh)
-#define pylith_bc_testdirichletpointsmulti_hh
-
-#include <cppunit/extensions/HelperMacros.h>
-
-#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
-
-/// Namespace for pylith package
-namespace pylith {
- namespace bc {
- class TestDirichletPointsMulti;
-
- class DirichletPoints;
- class DirichletDataMulti;
- } // bc
-} // pylith
-
-/// C++ unit testing for DirichletPointsMulti.
-class pylith::bc::TestDirichletPointsMulti : public CppUnit::TestFixture
-{ // class TestDirichletPointsMulti
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Setup testing data.
- void setUp(void);
-
- /// Tear down testing data.
- void tearDown(void);
-
- /// Test setConstraintSizes().
- void testSetConstraintSizes(void);
-
- /// Test setConstraints().
- void testSetConstraints(void);
-
- /// Test setField().
- void testSetField(void);
-
- // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
- DirichletDataMulti* _data; ///< Data for testing
-
- // PRIVATE METHODS ////////////////////////////////////////////////////
-private :
-
- /** Initialize DirichletPointsMulti boundary condition.
- *
- * @param mesh PETSc mesh to initialize
- * @param bcA DirichletPoints boundary condition A to initialize.
- * @param bcB DirichletPoints boundary condition B to initialize.
- * @param bcC DirichletPoints boundary condition C to initialize.
- */
- void _initialize(ALE::Obj<Mesh>* mesh,
- DirichletPoints* const bcA,
- DirichletPoints* const bcB,
- DirichletPoints* const bcC) const;
-
-}; // class TestDirichletPointsMulti
-
-#endif // pylith_bc_dirichletpointsmulti_hh
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTet4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTet4.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTet4.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,31 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestDirichletPointsMultiTet4.hh" // Implementation of class methods
-
-#include "data/DirichletDataMultiTet4.hh" // USES DirichletDataMultiTet4
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletPointsMultiTet4 );
-
-// ----------------------------------------------------------------------
-// Setup testing data.
-void
-pylith::bc::TestDirichletPointsMultiTet4::setUp(void)
-{ // setUp
- _data = new DirichletDataMultiTet4();
-} // setUp
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTet4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTet4.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTet4.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,55 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/bc/TestDirichletPointsMultiTet4.hh
- *
- * @brief C++ TestDirichletPoints object.
- *
- * C++ unit testing for DirichletPoints for mesh with 1-D line cells.
- */
-
-#if !defined(pylith_bc_testdirichletpointsmultitet4_hh)
-#define pylith_bc_testdirichletpointsmultitet4_hh
-
-#include "TestDirichletPointsMulti.hh" // ISA TestDirichletPoints
-
-/// Namespace for pylith package
-namespace pylith {
- namespace bc {
- class TestDirichletPointsMultiTet4;
- } // bc
-} // pylith
-
-/// C++ unit testing for DirichletPoints for mesh with 2-D tri cells.
-class pylith::bc::TestDirichletPointsMultiTet4 : public TestDirichletPointsMulti
-{ // class TestDirichletPoints
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUITE( TestDirichletPointsMultiTet4 );
- CPPUNIT_TEST( testSetConstraintSizes );
- CPPUNIT_TEST( testSetConstraints );
- CPPUNIT_TEST( testSetField );
- CPPUNIT_TEST_SUITE_END();
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Setup testing data.
- void setUp(void);
-
-}; // class TestDirichletPointsMultiTet4
-
-#endif // pylith_bc_dirichletpointsmultitet4_hh
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTri3.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTri3.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTri3.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,31 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestDirichletPointsMultiTri3.hh" // Implementation of class methods
-
-#include "data/DirichletDataMultiTri3.hh" // USES DirichletDataMultiTri3
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletPointsMultiTri3 );
-
-// ----------------------------------------------------------------------
-// Setup testing data.
-void
-pylith::bc::TestDirichletPointsMultiTri3::setUp(void)
-{ // setUp
- _data = new DirichletDataMultiTri3();
-} // setUp
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTri3.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTri3.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsMultiTri3.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,55 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/bc/TestDirichletPointsMultiTri3.hh
- *
- * @brief C++ TestDirichletPoints object.
- *
- * C++ unit testing for DirichletPoints for mesh with 1-D line cells.
- */
-
-#if !defined(pylith_bc_testdirichletpointsmultitri3_hh)
-#define pylith_bc_testdirichletpointsmultitri3_hh
-
-#include "TestDirichletPointsMulti.hh" // ISA TestDirichletPoints
-
-/// Namespace for pylith package
-namespace pylith {
- namespace bc {
- class TestDirichletPointsMultiTri3;
- } // bc
-} // pylith
-
-/// C++ unit testing for DirichletPoints for mesh with 2-D tri cells.
-class pylith::bc::TestDirichletPointsMultiTri3 : public TestDirichletPointsMulti
-{ // class TestDirichletPoints
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUITE( TestDirichletPointsMultiTri3 );
- CPPUNIT_TEST( testSetConstraintSizes );
- CPPUNIT_TEST( testSetConstraints );
- CPPUNIT_TEST( testSetField );
- CPPUNIT_TEST_SUITE_END();
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Setup testing data.
- void setUp(void);
-
-}; // class TestDirichletPointsMultiTri3
-
-#endif // pylith_bc_dirichletpointsmultitri3_hh
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsQuad4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsQuad4.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsQuad4.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,31 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestDirichletPointsQuad4.hh" // Implementation of class methods
-
-#include "data/DirichletDataQuad4.hh" // USES DirichletDataQuad4
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletPointsQuad4 );
-
-// ----------------------------------------------------------------------
-// Setup testing data.
-void
-pylith::bc::TestDirichletPointsQuad4::setUp(void)
-{ // setUp
- _data = new DirichletDataQuad4();
-} // setUp
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsQuad4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsQuad4.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsQuad4.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,56 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/bc/TestDirichletPointsQuad4.hh
- *
- * @brief C++ TestDirichletPoints object.
- *
- * C++ unit testing for DirichletPoints for mesh with 1-D line cells.
- */
-
-#if !defined(pylith_bc_testdirichletpointsquad4_hh)
-#define pylith_bc_testdirichletpointsquad4_hh
-
-#include "TestDirichletPoints.hh" // ISA TestDirichletPoints
-
-/// Namespace for pylith package
-namespace pylith {
- namespace bc {
- class TestDirichletPointsQuad4;
- } // bc
-} // pylith
-
-/// C++ unit testing for DirichletPoints for mesh with 2-D quad cells.
-class pylith::bc::TestDirichletPointsQuad4 : public TestDirichletPoints
-{ // class TestDirichletPoints
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUB_SUITE( TestDirichletPointsQuad4, TestDirichletPoints );
- CPPUNIT_TEST( testInitialize );
- CPPUNIT_TEST( testSetConstraintSizes );
- CPPUNIT_TEST( testSetConstraints );
- CPPUNIT_TEST( testSetField );
- CPPUNIT_TEST_SUITE_END();
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Setup testing data.
- void setUp(void);
-
-}; // class TestDirichletPointsQuad4
-
-#endif // pylith_bc_dirichletpointsquad4_hh
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTet4.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTet4.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTet4.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,31 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestDirichletPointsTet4.hh" // Implementation of class methods
-
-#include "data/DirichletDataTet4.hh" // USES DirichletDataTet4
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletPointsTet4 );
-
-// ----------------------------------------------------------------------
-// Setup testing data.
-void
-pylith::bc::TestDirichletPointsTet4::setUp(void)
-{ // setUp
- _data = new DirichletDataTet4();
-} // setUp
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTet4.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTet4.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTet4.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,56 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/bc/TestDirichletPointsTet4.hh
- *
- * @brief C++ TestDirichletPoints object.
- *
- * C++ unit testing for DirichletPoints for mesh with 1-D line cells.
- */
-
-#if !defined(pylith_bc_testdirichletpointstet4_hh)
-#define pylith_bc_testdirichletpointset4_hh
-
-#include "TestDirichletPoints.hh" // ISA TestDirichletPoints
-
-/// Namespace for pylith package
-namespace pylith {
- namespace bc {
- class TestDirichletPointsTet4;
- } // bc
-} // pylith
-
-/// C++ unit testing for DirichletPoints for mesh with 3-D tet cells.
-class pylith::bc::TestDirichletPointsTet4 : public TestDirichletPoints
-{ // class TestDirichletPoints
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUB_SUITE( TestDirichletPointsTet4, TestDirichletPoints );
- CPPUNIT_TEST( testInitialize );
- CPPUNIT_TEST( testSetConstraintSizes );
- CPPUNIT_TEST( testSetConstraints );
- CPPUNIT_TEST( testSetField );
- CPPUNIT_TEST_SUITE_END();
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Setup testing data.
- void setUp(void);
-
-}; // class TestDirichletPointsTet4
-
-#endif // pylith_bc_dirichletpointstet4_hh
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTri3.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTri3.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTri3.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,31 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestDirichletPointsTri3.hh" // Implementation of class methods
-
-#include "data/DirichletDataTri3.hh" // USES DirichletDataTri3
-
-// ----------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletPointsTri3 );
-
-// ----------------------------------------------------------------------
-// Setup testing data.
-void
-pylith::bc::TestDirichletPointsTri3::setUp(void)
-{ // setUp
- _data = new DirichletDataTri3();
-} // setUp
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTri3.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTri3.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/bc/TestDirichletPointsTri3.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,56 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/bc/TestDirichletPointsTri3.hh
- *
- * @brief C++ TestDirichletPoints object.
- *
- * C++ unit testing for DirichletPoints for mesh with 1-D line cells.
- */
-
-#if !defined(pylith_bc_testdirichletpointstri3_hh)
-#define pylith_bc_testdirichletpointstri3_hh
-
-#include "TestDirichletPoints.hh" // ISA TestDirichletPoints
-
-/// Namespace for pylith package
-namespace pylith {
- namespace bc {
- class TestDirichletPointsTri3;
- } // bc
-} // pylith
-
-/// C++ unit testing for DirichletPoints for mesh with 2-D tri cells.
-class pylith::bc::TestDirichletPointsTri3 : public TestDirichletPoints
-{ // class TestDirichletPoints
-
- // CPPUNIT TEST SUITE /////////////////////////////////////////////////
- CPPUNIT_TEST_SUB_SUITE( TestDirichletPointsTri3, TestDirichletPoints );
- CPPUNIT_TEST( testInitialize );
- CPPUNIT_TEST( testSetConstraintSizes );
- CPPUNIT_TEST( testSetConstraints );
- CPPUNIT_TEST( testSetField );
- CPPUNIT_TEST_SUITE_END();
-
- // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
-
- /// Setup testing data.
- void setUp(void);
-
-}; // class TestDirichletPointsTri3
-
-#endif // pylith_bc_dirichletpointstri3_hh
-
-
-// End of file
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc 2009-01-26 05:47:02 UTC (rev 13956)
@@ -55,7 +55,7 @@
} // testConstructor
// ----------------------------------------------------------------------
-// Test section().
+// Test section() and newSection().
void
pylith::topology::TestField::testSection(void)
{ // testSection
@@ -71,6 +71,26 @@
} // testSection
// ----------------------------------------------------------------------
+// Test section() and newSection(points).
+void
+pylith::topology::TestField::testSectionPoints(void)
+{ // testSectionPoints
+ Mesh mesh;
+ _buildMesh(&mesh);
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+
+ Field field(sieveMesh);
+
+ const ALE::Obj<SieveMesh::real_section_type>& section = field.section();
+ CPPUNIT_ASSERT(section.isNull());
+
+ const ALE::Obj<SieveMesh::label_sequence>& vertices =
+ sieveMesh->depthStratum(0);
+ field.newSection();
+ CPPUNIT_ASSERT(!section.isNull());
+} // testSectionPoints
+
+// ----------------------------------------------------------------------
// Test name().
void
pylith::topology::TestField::testName(void)
Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh 2009-01-26 05:47:02 UTC (rev 13956)
@@ -43,6 +43,7 @@
CPPUNIT_TEST( testConstructor );
CPPUNIT_TEST( testSection );
+ CPPUNIT_TEST( testSectionPoints );
CPPUNIT_TEST( testName );
CPPUNIT_TEST( testVectorFieldType );
CPPUNIT_TEST( testSpaceDim );
@@ -68,6 +69,9 @@
/// Test newSection() and section().
void testSection(void);
+ /// Test newSection(points) and section().
+ void testSectionPoints(void);
+
/// Test name().
void testName(void);
Copied: short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletBC.py (from rev 13939, short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletPoints.py)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletBC.py (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletBC.py 2009-01-26 05:47:02 UTC (rev 13956)
@@ -0,0 +1,205 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# {LicenseText}
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/bc/TestDirichletBC.py
+
+## @brief Unit testing of DirichletBC object.
+
+import unittest
+
+from pylith.bc.DirichletBC import DirichletBC
+
+# ----------------------------------------------------------------------
+class TestDirichletBC(unittest.TestCase):
+ """
+ Unit testing of DirichletBC object.
+ """
+
+ def test_implementsConstraint(self):
+ """
+ Test to make sure DirichletBC satisfies constraint requirements.
+ """
+ bc = DirichletBC()
+ from pylith.feassemble.Constraint import implementsConstraint
+ self.failUnless(implementsConstraint(bc))
+ return
+
+
+ def test_constructor(self):
+ """
+ Test constructor.
+ """
+ from pylith.bc.DirichletBC import DirichletBC
+ bc = DirichletBC()
+ return
+
+
+ def test_initialize(self):
+ """
+ Test initialize().
+
+ WARNING: This is not a rigorous test of initialize() because we
+ don't verify the results.
+ """
+
+ (mesh, bc, fields) = self._initialize()
+
+ self.assertNotEqual(None, bc.cppHandle)
+
+ # We should really add something here to check to make sure things
+ # actually initialized correctly
+ return
+
+
+ def test_setConstraintSizes(self):
+ """
+ Test setConstraintSizes().
+
+ WARNING: This is not a rigorous test of setConstraintSizes() because we
+ don't verify the results.
+ """
+
+ (mesh, bc, fields) = self._initialize()
+ field = fields.getReal("field")
+ bc.setConstraintSizes(field)
+
+ # We should really add something here to check to make sure things
+ # actually initialized correctly
+ return
+
+
+ def test_setConstraints(self):
+ """
+ Test setConstraints().
+
+ WARNING: This is not a rigorous test of setConstraints() because we
+ don't verify the results.
+ """
+
+ (mesh, bc, fields) = self._initialize()
+ field = fields.getReal("field")
+ bc.setConstraintSizes(field)
+ mesh.allocateRealSection(field)
+ bc.setConstraints(field)
+
+ # We should really add something here to check to make sure things
+ # actually initialized correctly
+ return
+
+
+ def test_useSolnIncr(self):
+ """
+ Test useSolnIncr().
+ """
+ (mesh, bc, fields) = self._initialize()
+ bc.useSolnIncr(True)
+ return
+
+
+ def test_setField(self):
+ """
+ Test setField().
+
+ WARNING: This is not a rigorous test of setField() because we
+ don't verify the results.
+ """
+
+ (mesh, bc, fields) = self._initialize()
+ field = fields.getReal("field")
+ bc.setConstraintSizes(field)
+ mesh.allocateRealSection(field)
+ bc.setConstraints(field)
+ t = 1.0
+ bc.setField(t, field)
+
+ # We should really add something here to check to make sure things
+ # actually initialized correctly
+ return
+
+
+ def test_finalize(self):
+ """
+ Test finalize().
+
+ WARNING: This is not a rigorous test of finalize() because we
+ neither set the input fields or verify the results.
+ """
+ (mesh, bc, fields) = self._initialize()
+ bc.finalize()
+
+ # We should really add something here to check to make sure things
+ # actually initialized correctly.
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _initialize(self):
+ """
+ Initialize DirichletBC boundary condition.
+ """
+ from pylith.bc.DirichletBC import DirichletBC
+ bc = DirichletBC()
+ bc._configure()
+ bc.id = 0
+ bc.label = "bc"
+ bc.fixedDOF = [1]
+
+ from pyre.units.time import second
+ bc.tRef = -1.0*second
+
+ from spatialdata.spatialdb.SimpleDB import SimpleDB
+ db = SimpleDB()
+ db._configure()
+ db.label = "TestDirichletBC tri3"
+ db.iohandler.filename = "data/tri3.spatialdb"
+ db.initialize()
+ bc.db = db
+
+ from pylith.bc.FixedDOFDB import FixedDOFDB
+ dbRate = FixedDOFDB()
+ dbRate._configure()
+ dbRate.label = "TestDirichletBC rate tri3"
+ dbRate.initialize()
+ bc.dbRate = dbRate
+
+ from spatialdata.geocoords.CSCart import CSCart
+ cs = CSCart()
+ cs.spaceDim = 2
+
+ from spatialdata.units.Nondimensional import Nondimensional
+ normalizer = Nondimensional()
+ normalizer.initialize()
+
+ from pylith.meshio.MeshIOAscii import MeshIOAscii
+ importer = MeshIOAscii()
+ importer.filename = "data/tri3.mesh"
+ importer.coordsys = cs
+ mesh = importer.read(normalizer, debug=False, interpolate=False)
+
+ bc.preinitialize(mesh)
+ bc.initialize(totalTime=0.0, numTimeSteps=1, normalizer=normalizer)
+
+ # Setup fields
+ from pylith.topology.FieldsManager import FieldsManager
+ fields = FieldsManager(mesh)
+ fields.addReal("field")
+ fields.setFiberDimension("field", cs.spaceDim)
+ fields.allocate("field")
+
+ import pylith.topology.topology as bindings
+ bindings.zeroRealSection(fields.getReal("field"))
+
+ return (mesh, bc, fields)
+
+
+# End of file
Deleted: short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletPoints.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletPoints.py 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/TestDirichletPoints.py 2009-01-26 05:47:02 UTC (rev 13956)
@@ -1,205 +0,0 @@
-#!/usr/bin/env python
-#
-# ======================================================================
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# {LicenseText}
-#
-# ======================================================================
-#
-
-## @file unittests/pytests/bc/TestDirichletPoints.py
-
-## @brief Unit testing of DirichletPoints object.
-
-import unittest
-
-from pylith.bc.DirichletPoints import DirichletPoints
-
-# ----------------------------------------------------------------------
-class TestDirichletPoints(unittest.TestCase):
- """
- Unit testing of DirichletPoints object.
- """
-
- def test_implementsConstraint(self):
- """
- Test to make sure DirichletPoints satisfies constraint requirements.
- """
- bc = DirichletPoints()
- from pylith.feassemble.Constraint import implementsConstraint
- self.failUnless(implementsConstraint(bc))
- return
-
-
- def test_constructor(self):
- """
- Test constructor.
- """
- from pylith.bc.DirichletPoints import DirichletPoints
- bc = DirichletPoints()
- return
-
-
- def test_initialize(self):
- """
- Test initialize().
-
- WARNING: This is not a rigorous test of initialize() because we
- don't verify the results.
- """
-
- (mesh, bc, fields) = self._initialize()
-
- self.assertNotEqual(None, bc.cppHandle)
-
- # We should really add something here to check to make sure things
- # actually initialized correctly
- return
-
-
- def test_setConstraintSizes(self):
- """
- Test setConstraintSizes().
-
- WARNING: This is not a rigorous test of setConstraintSizes() because we
- don't verify the results.
- """
-
- (mesh, bc, fields) = self._initialize()
- field = fields.getReal("field")
- bc.setConstraintSizes(field)
-
- # We should really add something here to check to make sure things
- # actually initialized correctly
- return
-
-
- def test_setConstraints(self):
- """
- Test setConstraints().
-
- WARNING: This is not a rigorous test of setConstraints() because we
- don't verify the results.
- """
-
- (mesh, bc, fields) = self._initialize()
- field = fields.getReal("field")
- bc.setConstraintSizes(field)
- mesh.allocateRealSection(field)
- bc.setConstraints(field)
-
- # We should really add something here to check to make sure things
- # actually initialized correctly
- return
-
-
- def test_useSolnIncr(self):
- """
- Test useSolnIncr().
- """
- (mesh, bc, fields) = self._initialize()
- bc.useSolnIncr(True)
- return
-
-
- def test_setField(self):
- """
- Test setField().
-
- WARNING: This is not a rigorous test of setField() because we
- don't verify the results.
- """
-
- (mesh, bc, fields) = self._initialize()
- field = fields.getReal("field")
- bc.setConstraintSizes(field)
- mesh.allocateRealSection(field)
- bc.setConstraints(field)
- t = 1.0
- bc.setField(t, field)
-
- # We should really add something here to check to make sure things
- # actually initialized correctly
- return
-
-
- def test_finalize(self):
- """
- Test finalize().
-
- WARNING: This is not a rigorous test of finalize() because we
- neither set the input fields or verify the results.
- """
- (mesh, bc, fields) = self._initialize()
- bc.finalize()
-
- # We should really add something here to check to make sure things
- # actually initialized correctly.
- return
-
-
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _initialize(self):
- """
- Initialize DirichletPoints boundary condition.
- """
- from pylith.bc.DirichletPoints import DirichletPoints
- bc = DirichletPoints()
- bc._configure()
- bc.id = 0
- bc.label = "bc"
- bc.fixedDOF = [1]
-
- from pyre.units.time import second
- bc.tRef = -1.0*second
-
- from spatialdata.spatialdb.SimpleDB import SimpleDB
- db = SimpleDB()
- db._configure()
- db.label = "TestDirichletPoints tri3"
- db.iohandler.filename = "data/tri3.spatialdb"
- db.initialize()
- bc.db = db
-
- from pylith.bc.FixedDOFDB import FixedDOFDB
- dbRate = FixedDOFDB()
- dbRate._configure()
- dbRate.label = "TestDirichletPoints rate tri3"
- dbRate.initialize()
- bc.dbRate = dbRate
-
- from spatialdata.geocoords.CSCart import CSCart
- cs = CSCart()
- cs.spaceDim = 2
-
- from spatialdata.units.Nondimensional import Nondimensional
- normalizer = Nondimensional()
- normalizer.initialize()
-
- from pylith.meshio.MeshIOAscii import MeshIOAscii
- importer = MeshIOAscii()
- importer.filename = "data/tri3.mesh"
- importer.coordsys = cs
- mesh = importer.read(normalizer, debug=False, interpolate=False)
-
- bc.preinitialize(mesh)
- bc.initialize(totalTime=0.0, numTimeSteps=1, normalizer=normalizer)
-
- # Setup fields
- from pylith.topology.FieldsManager import FieldsManager
- fields = FieldsManager(mesh)
- fields.addReal("field")
- fields.setFiberDimension("field", cs.spaceDim)
- fields.allocate("field")
-
- import pylith.topology.topology as bindings
- bindings.zeroRealSection(fields.getReal("field"))
-
- return (mesh, bc, fields)
-
-
-# End of file
Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/testbc.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/testbc.py 2009-01-25 23:11:21 UTC (rev 13955)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/bc/testbc.py 2009-01-26 05:47:02 UTC (rev 13956)
@@ -56,18 +56,18 @@
suite = unittest.TestSuite()
+ from TestDirichletBC import TestDirichletBC
+ suite.addTest(unittest.makeSuite(TestDirichletBC))
+
from TestDirichletBoundary import TestDirichletBoundary
suite.addTest(unittest.makeSuite(TestDirichletBoundary))
- from TestDirichletPoints import TestDirichletPoints
- suite.addTest(unittest.makeSuite(TestDirichletPoints))
+ #from TestAbsorbingDampers import TestAbsorbingDampers
+ #suite.addTest(unittest.makeSuite(TestAbsorbingDampers))
- from TestAbsorbingDampers import TestAbsorbingDampers
- suite.addTest(unittest.makeSuite(TestAbsorbingDampers))
+ #from TestNeumann import TestNeumann
+ #suite.addTest(unittest.makeSuite(TestNeumann))
- from TestNeumann import TestNeumann
- suite.addTest(unittest.makeSuite(TestNeumann))
-
return suite
More information about the CIG-COMMITS
mailing list