[cig-commits] r15132 - short/3D/PyLith/trunk/unittests/libtests/bc
brad at geodynamics.org
brad at geodynamics.org
Sat Jun 6 20:49:01 PDT 2009
Author: brad
Date: 2009-06-06 20:49:00 -0700 (Sat, 06 Jun 2009)
New Revision: 15132
Added:
short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryConditionPoints.cc
short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryConditionPoints.hh
Modified:
short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am
Log:
Added another unit test.
Modified: short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am 2009-06-07 03:30:55 UTC (rev 15131)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/Makefile.am 2009-06-07 03:49:00 UTC (rev 15132)
@@ -22,6 +22,7 @@
# Primary source files
testbc_SOURCES = \
TestBoundaryCondition.cc \
+ TestBoundaryConditionPoints.cc \
TestTimeDependent.cc \
TestBoundaryMesh.cc \
TestBoundaryMeshTri3.cc \
@@ -62,6 +63,7 @@
noinst_HEADERS = \
TestBoundaryCondition.hh \
+ TestBoundaryConditionPoints.hh \
TestTimeDependent.hh \
TestBoundaryMesh.hh \
TestBoundaryMeshTri3.hh \
Added: short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryConditionPoints.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryConditionPoints.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryConditionPoints.cc 2009-06-07 03:49:00 UTC (rev 15132)
@@ -0,0 +1,69 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestBoundaryConditionPoints.hh" // Implementation of class methods
+
+#include "pylith/bc/PointForce.hh" // USES PointForce
+
+#include "data/PointForceDatatri3.hh" // USES PointForceDataTri3
+
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
+
+#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::bc::TestBoundaryConditionPoints );
+
+// ----------------------------------------------------------------------
+typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+
+// ----------------------------------------------------------------------
+// Test _getPoints().
+void
+pylith::bc::TestBoundaryConditionPoints::testGetPoints(void)
+{ // testGetPoints
+ topology::Mesh mesh;
+ PointForce bc;
+ PointForceDataTri3 data;
+
+ meshio::MeshIOAscii iohandler;
+ iohandler.filename(data.meshFilename);
+ iohandler.read(&mesh);
+
+ spatialdata::geocoords::CSCart cs;
+ spatialdata::units::Nondimensional normalizer;
+ cs.setSpaceDim(mesh.dimension());
+ cs.initialize();
+ mesh.coordsys(&cs);
+ mesh.nondimensionalize(normalizer);
+
+ bc.label(data.label);
+ bc.BoundaryConditionPoints::_getPoints(mesh);
+
+ const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+ CPPUNIT_ASSERT(!sieveMesh.isNull());
+
+ const int numCells = sieveMesh->heightStratum(0)->size();
+ const size_t numPoints = data.numForcePts;
+
+ // Check points
+ const int offset = numCells;
+ CPPUNIT_ASSERT_EQUAL(numPoints, bc._points.size());
+ for (int i=0; i < numPoints; ++i)
+ CPPUNIT_ASSERT_EQUAL(data.forcePoints[i]+offset, bc._points[i]);
+} // testGetPoints
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryConditionPoints.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryConditionPoints.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/bc/TestBoundaryConditionPoints.hh 2009-06-07 03:49:00 UTC (rev 15132)
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/bc/TestBoundaryConditionPoints.hh
+ *
+ * @brief C++ TestBoundaryConditionPoints object.
+ *
+ * C++ unit testing for BoundaryConditionPoints.
+ */
+
+#if !defined(pylith_bc_testboundaryconditionpoints_hh)
+#define pylith_bc_testboundaryconditionpoints_hh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace bc {
+ class TestBoundaryConditionPoints;
+ class PointForceData;
+ } // bc
+} // pylith
+
+/// C++ unit testing for PointForce.
+class pylith::bc::TestBoundaryConditionPoints : public CppUnit::TestFixture
+{ // class TestBoundaryConditionPoints
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestBoundaryConditionPoints );
+
+ CPPUNIT_TEST( testGetPoints );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Test _getPoints().
+ void testGetPoints(void);
+
+}; // class TestBoundaryConditionPoints
+
+#endif // pylith_bc_testboundaryconditionpoints_hh
+
+
+// End of file
More information about the CIG-COMMITS
mailing list