[cig-commits] r6989 - in short/3D/PyLith/trunk: . libsrc/feassemble unittests/libtests/feassemble

brad at geodynamics.org brad at geodynamics.org
Tue May 29 08:19:54 PDT 2007


Author: brad
Date: 2007-05-29 08:19:53 -0700 (Tue, 29 May 2007)
New Revision: 6989

Added:
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.hh
Removed:
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegratorInertia.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegratorInertia.hh
Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.hh
Log:
Worked more on testing elasticity integrators.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2007-05-29 01:22:04 UTC (rev 6988)
+++ short/3D/PyLith/trunk/TODO	2007-05-29 15:19:53 UTC (rev 6989)
@@ -2,6 +2,8 @@
 MAIN PRIORITIES (Brad)
 ======================================================================
 
+Fix TestDirichlet.setField unit test.
+
 1. Unit tests for Integrator stuff.
 
   a. Add in use of useElasticBehavior()

Modified: short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc	2007-05-29 01:22:04 UTC (rev 6988)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Integrator.cc	2007-05-29 15:19:53 UTC (rev 6989)
@@ -104,6 +104,7 @@
 pylith::feassemble::Integrator::_resetCellVector(void)
 { // _resetCellVector
   assert(0 != _quadrature);
+  assert(0 != _cellVector);
   const int size = _quadrature->spaceDim() * _quadrature->numBasis();
   for (int i=0; i < size; ++i)
     _cellVector[i] = 0.0;
@@ -130,6 +131,7 @@
 pylith::feassemble::Integrator::_resetCellMatrix(void)
 { // _resetCellMatrix
   assert(0 != _quadrature);
+  assert(0 != _cellMatrix);
   const int size =
     _quadrature->spaceDim() * _quadrature->numBasis() *
     _quadrature->spaceDim() * _quadrature->numBasis();

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am	2007-05-29 01:22:04 UTC (rev 6988)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/Makefile.am	2007-05-29 15:19:53 UTC (rev 6989)
@@ -19,6 +19,7 @@
 
 # Primary source files
 testfeassemble_SOURCES = \
+	TestElasticityExplicit.cc \
 	TestIntegrator.cc \
 	TestQuadrature.cc \
 	TestQuadrature1D.cc \
@@ -28,17 +29,9 @@
 	TestQuadrature3D.cc \
 	test_feassemble.cc
 
-#TestIntegratorInertia.cc \
-#TestIntegratorInertia1D.cc \
-#TestIntegratorInertia2D.cc \
-#TestIntegratorInertia3D.cc
-
 noinst_HEADERS = \
+	TestElasticityExplicit.hh \
 	TestIntegrator.hh \
-	TestIntegratorInertia.hh \
-	TestIntegratorInertia1D.hh \
-	TestIntegratorInertia2D.hh \
-	TestIntegratorInertia3D.hh \
 	TestQuadrature.hh \
 	TestQuadrature1D.hh \
 	TestQuadrature1Din2D.hh \
@@ -48,14 +41,6 @@
 
 # Source files associated with testing data
 testfeassemble_SOURCES += \
-	data/IntegratorData.cc \
-	data/IntegratorDataInertia1DLinear.cc \
-	data/IntegratorDataInertia1DQuadratic.cc \
-	data/IntegratorDataInertia2Din3DOne.cc \
-	data/IntegratorDataInertia2Din3DTwo.cc \
-	data/IntegratorDataInertia2Din3DThree.cc \
-	data/IntegratorDataInertia3DLinear.cc \
-	data/IntegratorDataInertia3DQuadratic.cc \
 	data/QuadratureData.cc \
 	data/QuadratureData1DLinear.cc \
 	data/QuadratureData1DQuadratic.cc \
@@ -74,14 +59,6 @@
 	data/QuadratureData3DQuadratic.cc
 
 noinst_HEADERS += \
-	data/IntegratorData.hh \
-	data/IntegratorDataInertia1DLinear.hh \
-	data/IntegratorDataInertia1DQuadratic.hh \
-	data/IntegratorDataInertia2Din3DOne.hh \
-	data/IntegratorDataInertia2Din3DTwo.hh \
-	data/IntegratorDataInertia2Din3DThree.hh \
-	data/IntegratorDataInertia3DLinear.hh \
-	data/IntegratorDataInertia3DQuadratic.hh \
 	data/QuadratureData.hh \
 	data/QuadratureData1DLinear.hh \
 	data/QuadratureData1DQuadratic.hh \

Copied: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc (from rev 6977, short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegratorInertia.cc)
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegratorInertia.cc	2007-05-26 00:55:01 UTC (rev 6977)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc	2007-05-29 15:19:53 UTC (rev 6989)
@@ -0,0 +1,199 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestElasticityExplicit.hh" // Implementation of class methods
+
+#include "pylith/feassemble/ElasticityExplicit.hh" // USES ElasticityExplicit
+//#include "data/ElasticityExplicitData.hh" // USES ElasticityExplicitData
+
+#include "pylith/materials/ElasticIsotropic3D.hh" // USES ElasticIsotropic3D
+
+#include <stdexcept> // TEMPORARY
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::feassemble::TestElasticityExplicit );
+
+// ----------------------------------------------------------------------
+// Test constructor.
+void
+pylith::feassemble::TestElasticityExplicit::testConstructor(void)
+{ // testConstructor
+  ElasticityExplicit integrator;
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test timeStep().
+void
+pylith::feassemble::TestElasticityExplicit::testTimeStep(void)
+{ // testTimeStep
+  ElasticityExplicit integrator;
+
+  const double dt1 = 2.0;
+  integrator.timeStep(dt1);
+  CPPUNIT_ASSERT_EQUAL(dt1, integrator._dt);
+  integrator.timeStep(dt1);
+  CPPUNIT_ASSERT_EQUAL(dt1, integrator._dtm1);
+  CPPUNIT_ASSERT_EQUAL(dt1, integrator._dt);
+} // testTimeStep
+
+// ----------------------------------------------------------------------
+// Test StableTimeStep().
+void
+pylith::feassemble::TestElasticityExplicit::testStableTimeStep(void)
+{ // testStableTimeStep
+  ElasticityExplicit integrator;
+
+  const double dt1 = 2.0;
+  integrator.timeStep(dt1);
+  const double stableTimeStep = integrator.stableTimeStep();
+  CPPUNIT_ASSERT_EQUAL(dt1, stableTimeStep);
+} // testStableTimeStep
+
+// ----------------------------------------------------------------------
+// Test material().
+void
+pylith::feassemble::TestElasticityExplicit::testMaterial(void)
+{ // testMaterial
+  ElasticityExplicit integrator;
+
+  materials::ElasticIsotropic3D material;
+  const int id = 3;
+  const std::string label("my material");
+  material.id(id);
+  material.label(label.c_str());
+  integrator.material(&material);
+  CPPUNIT_ASSERT_EQUAL(id, integrator._material->id());
+  CPPUNIT_ASSERT_EQUAL(label, std::string(integrator._material->label()));
+} // testMaterial
+
+// ----------------------------------------------------------------------
+// Test updateState().
+void 
+pylith::feassemble::TestElasticityExplicit::testUpdateState(void)
+{ // testUpdateState
+  throw std::logic_error("Unit test not implemented.");
+} // testUpdateState
+
+// ----------------------------------------------------------------------
+// Test integrateResidual().
+void
+pylith::feassemble::TestElasticityExplicit::testIntegrateResidual(void)
+{ // testIntegrateResidual
+  throw std::logic_error("Unit test not implemented.");
+} // testIntegrateResidual
+
+// ----------------------------------------------------------------------
+// Test integrateJacobian().
+void
+pylith::feassemble::TestElasticityExplicit::testIntegrateJacobian(void)
+{ // testIntegrateJacobian
+  throw std::logic_error("Unit test not implemented.");
+} // testIntegrateJacobian
+
+
+#if 0
+// ----------------------------------------------------------------------
+// Test integrateLumped()
+void
+pylith::feassemble::TestIntegratorInertia::_testIntegrateLumped(
+					   IntegratorInertia* integrator,
+					   const IntegratorData& data) const
+{ // _testIntegrateLumped
+
+  CPPUNIT_ASSERT(false);
+
+  ALE::Obj<ALE::Mesh> mesh = _TestIntegratorInertia::_setupMesh(data);
+  const ALE::Mesh::int_section_type::patch_type patch = 0;
+
+  // Fiber dimension (number of values in field per vertex) for fields
+  const int fiberDim = data.fiberDim;
+
+  // Setup field for action result
+  const ALE::Obj<real_section_type>& fieldOut =
+    mesh->getRealSection("fieldOut");
+  fieldOut->setName("fieldOut");
+  fieldOut->setFiberDimensionByDepth(patch, 0, fiberDim);
+  fieldOut->allocate();
+
+  // Should read density from spatial database
+  const ALE::Obj<real_section_type>& density =
+    mesh->getRealSection("density");
+  density->setName("density");
+  density->setFiberDimensionByDepth(patch, 0, 
+				    integrator->_quadrature->numQuadPts());
+  density->allocate();
+  integrator->setDensity(density);
+
+  // Integrate action
+  const ALE::Obj<real_section_type>& coordinates = 
+    mesh->getRealSection("coordinates");
+  integrator->integrateLumped(fieldOut, coordinates);
+  //fieldOut->view("field out");
+  
+  // Check values in output field
+  int iVertex = 0;
+  const ALE::Obj<topology_type::label_sequence>& vertices = 
+    mesh->getTopology()->depthStratum(patch, 0);
+  const topology_type::label_sequence::iterator verticesEnd =
+    vertices->end();
+  const double tolerance = 1.0e-06;
+  for (topology_type::label_sequence::iterator vIter=vertices->begin();
+       vIter != verticesEnd;
+       ++vIter, ++iVertex) {
+    const real_section_type::value_type* vals = 
+      fieldOut->restrict(patch, *vIter);
+    const double* valsE = &data.valsLumped[iVertex*fiberDim];
+    const int dim = fieldOut->getFiberDimension(patch, *vIter);
+    CPPUNIT_ASSERT_EQUAL(fiberDim, dim);
+    for (int iDim=0; iDim < fiberDim; ++iDim)
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[iDim]/valsE[iDim], tolerance);
+  } // for
+} // _testIntegrateLumped
+
+
+// ----------------------------------------------------------------------
+// Setup mesh.
+ALE::Obj<ALE::Mesh>
+pylith::feassemble::_TestIntegratorInertia::_setupMesh(const IntegratorData& data)
+{ // _setupMesh
+  const int cellDim = data.cellDim;
+  const int numCorners = data.numCorners;
+  const int spaceDim = data.spaceDim;
+  const int numVertices = data.numVertices;
+  const int numCells = data.numCells;
+  const double* vertCoords = data.vertices;
+  const int* cells = data.cells;
+  CPPUNIT_ASSERT(0 != vertCoords);
+  CPPUNIT_ASSERT(0 != cells);
+
+  ALE::Obj<ALE::Mesh> mesh = new ALE::Mesh(PETSC_COMM_WORLD, cellDim);
+  ALE::Obj<sieve_type> sieve = new sieve_type(mesh->comm());
+  ALE::Obj<topology_type> topology = new topology_type(mesh->comm());
+
+  const bool interpolate = false;
+  ALE::New::SieveBuilder<sieve_type>::buildTopology(sieve, cellDim, numCells,
+	       const_cast<int*>(cells), numVertices, interpolate, numCorners);
+  sieve->stratify();
+  topology->setPatch(0, sieve);
+  topology->stratify();
+  mesh->setTopology(topology);
+  ALE::New::SieveBuilder<sieve_type>::buildCoordinates(
+		    mesh->getRealSection("coordinates"), spaceDim, vertCoords);
+
+  return mesh;
+} // _setupMesh
+#endif
+
+
+// End of file 

Copied: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.hh (from rev 6977, short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegratorInertia.hh)
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegratorInertia.hh	2007-05-26 00:55:01 UTC (rev 6977)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.hh	2007-05-29 15:19:53 UTC (rev 6989)
@@ -0,0 +1,98 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/feassemble/TestElasticityExplicit.hh
+ *
+ * @brief C++ TestElasticityExplicit object
+ *
+ * C++ unit testing for ElasticityExplicit.
+ */
+
+#if !defined(pylith_feassemble_testelasticityexplicit_hh)
+#define pylith_feassemble_testelasticityexplicit_hh
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "pylith/utils/sievefwd.hh" // USES PETSc Mesh
+
+/// Namespace for pylith package
+namespace pylith {
+  namespace feassemble {
+    class TestElasticityExplicit;
+
+    class ElasticityExplicit; // USES ElasticityExplicit
+    class ElasticityExplicitData; // USES ElasticityExplicitData
+  } // feassemble
+} // pylith
+
+/// C++ unit testing for ElasticityExplicit
+class pylith::feassemble::TestElasticityExplicit : public CppUnit::TestFixture
+{ // class TestElasticityExplicit
+
+  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+  CPPUNIT_TEST_SUITE( TestElasticityExplicit );
+
+  CPPUNIT_TEST( testConstructor );
+  CPPUNIT_TEST( testTimeStep );
+  CPPUNIT_TEST( testStableTimeStep );
+  CPPUNIT_TEST( testMaterial );
+  CPPUNIT_TEST( testUpdateState );
+
+  CPPUNIT_TEST_SUITE_END();
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Test constructor.
+  void testConstructor(void);
+
+  /// Test timeStep().
+  void testTimeStep(void);
+
+  /// Test StableTimeStep().
+  void testStableTimeStep(void);
+
+  /// Test material().
+  void testMaterial(void);
+
+  /// Test updateState().
+  void testUpdateState(void);
+
+  /// Test integrateResidual().
+  void testIntegrateResidual(void);
+
+  /// Test integrateJacobian().
+  void testIntegrateJacobian(void);
+
+  // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+  ElasticityExplicitData* _data; ///< Data for testing
+
+  // PRIVATE METHODS ////////////////////////////////////////////////////
+private :
+
+  /** Initialize elasticity integrator..
+   *
+   * @param mesh PETSc mesh to initialize.
+   * @param integrator ElasticityIntegrator to initialize.
+   */
+  void _initialize(ALE::Obj<ALE::Mesh>* mesh,
+		   ElasticityExplicit* const integrator) const;
+
+}; // class TestElasticityExplicit
+
+#endif // pylith_feassemble_testelasticityexplicit_hh
+
+
+// End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc	2007-05-29 01:22:04 UTC (rev 6988)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.cc	2007-05-29 15:19:53 UTC (rev 6989)
@@ -19,6 +19,7 @@
 
 #include <petscmat.h>
 
+#include <stdexcept> // TEMPORARY
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::feassemble::TestIntegrator );
 
