[cig-commits] r14047 - in short/3D/PyLith/branches/pylith-swig: libsrc libsrc/feassemble unittests/libtests/feassemble
brad at geodynamics.org
brad at geodynamics.org
Thu Feb 12 21:42:52 PST 2009
Author: brad
Date: 2009-02-12 21:42:52 -0800 (Thu, 12 Feb 2009)
New Revision: 14047
Added:
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureRefCell.cc
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureRefCell.hh
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureRefCell.icc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestQuadratureEngine.cc
short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestQuadratureEngine.hh
Removed:
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.cc
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.hh
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.icc
Modified:
short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Makefile.am
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Quadrature.hh
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureEngine.cc
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureEngine.hh
short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/feassemblefwd.hh
Log:
Yet more work on quadrature.
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am 2009-02-13 03:46:04 UTC (rev 14046)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/Makefile.am 2009-02-13 05:42:52 UTC (rev 14047)
@@ -39,7 +39,7 @@
feassemble/GeometryQuad2D.cc \
feassemble/GeometryQuad3D.cc \
feassemble/GeometryHex3D.cc \
- feassemble/QuadratureBase.cc \
+ feassemble/QuadratureRefCell.cc \
feassemble/QuadratureEngine.cc \
meshio/BinaryIO.cc \
meshio/GMVFile.cc \
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Makefile.am 2009-02-13 03:46:04 UTC (rev 14046)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Makefile.am 2009-02-13 05:42:52 UTC (rev 14047)
@@ -35,8 +35,8 @@
GeometryQuad2D.hh \
GeometryQuad3D.hh \
GeometryHex3D.hh \
- QuadratureBase.hh \
- QuadratureBase.icc \
+ QuadratureRefCell.hh \
+ QuadratureRefCell.icc \
QuadratureEngine.hh \
QuadratureEngine.icc \
Quadrature.hh \
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Quadrature.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Quadrature.hh 2009-02-13 03:46:04 UTC (rev 14046)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/Quadrature.hh 2009-02-13 05:42:52 UTC (rev 14047)
@@ -30,16 +30,15 @@
#define pylith_feassemble_quadrature_hh
// Include directives ---------------------------------------------------
-#include "QuadratureBase.hh" // ISA QuadratureBase
+#include "QuadratureRefCell.hh" // ISA QuadratureRefCell
#include "pylith/topology/topologyfwd.hh" // forward declarations
-#include "pylith/topology/topologyfwd.hh" // forward declarations
#include "pylith/utils/array.hh" // HASA double_array
// Quadrature -----------------------------------------------------------
template<typename mesh_type>
-class pylith::feassemble::Quadrature : public QuadratureBase
+class pylith::feassemble::Quadrature : public QuadratureRefCell
{ // Quadrature
friend class TestQuadrature; // unit testing
Deleted: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.cc 2009-02-13 03:46:04 UTC (rev 14046)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.cc 2009-02-13 05:42:52 UTC (rev 14047)
@@ -1,200 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#include <portinfo>
-
-#include "QuadratureBase.hh" // implementation of class methods
-
-#include "CellGeometry.hh" // USES CellGeometry
-
-#include <cstring> // USES memcpy()
-#include <cassert> // USES assert()
-#include <stdexcept> // USES std::runtime_error
-#include <sstream> // USES std::ostringstream
-
-// ----------------------------------------------------------------------
-// Constructor
-pylith::feassemble::QuadratureBase::QuadratureBase(void) :
- _minJacobian(0),
- _cellDim(0),
- _numBasis(0),
- _numQuadPts(0),
- _spaceDim(0),
- _geometry(0)
-{ // constructor
-} // constructor
-
-// ----------------------------------------------------------------------
-// Destructor
-pylith::feassemble::QuadratureBase::~QuadratureBase(void)
-{ // destructor
- delete _geometry; _geometry = 0;
-} // destructor
-
-// ----------------------------------------------------------------------
-// Copy constructor
-pylith::feassemble::QuadratureBase::QuadratureBase(const QuadratureBase& q) :
- _minJacobian(q._minJacobian),
- _quadPtsRef(q._quadPtsRef),
- _quadWts(q._quadWts),
- _basis(q._basis),
- _basisDerivRef(q._basisDerivRef),
- _cellDim(q._cellDim),
- _numBasis(q._numBasis),
- _numQuadPts(q._numQuadPts),
- _spaceDim(q._spaceDim),
- _geometry(0)
-{ // copy constructor
- if (0 != q._geometry)
- _geometry = q._geometry->clone();
-} // copy constructor
-
-// ----------------------------------------------------------------------
-// Set basis functions and their derivatives and coordinates and
-// weights of the quadrature points.
-void
-pylith::feassemble::QuadratureBase::initialize(const double* basis,
- const double* basisDerivRef,
- const double* quadPtsRef,
- const double* quadWts,
- const int cellDim,
- const int numBasis,
- const int numQuadPts,
- const int spaceDim)
-{ // initialize
- if (0 == basis ||
- 0 == basisDerivRef ||
- 0 == quadPtsRef ||
- 0 == quadWts ||
- cellDim < 0 || cellDim > 3 ||
- numBasis < 1 ||
- numQuadPts < 1 ||
- spaceDim < 1 || spaceDim > 3) {
- std::ostringstream msg;
- msg << "Incompatible values for quadrature information. Basis functions,\n"
- << "their derivatives, and coordinates and weights of quadrature\n"
- << "points must all be specified.\n"
- << "Values:\n"
- << " basis pointer: " << basis << "\n"
- << " basis derivatites pointer: " << basisDerivRef << "\n"
- << " quadrature points pointer: " << quadPtsRef << "\n"
- << " quadrature weights pointer: " << quadWts << "\n"
- << " space dimension: " << spaceDim << "\n"
- << " # basis functions: " << numBasis << "\n"
- << " # quadrature points: " << numQuadPts << "\n"
- << " dimension of coordinate space: " << spaceDim << "\n";
- throw std::runtime_error(msg.str());
- } // if
-
- if (cellDim > 0) {
- int size = numBasis * numQuadPts; assert(size > 0);
- _basis.resize(size);
- for (int i=0; i < size; ++i)
- _basis[i] = basis[i];
-
- size = numQuadPts * numBasis * cellDim; assert(size > 0);
- _basisDerivRef.resize(size);
- for (int i=0; i < size; ++i)
- _basisDerivRef[i] = basisDerivRef[i];
-
- size = numQuadPts * cellDim; assert(size > 0);
- _quadPtsRef.resize(size);
- for (int i=0; i < size; ++i)
- _quadPtsRef[i] = quadPtsRef[i];
-
- size = numQuadPts; assert(size > 0);
- _quadWts.resize(size);
- for (int i=0; i < size; ++i)
- _quadWts[i] = quadWts[i];
-
- _cellDim = cellDim;
- _numBasis = numBasis;
- _numQuadPts = numQuadPts;
- _spaceDim = spaceDim;
-
- } else {
- if (1 != numBasis ||
- 1 != numQuadPts ||
- 1 != spaceDim) {
- std::ostringstream msg;
- msg << "0-D quadrature only works in 1-D and is limited to 1 basis "
- << "function and 1 quadrature point.\n"
- << "Values:\n"
- << " cell dimension: " << cellDim << "\n"
- << " spatial dimension: " << spaceDim << "\n"
- << " # basis functions: " << numBasis << "\n"
- << " # quadrature points: " << numQuadPts << "\n";
- throw std::runtime_error(msg.str());
- } // if
-
- int size = 1;
- _basis.resize(size);
- for (int i=0; i < size; ++i)
- _basis[i] = basis[i];
-
- size = 1;
- _basisDerivRef.resize(size);
- for (int i=0; i < size; ++i)
- _basisDerivRef[i] = basisDerivRef[i];
-
- size = 1;
- _quadPtsRef.resize(size);
- for (int i=0; i < size; ++i)
- _quadPtsRef[i] = quadPtsRef[i];
-
- size = 1;
- _quadWts.resize(size);
- for (int i=0; i < size; ++i)
- _quadWts[i] = quadWts[i];
-
- _cellDim = cellDim;
- _numBasis = numBasis;
- _numQuadPts = numQuadPts;
- _spaceDim = spaceDim;
-
- } // else
-} // initialize
-
-// ----------------------------------------------------------------------
-// Set geometry associated with reference cell.
-void
-pylith::feassemble::QuadratureBase::refGeometry(CellGeometry* const geometry)
-{ // refGeometry
- delete _geometry; _geometry = (0 != geometry) ? geometry->clone() : 0;
-} // refGeometry
-
-// ----------------------------------------------------------------------
-// Get geometry associated with reference cell.
-const pylith::feassemble::CellGeometry&
-pylith::feassemble::QuadratureBase::refGeometry(void) const
-{ // refGeometry
- assert(0 != _geometry);
- return *_geometry;
-} // refGeometry
-
-// ----------------------------------------------------------------------
-// Check determinant of Jacobian against minimum allowable value
-void
-pylith::feassemble::QuadratureBase::_checkJacobianDet(const double det,
- const int cell) const
-{ // _checkJacobianDet
- if (det < _minJacobian) {
- std::ostringstream msg;
- msg << "Determinant of Jacobian (" << det << ") for cell " << cell
- << " is smaller than minimum permissible value (" << _minJacobian
- << ")!\n";
- throw std::runtime_error(msg.str());
- } // if
-} // _checkJacobianDet
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.hh 2009-02-13 03:46:04 UTC (rev 14046)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.hh 2009-02-13 05:42:52 UTC (rev 14047)
@@ -1,241 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-/**
- * @file pylith/feassemble/QuadratureBase.hh
- *
- * @brief Object with basic quadrature information for the reference cell.
- *
- * This object contains the basis functions and their derivatives
- * evaluated at the quadrature points of the reference element, and
- * the coordinates and weights of the quadrature points.
- *
- * The Quadrature object manages the general functionality of the
- * numerical quadrature.
- */
-
-#if !defined(pylith_feassemble_quadraturebase_hh)
-#define pylith_feassemble_quadraturebase_hh
-
-// Include directives ---------------------------------------------------
-#include "feassemblefwd.hh" // forward declarations
-
-#include "pylith/utils/array.hh" // HASA double_array
-
-// Quadrature -----------------------------------------------------------
-class pylith::feassemble::QuadratureBase
-{ // Quadrature
- friend class TestQuadratureBase; // unit testing
-
-// PUBLIC METHODS ///////////////////////////////////////////////////////
-public :
-
- /// Constructor
- QuadratureBase(void);
-
- /// Destructor
- ~QuadratureBase(void);
-
- /** Set basis functions and their derivatives, and coordinates and
- * weights of the quadrature points.
- *
- * @param basis Array of basis functions evaluated at quadrature pts
- * N0Qp0, N1Qp0, ...
- * N0Qp1, N1Qp1, ...
- * ...
- * size = numQuadPts * numBasis
- * index = iQuadPt*numBasis + iBasis
- *
- * @param basisDerivRef Array of basis function derivaties evaluated at
- * quadrature pts, where derivatives are with respect to cell's
- * local coordinates.
- * N0pQp0, N0qQp0, N0rQp0, N1pQp0, N1qQp0, N1rQp0, ...
- * N0pQp1, N0qQp1, N0rQp1, N1pQp1, N1qQp1, N1rQp1, ...
- * ...
- * size = numQuadPts * numBasis * cellDim
- * index = iQuadPt*numBasis*cellDim + iBasis*cellDim + iDim
- *
- * @param quadPts Array of coordinates of quadrature points in
- * reference cell
- * Qp0p, Qp0q, Qp0r
- * Qp1p, Qp1q, Qp1r
- * size = numQuadPts * numDims
- * index = iQuadPt*numDims + iDim
- *
- * @param quadWts Array of weights of quadrature points
- * WtQp0, WtQp1, ...
- * index = iQuadPt
- *
- * @param cellDim Number of dimensions in reference cell
- * @param numBasis Number of basis functions for a cell
- * @param numQuadPts Number of quadrature points
- * @param spaceDim Number of dimensions in coordinates of cell vertices
- */
- void initialize(const double* basis,
- const double* basisDerivRef,
- const double* quadPtsRef,
- const double* quadWts,
- const int cellDim,
- const int numBasis,
- const int numQuadPts,
- const int spaceDim);
-
- /** Set geometry associated with reference cell.
- *
- * @param geometry Geometry of reference cell.
- */
- void refGeometry(CellGeometry* const geometry);
-
- /** Get geometry associated with reference cell.
- *
- * @returns Geometry of reference cell.
- */
- const CellGeometry& refGeometry(void) const;
-
- /** Set minimum allowable determinant of Jacobian.
- *
- * @param tolerance Minimum allowable value for Jacobian
- */
- void minJacobian(const double min);
-
- /** Get minimum allowable determinant of Jacobian.
- *
- * @returns Minimum allowable value for Jacobian
- */
- double minJacobian(void) const;
-
- /** Get coordinates of quadrature points in reference cell.
- *
- * @returns Array of coordinates of quadrature points in reference cell.
- */
- const double_array& quadPtsRef(void) const;
-
- /** Get weights of quadrature points.
- *
- * @returns Weights of quadrature points
- */
- const double_array& quadWts(void) const;
-
- /** Get basis fns evaluated at quadrature points.
- *
- * @returns Array of basis fns evaluated at quadrature points
- */
- const double_array& basis(void) const;
-
- /** Get number of dimensions in reference cell.
- *
- * @returns Number of dimensions in reference cell
- */
- int cellDim(void) const;
-
- /** Get number of basis functions for cell.
- *
- * @returns Number of basis functions for cell
- */
- int numBasis(void) const;
-
- /** Get number of quadrature points.
- *
- * @returns Number of quadrature points
- */
- int numQuadPts(void) const;
-
- /** Get number of dimensions in coordinates of cell vertices.
- *
- * @returns Number of dimensions in coordinates of cell vertices
- */
- int spaceDim(void) const;
-
-// PROTECTED METHODS ////////////////////////////////////////////////////
-protected :
-
- /** Copy constructor.
- *
- * @param q Quadrature to copy
- */
- QuadratureBase(const QuadratureBase& q);
-
- /* Check determinant of Jacobian against minimum allowable value.
- *
- * @param det Value of determinant of Jacobian
- * @param cell Label of finite-element cell
- */
- void _checkJacobianDet(const double det,
- const int cell) const;
-
-// PROTECTED MEMBERS ////////////////////////////////////////////////////
-protected :
-
- double _minJacobian; ///< Minium allowable Jacobian determinant
-
- /** Array of coordinates of quadrature points in reference cell.
- *
- * Reference coordinates: (p,q,r)
- *
- * Qp0p, Qp0q, Qp0r
- * Qp1p, Qp1q, Qp1r
- *
- * size = numQuadPts * cellDim
- * index = iQuadPts*cellDim + iDim
- */
- double_array _quadPtsRef;
-
- /** Array of weights of quadrature points.
- *
- * WtQp0, WtQp1, ...
- * size = numQuadPts
- * index = iQuadPt
- */
- double_array _quadWts;
-
- /** Array of basis functions evaluated at the quadrature points.
- *
- * N0Qp0, N1Qp0, ...
- * N0Qp1, N1Qp1, ...
- *
- * size = numQuadPts * numBasis
- * index = iQuadPt*numBasis + iBasis
- */
- double_array _basis;
-
- /** Array of basis function derivatives evaluated at the quadrature
- * points, where derivatives are with respect to cell's local
- * coordinates.
- *
- * N0pQp0, N0qQp0, N0rQp0, N1pQp0, N1qQp0, N1rQp0, ...
- * N0pQp1, N0qQp1, N0rQp1, N1pQp1, N1qQp1, N1rQp1, ...
- *
- * size = numQuadPts * numBasis * cellDim
- * index = iQuadPt*numBasis*cellDim + iBasis*cellDim + iDim
- */
- double_array _basisDerivRef;
-
- int _cellDim; ///< Number of dimensions in reference cell
- int _numBasis; ///< Number of basis functions (and vertices) for cell
- int _numQuadPts; ///< Number of quadrature points
- int _spaceDim; ///< Number of dimensions in coordinates of cell vertices
-
- CellGeometry* _geometry; ///< Geometry of reference cell
-
-// NOT IMPLEMENTED //////////////////////////////////////////////////////
-private :
-
- const QuadratureBase& operator=(const QuadratureBase&); ///< Not implemented
-
-}; // QuadratureBase
-
-#include "QuadratureBase.icc" // inline methods
-
-#endif // pylith_feassemble_quadraturebase_hh
-
-
-// End of file
Deleted: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.icc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.icc 2009-02-13 03:46:04 UTC (rev 14046)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.icc 2009-02-13 05:42:52 UTC (rev 14047)
@@ -1,82 +0,0 @@
-// -*- C++ -*-
-//
-// ======================================================================
-//
-// Brad T. Aagaard
-// U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ======================================================================
-//
-
-#if !defined(pylith_feassemble_quadraturebase_hh)
-#error "QuadratureBase.icc must be included only from QuadratureBase.hh"
-#else
-
-// Get minimum allowable Jacobian.
-inline
-double
-pylith::feassemble::QuadratureBase::minJacobian(void) const {
- return _minJacobian;
-}
-
-// Set minimum allowable Jacobian.
-inline
-void
-pylith::feassemble::QuadratureBase::minJacobian(const double min) {
- _minJacobian = min;
-}
-
-// Get coordinates of quadrature points in reference cell.
-inline
-const pylith::double_array&
-pylith::feassemble::QuadratureBase::quadPtsRef(void) const {
- return _quadPtsRef;
-}
-
-// Get weights of quadrature points.
-inline
-const pylith::double_array&
-pylith::feassemble::QuadratureBase::quadWts(void) const {
- return _quadWts;
-}
-
-// Get basis fns evaluated at quadrature points.
-inline
-const pylith::double_array&
-pylith::feassemble::QuadratureBase::basis(void) const {
- return _basis;
-}
-
-// Get number of dimensions in reference cell.
-inline
-int
-pylith::feassemble::QuadratureBase::cellDim(void) const {
- return _cellDim;
-}
-
-// Get number of basis functions for cell.
-inline
-int
-pylith::feassemble::QuadratureBase::numBasis(void) const {
- return _numBasis;
-}
-
-// Get number of quadrature points.
-inline
-int
-pylith::feassemble::QuadratureBase::numQuadPts(void) const {
- return _numQuadPts;
-}
-
-// Get number of dimensions in coordinates of cell vertices.
-inline
-int
-pylith::feassemble::QuadratureBase::spaceDim(void) const {
- return _spaceDim;
-}
-
-#endif
-
-// End of file
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureEngine.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureEngine.cc 2009-02-13 03:46:04 UTC (rev 14046)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureEngine.cc 2009-02-13 05:42:52 UTC (rev 14047)
@@ -15,11 +15,11 @@
#include "QuadratureEngine.hh" // implementation of class methods
#include "CellGeometry.hh" // USES CellGeometry
-#include "QuadratureBase.hh" // QuadratureBase
+#include "QuadratureRefCell.hh" // QuadratureRefCell
// ----------------------------------------------------------------------
// Constructor.
-pylith::feassemble::QuadratureEngine::QuadratureEngine(const QuadratureBase& q) :
+pylith::feassemble::QuadratureEngine::QuadratureEngine(const QuadratureRefCell& q) :
_quadRefCell(q)
{ // constructor
} // constructor
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureEngine.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureEngine.hh 2009-02-13 03:46:04 UTC (rev 14046)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureEngine.hh 2009-02-13 05:42:52 UTC (rev 14047)
@@ -32,7 +32,7 @@
*
* @param q Quadrature information for reference cell.
*/
- QuadratureEngine(const QuadratureBase& q);
+ QuadratureEngine(const QuadratureRefCell& q);
/// Destructor
~QuadratureEngine(void);
@@ -105,7 +105,7 @@
double_array _jacobianInv; /// Inverse of Jacobian at quad pts.
double_array _basisDeriv; ///< Deriv. of basis fns at quad pts.
- const QuadratureBase& _quadRefCell;
+ const QuadratureRefCell& _quadRefCell;
// NOT IMPLEMENTED //////////////////////////////////////////////////////
private :
Copied: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureRefCell.cc (from rev 14045, short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.cc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureRefCell.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureRefCell.cc 2009-02-13 05:42:52 UTC (rev 14047)
@@ -0,0 +1,200 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include <portinfo>
+
+#include "QuadratureRefCell.hh" // implementation of class methods
+
+#include "CellGeometry.hh" // USES CellGeometry
+
+#include <cstring> // USES memcpy()
+#include <cassert> // USES assert()
+#include <stdexcept> // USES std::runtime_error
+#include <sstream> // USES std::ostringstream
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::feassemble::QuadratureRefCell::QuadratureRefCell(void) :
+ _minJacobian(0),
+ _cellDim(0),
+ _numBasis(0),
+ _numQuadPts(0),
+ _spaceDim(0),
+ _geometry(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::feassemble::QuadratureRefCell::~QuadratureRefCell(void)
+{ // destructor
+ delete _geometry; _geometry = 0;
+} // destructor
+
+// ----------------------------------------------------------------------
+// Copy constructor
+pylith::feassemble::QuadratureRefCell::QuadratureRefCell(const QuadratureRefCell& q) :
+ _minJacobian(q._minJacobian),
+ _quadPtsRef(q._quadPtsRef),
+ _quadWts(q._quadWts),
+ _basis(q._basis),
+ _basisDerivRef(q._basisDerivRef),
+ _cellDim(q._cellDim),
+ _numBasis(q._numBasis),
+ _numQuadPts(q._numQuadPts),
+ _spaceDim(q._spaceDim),
+ _geometry(0)
+{ // copy constructor
+ if (0 != q._geometry)
+ _geometry = q._geometry->clone();
+} // copy constructor
+
+// ----------------------------------------------------------------------
+// Set basis functions and their derivatives and coordinates and
+// weights of the quadrature points.
+void
+pylith::feassemble::QuadratureRefCell::initialize(const double* basis,
+ const double* basisDerivRef,
+ const double* quadPtsRef,
+ const double* quadWts,
+ const int cellDim,
+ const int numBasis,
+ const int numQuadPts,
+ const int spaceDim)
+{ // initialize
+ if (0 == basis ||
+ 0 == basisDerivRef ||
+ 0 == quadPtsRef ||
+ 0 == quadWts ||
+ cellDim < 0 || cellDim > 3 ||
+ numBasis < 1 ||
+ numQuadPts < 1 ||
+ spaceDim < 1 || spaceDim > 3) {
+ std::ostringstream msg;
+ msg << "Incompatible values for quadrature information. Basis functions,\n"
+ << "their derivatives, and coordinates and weights of quadrature\n"
+ << "points must all be specified.\n"
+ << "Values:\n"
+ << " basis pointer: " << basis << "\n"
+ << " basis derivatites pointer: " << basisDerivRef << "\n"
+ << " quadrature points pointer: " << quadPtsRef << "\n"
+ << " quadrature weights pointer: " << quadWts << "\n"
+ << " space dimension: " << spaceDim << "\n"
+ << " # basis functions: " << numBasis << "\n"
+ << " # quadrature points: " << numQuadPts << "\n"
+ << " dimension of coordinate space: " << spaceDim << "\n";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ if (cellDim > 0) {
+ int size = numBasis * numQuadPts; assert(size > 0);
+ _basis.resize(size);
+ for (int i=0; i < size; ++i)
+ _basis[i] = basis[i];
+
+ size = numQuadPts * numBasis * cellDim; assert(size > 0);
+ _basisDerivRef.resize(size);
+ for (int i=0; i < size; ++i)
+ _basisDerivRef[i] = basisDerivRef[i];
+
+ size = numQuadPts * cellDim; assert(size > 0);
+ _quadPtsRef.resize(size);
+ for (int i=0; i < size; ++i)
+ _quadPtsRef[i] = quadPtsRef[i];
+
+ size = numQuadPts; assert(size > 0);
+ _quadWts.resize(size);
+ for (int i=0; i < size; ++i)
+ _quadWts[i] = quadWts[i];
+
+ _cellDim = cellDim;
+ _numBasis = numBasis;
+ _numQuadPts = numQuadPts;
+ _spaceDim = spaceDim;
+
+ } else {
+ if (1 != numBasis ||
+ 1 != numQuadPts ||
+ 1 != spaceDim) {
+ std::ostringstream msg;
+ msg << "0-D quadrature only works in 1-D and is limited to 1 basis "
+ << "function and 1 quadrature point.\n"
+ << "Values:\n"
+ << " cell dimension: " << cellDim << "\n"
+ << " spatial dimension: " << spaceDim << "\n"
+ << " # basis functions: " << numBasis << "\n"
+ << " # quadrature points: " << numQuadPts << "\n";
+ throw std::runtime_error(msg.str());
+ } // if
+
+ int size = 1;
+ _basis.resize(size);
+ for (int i=0; i < size; ++i)
+ _basis[i] = basis[i];
+
+ size = 1;
+ _basisDerivRef.resize(size);
+ for (int i=0; i < size; ++i)
+ _basisDerivRef[i] = basisDerivRef[i];
+
+ size = 1;
+ _quadPtsRef.resize(size);
+ for (int i=0; i < size; ++i)
+ _quadPtsRef[i] = quadPtsRef[i];
+
+ size = 1;
+ _quadWts.resize(size);
+ for (int i=0; i < size; ++i)
+ _quadWts[i] = quadWts[i];
+
+ _cellDim = cellDim;
+ _numBasis = numBasis;
+ _numQuadPts = numQuadPts;
+ _spaceDim = spaceDim;
+
+ } // else
+} // initialize
+
+// ----------------------------------------------------------------------
+// Set geometry associated with reference cell.
+void
+pylith::feassemble::QuadratureRefCell::refGeometry(CellGeometry* const geometry)
+{ // refGeometry
+ delete _geometry; _geometry = (0 != geometry) ? geometry->clone() : 0;
+} // refGeometry
+
+// ----------------------------------------------------------------------
+// Get geometry associated with reference cell.
+const pylith::feassemble::CellGeometry&
+pylith::feassemble::QuadratureRefCell::refGeometry(void) const
+{ // refGeometry
+ assert(0 != _geometry);
+ return *_geometry;
+} // refGeometry
+
+// ----------------------------------------------------------------------
+// Check determinant of Jacobian against minimum allowable value
+void
+pylith::feassemble::QuadratureRefCell::_checkJacobianDet(const double det,
+ const int cell) const
+{ // _checkJacobianDet
+ if (det < _minJacobian) {
+ std::ostringstream msg;
+ msg << "Determinant of Jacobian (" << det << ") for cell " << cell
+ << " is smaller than minimum permissible value (" << _minJacobian
+ << ")!\n";
+ throw std::runtime_error(msg.str());
+ } // if
+} // _checkJacobianDet
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureRefCell.hh (from rev 14045, short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.hh)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureRefCell.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureRefCell.hh 2009-02-13 05:42:52 UTC (rev 14047)
@@ -0,0 +1,241 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/feassemble/QuadratureRefCell.hh
+ *
+ * @brief Object with basic quadrature information for the reference cell.
+ *
+ * This object contains the basis functions and their derivatives
+ * evaluated at the quadrature points of the reference element, and
+ * the coordinates and weights of the quadrature points.
+ *
+ * The Quadrature object manages the general functionality of the
+ * numerical quadrature.
+ */
+
+#if !defined(pylith_feassemble_quadraturerefcell_hh)
+#define pylith_feassemble_quadraturerefcell_hh
+
+// Include directives ---------------------------------------------------
+#include "feassemblefwd.hh" // forward declarations
+
+#include "pylith/utils/array.hh" // HASA double_array
+
+// Quadrature -----------------------------------------------------------
+class pylith::feassemble::QuadratureRefCell
+{ // Quadrature
+ friend class TestQuadratureRefCell; // unit testing
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Constructor
+ QuadratureRefCell(void);
+
+ /// Destructor
+ ~QuadratureRefCell(void);
+
+ /** Set basis functions and their derivatives, and coordinates and
+ * weights of the quadrature points.
+ *
+ * @param basis Array of basis functions evaluated at quadrature pts
+ * N0Qp0, N1Qp0, ...
+ * N0Qp1, N1Qp1, ...
+ * ...
+ * size = numQuadPts * numBasis
+ * index = iQuadPt*numBasis + iBasis
+ *
+ * @param basisDerivRef Array of basis function derivaties evaluated at
+ * quadrature pts, where derivatives are with respect to cell's
+ * local coordinates.
+ * N0pQp0, N0qQp0, N0rQp0, N1pQp0, N1qQp0, N1rQp0, ...
+ * N0pQp1, N0qQp1, N0rQp1, N1pQp1, N1qQp1, N1rQp1, ...
+ * ...
+ * size = numQuadPts * numBasis * cellDim
+ * index = iQuadPt*numBasis*cellDim + iBasis*cellDim + iDim
+ *
+ * @param quadPts Array of coordinates of quadrature points in
+ * reference cell
+ * Qp0p, Qp0q, Qp0r
+ * Qp1p, Qp1q, Qp1r
+ * size = numQuadPts * numDims
+ * index = iQuadPt*numDims + iDim
+ *
+ * @param quadWts Array of weights of quadrature points
+ * WtQp0, WtQp1, ...
+ * index = iQuadPt
+ *
+ * @param cellDim Number of dimensions in reference cell
+ * @param numBasis Number of basis functions for a cell
+ * @param numQuadPts Number of quadrature points
+ * @param spaceDim Number of dimensions in coordinates of cell vertices
+ */
+ void initialize(const double* basis,
+ const double* basisDerivRef,
+ const double* quadPtsRef,
+ const double* quadWts,
+ const int cellDim,
+ const int numBasis,
+ const int numQuadPts,
+ const int spaceDim);
+
+ /** Set geometry associated with reference cell.
+ *
+ * @param geometry Geometry of reference cell.
+ */
+ void refGeometry(CellGeometry* const geometry);
+
+ /** Get geometry associated with reference cell.
+ *
+ * @returns Geometry of reference cell.
+ */
+ const CellGeometry& refGeometry(void) const;
+
+ /** Set minimum allowable determinant of Jacobian.
+ *
+ * @param tolerance Minimum allowable value for Jacobian
+ */
+ void minJacobian(const double min);
+
+ /** Get minimum allowable determinant of Jacobian.
+ *
+ * @returns Minimum allowable value for Jacobian
+ */
+ double minJacobian(void) const;
+
+ /** Get coordinates of quadrature points in reference cell.
+ *
+ * @returns Array of coordinates of quadrature points in reference cell.
+ */
+ const double_array& quadPtsRef(void) const;
+
+ /** Get weights of quadrature points.
+ *
+ * @returns Weights of quadrature points
+ */
+ const double_array& quadWts(void) const;
+
+ /** Get basis fns evaluated at quadrature points.
+ *
+ * @returns Array of basis fns evaluated at quadrature points
+ */
+ const double_array& basis(void) const;
+
+ /** Get number of dimensions in reference cell.
+ *
+ * @returns Number of dimensions in reference cell
+ */
+ int cellDim(void) const;
+
+ /** Get number of basis functions for cell.
+ *
+ * @returns Number of basis functions for cell
+ */
+ int numBasis(void) const;
+
+ /** Get number of quadrature points.
+ *
+ * @returns Number of quadrature points
+ */
+ int numQuadPts(void) const;
+
+ /** Get number of dimensions in coordinates of cell vertices.
+ *
+ * @returns Number of dimensions in coordinates of cell vertices
+ */
+ int spaceDim(void) const;
+
+// PROTECTED METHODS ////////////////////////////////////////////////////
+protected :
+
+ /** Copy constructor.
+ *
+ * @param q Quadrature to copy
+ */
+ QuadratureRefCell(const QuadratureRefCell& q);
+
+ /* Check determinant of Jacobian against minimum allowable value.
+ *
+ * @param det Value of determinant of Jacobian
+ * @param cell Label of finite-element cell
+ */
+ void _checkJacobianDet(const double det,
+ const int cell) const;
+
+// PROTECTED MEMBERS ////////////////////////////////////////////////////
+protected :
+
+ double _minJacobian; ///< Minium allowable Jacobian determinant
+
+ /** Array of coordinates of quadrature points in reference cell.
+ *
+ * Reference coordinates: (p,q,r)
+ *
+ * Qp0p, Qp0q, Qp0r
+ * Qp1p, Qp1q, Qp1r
+ *
+ * size = numQuadPts * cellDim
+ * index = iQuadPts*cellDim + iDim
+ */
+ double_array _quadPtsRef;
+
+ /** Array of weights of quadrature points.
+ *
+ * WtQp0, WtQp1, ...
+ * size = numQuadPts
+ * index = iQuadPt
+ */
+ double_array _quadWts;
+
+ /** Array of basis functions evaluated at the quadrature points.
+ *
+ * N0Qp0, N1Qp0, ...
+ * N0Qp1, N1Qp1, ...
+ *
+ * size = numQuadPts * numBasis
+ * index = iQuadPt*numBasis + iBasis
+ */
+ double_array _basis;
+
+ /** Array of basis function derivatives evaluated at the quadrature
+ * points, where derivatives are with respect to cell's local
+ * coordinates.
+ *
+ * N0pQp0, N0qQp0, N0rQp0, N1pQp0, N1qQp0, N1rQp0, ...
+ * N0pQp1, N0qQp1, N0rQp1, N1pQp1, N1qQp1, N1rQp1, ...
+ *
+ * size = numQuadPts * numBasis * cellDim
+ * index = iQuadPt*numBasis*cellDim + iBasis*cellDim + iDim
+ */
+ double_array _basisDerivRef;
+
+ int _cellDim; ///< Number of dimensions in reference cell
+ int _numBasis; ///< Number of basis functions (and vertices) for cell
+ int _numQuadPts; ///< Number of quadrature points
+ int _spaceDim; ///< Number of dimensions in coordinates of cell vertices
+
+ CellGeometry* _geometry; ///< Geometry of reference cell
+
+// NOT IMPLEMENTED //////////////////////////////////////////////////////
+private :
+
+ const QuadratureRefCell& operator=(const QuadratureRefCell&); ///< Not implemented
+
+}; // QuadratureRefCell
+
+#include "QuadratureRefCell.icc" // inline methods
+
+#endif // pylith_feassemble_quadraturerefcell_hh
+
+
+// End of file
Copied: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureRefCell.icc (from rev 14045, short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureBase.icc)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureRefCell.icc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/QuadratureRefCell.icc 2009-02-13 05:42:52 UTC (rev 14047)
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_feassemble_quadraturerefcell_hh)
+#error "QuadratureRefCell.icc must be included only from QuadratureRefCell.hh"
+#else
+
+// Get minimum allowable Jacobian.
+inline
+double
+pylith::feassemble::QuadratureRefCell::minJacobian(void) const {
+ return _minJacobian;
+}
+
+// Set minimum allowable Jacobian.
+inline
+void
+pylith::feassemble::QuadratureRefCell::minJacobian(const double min) {
+ _minJacobian = min;
+}
+
+// Get coordinates of quadrature points in reference cell.
+inline
+const pylith::double_array&
+pylith::feassemble::QuadratureRefCell::quadPtsRef(void) const {
+ return _quadPtsRef;
+}
+
+// Get weights of quadrature points.
+inline
+const pylith::double_array&
+pylith::feassemble::QuadratureRefCell::quadWts(void) const {
+ return _quadWts;
+}
+
+// Get basis fns evaluated at quadrature points.
+inline
+const pylith::double_array&
+pylith::feassemble::QuadratureRefCell::basis(void) const {
+ return _basis;
+}
+
+// Get number of dimensions in reference cell.
+inline
+int
+pylith::feassemble::QuadratureRefCell::cellDim(void) const {
+ return _cellDim;
+}
+
+// Get number of basis functions for cell.
+inline
+int
+pylith::feassemble::QuadratureRefCell::numBasis(void) const {
+ return _numBasis;
+}
+
+// Get number of quadrature points.
+inline
+int
+pylith::feassemble::QuadratureRefCell::numQuadPts(void) const {
+ return _numQuadPts;
+}
+
+// Get number of dimensions in coordinates of cell vertices.
+inline
+int
+pylith::feassemble::QuadratureRefCell::spaceDim(void) const {
+ return _spaceDim;
+}
+
+#endif
+
+// End of file
Modified: short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/feassemblefwd.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/feassemblefwd.hh 2009-02-13 03:46:04 UTC (rev 14046)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/feassemble/feassemblefwd.hh 2009-02-13 05:42:52 UTC (rev 14047)
@@ -38,7 +38,7 @@
class GeometryTet3D;
class GeometryHex3D;
- class QuadratureBase;
+ class QuadratureRefCell;
class QuadratureEngine;
class Quadrature0D;
class Quadrature1D;
Added: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestQuadratureEngine.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestQuadratureEngine.cc (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestQuadratureEngine.cc 2009-02-13 05:42:52 UTC (rev 14047)
@@ -0,0 +1,157 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestQuadratureEngine.hh" // Implementation of class methods
+
+#include "pylith/feassemble/Quadrature1D.hh" // USES Quadrature1D
+
+#include "data/QuadratureData.hh" // USES QuadratureData
+
+#include <string.h> // USES memcpy()
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::feassemble::TestQuadratureEngine );
+
+// ----------------------------------------------------------------------
+// Test copy constructor.
+void
+pylith::feassemble::TestQuadratureEngine::testCopyConstructor(void)
+{ // testClone
+ // Semi-random values manually set to check cloning
+ const double quadPtsE[] = { 12.8 };
+ const double jacobianE[] = { 2.56 };
+ const double jacobianInvE[] = { 5.12 };
+ const double jacobianDetE[] = { 10.24 };
+ const double basisDerivE[] = { 0.8, 1.6 };
+
+ Quadrature1D engineOrig;
+ int size = 0;
+
+ // Set values
+ size = 1;
+ engineOrig._quadPts.resize(size);
+ memcpy(&engineOrig._quadPts[0], quadPtsE, size*sizeof(double));
+
+ size = 1;
+ engineOrig._jacobian.resize(size);
+ memcpy(&engineOrig._jacobian[0], jacobianE, size*sizeof(double));
+
+ size = 1;
+ engineOrig._jacobianInv.resize(size);
+ memcpy(&engineOrig._jacobianInv[0], jacobianInvE, size*sizeof(double));
+
+ size = 1;
+ engineOrig._jacobianDet.resize(size);
+ memcpy(&engineOrig._jacobianDet[0], jacobianDetE, size*sizeof(double));
+
+ // Copy
+ Quadrature1D engine(engineOrig);
+
+ const double_array& quadPts = engine.quadPts();
+ size = 1;
+ CPPUNIT_ASSERT_EQUAL(size, quadPts.size());
+ for (int i=0; i < size; ++i)
+ CPPUNIT_ASSERT_EQUAL(quadPtsE[i], quadPts[i]);
+
+ const double_array& jacobian = engine._jacobian;
+ size = 1;
+ CPPUNIT_ASSERT_EQUAL(size, jacobian.size());
+ for (int i=0; i < size; ++i)
+ CPPUNIT_ASSERT_EQUAL(jacobianE[i], jacobian[i]);
+
+ const double_array& jacobianInv = engine.jacobianInv();
+ size = 1;
+ CPPUNIT_ASSERT_EQUAL(size, jacobianInv.size());
+ for (int i=0; i < size; ++i)
+ CPPUNIT_ASSERT_EQUAL(jacobianInvE[i], jacobianInv[i]);
+
+ const double_array& jacobianDet = engine.jacobianDet();
+ size = 1;
+ CPPUNIT_ASSERT_EQUAL(size, jacobianDet.size());
+ for (int i=0; i < size; ++i)
+ CPPUNIT_ASSERT_EQUAL(jacobianDetE[i], jacobianDet[i]);
+} // testCopyConstructor
+
+// ----------------------------------------------------------------------
+// Test computeGeometry().
+void
+pylith::feassemble::TestQuadratureEngine::_testComputeGeometry(Quadrature<topology::Mesh>* pQuad,
+ const QuadratureData& data) const
+{ // testComputeGeometry
+ const int cellDim = data.cellDim;
+ const int numBasis = data.numBasis;
+ const int numQuadPts = data.numQuadPts;
+ const int spaceDim = data.spaceDim;
+ const double* basis = data.basis;
+ const double* basisDerivRef = data.basisDerivRef;
+ const double* basisDeriv = data.basisDeriv;
+ const double* quadPtsRef = data.quadPtsRef;
+ const double* quadWts = data.quadWts;
+
+ const int numVertices = data.numVertices;
+ const int numCells = data.numCells;
+ const double* vertCoords = data.vertices;
+ const int* cells = data.cells;
+ const double* quadPts = data.quadPts;
+ const double* jacobian = data.jacobian;
+ const double* jacobianInv = data.jacobianInv;
+ const double* jacobianDet = data.jacobianDet;
+
+ const double minJacobian = 1.0e-06;
+
+ QuadratureRefCell quadRefCell;
+ quadRefCell.minJacobian(minJacobian);
+ quadRefCell.initialize(basis, basisDerivRef, quadPtsRef, quadWts,
+ cellDim, numBasis, numQuadPts, spaceDim);
+
+ // Check values from computeGeometry()
+ const ALE::Obj<Mesh::label_sequence>& cellsMesh = mesh->heightStratum(0);
+ CPPUNIT_ASSERT(!cellsMesh.isNull());
+ const Mesh::label_sequence::iterator e_iter = cellsMesh->begin();
+ const ALE::Obj<Mesh::real_section_type>& coordinates =
+ mesh->getRealSection("coordinates");
+ CPPUNIT_ASSERT(!coordinates.isNull());
+ pQuad->computeGeometry(mesh, coordinates, *e_iter);
+
+ CPPUNIT_ASSERT(1 == numCells);
+
+ const double tolerance = 1.0e-06;
+ int size = numQuadPts * spaceDim;
+ for (int i=0; i < size; ++i)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(quadPts[i], pQuad->_quadPts[i], tolerance);
+
+ size = numQuadPts * cellDim * spaceDim;
+ for (int i=0; i < size; ++i)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(jacobian[i], pQuad->_jacobian[i],
+ tolerance);
+
+ size = numQuadPts * spaceDim * cellDim;
+ for (int i=0; i < size; ++i)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(jacobianInv[i], pQuad->_jacobianInv[i],
+ tolerance);
+
+ size = numQuadPts;
+ for (int i=0; i < size; ++i)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(jacobianDet[i], pQuad->_jacobianDet[i],
+ tolerance);
+
+ size = numQuadPts * numBasis * spaceDim;
+ for (int i=0; i < size; ++i)
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(basisDeriv[i], pQuad->_basisDeriv[i],
+ tolerance);
+
+} // testComputeGeometry
+
+
+// End of file
Added: short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestQuadratureEngine.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestQuadratureEngine.hh (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/feassemble/TestQuadratureEngine.hh 2009-02-13 05:42:52 UTC (rev 14047)
@@ -0,0 +1,72 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/feassemble/TestQuadratureEngine.hh
+ *
+ * @brief C++ TestQuadratureEngine object
+ *
+ * C++ unit testing for Quadrature.
+ */
+
+#if !defined(pylith_feassemble_testquadrature_hh)
+#define pylith_feassemble_testquadrature_hh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "pylith/feassemble/feassemblefwd.hh" // forward declarations
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace feassemble {
+ class TestQuadratureEngine;
+ class QuadratureData;
+ } // feassemble
+} // pylith
+
+/// C++ unit testing for Quadrature
+class pylith::feassemble::TestQuadratureEngine : public CppUnit::TestFixture
+{ // class TestQuadratureEngine
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestQuadratureEngine );
+
+ CPPUNIT_TEST( testCopyConstructor );
+ CPPUNIT_TEST( testCheckConditioning );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test copy constructor.
+ void testCopyConstructor(void);
+
+ /// Test checkConditioning()
+ void testCheckConditioning(void);
+
+ // PROTECTED METHODS //////////////////////////////////////////////////
+protected :
+
+ /** Test computeGeometry() and retrieveGeometry().
+ *
+ * @param engine Quadrature engine.
+ * @param data Data for testing quadrature
+ */
+ void _testComputeGeometry(QuadratureEngine* engine,
+ const QuadratureData& data) const;
+
+}; // class TestQuadratureEngine
+
+#endif // pylith_feassemble_testquadratureengine_hh
+
+// End of file
More information about the CIG-COMMITS
mailing list