[cig-commits] r11497 - in short/3D/PyLith/trunk: libsrc/bc modulesrc/faults modulesrc/feassemble unittests/libtests/bc unittests/libtests/bc/data
brad at geodynamics.org
brad at geodynamics.org
Thu Mar 20 23:12:20 PDT 2008
Author: brad
Date: 2008-03-20 23:12:19 -0700 (Thu, 20 Mar 2008)
New Revision: 11497
Added:
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMultiTet4.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMultiTet4.hh
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMultiTet4.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMultiTet4.hh
short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMultiTet4.cc
short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMultiTet4.hh
short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_a.spatialdb
short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_a_rate.spatialdb
Modified:
short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.cc
short/3D/PyLith/trunk/libsrc/bc/DirichletPoints.cc
short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMulti.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMulti.hh
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMulti.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMulti.hh
short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMulti.cc
short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMulti.hh
short/3D/PyLith/trunk/unittests/libtests/bc/data/Makefile.am
Log:
Fixed bugs in DirichletPoints and DirichletBoundary. Added unit test exposing bug in setting constraint sizes (index set improperly led to bad access). Initialized fieldType in module to prevent tripping valgrind error.
Modified: short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.cc 2008-03-20 22:18:02 UTC (rev 11496)
+++ short/3D/PyLith/trunk/libsrc/bc/DirichletBoundary.cc 2008-03-21 06:12:19 UTC (rev 11497)
@@ -227,13 +227,17 @@
} // if
// Add in the ones for this DirichletBoundary BC
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
+ for (int iDOF=0; iDOF < numFixedDOF; ++iDOF) {
+ assert(offset[0]+iDOF < numTotalConstrained);
allFixedDOF[offset[0]+iDOF] = _fixedDOF[iDOF];
+ } // for
// Fill in rest of values not yet set
// (will be set by another DirichletBoundary BC)
- for (int iDOF=offset[0]+numFixedDOF; iDOF < numTotalConstrained; ++iDOF)
- allFixedDOF[offset[0]+iDOF] = 999;
+ for (int iDOF=offset[0]+numFixedDOF; iDOF < numTotalConstrained; ++iDOF) {
+ assert(iDOF < numTotalConstrained);
+ allFixedDOF[iDOF] = 999;
+ } // for
// Sort list of constrained DOF
// I need these sorted for my update algorithms to work properly
Modified: short/3D/PyLith/trunk/libsrc/bc/DirichletPoints.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/bc/DirichletPoints.cc 2008-03-20 22:18:02 UTC (rev 11496)
+++ short/3D/PyLith/trunk/libsrc/bc/DirichletPoints.cc 2008-03-21 06:12:19 UTC (rev 11497)
@@ -205,14 +205,19 @@
} // if
// Add in the ones for this DirichletPoints BC
- for (int iDOF=0; iDOF < numFixedDOF; ++iDOF)
+ for (int iDOF=0; iDOF < numFixedDOF; ++iDOF) {
+ assert(_offsetLocal[iPoint]+iDOF < numTotalConstrained);
allFixedDOF[_offsetLocal[iPoint]+iDOF] = _fixedDOF[iDOF];
+ } // for
- // Fill in rest of values not yet set (will be set by another DirichletPoints BC)
+ // Fill in rest of values not yet set (will be set by
+ // another DirichletPoints BC)
for (int iDOF=_offsetLocal[iPoint]+numFixedDOF;
iDOF < numTotalConstrained;
- ++iDOF)
- allFixedDOF[_offsetLocal[iPoint]+iDOF] = 999;
+ ++iDOF) {
+ assert(iDOF < numTotalConstrained);
+ allFixedDOF[iDOF] = 999;
+ }
// Sort list of constrained DOF
// I need these sorted for my update algorithms to work properly
Modified: short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src 2008-03-20 22:18:02 UTC (rev 11496)
+++ short/3D/PyLith/trunk/modulesrc/faults/faults.pyxe.src 2008-03-21 06:12:19 UTC (rev 11497)
@@ -236,6 +236,7 @@
"'pylith::topology::FieldsManager'."
cdef void* ptr
cdef int fieldType
+ fieldType = 3
if None != fields:
ptr = Fault_vertexField(self.thisptr, &fieldType, name,
ptrFromHandle(mesh), ptrFromHandle(fields))
Modified: short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src 2008-03-20 22:18:02 UTC (rev 11496)
+++ short/3D/PyLith/trunk/modulesrc/feassemble/feassemble.pyxe.src 2008-03-21 06:12:19 UTC (rev 11497)
@@ -1270,6 +1270,7 @@
"'pylith::topology::FieldsManager'."
cdef void* ptr
cdef int fieldType
+ fieldType = 3
if None != fields:
ptr = IntegratorElasticity_cellField(self.thisptr, &fieldType, name,
ptrFromHandle(mesh),
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am 2008-03-20 22:18:02 UTC (rev 11496)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am 2008-03-21 06:12:19 UTC (rev 11497)
@@ -40,6 +40,7 @@
TestDirichletBoundaryHex8.cc \
TestDirichletBoundaryMulti.cc \
TestDirichletBoundaryMultiTri3.cc \
+ TestDirichletBoundaryMultiTet4.cc \
TestDirichletPoints.cc \
TestDirichletPointsLine2.cc \
TestDirichletPointsLine2b.cc \
@@ -49,6 +50,7 @@
TestDirichletPointsHex8.cc \
TestDirichletPointsMulti.cc \
TestDirichletPointsMultiTri3.cc \
+ TestDirichletPointsMultiTet4.cc \
TestNeumann.cc \
TestNeumannLine2.cc \
TestNeumannTri3.cc \
@@ -77,6 +79,7 @@
TestDirichletBoundaryHex8.hh \
TestDirichletBoundaryMulti.hh \
TestDirichletBoundaryMultiTri3.hh \
+ TestDirichletBoundaryMultiTet4.hh \
TestDirichletPoints.hh \
TestDirichletPointsLine2.hh \
TestDirichletPointsLine2b.hh \
@@ -86,6 +89,7 @@
TestDirichletPointsHex8.hh \
TestDirichletPointsMulti.hh \
TestDirichletPointsMultiTri3.hh \
+ TestDirichletPointsMultiTet4.hh \
TestNeumann.hh \
TestNeumannLine2.hh \
TestNeumannTri3.hh \
@@ -115,6 +119,7 @@
data/DirichletDataHex8.cc \
data/DirichletDataMulti.cc \
data/DirichletDataMultiTri3.cc \
+ data/DirichletDataMultiTet4.cc \
data/NeumannData.cc \
data/NeumannDataLine2.cc \
data/NeumannDataTri3.cc \
@@ -143,6 +148,7 @@
data/DirichletDataHex8.hh \
data/DirichletDataMulti.hh \
data/DirichletDataMultiTri3.hh \
+ data/DirichletDataMultiTet4.hh \
data/NeumannData.hh \
data/NeumannDataLine2.hh \
data/NeumannDataTri3.hh \
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMulti.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMulti.cc 2008-03-20 22:18:02 UTC (rev 11496)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMulti.cc 2008-03-21 06:12:19 UTC (rev 11497)
@@ -49,13 +49,15 @@
ALE::Obj<Mesh> mesh;
DirichletBoundary bcA;
DirichletBoundary bcB;
- _initialize(&mesh, &bcA, &bcB);
+ DirichletBoundary bcC;
+ _initialize(&mesh, &bcA, &bcB, &bcC);
const ALE::Obj<real_section_type>& field = mesh->getRealSection("field");
const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
field->setFiberDimension(vertices, _data->numDOF);
bcA.setConstraintSizes(field, mesh);
bcB.setConstraintSizes(field, mesh);
+ bcC.setConstraintSizes(field, mesh);
CPPUNIT_ASSERT(0 != _data);
@@ -79,16 +81,19 @@
ALE::Obj<Mesh> mesh;
DirichletBoundary bcA;
DirichletBoundary bcB;
- _initialize(&mesh, &bcA, &bcB);
+ DirichletBoundary bcC;
+ _initialize(&mesh, &bcA, &bcB, &bcC);
const ALE::Obj<real_section_type>& field = mesh->getRealSection("field");
const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
field->setFiberDimension(vertices, _data->numDOF);
bcA.setConstraintSizes(field, mesh);
bcB.setConstraintSizes(field, mesh);
+ bcC.setConstraintSizes(field, mesh);
mesh->allocate(field);
bcA.setConstraints(field, mesh);
bcB.setConstraints(field, mesh);
+ bcC.setConstraints(field, mesh);
CPPUNIT_ASSERT(0 != _data);
@@ -115,16 +120,19 @@
ALE::Obj<Mesh> mesh;
DirichletBoundary bcA;
DirichletBoundary bcB;
- _initialize(&mesh, &bcA, &bcB);
+ DirichletBoundary bcC;
+ _initialize(&mesh, &bcA, &bcB, &bcC);
const ALE::Obj<real_section_type>& field = mesh->getRealSection("field");
const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
field->setFiberDimension(vertices, _data->numDOF);
bcA.setConstraintSizes(field, mesh);
bcB.setConstraintSizes(field, mesh);
+ bcC.setConstraintSizes(field, mesh);
mesh->allocate(field);
bcA.setConstraints(field, mesh);
bcB.setConstraints(field, mesh);
+ bcC.setConstraints(field, mesh);
CPPUNIT_ASSERT(0 != _data);
const double tolerance = 1.0e-06;
@@ -146,6 +154,7 @@
const double t = 10.0;
bcA.setField(t, field, mesh);
bcB.setField(t, field, mesh);
+ bcC.setField(t, field, mesh);
int i = 0;
for (Mesh::label_sequence::iterator v_iter = vertices->begin();
@@ -163,11 +172,13 @@
void
pylith::bc::TestDirichletBoundaryMulti::_initialize(ALE::Obj<Mesh>* mesh,
DirichletBoundary* const bcA,
- DirichletBoundary* const bcB) const
+ DirichletBoundary* const bcB,
+ DirichletBoundary* const bcC) const
{ // _initialize
CPPUNIT_ASSERT(0 != _data);
CPPUNIT_ASSERT(0 != bcA);
CPPUNIT_ASSERT(0 != bcB);
+ CPPUNIT_ASSERT(0 != bcC);
meshio::MeshIOAscii iohandler;
iohandler.filename(_data->meshFilename);
@@ -215,6 +226,24 @@
bcB->referenceTime(_data->tRefB);
bcB->fixedDOF(fixedDOFB);
bcB->initialize(*mesh, &cs, upDir);
+
+ // Setup boundary condition C
+ if (_data->numFixedDOFC > 0) {
+ dbIO.filename(_data->dbFilenameC);
+ db.ioHandler(&dbIO);
+
+ dbIORate.filename(_data->dbFilenameCRate);
+ dbRate.ioHandler(&dbIORate);
+
+ int_array fixedDOFC(_data->fixedDOFC, _data->numFixedDOFC);
+
+ bcC->label(_data->labelC);
+ bcC->db(&db);
+ bcC->dbRate(&dbRate);
+ bcC->referenceTime(_data->tRefC);
+ bcC->fixedDOF(fixedDOFC);
+ bcC->initialize(*mesh, &cs, upDir);
+ } // if
} // _initialize
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMulti.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMulti.hh 2008-03-20 22:18:02 UTC (rev 11496)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMulti.hh 2008-03-21 06:12:19 UTC (rev 11497)
@@ -70,10 +70,12 @@
* @param mesh PETSc mesh to initialize
* @param bcA DirichletBoundary boundary condition A to initialize.
* @param bcB DirichletBoundary boundary condition B to initialize.
+ * @param bcC DirichletBoundary boundary condition C to initialize.
*/
void _initialize(ALE::Obj<ALE::Mesh>* mesh,
DirichletBoundary* const bcA,
- DirichletBoundary* const bcB) const;
+ DirichletBoundary* const bcB,
+ DirichletBoundary* const bcC) const;
}; // class TestDirichletBoundaryMulti
Added: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMultiTet4.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMultiTet4.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMultiTet4.cc 2008-03-21 06:12:19 UTC (rev 11497)
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDirichletBoundaryMultiTet4.hh" // Implementation of class methods
+
+#include "data/DirichletDataMultiTet4.hh" // USES DirichletDataMultiTet4
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletBoundaryMultiTet4 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestDirichletBoundaryMultiTet4::setUp(void)
+{ // setUp
+ _data = new DirichletDataMultiTet4();
+} // setUp
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMultiTet4.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMultiTet4.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletBoundaryMultiTet4.hh 2008-03-21 06:12:19 UTC (rev 11497)
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestDirichletBoundaryMultiTet4.hh
+ *
+ * @brief C++ TestDirichletBoundary object.
+ *
+ * C++ unit testing for DirichletBoundary for mesh with 1-D line cells.
+ */
+
+#if !defined(pylith_bc_testdirichletboundarymultitet4_hh)
+#define pylith_bc_testdirichletboundarymultitet4_hh
+
+#include "TestDirichletBoundaryMulti.hh" // ISA TestDirichletBoundary
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestDirichletBoundaryMultiTet4;
+ } // bc
+} // pylith
+
+/// C++ unit testing for DirichletBoundary for mesh with 2-D tri cells.
+class pylith::bc::TestDirichletBoundaryMultiTet4 : public TestDirichletBoundaryMulti
+{ // class TestDirichletBoundary
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestDirichletBoundaryMultiTet4 );
+ CPPUNIT_TEST( testSetConstraintSizes );
+ CPPUNIT_TEST( testSetConstraints );
+ CPPUNIT_TEST( testSetField );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestDirichletBoundaryMultiTet4
+
+#endif // pylith_bc_dirichletboundarymultitet4_hh
+
+
+// End of file
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMulti.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMulti.cc 2008-03-20 22:18:02 UTC (rev 11496)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMulti.cc 2008-03-21 06:12:19 UTC (rev 11497)
@@ -49,13 +49,15 @@
ALE::Obj<Mesh> mesh;
DirichletPoints bcA;
DirichletPoints bcB;
- _initialize(&mesh, &bcA, &bcB);
+ DirichletPoints bcC;
+ _initialize(&mesh, &bcA, &bcB, &bcC);
const ALE::Obj<real_section_type>& field = mesh->getRealSection("field");
const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
field->setFiberDimension(vertices, _data->numDOF);
bcA.setConstraintSizes(field, mesh);
bcB.setConstraintSizes(field, mesh);
+ bcC.setConstraintSizes(field, mesh);
CPPUNIT_ASSERT(0 != _data);
@@ -79,16 +81,19 @@
ALE::Obj<Mesh> mesh;
DirichletPoints bcA;
DirichletPoints bcB;
- _initialize(&mesh, &bcA, &bcB);
+ DirichletPoints bcC;
+ _initialize(&mesh, &bcA, &bcB, &bcC);
const ALE::Obj<real_section_type>& field = mesh->getRealSection("field");
const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
field->setFiberDimension(vertices, _data->numDOF);
bcA.setConstraintSizes(field, mesh);
bcB.setConstraintSizes(field, mesh);
+ bcC.setConstraintSizes(field, mesh);
mesh->allocate(field);
bcA.setConstraints(field, mesh);
bcB.setConstraints(field, mesh);
+ bcC.setConstraints(field, mesh);
CPPUNIT_ASSERT(0 != _data);
@@ -115,16 +120,19 @@
ALE::Obj<Mesh> mesh;
DirichletPoints bcA;
DirichletPoints bcB;
- _initialize(&mesh, &bcA, &bcB);
+ DirichletPoints bcC;
+ _initialize(&mesh, &bcA, &bcB, &bcC);
const ALE::Obj<real_section_type>& field = mesh->getRealSection("field");
const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
field->setFiberDimension(vertices, _data->numDOF);
bcA.setConstraintSizes(field, mesh);
bcB.setConstraintSizes(field, mesh);
+ bcC.setConstraintSizes(field, mesh);
mesh->allocate(field);
bcA.setConstraints(field, mesh);
bcB.setConstraints(field, mesh);
+ bcC.setConstraints(field, mesh);
CPPUNIT_ASSERT(0 != _data);
const double tolerance = 1.0e-06;
@@ -146,6 +154,7 @@
const double t = 10.0;
bcA.setField(t, field, mesh);
bcB.setField(t, field, mesh);
+ bcC.setField(t, field, mesh);
int i = 0;
for (Mesh::label_sequence::iterator v_iter = vertices->begin();
@@ -162,12 +171,14 @@
// ----------------------------------------------------------------------
void
pylith::bc::TestDirichletPointsMulti::_initialize(ALE::Obj<Mesh>* mesh,
- DirichletPoints* const bcA,
- DirichletPoints* const bcB) const
+ DirichletPoints* const bcA,
+ DirichletPoints* const bcB,
+ DirichletPoints* const bcC) const
{ // _initialize
CPPUNIT_ASSERT(0 != _data);
CPPUNIT_ASSERT(0 != bcA);
CPPUNIT_ASSERT(0 != bcB);
+ CPPUNIT_ASSERT(0 != bcC);
meshio::MeshIOAscii iohandler;
iohandler.filename(_data->meshFilename);
@@ -215,6 +226,24 @@
bcB->referenceTime(_data->tRefB);
bcB->fixedDOF(fixedDOFB);
bcB->initialize(*mesh, &cs, upDir);
+
+ // Setup boundary condition C
+ if (_data->numFixedDOFC > 0.0) {
+ dbIO.filename(_data->dbFilenameC);
+ db.ioHandler(&dbIO);
+
+ dbIORate.filename(_data->dbFilenameCRate);
+ dbRate.ioHandler(&dbIORate);
+
+ int_array fixedDOFC(_data->fixedDOFC, _data->numFixedDOFC);
+
+ bcC->label(_data->labelC);
+ bcC->db(&db);
+ bcC->dbRate(&dbRate);
+ bcC->referenceTime(_data->tRefC);
+ bcC->fixedDOF(fixedDOFC);
+ bcC->initialize(*mesh, &cs, upDir);
+ } // if
} // _initialize
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMulti.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMulti.hh 2008-03-20 22:18:02 UTC (rev 11496)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMulti.hh 2008-03-21 06:12:19 UTC (rev 11497)
@@ -70,10 +70,12 @@
* @param mesh PETSc mesh to initialize
* @param bcA DirichletPoints boundary condition A to initialize.
* @param bcB DirichletPoints boundary condition B to initialize.
+ * @param bcC DirichletPoints boundary condition C to initialize.
*/
void _initialize(ALE::Obj<ALE::Mesh>* mesh,
DirichletPoints* const bcA,
- DirichletPoints* const bcB) const;
+ DirichletPoints* const bcB,
+ DirichletPoints* const bcC) const;
}; // class TestDirichletPointsMulti
Added: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMultiTet4.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMultiTet4.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMultiTet4.cc 2008-03-21 06:12:19 UTC (rev 11497)
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDirichletPointsMultiTet4.hh" // Implementation of class methods
+
+#include "data/DirichletDataMultiTet4.hh" // USES DirichletDataMultiTet4
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestDirichletPointsMultiTet4 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::bc::TestDirichletPointsMultiTet4::setUp(void)
+{ // setUp
+ _data = new DirichletDataMultiTet4();
+} // setUp
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMultiTet4.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMultiTet4.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestDirichletPointsMultiTet4.hh 2008-03-21 06:12:19 UTC (rev 11497)
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestDirichletPointsMultiTet4.hh
+ *
+ * @brief C++ TestDirichletPoints object.
+ *
+ * C++ unit testing for DirichletPoints for mesh with 1-D line cells.
+ */
+
+#if !defined(pylith_bc_testdirichletpointsmultitet4_hh)
+#define pylith_bc_testdirichletpointsmultitet4_hh
+
+#include "TestDirichletPointsMulti.hh" // ISA TestDirichletPoints
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestDirichletPointsMultiTet4;
+ } // bc
+} // pylith
+
+/// C++ unit testing for DirichletPoints for mesh with 2-D tri cells.
+class pylith::bc::TestDirichletPointsMultiTet4 : public TestDirichletPointsMulti
+{ // class TestDirichletPoints
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestDirichletPointsMultiTet4 );
+ CPPUNIT_TEST( testSetConstraintSizes );
+ CPPUNIT_TEST( testSetConstraints );
+ CPPUNIT_TEST( testSetField );
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestDirichletPointsMultiTet4
+
+#endif // pylith_bc_dirichletpointsmultitet4_hh
+
+
+// End of file
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMulti.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMulti.cc 2008-03-20 22:18:02 UTC (rev 11496)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMulti.cc 2008-03-21 06:12:19 UTC (rev 11497)
@@ -15,8 +15,8 @@
// ----------------------------------------------------------------------
// Constructor
pylith::bc::DirichletDataMulti::DirichletDataMulti(void) :
- numDOF(0),
- numFixedDOFA(0),
+ numDOF(0), // General
+ numFixedDOFA(0), // BC A
numConstrainedPtsA(0),
idA(0),
labelA(0),
@@ -25,7 +25,7 @@
dbFilenameA(0),
dbFilenameARate(0),
tRefA(0),
- numFixedDOFB(0),
+ numFixedDOFB(0), // BC B
numConstrainedPtsB(0),
idB(0),
labelB(0),
@@ -34,7 +34,16 @@
dbFilenameB(0),
dbFilenameBRate(0),
tRefB(0),
- field(0),
+ numFixedDOFC(0), // BC C
+ numConstrainedPtsC(0),
+ idC(0),
+ labelC(0),
+ fixedDOFC(0),
+ constrainedPointsC(0),
+ dbFilenameC(0),
+ dbFilenameCRate(0),
+ tRefC(0),
+ field(0), // General
constraintSizes(0),
constrainedDOF(0),
meshFilename(0)
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMulti.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMulti.hh 2008-03-20 22:18:02 UTC (rev 11496)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMulti.hh 2008-03-21 06:12:19 UTC (rev 11497)
@@ -60,6 +60,18 @@
double tRefB; ///< Reference time for rate of change of values.
//@}
+ //@{ Boundary condition C
+ int numFixedDOFC; ///< Number of fixedDOF at constrained points.
+ int numConstrainedPtsC; ///< Number of points constrained.
+ int idC; ///< Boundary condition identifier
+ char* labelC; ///< Label for boundary condition group
+ int* fixedDOFC; ///< Degrees of freedom that are constrained at each point
+ int* constrainedPointsC; ///< Array of indices of constrained points.
+ char* dbFilenameC; ///< Filename for db with initial values.
+ char* dbFilenameCRate; ///< Filename for db with rate of change of values.
+ double tRefC; ///< Reference time for rate of change of values.
+ //@}
+
double* field; ///< Values in field
int* constraintSizes; ///< Number of constrained DOF at each vertex
int* constrainedDOF; ///< Indices of constrained DOF at each constrained vertex
Added: short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMultiTet4.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMultiTet4.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMultiTet4.cc 2008-03-21 06:12:19 UTC (rev 11497)
@@ -0,0 +1,179 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/* Mesh: meshTet4.txt
+ *
+ * DirichletPoints BC A at vertices 1 and 3.
+ *
+ * Fixed DOF: { 1 }
+ *
+ * Initial values
+ * 0: 0.1
+ * 2: 0.2
+ * 3: 0.3
+ * 4: 0.4
+ * tRef = 0.0
+ * Rate of change of values
+ * 0: 1.0
+ * 2: 2.0
+ * 3: 3.0
+ * 4: 4.0
+ *
+ * DirichletPoints BC B at vertices 2 and 3.
+ *
+ * Fixed DOF: { 0 }
+ *
+ * Initial values
+ * 0: 0.01
+ * 2: 0.02
+ * 3: 0.03
+ * tRef = 0.0
+ * Rate of change of values
+ * 0: -1.0
+ * 2: -2.0
+ * 3: -3.0
+ *
+ * DirichletPoints BC C at vertices 2 and 3.
+ *
+ * Fixed DOF: { 2 }
+ *
+ * Initial values
+ * 1: 11.0
+ * 2: 22.0
+ * 3: 33.0
+ * tRef = 0.0.0
+ * Rate of change of values
+ * 1: 10.0
+ * 2: 20.0
+ * 3: 30.0
+ */
+
+#include "DirichletDataMultiTet4.hh"
+
+const int pylith::bc::DirichletDataMultiTet4::_numDOF = 3;
+
+const int pylith::bc::DirichletDataMultiTet4::_idA = 0;
+const char* pylith::bc::DirichletDataMultiTet4::_labelA = "bc4";
+const int pylith::bc::DirichletDataMultiTet4::_numFixedDOFA = 1;
+const int pylith::bc::DirichletDataMultiTet4::_fixedDOFA[] = { 0 };
+const int pylith::bc::DirichletDataMultiTet4::_numConstrainedPtsA = 4;
+const int pylith::bc::DirichletDataMultiTet4::_constrainedPointsA[] = { 0, 2, 3, 4 };
+
+const char* pylith::bc::DirichletDataMultiTet4::_dbFilenameA =
+ "data/tet4_a.spatialdb";
+const char* pylith::bc::DirichletDataMultiTet4::_dbFilenameARate =
+ "data/tet4_a_rate.spatialdb";
+const double pylith::bc::DirichletDataMultiTet4::_tRefA = 0.0;
+
+const int pylith::bc::DirichletDataMultiTet4::_idB = 1;
+const char* pylith::bc::DirichletDataMultiTet4::_labelB = "bc2";
+const int pylith::bc::DirichletDataMultiTet4::_numFixedDOFB = 1;
+const int pylith::bc::DirichletDataMultiTet4::_fixedDOFB[] = { 2 };
+const int pylith::bc::DirichletDataMultiTet4::_numConstrainedPtsB = 3;
+const int pylith::bc::DirichletDataMultiTet4::_constrainedPointsB[] = { 0, 2, 3 };
+
+const char* pylith::bc::DirichletDataMultiTet4::_dbFilenameB =
+ "data/tet4_a.spatialdb";
+const char* pylith::bc::DirichletDataMultiTet4::_dbFilenameBRate =
+ "data/tet4_a_rate.spatialdb";
+const double pylith::bc::DirichletDataMultiTet4::_tRefB = 0.0;
+
+const int pylith::bc::DirichletDataMultiTet4::_idC = 1;
+const char* pylith::bc::DirichletDataMultiTet4::_labelC = "bc3";
+const int pylith::bc::DirichletDataMultiTet4::_numFixedDOFC = 1;
+const int pylith::bc::DirichletDataMultiTet4::_fixedDOFC[] = { 1 };
+const int pylith::bc::DirichletDataMultiTet4::_numConstrainedPtsC = 3;
+const int pylith::bc::DirichletDataMultiTet4::_constrainedPointsC[] = { 1, 2, 3 };
+
+const char* pylith::bc::DirichletDataMultiTet4::_dbFilenameC =
+ "data/tet4_a.spatialdb";
+const char* pylith::bc::DirichletDataMultiTet4::_dbFilenameCRate =
+ "data/tet4_a_rate.spatialdb";
+const double pylith::bc::DirichletDataMultiTet4::_tRefC = 0.0;
+
+const int pylith::bc::DirichletDataMultiTet4::_constraintSizes[] = {
+ 2,
+ 1,
+ 3,
+ 3,
+ 1
+};
+
+const int pylith::bc::DirichletDataMultiTet4::_constrainedDOF[] = {
+ 0, 2,
+ 1,
+ 0, 1, 2,
+ 0, 1, 2,
+ 0
+};
+
+// Values at t=10.0
+const double pylith::bc::DirichletDataMultiTet4::_field[] = {
+ 10.1, 0.0, -9.99,
+ 0.0, 111.0, 0.0,
+ 20.2, 222.0, -19.98,
+ 30.3, 333.0, -29.97,
+ 40.4, 0.0, 0.0
+};
+
+const char* pylith::bc::DirichletDataMultiTet4::_meshFilename =
+ "data/tet4.mesh";
+
+pylith::bc::DirichletDataMultiTet4::DirichletDataMultiTet4(void)
+{ // constructor
+ numDOF = _numDOF;
+
+ idA = _idA;
+ labelA = const_cast<char*>(_labelA);
+ numFixedDOFA = _numFixedDOFA;
+ fixedDOFA = const_cast<int*>(_fixedDOFA);
+ numConstrainedPtsA = _numConstrainedPtsA;
+ constrainedPointsA = const_cast<int*>(_constrainedPointsA);
+
+ dbFilenameA = const_cast<char*>(_dbFilenameA);
+ dbFilenameARate = const_cast<char*>(_dbFilenameARate);
+ tRefA = _tRefA;
+
+ idB = _idB;
+ labelB = const_cast<char*>(_labelB);
+ numFixedDOFB = _numFixedDOFB;
+ fixedDOFB = const_cast<int*>(_fixedDOFB);
+ numConstrainedPtsB = _numConstrainedPtsB;
+ constrainedPointsB = const_cast<int*>(_constrainedPointsB);
+
+ dbFilenameB = const_cast<char*>(_dbFilenameB);
+ dbFilenameBRate = const_cast<char*>(_dbFilenameBRate);
+ tRefB = _tRefB;
+
+ idC = _idC;
+ labelC = const_cast<char*>(_labelC);
+ numFixedDOFC = _numFixedDOFC;
+ fixedDOFC = const_cast<int*>(_fixedDOFC);
+ numConstrainedPtsC = _numConstrainedPtsC;
+ constrainedPointsC = const_cast<int*>(_constrainedPointsC);
+
+ dbFilenameC = const_cast<char*>(_dbFilenameC);
+ dbFilenameCRate = const_cast<char*>(_dbFilenameCRate);
+ tRefC = _tRefC;
+
+ field = const_cast<double*>(_field);
+ constraintSizes = const_cast<int*>(_constraintSizes);
+ constrainedDOF = const_cast<int*>(_constrainedDOF);
+
+ meshFilename = const_cast<char*>(_meshFilename);
+} // constructor
+
+pylith::bc::DirichletDataMultiTet4::~DirichletDataMultiTet4(void)
+{}
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMultiTet4.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMultiTet4.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/DirichletDataMultiTet4.hh 2008-03-21 06:12:19 UTC (rev 11497)
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_bc_DirichletPointsDatamultitet4_hh)
+#define pylith_bc_DirichletPointsDatamultitet4_hh
+
+#include "DirichletDataMulti.hh"
+
+namespace pylith {
+ namespace bc {
+ class DirichletDataMultiTet4;
+ } // pylith
+} // bc
+
+class pylith::bc::DirichletDataMultiTet4 : public DirichletDataMulti
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public:
+
+ /// Constructor
+ DirichletDataMultiTet4(void);
+
+ /// Destructor
+ ~DirichletDataMultiTet4(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+ static const int _numDOF; ///< Number of degrees of freedom at each point.
+
+ static const int _numFixedDOFA; ///< Number of fixedDOF at constrained points.
+ static const int _numConstrainedPtsA; ///< Number of points constrained.
+ static const int _idA; ///< Boundary condition identifier
+ static const char* _labelA; /// Label for boundary condition group
+ static const int _fixedDOFA[]; ///< Degrees of freedom constrained at points
+ static const int _constrainedPointsA[]; ///< Array of indices of constrained pts.
+ static const char* _dbFilenameA; ///< Filename for db of initial values.
+ static const char* _dbFilenameARate; ///< Filename for db of rate of change.
+ static const double _tRefA; ///< Reference time for rate of change.
+
+ static const int _numFixedDOFB; ///< Number of fixedDOF at constrained points.
+ static const int _numConstrainedPtsB; ///< Number of points constrained.
+ static const int _idB; ///< Boundary condition identifier
+ static const char* _labelB; /// Label for boundary condition group
+ static const int _fixedDOFB[]; ///< Degrees of freedom constrained at points
+ static const int _constrainedPointsB[]; ///< Array of indices of constrained pts.
+ static const char* _dbFilenameB; ///< Filename for db of initial values.
+ static const char* _dbFilenameBRate; ///< Filename for db of rate of change.
+ static const double _tRefB; ///< Reference time for rate of change.
+
+ static const int _numFixedDOFC; ///< Number of fixedDOF at constrained points.
+ static const int _numConstrainedPtsC; ///< Number of points constrained.
+ static const int _idC; ///< Boundary condition identifier
+ static const char* _labelC; /// Label for boundary condition group
+ static const int _fixedDOFC[]; ///< Degrees of freedom constrained at points
+ static const int _constrainedPointsC[]; ///< Array of indices of constrained pts.
+ static const char* _dbFilenameC; ///< Filename for db of initial values.
+ static const char* _dbFilenameCRate; ///< Filename for db of rate of change.
+ static const double _tRefC; ///< Reference time for rate of change.
+
+ static const double _field[]; ///< Values in field
+ static const int _constraintSizes[]; ///< Number of constrained DOF at each vertex
+ static const int _constrainedDOF[]; ///< Indices of constrained DOF at each constrained vertex
+
+ static const char* _meshFilename; ///< Filename of input mesh.
+};
+
+#endif // pylith_bc_dirichletdatamultitet4_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 2008-03-20 22:18:02 UTC (rev 11496)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/Makefile.am 2008-03-21 06:12:19 UTC (rev 11497)
@@ -27,6 +27,8 @@
quad4-tractions.spatialdb \
tet4.mesh \
tet4.spatialdb \
+ tet4_a.spatialdb \
+ tet4_a_rate.spatialdb \
tet4-tractions.spatialdb \
elasticisotropic3d.spatialdb \
hex8.mesh \
Added: short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_a.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_a.spatialdb (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_a.spatialdb 2008-03-21 06:12:19 UTC (rev 11497)
@@ -0,0 +1,18 @@
+#SPATIAL.ascii 1
+SimpleDB {
+ num-values = 3
+ value-names = dof-0 dof-1 dof-2
+ value-units = m m m
+ num-locs = 5
+ data-dim = 3
+ space-dim = 3
+ cs-data = cartesian {
+ to-meters = 1.0
+ space-dim = 3
+ }
+}
+ 0.0 0.0 0.0 0.1 99.9 0.01
+ 1.0 0.0 0.0 9.9 11.0 9.99
+ 0.0 1.0 0.0 0.2 22.0 0.02
+ 0.0 0.0 1.0 0.3 33.0 0.03
+-1.0 0.0 0.0 0.4 99.9 9.99
Added: short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_a_rate.spatialdb
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_a_rate.spatialdb (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/data/tet4_a_rate.spatialdb 2008-03-21 06:12:19 UTC (rev 11497)
@@ -0,0 +1,18 @@
+#SPATIAL.ascii 1
+SimpleDB {
+ num-values = 3
+ value-names = dof-0 dof-1 dof-2
+ value-units = m m m
+ num-locs = 5
+ data-dim = 3
+ space-dim = 3
+ cs-data = cartesian {
+ to-meters = 1.0
+ space-dim = 3
+ }
+}
+ 0.0 0.0 0.0 1.0 99.9 -1.0
+ 1.0 0.0 0.0 9.9 10.0 -9.9
+ 0.0 1.0 0.0 2.0 20.0 -2.0
+ 0.0 0.0 1.0 3.0 30.0 -3.0
+-1.0 0.0 0.0 4.0 99.9 -9.9
More information about the cig-commits
mailing list