@@ -57,7 +58,129 @@
   CPPUNIT_ASSERT_EQUAL(false, integrator._needNewJacobian);
 } // testNeedNewJacobian
 
+// ----------------------------------------------------------------------
+// Test _initCellVector()
+void
+pylith::feassemble::TestIntegrator::testInitCellVector(void)
+{ // testInitCellVector
+  ElasticityExplicit integrator;
 
+  const int cellDim = 1;
+  const int numBasis = 2;
+  const int numQuadPts = 1;
+  const int spaceDim = 1;
+  const double basis[] = { 0.5, 0.5 };
+  const double basisDeriv[] = { -0.5, 0.5 };
+  const double quadPtsRef[] = { 0.0 };
+  const double quadWts[] = { 2.0 };
+  const double minJacobian = 1.0;
+
+  Quadrature1D quadrature;
+  quadrature.initialize(basis, basisDeriv, quadPtsRef, quadWts,
+			cellDim, numBasis, numQuadPts, spaceDim);
+  integrator.quadrature(&quadrature);
+  integrator._initCellVector();
+  
+  CPPUNIT_ASSERT(0 != integrator._cellVector);
+  const int size = spaceDim * numBasis;
+  for (int i=0; i < size; ++i)
+    CPPUNIT_ASSERT_EQUAL(0.0, integrator._cellVector[i]);
+} // testInitCellVector
+
+// ----------------------------------------------------------------------
+// Test _resetCellVector()
+void
+pylith::feassemble::TestIntegrator::testResetCellVector(void)
+{ // testResetCellVector
+  ElasticityExplicit integrator;
+
+  const int cellDim = 1;
+  const int numBasis = 2;
+  const int numQuadPts = 1;
+  const int spaceDim = 1;
+  const double basis[] = { 0.5, 0.5 };
+  const double basisDeriv[] = { -0.5, 0.5 };
+  const double quadPtsRef[] = { 0.0 };
+  const double quadWts[] = { 2.0 };
+  const double minJacobian = 1.0;
+
+  Quadrature1D quadrature;
+  quadrature.initialize(basis, basisDeriv, quadPtsRef, quadWts,
+			cellDim, numBasis, numQuadPts, spaceDim);
+  integrator.quadrature(&quadrature);
+  integrator._initCellVector();
+  
+  CPPUNIT_ASSERT(0 != integrator._cellVector);
+  const int size = spaceDim * numBasis;
+  for (int i=0; i < size; ++i)
+    integrator._cellVector[i] = 1.4+2*i;
+  integrator._resetCellVector();
+  for (int i=0; i < size; ++i)
+    CPPUNIT_ASSERT_EQUAL(0.0, integrator._cellVector[i]);
+} // testResetCellVector
+
+// ----------------------------------------------------------------------
+// Test _initCellMatrix()
+void
+pylith::feassemble::TestIntegrator::testInitCellMatrix(void)
+{ // testInitCellMatrix
+  ElasticityExplicit integrator;
+
+  const int cellDim = 1;
+  const int numBasis = 2;
+  const int numQuadPts = 1;
+  const int spaceDim = 1;
+  const double basis[] = { 0.5, 0.5 };
+  const double basisDeriv[] = { -0.5, 0.5 };
+  const double quadPtsRef[] = { 0.0 };
+  const double quadWts[] = { 2.0 };
+  const double minJacobian = 1.0;
+
+  Quadrature1D quadrature;
+  quadrature.initialize(basis, basisDeriv, quadPtsRef, quadWts,
+			cellDim, numBasis, numQuadPts, spaceDim);
+  integrator.quadrature(&quadrature);
+  integrator._initCellMatrix();
+  
+  CPPUNIT_ASSERT(0 != integrator._cellMatrix);
+  const int size = spaceDim * numBasis * spaceDim * numBasis;
+  for (int i=0; i < size; ++i)
+    CPPUNIT_ASSERT_EQUAL(0.0, integrator._cellMatrix[i]);
+} // testInitCellMatrix
+
+// ----------------------------------------------------------------------
+// Test _resetCellMatrix()
+void
+pylith::feassemble::TestIntegrator::testResetCellMatrix(void)
+{ // testResetCellMatrix
+  ElasticityExplicit integrator;
+
+  const int cellDim = 1;
+  const int numBasis = 2;
+  const int numQuadPts = 1;
+  const int spaceDim = 1;
+  const double basis[] = { 0.5, 0.5 };
+  const double basisDeriv[] = { -0.5, 0.5 };
+  const double quadPtsRef[] = { 0.0 };
+  const double quadWts[] = { 2.0 };
+  const double minJacobian = 1.0;
+
+  Quadrature1D quadrature;
+  quadrature.initialize(basis, basisDeriv, quadPtsRef, quadWts,
+			cellDim, numBasis, numQuadPts, spaceDim);
+  integrator.quadrature(&quadrature);
+  integrator._initCellMatrix();
+  
+  CPPUNIT_ASSERT(0 != integrator._cellMatrix);
+  const int size = spaceDim * numBasis * spaceDim * numBasis;
+  for (int i=0; i < size; ++i)
+    integrator._cellMatrix[i] = 1.23 + 1.2*i;
+  integrator._resetCellMatrix();
+  for (int i=0; i < size; ++i)
+    CPPUNIT_ASSERT_EQUAL(0.0, integrator._cellMatrix[i]);
+} // testResetCellMatrix
+
+
 #if 0
 // ----------------------------------------------------------------------
 namespace pylith {

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.hh	2007-05-29 01:22:04 UTC (rev 6988)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegrator.hh	2007-05-29 15:19:53 UTC (rev 6989)
@@ -41,6 +41,10 @@
 
   CPPUNIT_TEST( testQuadrature );
   CPPUNIT_TEST( testNeedNewJacobian );
+  CPPUNIT_TEST( testInitCellVector );
+  CPPUNIT_TEST( testResetCellVector );
+  CPPUNIT_TEST( testInitCellMatrix );
+  CPPUNIT_TEST( testResetCellMatrix );
 
   CPPUNIT_TEST_SUITE_END();
 
@@ -53,6 +57,18 @@
   /// Test needNewJacobian()
   void testNeedNewJacobian(void);
 
+  /// Test _initCellVector()
+  void testInitCellVector(void);
+
+  /// Test _resetCellVector()
+  void testResetCellVector(void);
+
+  /// Test _initCellMatrix()
+  void testInitCellMatrix(void);
+
+  /// Test _resetCellMatrix()
+  void testResetCellMatrix(void);
+
 }; // class TestIntegrator
 
 #endif // pylith_feassemble_testintegrator_hh

