[cig-commits] r8158 - in short/3D/PyLith/trunk: libsrc/bc
unittests/libtests/bc unittests/libtests/bc/data
brad at geodynamics.org
brad at geodynamics.org
Fri Oct 19 14:48:19 PDT 2007
Author: brad
Date: 2007-10-19 14:48:18 -0700 (Fri, 19 Oct 2007)
New Revision: 8158
Added:
short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampersTri3.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampersTri3.hh
short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataTri3.cc
short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataTri3.hh
short/3D/PyLith/trunk/unittests/libtests/bc/data/elasticplanestrain.spatialdb
Modified:
short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc
short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampersLine2.cc
short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataLine2.hh
short/3D/PyLith/trunk/unittests/libtests/bc/data/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/bc/data/line2.mesh
short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3.mesh
Log:
Working on more absorbing boundary unit tests.
Modified: short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc 2007-10-19 19:24:45 UTC (rev 8157)
+++ short/3D/PyLith/trunk/libsrc/bc/AbsorbingDampers.cc 2007-10-19 21:48:18 UTC (rev 8158)
@@ -66,7 +66,7 @@
throw std::runtime_error(msg.str());
} // if
- //_boundaryMesh->view("ABSORBING BOUNDARY MESH");
+ _boundaryMesh->view("ABSORBING BOUNDARY MESH");
// check compatibility of quadrature and boundary mesh
if (_quadrature->cellDim() != _boundaryMesh->getDimension()) {
@@ -148,6 +148,7 @@
const ALE::Obj<real_section_type>& coordinates =
_boundaryMesh->getRealSection("coordinates");
+ assert(!coordinates.isNull());
for(Mesh::label_sequence::iterator c_iter = cells->begin();
c_iter != cells->end();
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am 2007-10-19 19:24:45 UTC (rev 8157)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am 2007-10-19 21:48:18 UTC (rev 8158)
@@ -23,6 +23,7 @@
testbc_SOURCES = \
TestAbsorbingDampers.cc \
TestAbsorbingDampersLine2.cc \
+ TestAbsorbingDampersTri3.cc \
TestBoundaryCondition.cc \
TestDirichlet.cc \
TestDirichletLine2.cc \
@@ -40,6 +41,7 @@
noinst_HEADERS = \
TestAbsorbingDampers.hh \
TestAbsorbingDampersLine2.hh \
+ TestAbsorbingDampersTri3.hh \
TestBoundaryCondition.hh \
TestDirichlet.hh \
TestDirichletLine2.hh \
@@ -57,6 +59,7 @@
testbc_SOURCES += \
data/AbsorbingDampersData.cc \
data/AbsorbingDampersDataLine2.cc \
+ data/AbsorbingDampersDataTri3.cc \
data/DirichletData.cc \
data/DirichletDataLine2.cc \
data/DirichletDataLine2b.cc \
@@ -72,6 +75,7 @@
noinst_HEADERS += \
data/AbsorbingDampersData.hh \
data/AbsorbingDampersDataLine2.hh \
+ data/AbsorbingDampersDataTri3.hh \
data/DirichletData.hh \
data/DirichletDataLine2.hh \
data/DirichletDataLine2b.hh \
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc 2007-10-19 19:24:45 UTC (rev 8157)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampers.cc 2007-10-19 21:48:18 UTC (rev 8158)
@@ -233,6 +233,7 @@
// Setup mesh
meshio::MeshIOAscii iohandler;
iohandler.filename(_data->meshFilename);
+ iohandler.debug(true);
iohandler.read(mesh);
CPPUNIT_ASSERT(!mesh->isNull());
(*mesh)->getFactory()->clear();
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampersLine2.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampersLine2.cc 2007-10-19 19:24:45 UTC (rev 8157)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampersLine2.cc 2007-10-19 21:48:18 UTC (rev 8158)
@@ -17,7 +17,7 @@
#include "data/AbsorbingDampersDataLine2.hh" // USES AbsorbingDampersDataLine2
#include "pylith/feassemble/Quadrature0D.hh" // USES Quadrature1D
-#include "pylith/feassemble/GeometryPoint1D.hh" // USES GeometryPoint1D
+#include "pylith/feassemble/GeometryPoint1D.hh" // USES GeometryPoint0D
// ----------------------------------------------------------------------
CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestAbsorbingDampersLine2 );
Added: short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampersTri3.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampersTri3.cc 2007-10-19 19:24:45 UTC (rev 8157)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampersTri3.cc 2007-10-19 21:48:18 UTC (rev 8158)
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestAbsorbingDampersTri3.hh" // Implementation of class methods
+
+#include "data/AbsorbingDampersDataTri3.hh" // USES AbsorbingDampersDataTri3
+
+#include "pylith/feassemble/Quadrature1Din2D.hh" // USES Quadrature1Din2D
+#include "pylith/feassemble/GeometryLine2D.hh" // USES GeometryLine2D
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestAbsorbingDampersTri3 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestAbsorbingDampersTri3::setUp(void)
+{ // setUp
+ _data = new AbsorbingDampersDataTri3();
+ _quadrature = new feassemble::Quadrature1Din2D();
+ CPPUNIT_ASSERT(0 != _quadrature);
+ feassemble::GeometryLine2D geometry;
+ _quadrature->refGeometry(&geometry);
+} // setUp
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampersTri3.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampersTri3.hh 2007-10-19 19:24:45 UTC (rev 8157)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestAbsorbingDampersTri3.hh 2007-10-19 21:48:18 UTC (rev 8158)
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestAbsorbingDampersTri3.hh
+ *
+ * @brief C++ TestAbsorbingDampers object.
+ *
+ * C++ unit testing for AbsorbingDampers for mesh with 2-D tri cells.
+ */
+
+#if !defined(pylith_bc_testabsorbingdamperstri3_hh)
+#define pylith_bc_testabsorbingdamperstri3_hh
+
+#include "TestAbsorbingDampers.hh" // ISA TestAbsorbingDampers
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestAbsorbingDampersTri3;
+ } // bc
+} // pylith
+
+/// C++ unit testing for AbsorbingDampers for mesh with 2-D tri cells.
+class pylith::bc::TestAbsorbingDampersTri3 : public TestAbsorbingDampers
+{ // class TestAbsorbingDampers
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestAbsorbingDampersTri3 );
+ CPPUNIT_TEST( testInitialize );
+ CPPUNIT_TEST( testIntegrateResidual );
+ CPPUNIT_TEST( testIntegrateJacobian );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestAbsorbingDampersTri3
+
+#endif // pylith_bc_absorbingdamperstri3_hh
+
+
+// End of file
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataLine2.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataLine2.hh 2007-10-19 19:24:45 UTC (rev 8157)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataLine2.hh 2007-10-19 21:48:18 UTC (rev 8158)
@@ -65,6 +65,6 @@
};
-#endif // pylith_bc_absorbingdampersdata1d_hh
+#endif // pylith_bc_absorbingdampersdataline2_hh
// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataTri3.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataTri3.cc 2007-10-19 19:24:45 UTC (rev 8157)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataTri3.cc 2007-10-19 21:48:18 UTC (rev 8158)
@@ -0,0 +1,131 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "AbsorbingDampersDataTri3.hh"
+
+const char* pylith::bc::AbsorbingDampersDataTri3::_meshFilename =
+ "data/tri3.mesh";
+
+const int pylith::bc::AbsorbingDampersDataTri3::_numBasis = 2;
+const int pylith::bc::AbsorbingDampersDataTri3::_numQuadPts = 1;
+const double pylith::bc::AbsorbingDampersDataTri3::_quadPts[] = {
+ 0.0,
+};
+const double pylith::bc::AbsorbingDampersDataTri3::_quadWts[] = {
+ 1.0,
+};
+const double pylith::bc::AbsorbingDampersDataTri3::_basis[] = {
+ 1.0,
+};
+const double pylith::bc::AbsorbingDampersDataTri3::_basisDerivRef[] = {
+ 1.0,
+};
+
+const char* pylith::bc::AbsorbingDampersDataTri3::_spatialDBFilename = "data/elasticplanestrain.spatialdb";
+const int pylith::bc::AbsorbingDampersDataTri3::_id = 2;
+const char* pylith::bc::AbsorbingDampersDataTri3::_label = "bc";
+
+const double pylith::bc::AbsorbingDampersDataTri3::_dt = 0.25;
+const double pylith::bc::AbsorbingDampersDataTri3::_fieldTpdt[] = {
+ 1.0,
+ 1.1,
+ 1.2,
+ 1.3,
+};
+const double pylith::bc::AbsorbingDampersDataTri3::_fieldT[] = {
+ 1.1,
+ 1.3,
+ 1.5,
+ 1.7,
+};
+const double pylith::bc::AbsorbingDampersDataTri3::_fieldTmdt[] = {
+ 1.2,
+ 1.5,
+ 1.8,
+ 2.1,
+};
+
+const int pylith::bc::AbsorbingDampersDataTri3::_spaceDim = 2;
+const int pylith::bc::AbsorbingDampersDataTri3::_cellDim = 1;
+const int pylith::bc::AbsorbingDampersDataTri3::_numVertices = 2;
+const int pylith::bc::AbsorbingDampersDataTri3::_numCells = 1;
+const int pylith::bc::AbsorbingDampersDataTri3::_numCorners = 2;
+const int pylith::bc::AbsorbingDampersDataTri3::_cells[] = {
+ 3, 5,
+};
+
+
+const double pylith::bc::AbsorbingDampersDataTri3::_dampingConsts[] = {
+ 12.5e+6, 7.5e+6,
+};
+const double pylith::bc::AbsorbingDampersDataTri3::_valsResidual[] = {
+ 0.0, 0.0, // FIX THESE
+ 0.0, 0.0,
+ 0.0, 0.0,
+ 0.0, 0.0,
+};
+const double pylith::bc::AbsorbingDampersDataTri3::_valsJacobian[] = {
+ 0.0, 0.0, // 0 // FIX THESE
+ 0.0, 0.0,
+ 0.0, 0.0,
+ 0.0, 0.0,
+ 0.0, 0.0, // 1
+ 0.0, 0.0,
+ 0.0, 0.0,
+ 0.0, 0.0,
+ 0.0, 0.0, // 2
+ 0.0, 0.0,
+ 0.0, 0.0,
+ 0.0, 0.0,
+ 0.0, 0.0, // 3
+ 0.0, 0.0,
+ 0.0, 0.0,
+ 0.0, 0.0,
+};
+
+pylith::bc::AbsorbingDampersDataTri3::AbsorbingDampersDataTri3(void)
+{ // constructor
+ meshFilename = const_cast<char*>(_meshFilename);
+
+ numBasis = _numBasis;
+ numQuadPts = _numQuadPts;
+ quadPts = const_cast<double*>(_quadPts);
+ quadWts = const_cast<double*>(_quadWts);
+ basis = const_cast<double*>(_basis);
+ basisDerivRef = const_cast<double*>(_basisDerivRef);
+
+ spatialDBFilename = const_cast<char*>(_spatialDBFilename);
+ id = _id;
+ label = const_cast<char*>(_label);
+
+ dt = _dt;
+ fieldTpdt = const_cast<double*>(_fieldTpdt);
+ fieldT = const_cast<double*>(_fieldT);
+ fieldTmdt = const_cast<double*>(_fieldTmdt);
+
+ spaceDim = _spaceDim;
+ cellDim = _cellDim;
+ numVertices = _numVertices;
+ numCells = _numCells;
+ numCorners = _numCorners;
+ cells = const_cast<int*>(_cells);
+
+ dampingConsts = const_cast<double*>(_dampingConsts);
+ valsResidual = const_cast<double*>(_valsResidual);
+ valsJacobian = const_cast<double*>(_valsJacobian);
+} // constructor
+
+pylith::bc::AbsorbingDampersDataTri3::~AbsorbingDampersDataTri3(void)
+{}
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataTri3.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataTri3.hh 2007-10-19 19:24:45 UTC (rev 8157)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/AbsorbingDampersDataTri3.hh 2007-10-19 21:48:18 UTC (rev 8158)
@@ -0,0 +1,70 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_bc_absorbingdampersdatatri3_hh)
+#define pylith_bc_absorbingdampersdatatri3_hh
+
+#include "AbsorbingDampersData.hh"
+
+namespace pylith {
+ namespace bc {
+ class AbsorbingDampersDataTri3;
+ } // pylith
+} // bc
+
+class pylith::bc::AbsorbingDampersDataTri3 : public AbsorbingDampersData
+{
+
+public:
+
+ /// Constructor
+ AbsorbingDampersDataTri3(void);
+
+ /// Destructor
+ ~AbsorbingDampersDataTri3(void);
+
+private:
+
+ static const char* _meshFilename;
+
+ static const int _numBasis;
+ static const int _numQuadPts;
+ static const double _quadPts[];
+ static const double _quadWts[];
+ static const double _basis[];
+ static const double _basisDerivRef[];
+
+ static const char* _spatialDBFilename;
+ static const int _id;
+ static const char* _label;
+
+ static const double _dt;
+ static const double _fieldTpdt[];
+ static const double _fieldT[];
+ static const double _fieldTmdt[];
+
+ static const int _spaceDim;
+ static const int _cellDim;
+ static const int _numVertices;
+ static const int _numCells;
+ static const int _numCorners;
+ static const int _cells[];
+
+ static const double _dampingConsts[];
+ static const double _valsResidual[];
+ static const double _valsJacobian[];
+
+};
+
+#endif // pylith_bc_absorbingdampersdatatri3_hh
+
+// End of file
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/Makefile.am 2007-10-19 19:24:45 UTC (rev 8157)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/Makefile.am 2007-10-19 21:48:18 UTC (rev 8158)
@@ -17,6 +17,7 @@
tri3.mesh \
tri3.spatialdb \
tri3_b.spatialdb \
+ elasticplanestrain.spatialdb \
quad4.mesh \
quad4.spatialdb \
tet4.mesh \
Added: short/3D/PyLith/trunk/unittests/libtests/bc/data/elasticplanestrain.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/elasticplanestrain.spatialdb 2007-10-19 19:24:45 UTC (rev 8157)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/elasticplanestrain.spatialdb 2007-10-19 21:48:18 UTC (rev 8158)
@@ -0,0 +1,14 @@
+#SPATIAL.ascii 1
+SimpleDB {
+ num-values = 3
+ value-names = density vs vp
+ value-units = kg/m^3 m/s m/s
+ num-locs = 1
+ data-dim = 0
+ space-dim = 2
+ cs-data = cartesian {
+ to-meters = 1.0
+ space-dim = 2
+ }
+}
+0.0 0.0 2500.0 3000.0 5000.0
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/line2.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/line2.mesh 2007-10-19 19:24:45 UTC (rev 8157)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/line2.mesh 2007-10-19 21:48:18 UTC (rev 8158)
@@ -1,3 +1,5 @@
+// 0 ----- 1 ----- 2
+//
mesh = {
dimension = 1
use-index-zero = true
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3.mesh 2007-10-19 19:24:45 UTC (rev 8157)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/tri3.mesh 2007-10-19 21:48:18 UTC (rev 8158)
@@ -1,3 +1,11 @@
+// 2
+// / | \
+// / | \
+// 0 | 3
+// \ | /
+// \ | /
+// 1
+//
mesh = {
dimension = 2
use-index-zero = true
More information about the cig-commits
mailing list