[cig-commits] r15163 - in short/3D/PyLith/trunk: . libsrc/bc modulesrc/bc pylith/bc unittests/libtests/bc
brad at geodynamics.org
brad at geodynamics.org
Tue Jun 9 15:44:16 PDT 2009
Author: brad
Date: 2009-06-09 15:44:14 -0700 (Tue, 09 Jun 2009)
New Revision: 15163
Added:
short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.icc
short/3D/PyLith/trunk/libsrc/bc/Neumann.icc
short/3D/PyLith/trunk/modulesrc/bc/BCIntegratorSubMesh.i
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc
short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.hh
short/3D/PyLith/trunk/libsrc/bc/BCIntegratorSubMesh.hh
short/3D/PyLith/trunk/libsrc/bc/BCIntegratorSubMesh.icc
short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.cc
short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.hh
short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.icc
short/3D/PyLith/trunk/libsrc/bc/Makefile.am
short/3D/PyLith/trunk/libsrc/bc/Neumann.cc
short/3D/PyLith/trunk/libsrc/bc/Neumann.hh
short/3D/PyLith/trunk/modulesrc/bc/AbsorbingDampers.i
short/3D/PyLith/trunk/modulesrc/bc/BoundaryCondition.i
short/3D/PyLith/trunk/modulesrc/bc/Makefile.am
short/3D/PyLith/trunk/modulesrc/bc/Neumann.i
short/3D/PyLith/trunk/modulesrc/bc/bc.i
short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py
short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
short/3D/PyLith/trunk/pylith/bc/Neumann.py
short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.hh
short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryCondition.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryCondition.hh
short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.hh
Log:
More work on migrating towards time-dependent Neumann BC.
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/TODO 2009-06-09 22:44:14 UTC (rev 15163)
@@ -26,8 +26,7 @@
Update Neumann
ArbitratySlipFn (final slip, start time)
UniformDB units
- field split (setup fields)
- symmetric matrix (use in examples, testing)
+ symmetric matrix (preconditioner?)
full-scale testing
cleanup
test uniform refinement
Modified: short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc 2009-06-09 22:44:14 UTC (rev 15163)
@@ -41,8 +41,7 @@
// ----------------------------------------------------------------------
// Default constructor.
pylith::bc::AbsorbingDampers::AbsorbingDampers(void) :
- _boundaryMesh(0),
- _parameters(0)
+ _db(0)
{ // constructor
} // constructor
@@ -50,8 +49,7 @@
// Destructor.
pylith::bc::AbsorbingDampers::~AbsorbingDampers(void)
{ // destructor
- delete _boundaryMesh; _boundaryMesh = 0;
- delete _parameters; _parameters = 0;
+ _db = 0; // :TODO: Use shared pointer
} // destructor
// ----------------------------------------------------------------------
@@ -61,27 +59,11 @@
pylith::bc::AbsorbingDampers::initialize(const topology::Mesh& mesh,
const double upDir[3])
{ // initialize
+ assert(0 != _boundaryMesh);
assert(0 != _quadrature);
assert(0 != _db);
- delete _boundaryMesh; _boundaryMesh = 0;
- delete _parameters; _parameters = 0;
-
- _boundaryMesh = new topology::SubMesh(mesh, _label.c_str());
- assert(0 != _boundaryMesh);
-
double_array up(upDir, 3);
-
- // check compatibility of quadrature and boundary mesh
- if (_quadrature->cellDim() != _boundaryMesh->dimension()) {
- std::ostringstream msg;
- msg << "Quadrature is incompatible with cells for absorbing boundary "
- << "condition '" << _label << "'.\n"
- << "Dimension of boundary mesh: " << _boundaryMesh->dimension()
- << ", dimension of quadrature: " << _quadrature->cellDim()
- << ".";
- throw std::runtime_error(msg.str());
- } // if
const int numCorners = _quadrature->numBasis();
// Get 'surface' cells (1 dimension lower than top-level cells)
@@ -93,24 +75,6 @@
const SieveSubMesh::label_sequence::iterator cellsBegin = cells->begin();
const SieveSubMesh::label_sequence::iterator cellsEnd = cells->end();
- // Make sure surface cells are compatible with quadrature.
- const int boundaryDepth = sieveSubMesh->depth()-1; // depth of bndry cells
- for (SieveSubMesh::label_sequence::iterator c_iter=cellsBegin;
- c_iter != cellsEnd;
- ++c_iter) {
- const int cellNumCorners =
- sieveSubMesh->getNumCellCorners(*c_iter, boundaryDepth);
- if (numCorners != cellNumCorners) {
- std::ostringstream msg;
- msg << "Quadrature is incompatible with cell for absorbing boundary "
- << "condition '" << _label << "'.\n"
- << "Cell " << *c_iter << " has " << cellNumCorners
- << " vertices but quadrature reference cell has "
- << numCorners << " vertices.";
- throw std::runtime_error(msg.str());
- } // if
- } // for
-
// Get damping constants at each quadrature point and rotate to
// global coordinate frame using orientation information
const feassemble::CellGeometry& cellGeometry = _quadrature->refGeometry();
@@ -120,6 +84,7 @@
const int spaceDim = cellGeometry.spaceDim();
const int fiberDim = numQuadPts * spaceDim;
+ delete _parameters;
_parameters =
new topology::Fields<topology::Field<topology::SubMesh> >(*_boundaryMesh);
assert(0 != _parameters);
@@ -507,7 +472,7 @@
void
pylith::bc::AbsorbingDampers::verifyConfiguration(const topology::Mesh& mesh) const
{ // verifyConfiguration
- BoundaryCondition::verifyConfiguration(mesh);
+ BCIntegratorSubMesh::verifyConfiguration(mesh);
} // verifyConfiguration
Modified: short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.hh 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.hh 2009-06-09 22:44:14 UTC (rev 15163)
@@ -51,17 +51,10 @@
#define pylith_bc_absorbingdampers_hh
// Include directives ---------------------------------------------------
-#include "BoundaryCondition.hh" // ISA BoundaryCondition
+#include "BCIntegratorSubMesh.hh" // ISA BCIntegratorSubMesh
-#include "pylith/topology/SubMesh.hh" // ISA Quadrature<SubMesh>
-#include "pylith/feassemble/Quadrature.hh" // ISA Integrator<Quadrature>
-#include "pylith/feassemble/Integrator.hh" // ISA Integrator
-
-#include "pylith/utils/array.hh" // USES std::vector, double_array, int_array
-
// AbsorbingDampers ------------------------------------------------------
-class pylith::bc::AbsorbingDampers : public BoundaryCondition,
- public feassemble::Integrator<feassemble::Quadrature<topology::SubMesh> >
+class pylith::bc::AbsorbingDampers : public BCIntegratorSubMesh
{ // class AbsorbingDampers
friend class TestAbsorbingDampers; // unit testing
@@ -74,6 +67,12 @@
/// Destructor.
~AbsorbingDampers(void);
+ /** Set database for boundary condition parameters.
+ *
+ * @param db Spatial database
+ */
+ void db(spatialdata::spatialdb::SpatialDB* const db);
+
/** Initialize boundary condition.
*
* @param mesh Finite-element mesh.
@@ -110,26 +109,24 @@
*/
void verifyConfiguration(const topology::Mesh& mesh) const;
+ // PRIVATE MEMBERS ////////////////////////////////////////////////////
+private :
+
+ spatialdata::spatialdb::SpatialDB* _db; ///< Spatial database w/parameters
+
// NOT IMPLEMENTED ////////////////////////////////////////////////////
private :
/// Not implemented
- AbsorbingDampers(const AbsorbingDampers& m);
+ AbsorbingDampers(const AbsorbingDampers&);
/// Not implemented
- const AbsorbingDampers& operator=(const AbsorbingDampers& m);
+ const AbsorbingDampers& operator=(const AbsorbingDampers&);
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
-private :
-
- /// Mesh of absorbing boundary
- topology::SubMesh* _boundaryMesh;
-
- /// Parameters for damping constants.
- topology::Fields<topology::Field<topology::SubMesh> >* _parameters;
-
}; // class AbsorbingDampers
+#include "AbsorbingDampers.icc" // inline methods
+
#endif // pylith_bc_absorbingdampers_hh
Added: short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.icc (rev 0)
+++ short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.icc 2009-06-09 22:44:14 UTC (rev 15163)
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(pylith_bc_absorbingdampers_hh)
+#error "AbsorbingDampers.icc can only be included from AbsorbingDampers.hh"
+#endif
+
+// Set database for boundary condition parameters.
+inline
+void
+pylith::bc::AbsorbingDampers::db(spatialdata::spatialdb::SpatialDB* const db) {
+ _db = db;
+}
+
+
+// End of file
Modified: short/3D/PyLith/trunk/libsrc/bc/BCIntegratorSubMesh.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/BCIntegratorSubMesh.hh 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/libsrc/bc/BCIntegratorSubMesh.hh 2009-06-09 22:44:14 UTC (rev 15163)
@@ -34,7 +34,7 @@
// BCIntegratorSubMesh ----------------------------------------------
class pylith::bc::BCIntegratorSubMesh : public BoundaryCondition,
public feassemble::Integrator<feassemble::Quadrature<topology::SubMesh> >
-{ // class BoundaryCondition
+{ // class BCIntegratorSubMesh
friend class TestBCIntegratorSubMesh; // unit testing
// PUBLIC METHODS /////////////////////////////////////////////////////
@@ -51,7 +51,7 @@
*
* @returns Parameter fields.
*/
- const topology::Fields<topology::Field<topology::Mesh> >*
+ const topology::Fields<topology::Field<topology::SubMesh> >*
parameterFields(void) const;
/** Get boundary mesh.
@@ -91,6 +91,8 @@
}; // class BCIntegratorSubMesh
+#include "BCIntegratorSubMesh.icc" // inline methods
+
#endif // pylith_bc_bcintegratorsubmesh_hh
Modified: short/3D/PyLith/trunk/libsrc/bc/BCIntegratorSubMesh.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/BCIntegratorSubMesh.icc 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/libsrc/bc/BCIntegratorSubMesh.icc 2009-06-09 22:44:14 UTC (rev 15163)
@@ -16,16 +16,15 @@
#include <cassert> // USES assert()
-// ----------------------------------------------------------------------
// Get parameter fields.
-const pylith::topology::Fields<pylith::topology::Field<pylith::topology::Mesh> >*
-pylith::bc::BCIntegratorSubMesh::parameterFields(void) const
-{ // parameterFields
+inline
+const pylith::topology::Fields<pylith::topology::Field<pylith::topology::SubMesh> >*
+pylith::bc::BCIntegratorSubMesh::parameterFields(void) const {
return _parameters;
} // parameterFields
-// ----------------------------------------------------------------------
// Get boundary mesh.
+inline
const pylith::topology::SubMesh&
pylith::bc::BCIntegratorSubMesh::boundaryMesh(void) const {
assert(0 != _boundaryMesh);
Modified: short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.cc 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.cc 2009-06-09 22:44:14 UTC (rev 15163)
@@ -21,8 +21,7 @@
// ----------------------------------------------------------------------
// Default constructor.
pylith::bc::BoundaryCondition::BoundaryCondition(void) :
- _label(""),
- _db(0)
+ _label("")
{ // constructor
} // constructor
@@ -30,7 +29,6 @@
// Destructor.
pylith::bc::BoundaryCondition::~BoundaryCondition(void)
{ // destructor
- _db = 0;
} // destructor
// ----------------------------------------------------------------------
Modified: short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.hh 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.hh 2009-06-09 22:44:14 UTC (rev 15163)
@@ -58,13 +58,6 @@
*/
const char* label(void) const;
- // REMOVE THIS
- /** Set database for boundary condition parameters.
- *
- * @param db Spatial database
- */
- void db(spatialdata::spatialdb::SpatialDB* const db);
-
/** Verify configuration.
*
* @param mesh Finite-element mesh.
@@ -81,21 +74,20 @@
void initialize(const topology::Mesh& mesh,
const double upDir[3]) = 0;
+ // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+ std::string _label; ///< Label of boundary condition
+
// NOT IMPLEMENTED ////////////////////////////////////////////////////
private :
/// Not implemented
- BoundaryCondition(const BoundaryCondition& m);
+ BoundaryCondition(const BoundaryCondition&);
/// Not implemented
- const BoundaryCondition& operator=(const BoundaryCondition& m);
+ const BoundaryCondition& operator=(const BoundaryCondition&);
- // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
- std::string _label; ///< Label of boundary condition
- spatialdata::spatialdb::SpatialDB* _db; ///< Spatial database w/parameters
-
}; // class BoundaryCondition
#include "BoundaryCondition.icc" // inline methods
Modified: short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.icc 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/libsrc/bc/BoundaryCondition.icc 2009-06-09 22:44:14 UTC (rev 15163)
@@ -28,12 +28,5 @@
return _label.c_str();
}
-// Set database for boundary condition parameters.
-inline
-void
-pylith::bc::BoundaryCondition::db(spatialdata::spatialdb::SpatialDB* const db) {
- _db = db;
-}
-
// End of file
Modified: short/3D/PyLith/trunk/libsrc/bc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/Makefile.am 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/libsrc/bc/Makefile.am 2009-06-09 22:44:14 UTC (rev 15163)
@@ -18,16 +18,19 @@
BoundaryCondition.icc \
BoundaryConditionPoints.hh \
BCIntegratorSubMesh.hh \
+ BCIntegratorSubMesh.icc \
TimeDependent.hh \
TimeDependent.icc \
TimeDependentPoints.hh \
TimeDependentPoints.icc \
AbsorbingDampers.hh \
+ AbsorbingDampers.icc \
DirichletBC.hh \
DirichletBC.icc \
DirichletBoundary.hh \
DirichletBoundary.icc \
Neumann.hh \
+ Neumann.icc \
PointForce.hh \
PointForce.icc \
bcfwd.hh
Modified: short/3D/PyLith/trunk/libsrc/bc/Neumann.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/Neumann.cc 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/libsrc/bc/Neumann.cc 2009-06-09 22:44:14 UTC (rev 15163)
@@ -38,8 +38,7 @@
// ----------------------------------------------------------------------
// Default constructor.
pylith::bc::Neumann::Neumann(void) :
- _boundaryMesh(0),
- _parameters(0)
+ _db(0)
{ // constructor
} // constructor
@@ -47,8 +46,7 @@
// Destructor.
pylith::bc::Neumann::~Neumann(void)
{ // destructor
- delete _boundaryMesh; _boundaryMesh = 0;
- delete _parameters; _parameters = 0;
+ _db = 0; // :TODO: Use shared pointer
} // destructor
// ----------------------------------------------------------------------
@@ -58,27 +56,11 @@
pylith::bc::Neumann::initialize(const topology::Mesh& mesh,
const double upDir[3])
{ // initialize
+ assert(0 != _boundaryMesh);
assert(0 != _quadrature);
assert(0 != _db);
- delete _boundaryMesh; _boundaryMesh = 0;
- delete _parameters; _parameters = 0;
-
- _boundaryMesh = new topology::SubMesh(mesh, _label.c_str());
- assert(0 != _boundaryMesh);
-
double_array up(upDir, 3);
-
- // check compatibility of quadrature and boundary mesh
- if (_quadrature->cellDim() != _boundaryMesh->dimension()) {
- std::ostringstream msg;
- msg << "Quadrature is incompatible with cells for Neumann traction "
- << "boundary condition '" << _label << "'.\n"
- << "Dimension of boundary mesh: " << _boundaryMesh->dimension()
- << ", dimension of quadrature: " << _quadrature->cellDim()
- << ".";
- throw std::runtime_error(msg.str());
- } // if
const int numCorners = _quadrature->numBasis();
assert(0 != _normalizer);
@@ -94,24 +76,6 @@
const SieveSubMesh::label_sequence::iterator cellsBegin = cells->begin();
const SieveSubMesh::label_sequence::iterator cellsEnd = cells->end();
- // Make sure surface cells are compatible with quadrature.
- const int boundaryDepth = subSieveMesh->depth()-1; // depth of bndry cells
- for (SieveSubMesh::label_sequence::iterator c_iter=cellsBegin;
- c_iter != cellsEnd;
- ++c_iter) {
- const int cellNumCorners =
- subSieveMesh->getNumCellCorners(*c_iter, boundaryDepth);
- if (numCorners != cellNumCorners) {
- std::ostringstream msg;
- msg << "Quadrature is incompatible with cell for Neumann traction "
- << "boundary condition '" << _label << "'.\n"
- << "Cell " << *c_iter << " has " << cellNumCorners
- << " vertices but quadrature reference cell has "
- << numCorners << " vertices.";
- throw std::runtime_error(msg.str());
- } // if
- } // for
-
// Create section for traction vector in global coordinates
const feassemble::CellGeometry& cellGeometry = _quadrature->refGeometry();
const int cellDim = _quadrature->cellDim() > 0 ? _quadrature->cellDim() : 1;
@@ -120,6 +84,7 @@
const int spaceDim = cellGeometry.spaceDim();
const int fiberDim = spaceDim * numQuadPts;
+ delete _parameters;
_parameters =
new topology::Fields<topology::Field<topology::SubMesh> >(*_boundaryMesh);
assert(0 != _parameters);
@@ -369,20 +334,10 @@
void
pylith::bc::Neumann::verifyConfiguration(const topology::Mesh& mesh) const
{ // verifyConfiguration
- BoundaryCondition::verifyConfiguration(mesh);
+ BCIntegratorSubMesh::verifyConfiguration(mesh);
} // verifyConfiguration
// ----------------------------------------------------------------------
-// Get boundary mesh.
-const pylith::topology::SubMesh&
-pylith::bc::Neumann::boundaryMesh(void) const
-{ // dataMesh
- assert(0 != _boundaryMesh);
-
- return *_boundaryMesh;
-} // dataMesh
-
-// ----------------------------------------------------------------------
// Get cell field for tractions.
const pylith::topology::Field<pylith::topology::SubMesh>&
pylith::bc::Neumann::cellField(const char* name,
Modified: short/3D/PyLith/trunk/libsrc/bc/Neumann.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/Neumann.hh 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/libsrc/bc/Neumann.hh 2009-06-09 22:44:14 UTC (rev 15163)
@@ -20,17 +20,10 @@
#define pylith_bc_neumann_hh
// Include directives ---------------------------------------------------
-#include "BoundaryCondition.hh" // ISA BoundaryCondition
+#include "BCIntegratorSubMesh.hh" // ISA BCIntegratorSubMesh
-#include "pylith/topology/SubMesh.hh" // ISA Quadrature<SubMesh>
-#include "pylith/feassemble/Quadrature.hh" // ISA Integrator<Quadrature>
-#include "pylith/feassemble/Integrator.hh" // ISA Integrator
-
-#include "pylith/utils/array.hh" // USES std::vector, double_array, int_array
-
// Neumann --------------------------------------------------------------
-class pylith::bc::Neumann : public BoundaryCondition,
- public feassemble::Integrator<feassemble::Quadrature<topology::SubMesh> >
+class pylith::bc::Neumann : public BCIntegratorSubMesh
{ // class Neumann
friend class TestNeumann; // unit testing
@@ -43,6 +36,12 @@
/// Destructor.
~Neumann(void);
+ /** Set database for boundary condition parameters.
+ *
+ * @param db Spatial database
+ */
+ void db(spatialdata::spatialdb::SpatialDB* const db);
+
/** Initialize boundary condition.
*
* @param mesh Finite-element mesh.
@@ -79,12 +78,6 @@
*/
void verifyConfiguration(const topology::Mesh& mesh) const;
- /** Get boundary mesh.
- *
- * @returns Boundary mesh.
- */
- const topology::SubMesh& boundaryMesh(void) const;
-
/** Get cell field with BC information.
*
* @param fieldType Type of field.
@@ -98,27 +91,21 @@
cellField(const char* name,
topology::SolutionFields* const fields =0);
- // NOT IMPLEMENTED ////////////////////////////////////////////////////
+ // PRIVATE MEMBERS ////////////////////////////////////////////////////
private :
- /// Not implemented
- Neumann(const Neumann&);
+ spatialdata::spatialdb::SpatialDB* _db; ///< Spatial database w/parameters
- /// Not implemented
- const Neumann& operator=(const Neumann&);
-
- // PRIVATE MEMBERS ////////////////////////////////////////////////////
+ // NOT IMPLEMENTED ////////////////////////////////////////////////////
private :
- /// Mesh over which tractions are applied
- topology::SubMesh* _boundaryMesh;
+ Neumann(const Neumann&); ///< Not implemented
+ const Neumann& operator=(const Neumann&); ///< Not implemented
- /// Parameters for tractions vector in global coordinates at
- /// integration points.
- topology::Fields<topology::Field<topology::SubMesh> >* _parameters;
-
}; // class Neumann
+#include "Neumann.icc" // inline methods
+
#endif // pylith_bc_neumann_hh
Added: short/3D/PyLith/trunk/libsrc/bc/Neumann.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/Neumann.icc (rev 0)
+++ short/3D/PyLith/trunk/libsrc/bc/Neumann.icc 2009-06-09 22:44:14 UTC (rev 15163)
@@ -0,0 +1,25 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#if !defined(pylith_bc_neumann_hh)
+#error "Neumann.icc can only be included from Neumann.hh"
+#endif
+
+// Set database for boundary condition parameters.
+inline
+void
+pylith::bc::Neumann::db(spatialdata::spatialdb::SpatialDB* const db) {
+ _db = db;
+}
+
+
+// End of file
Modified: short/3D/PyLith/trunk/modulesrc/bc/AbsorbingDampers.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/AbsorbingDampers.i 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/modulesrc/bc/AbsorbingDampers.i 2009-06-09 22:44:14 UTC (rev 15163)
@@ -18,9 +18,7 @@
namespace pylith {
namespace bc {
- class AbsorbingDampers :
- public BoundaryCondition,
- public pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >
+ class AbsorbingDampers : public BCIntegratorSubMesh
{ // class AbsorbingDampers
// PUBLIC METHODS /////////////////////////////////////////////////
@@ -32,6 +30,12 @@
/// Destructor.
~AbsorbingDampers(void);
+ /** Set database for boundary condition parameters.
+ *
+ * @param db Spatial database
+ */
+ void db(spatialdata::spatialdb::SpatialDB* const db);
+
/** Initialize boundary condition.
*
* @param mesh Finite-element mesh.
Added: short/3D/PyLith/trunk/modulesrc/bc/BCIntegratorSubMesh.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/BCIntegratorSubMesh.i (rev 0)
+++ short/3D/PyLith/trunk/modulesrc/bc/BCIntegratorSubMesh.i 2009-06-09 22:44:14 UTC (rev 15163)
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/bc/BCIntegratorSubMesh.i
+ *
+ * @brief Python interface to C++ BCIntegratorSubMesh object.
+ */
+
+namespace pylith {
+ namespace bc {
+
+ class pylith::bc::BCIntegratorSubMesh : public BoundaryCondition,
+ public pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >
+ { // class BoundaryCondition
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor.
+ BCIntegratorSubMesh(void);
+
+ /// Destructor.
+ virtual
+ ~BCIntegratorSubMesh(void);
+
+ /** Get parameter fields.
+ *
+ * @returns Parameter fields.
+ */
+ const pylith::topology::Fields<pylith::topology::Field<pylith::topology::Mesh> >*
+ parameterFields(void) const;
+
+ /** Get boundary mesh.
+ *
+ * @return Boundary mesh.
+ */
+ const pylith::topology::SubMesh& boundaryMesh(void) const;
+
+ /** Get mesh labels for submesh associated with applied forces.
+ *
+ * @param mesh Finite-element mesh.
+ */
+ void createSubMesh(const pylith::topology::Mesh& mesh);
+
+ /** Verify configuration is acceptable.
+ *
+ * @param mesh Finite-element mesh
+ */
+ void verifyConfiguration(const pylith::topology::Mesh& mesh) const;
+
+ }; // BCIntegratorSubMesh
+
+ } // bc
+} // pylith
+
+
+// End of file
Modified: short/3D/PyLith/trunk/modulesrc/bc/BoundaryCondition.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/BoundaryCondition.i 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/modulesrc/bc/BoundaryCondition.i 2009-06-09 22:44:14 UTC (rev 15163)
@@ -43,12 +43,6 @@
*/
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.
Modified: short/3D/PyLith/trunk/modulesrc/bc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/Makefile.am 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/modulesrc/bc/Makefile.am 2009-06-09 22:44:14 UTC (rev 15163)
@@ -21,6 +21,7 @@
bc.i \
BoundaryCondition.i \
BoundaryConditionPoints.i \
+ BCIntegratorSubMesh.i \
TimeDependent.i \
TimeDependentPoints.i \
DirichletBC.i \
Modified: short/3D/PyLith/trunk/modulesrc/bc/Neumann.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/Neumann.i 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/modulesrc/bc/Neumann.i 2009-06-09 22:44:14 UTC (rev 15163)
@@ -18,10 +18,8 @@
namespace pylith {
namespace bc {
- class Neumann : public BoundaryCondition,
- public pylith::feassemble::Integrator<pylith::feassemble::Quadrature<pylith::topology::SubMesh> >
+ class Neumann : public BCIntegratorSubMesh
{ // class Neumann
- friend class TestNeumann; // unit testing
// PUBLIC METHODS /////////////////////////////////////////////////
public :
@@ -32,6 +30,12 @@
/// Destructor.
~Neumann(void);
+ /** Set database for boundary condition parameters.
+ *
+ * @param db Spatial database
+ */
+ void db(spatialdata::spatialdb::SpatialDB* const db);
+
/** Initialize boundary condition.
*
* @param mesh Finite-element mesh.
@@ -68,12 +72,6 @@
*/
void verifyConfiguration(const pylith::topology::Mesh& mesh) const;
- /** Get boundary mesh.
- *
- * @returns Boundary mesh.
- */
- const pylith::topology::SubMesh& boundaryMesh(void) const;
-
/** Get cell field with BC information.
*
* @param fieldType Type of field.
Modified: short/3D/PyLith/trunk/modulesrc/bc/bc.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/bc/bc.i 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/modulesrc/bc/bc.i 2009-06-09 22:44:14 UTC (rev 15163)
@@ -17,6 +17,7 @@
%{
#include "pylith/bc/BoundaryCondition.hh"
#include "pylith/bc/BoundaryConditionPoints.hh"
+#include "pylith/bc/BCIntegratorSubMesh.hh"
#include "pylith/bc/TimeDependent.hh"
#include "pylith/bc/TimeDependentPoints.hh"
#include "pylith/bc/DirichletBC.hh"
@@ -58,6 +59,7 @@
%include "BoundaryCondition.i"
%include "BoundaryConditionPoints.i"
+%include "BCIntegratorSubMesh.i"
%include "TimeDependent.i"
%include "TimeDependentPoints.i"
%include "DirichletBC.i"
Modified: short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/pylith/bc/AbsorbingDampers.py 2009-06-09 22:44:14 UTC (rev 15163)
@@ -45,6 +45,7 @@
##
## \b Facilities
## @li \b quadrature Quadrature object for numerical integration
+ ## @li \b db Database of boundary condition parameters
import pyre.inventory
@@ -53,6 +54,11 @@
factory=SubMeshQuadrature)
quadrature.meta['tip'] = "Quadrature object for numerical integration."
+ from spatialdata.spatialdb.SimpleDB import SimpleDB
+ db = pyre.inventory.facility("db", factory=SimpleDB,
+ family="spatial_database")
+ db.meta['tip'] = "Database of boundary condition parameters."
+
# PUBLIC METHODS /////////////////////////////////////////////////////
@@ -74,6 +80,7 @@
Integrator.preinitialize(self, mesh)
self.bcQuadrature.preinitialize(mesh.coordsys().spaceDim())
self.quadrature(self.bcQuadrature)
+ self.createSubMesh(mesh)
return
@@ -93,6 +100,7 @@
"Dimension of mesh boundary '%s': %d" % \
(self.bcQuadrature.cellDim,
self.label, self.mesh.dimension()-1)
+ ModuleAbsorbingDampers.verifyConfiguration(self, self.mesh)
self._logger.eventEnd(logEvent)
return
@@ -120,6 +128,7 @@
"""
BoundaryCondition._configure(self)
self.bcQuadrature = self.inventory.quadrature
+ ModuleAbsorbingDampers.db(self, self.inventory.db)
return
Modified: short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/pylith/bc/BoundaryCondition.py 2009-06-09 22:44:14 UTC (rev 15163)
@@ -67,7 +67,6 @@
## @li \b label Label identifier for boundary.
##
## \b Facilities
- ## @li \b db Database of boundary condition parameters
import pyre.inventory
@@ -80,11 +79,6 @@
"tangent direction that is not collinear " \
"with normal direction."
- from spatialdata.spatialdb.SimpleDB import SimpleDB
- db = pyre.inventory.facility("db", factory=SimpleDB,
- family="spatial_database")
- db.meta['tip'] = "Database of boundary condition parameters."
-
# PUBLIC METHODS /////////////////////////////////////////////////////
@@ -101,8 +95,6 @@
"""
Setup boundary condition.
"""
- self.label(self.inventory.label)
- self.db(self.inventory.db)
self.mesh = mesh
return
@@ -122,6 +114,7 @@
Setup members using inventory.
"""
Component._configure(self)
+ ModuleBoundaryCondition.label(self, self.inventory.label)
self.upDir = map(float, self.inventory.upDir)
return
Modified: short/3D/PyLith/trunk/pylith/bc/Neumann.py
===================================================================
--- short/3D/PyLith/trunk/pylith/bc/Neumann.py 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/pylith/bc/Neumann.py 2009-06-09 22:44:14 UTC (rev 15163)
@@ -43,6 +43,7 @@
##
## \b Facilities
## @li \b quadrature Quadrature object for numerical integration
+ ## @li \b db Database of boundary condition parameters
## @li \b output Output manager associated with diagnostic output.
import pyre.inventory
@@ -52,6 +53,11 @@
factory=SubMeshQuadrature)
quadrature.meta['tip'] = "Quadrature object for numerical integration."
+ from spatialdata.spatialdb.SimpleDB import SimpleDB
+ db = pyre.inventory.facility("db", factory=SimpleDB,
+ family="spatial_database")
+ db.meta['tip'] = "Database of boundary condition parameters."
+
from pylith.meshio.OutputNeumann import OutputNeumann
output = pyre.inventory.facility("output", family="output_manager",
factory=OutputNeumann)
@@ -85,6 +91,7 @@
Integrator.preinitialize(self, mesh)
self.bcQuadrature.preinitialize(mesh.coordsys().spaceDim())
self.quadrature(self.bcQuadrature)
+ self.createSubMesh(mesh)
self.output.preinitialize(self)
return
@@ -155,6 +162,7 @@
"""
BoundaryCondition._configure(self)
self.bcQuadrature = self.inventory.quadrature
+ ModuleNeumann.db(self, self.inventory.db)
self.output = self.inventory.output
return
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc 2009-06-09 22:44:14 UTC (rev 15163)
@@ -69,6 +69,20 @@
} // testConstructor
// ----------------------------------------------------------------------
+// Test db().
+void
+pylith::bc::TestAbsorbingDampers::testDB(void)
+{ // testDB
+ const std::string& label = "my db";
+ spatialdata::spatialdb::SimpleDB db(label.c_str());
+ AbsorbingDampers bc;
+ bc.db(&db);
+
+ CPPUNIT_ASSERT(0 != bc._db);
+ CPPUNIT_ASSERT_EQUAL(label, std::string(bc._db->label()));
+} // testDB
+
+// ----------------------------------------------------------------------
// Test initialize().
void
pylith::bc::TestAbsorbingDampers::testInitialize(void)
@@ -309,6 +323,7 @@
bc->timeStep(_data->dt);
bc->label(_data->label);
bc->db(&db);
+ bc->createSubMesh(*mesh);
bc->initialize(*mesh, upDir);
//bc->_boundaryMesh->view("BOUNDARY MESH");
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.hh 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.hh 2009-06-09 22:44:14 UTC (rev 15163)
@@ -41,7 +41,10 @@
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
CPPUNIT_TEST_SUITE( TestAbsorbingDampers );
+
CPPUNIT_TEST( testConstructor );
+ CPPUNIT_TEST( testDB );
+
CPPUNIT_TEST_SUITE_END();
// PUBLIC METHODS /////////////////////////////////////////////////////
@@ -56,6 +59,9 @@
/// Test constructor.
void testConstructor(void);
+ /// Test db()
+ void testDB(void);
+
/// Test initialize().
void testInitialize(void);
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryCondition.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryCondition.cc 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryCondition.cc 2009-06-09 22:44:14 UTC (rev 15163)
@@ -16,8 +16,6 @@
#include "pylith/bc/DirichletBC.hh" // USES DirichletBC
-#include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB
-
#include <string> // USES std::string
// ----------------------------------------------------------------------
@@ -35,19 +33,5 @@
CPPUNIT_ASSERT_EQUAL(label, std::string(bc.label()));
} // testLabel
-// ----------------------------------------------------------------------
-// Test db().
-void
-pylith::bc::TestBoundaryCondition::testDB(void)
-{ // testDB
- const std::string& label = "my db";
- spatialdata::spatialdb::SimpleDB db(label.c_str());
- DirichletBC bc;
- bc.db(&db);
-
- CPPUNIT_ASSERT(0 != bc._db);
- CPPUNIT_ASSERT_EQUAL(label, std::string(bc._db->label()));
-} // testDB
-
// End of file
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryCondition.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryCondition.hh 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryCondition.hh 2009-06-09 22:44:14 UTC (rev 15163)
@@ -36,8 +36,9 @@
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
CPPUNIT_TEST_SUITE( TestBoundaryCondition );
+
CPPUNIT_TEST( testLabel );
- CPPUNIT_TEST( testDB );
+
CPPUNIT_TEST_SUITE_END();
// PUBLIC METHODS /////////////////////////////////////////////////////
@@ -46,9 +47,6 @@
/// Test label()
void testLabel(void);
- /// Test db()
- void testDB(void);
-
}; // class TestBoundaryCondition
#endif // pylith_bc_testboundarycondition_hh
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.cc 2009-06-09 22:44:14 UTC (rev 15163)
@@ -68,6 +68,20 @@
} // testConstructor
// ----------------------------------------------------------------------
+// Test db().
+void
+pylith::bc::TestNeumann::testDB(void)
+{ // testDB
+ const std::string& label = "my db";
+ spatialdata::spatialdb::SimpleDB db(label.c_str());
+ Neumann bc;
+ bc.db(&db);
+
+ CPPUNIT_ASSERT(0 != bc._db);
+ CPPUNIT_ASSERT_EQUAL(label, std::string(bc._db->label()));
+} // testDB
+
+// ----------------------------------------------------------------------
// Test initialize().
void
pylith::bc::TestNeumann::testInitialize(void)
@@ -252,6 +266,7 @@
bc->quadrature(_quadrature);
bc->label(_data->label);
bc->db(&db);
+ bc->createSubMesh(*mesh);
bc->initialize(*mesh, upDir);
// Set up fields
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.hh 2009-06-09 22:30:11 UTC (rev 15162)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestNeumann.hh 2009-06-09 22:44:14 UTC (rev 15163)
@@ -41,7 +41,10 @@
// CPPUNIT TEST SUITE /////////////////////////////////////////////////
CPPUNIT_TEST_SUITE( TestNeumann );
+
CPPUNIT_TEST( testConstructor );
+ CPPUNIT_TEST( testDB );
+
CPPUNIT_TEST_SUITE_END();
// PUBLIC METHODS /////////////////////////////////////////////////////
@@ -56,6 +59,9 @@
/// Test constructor.
void testConstructor(void);
+ /// Test db()
+ void testDB(void);
+
/// Test initialize().
void testInitialize(void);
More information about the CIG-COMMITS
mailing list