Deleted: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegratorInertia.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegratorInertia.cc	2007-05-29 01:22:04 UTC (rev 6988)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegratorInertia.cc	2007-05-29 15:19:53 UTC (rev 6989)
@@ -1,134 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-#include <portinfo>
-
-#include "TestIntegratorInertia.hh" // Implementation of class methods
-
-#include "pylith/feassemble/IntegratorInertia.hh" // USES IntegratorInertia
-#include "data/IntegratorData.hh" // USES IntegratorData
-
-// ----------------------------------------------------------------------
-namespace pylith {
-  namespace feassemble {
-    class _TestIntegratorInertia;
-  } // feassemble
-} // pylith
-
-/// Helper class for TestIntegrator
-class pylith::feassemble::_TestIntegratorInertia {
-
-public :
-  /** Setup mesh.
-   *
-   * @param data Integrator data
-   */
-  static 
-  ALE::Obj<ALE::Mesh>
-  _setupMesh(const IntegratorData& data);
-}; // _TestIntegrator
-
-// ----------------------------------------------------------------------
-// Test integrateLumped()
-void
-pylith::feassemble::TestIntegratorInertia::_testIntegrateLumped(
-					   IntegratorInertia* integrator,
-					   const IntegratorData& data) const
-{ // _testIntegrateLumped
-
-  CPPUNIT_ASSERT(false);
-
-#if 0
-  ALE::Obj<ALE::Mesh> mesh = _TestIntegratorInertia::_setupMesh(data);
-  const ALE::Mesh::int_section_type::patch_type patch = 0;
-
-  // Fiber dimension (number of values in field per vertex) for fields
-  const int fiberDim = data.fiberDim;
-
-  // Setup field for action result
-  const ALE::Obj<real_section_type>& fieldOut =
-    mesh->getRealSection("fieldOut");
-  fieldOut->setName("fieldOut");
-  fieldOut->setFiberDimensionByDepth(patch, 0, fiberDim);
-  fieldOut->allocate();
-
-  // Should read density from spatial database
-  const ALE::Obj<real_section_type>& density =
-    mesh->getRealSection("density");
-  density->setName("density");
-  density->setFiberDimensionByDepth(patch, 0, 
-				    integrator->_quadrature->numQuadPts());
-  density->allocate();
-  integrator->setDensity(density);
-
-  // Integrate action
-  const ALE::Obj<real_section_type>& coordinates = 
-    mesh->getRealSection("coordinates");
-  integrator->integrateLumped(fieldOut, coordinates);
-  //fieldOut->view("field out");
-  
-  // Check values in output field
-  int iVertex = 0;
-  const ALE::Obj<topology_type::label_sequence>& vertices = 
-    mesh->getTopology()->depthStratum(patch, 0);
-  const topology_type::label_sequence::iterator verticesEnd =
-    vertices->end();
-  const double tolerance = 1.0e-06;
-  for (topology_type::label_sequence::iterator vIter=vertices->begin();
-       vIter != verticesEnd;
-       ++vIter, ++iVertex) {
-    const real_section_type::value_type* vals = 
-      fieldOut->restrict(patch, *vIter);
-    const double* valsE = &data.valsLumped[iVertex*fiberDim];
-    const int dim = fieldOut->getFiberDimension(patch, *vIter);
-    CPPUNIT_ASSERT_EQUAL(fiberDim, dim);
-    for (int iDim=0; iDim < fiberDim; ++iDim)
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[iDim]/valsE[iDim], tolerance);
-  } // for
-#endif
-} // _testIntegrateLumped
-
-
-// ----------------------------------------------------------------------
-// Setup mesh.
-ALE::Obj<ALE::Mesh>
-pylith::feassemble::_TestIntegratorInertia::_setupMesh(const IntegratorData& data)
-{ // _setupMesh
-  const int cellDim = data.cellDim;
-  const int numCorners = data.numCorners;
-  const int spaceDim = data.spaceDim;
-  const int numVertices = data.numVertices;
-  const int numCells = data.numCells;
-  const double* vertCoords = data.vertices;
-  const int* cells = data.cells;
-  CPPUNIT_ASSERT(0 != vertCoords);
-  CPPUNIT_ASSERT(0 != cells);
-
-  ALE::Obj<ALE::Mesh> mesh = new ALE::Mesh(PETSC_COMM_WORLD, cellDim);
-  ALE::Obj<sieve_type> sieve = new sieve_type(mesh->comm());
-  ALE::Obj<topology_type> topology = new topology_type(mesh->comm());
-
-  const bool interpolate = false;
-  ALE::New::SieveBuilder<sieve_type>::buildTopology(sieve, cellDim, numCells,
-	       const_cast<int*>(cells), numVertices, interpolate, numCorners);
-  sieve->stratify();
-  topology->setPatch(0, sieve);
-  topology->stratify();
-  mesh->setTopology(topology);
-  ALE::New::SieveBuilder<sieve_type>::buildCoordinates(
-		    mesh->getRealSection("coordinates"), spaceDim, vertCoords);
-
-  return mesh;
-} // _setupMesh
-
-
-// End of file 

Deleted: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegratorInertia.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegratorInertia.hh	2007-05-29 01:22:04 UTC (rev 6988)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestIntegratorInertia.hh	2007-05-29 15:19:53 UTC (rev 6989)
@@ -1,54 +0,0 @@
-// -*- C++ -*-
-//
-// ----------------------------------------------------------------------
-//
-//                           Brad T. Aagaard
-//                        U.S. Geological Survey
-//
-// {LicenseText}
-//
-// ----------------------------------------------------------------------
-//
-
-/**
- * @file unittests/libtests/feassemble/TestIntegratorInertia.hh
- *
- * @brief C++ TestIntegratorInertia object
- *
- * C++ unit testing for IntegratorInertia.
- */
-
-#if !defined(pylith_feassemble_testintegratorinertia_hh)
-#define pylith_feassemble_testintegratorinertia_hh
-
-#include "TestIntegrator.hh"
-
-/// Namespace for pylith package
-namespace pylith {
-  namespace feassemble {
-    class TestIntegratorInertia;
-
-    class IntegratorInertia; // USES IntegratorInertia
-  } // feassemble
-} // pylith
-
-/// C++ unit testing for IntegratorInertia
-class pylith::feassemble::TestIntegratorInertia : public TestIntegrator
-{ // class TestIntegratorInertia1D
-
-  // PROTECTED METHODS //////////////////////////////////////////////////
-protected :
-
-  /** Test integrateLumped()
-   *
-   * @param integrator Pointer to integrator
-   * @param data Data for testing integrator
-   */
-  void _testIntegrateLumped(IntegratorInertia* integrator,
-			    const IntegratorData& data) const;
-
-}; // class TestIntegratorInertia
-
-#endif // pylith_feassemble_testintegratorinertia_hh
-
-// End of file 



More information about the cig-commits mailing list