[cig-commits] r14000 - short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology

brad at geodynamics.org brad at geodynamics.org
Sat Jan 31 16:15:18 PST 2009


Author: brad
Date: 2009-01-31 16:15:18 -0800 (Sat, 31 Jan 2009)
New Revision: 14000

Added:
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSubMesh.cc
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSubMesh.hh
Modified:
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/Makefile.am
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh
   short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestMesh.cc
Log:
Added C++ unit tests for SubMesh.

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/Makefile.am	2009-01-30 14:56:05 UTC (rev 13999)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/Makefile.am	2009-02-01 00:15:18 UTC (rev 14000)
@@ -24,6 +24,7 @@
 	TestFieldBase.cc \
 	TestField.cc \
 	TestMesh.cc \
+	TestSubMesh.cc \
 	TestMeshOps.cc \
 	test_topology.cc
 
@@ -34,6 +35,7 @@
 	TestField.hh \
 	TestFieldsManager.hh \
 	TestMesh.hh \
+	TestSubMesh.hh \
 	TestMeshOps.hh
 
 # Source files associated with testing data

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc	2009-01-30 14:56:05 UTC (rev 13999)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.cc	2009-02-01 00:15:18 UTC (rev 14000)
@@ -65,48 +65,124 @@
 } // testSection
 
 // ----------------------------------------------------------------------
+// Test spaceDim().
+void
+pylith::topology::TestField::testSpaceDim(void)
+{ // testSpaceDim
+  Mesh mesh;
+  _buildMesh(&mesh);
+  Field field(mesh);
+
+  CPPUNIT_ASSERT_EQUAL(_TestField::cellDim, field.spaceDim());
+} // testSpaceDim
+
+// ----------------------------------------------------------------------
 // Test newSection().
 void
 pylith::topology::TestField::testNewSection(void)
 { // testNewSection
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+
+  Field field(mesh);
+  field.newSection();
+  const ALE::Obj<SieveMesh::real_section_type>& section = field.section();
+  CPPUNIT_ASSERT(!section.isNull());
+} // testNewSection
+
+// ----------------------------------------------------------------------
+// Test newSection(points).
+void
+pylith::topology::TestField::testNewSectionPoints(void)
+{ // testNewSectionPoints
   const int fiberDim = 2;
 
   Mesh mesh;
   _buildMesh(&mesh);
   const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
 
-  Field fieldA(mesh);
+  Field field(mesh);
   const ALE::Obj<SieveMesh::label_sequence>& vertices = 
     sieveMesh->depthStratum(0);
-  fieldA.newSection(vertices, fiberDim);
-  const ALE::Obj<SieveMesh::real_section_type>& sectionA = fieldA.section();
-  CPPUNIT_ASSERT(!sectionA.isNull());
+  field.newSection(vertices, fiberDim);
+  const ALE::Obj<SieveMesh::real_section_type>& section = field.section();
+  CPPUNIT_ASSERT(!section.isNull());
 
-  Field fieldB(mesh);
-  fieldB.newSection(Field::VERTICES_FIELD, fiberDim);
-  const ALE::Obj<SieveMesh::real_section_type>& sectionB = fieldB.section();
-  CPPUNIT_ASSERT(!sectionB.isNull());
-} // testNewSection
+  CPPUNIT_ASSERT(!vertices.isNull());
+  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter)
+    CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
+} // testNewSectionPoints
 
 // ----------------------------------------------------------------------
-// Test spaceDim().
+// Test newSection(domain).
 void
-pylith::topology::TestField::testSpaceDim(void)
-{ // testSpaceDim
+pylith::topology::TestField::testNewSectionDomain(void)
+{ // testNewSectionDomain
+  const int fiberDim = 2;
+
   Mesh mesh;
   _buildMesh(&mesh);
+  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+
   Field field(mesh);
+  field.newSection(Field::VERTICES_FIELD, fiberDim);
 
-  std::cout << "MESH DIM: " << mesh.sieveMesh()->getDimension() << std::endl;
+  const ALE::Obj<SieveMesh::real_section_type>& section = field.section();
+  CPPUNIT_ASSERT(!section.isNull());
+  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+  CPPUNIT_ASSERT(!vertices.isNull());
+  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter)
+    CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
+} // testNewSectionDomain
 
-  CPPUNIT_ASSERT_EQUAL(_TestField::cellDim, field.spaceDim());
-} // testSpaceDim
+// ----------------------------------------------------------------------
+// Test newSection(chart).
+void
+pylith::topology::TestField::testNewSectionChart(void)
+{ // testNewSectionChart
+  const int fiberDim = 3;
+  const int nconstraints[] = { 0, 2, 1, 3 };
+  const int constraints[] = {
+              // 0
+    0, 3,     // 1
+    2,        // 2
+    0, 1, 2,  // 3
+  };
+    
+  Mesh mesh;
+  _buildMesh(&mesh);
+  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
 
+  // Create field with atlas to use to create new field
+  Field fieldSrc(mesh);
+  fieldSrc.newSection(Field::VERTICES_FIELD, fiberDim);
+  const ALE::Obj<MeshRealSection>& sectionSrc = fieldSrc.section();
+  CPPUNIT_ASSERT(!sectionSrc.isNull());
+  const MeshRealSection::chart_type& chart = sectionSrc->getChart();
+
+  Field field(mesh);
+  field.newSection(chart, fiberDim);
+  const ALE::Obj<MeshRealSection>& section = field.section();
+  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+  CPPUNIT_ASSERT(!vertices.isNull());
+  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter)
+    CPPUNIT_ASSERT_EQUAL(fiberDim, section->getFiberDimension(*v_iter));
+} // testNewSectionChart
+
 // ----------------------------------------------------------------------
-// Test copyLayout().
+// Test newSection(field).
 void
-pylith::topology::TestField::testCopyLayout(void)
-{ // testCopyLayout
+pylith::topology::TestField::testNewSectionField(void)
+{ // testNewSectionField
   const int fiberDim = 3;
   const int nconstraints[] = { 0, 2, 1, 3 };
   const int constraints[] = {
@@ -118,11 +194,11 @@
     
   Mesh mesh;
   _buildMesh(&mesh);
-  
+  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
 
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
   const ALE::Obj<SieveMesh::label_sequence>& vertices = 
     sieveMesh->depthStratum(0);
+  CPPUNIT_ASSERT(!vertices.isNull());
 
   // Create field with atlas to use to create new field
   Field fieldSrc(mesh);
@@ -130,6 +206,8 @@
     fieldSrc.newSection(Field::VERTICES_FIELD, fiberDim);
     const ALE::Obj<MeshRealSection>& section = fieldSrc.section();
     int iV=0;
+
+    CPPUNIT_ASSERT(!vertices.isNull());
     for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
 	 v_iter != vertices->end();
 	 ++v_iter)
@@ -137,9 +215,9 @@
     fieldSrc.allocate();
   } // Setup source field
 
+
   Field field(mesh);
-  field.copyLayout(fieldSrc);
-
+  field.newSection(fieldSrc);
   const ALE::Obj<MeshRealSection>& section = field.section();
   int iV = 0;
   for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
@@ -149,7 +227,7 @@
     CPPUNIT_ASSERT_EQUAL(nconstraints[iV++], 
 			 section->getConstraintDimension(*v_iter));
   } // for
-} // testCopyLayout
+} // testNewSectionField
 
 // ----------------------------------------------------------------------
 // Test clear().
@@ -174,7 +252,7 @@
 // Test allocate().
 void
 pylith::topology::TestField::testAllocate(void)
-{ // testZero
+{ // testAllocate
   const int fiberDim = 3;
   const double scale = 2.0;
   const double valuesNondim[] = {
@@ -215,7 +293,7 @@
       CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesNondim[i++], values[iDim], tolerance);
     } // for
   } // for
-} // testZero
+} // testAllocate
 
 // ----------------------------------------------------------------------
 // Test zero().
@@ -572,6 +650,11 @@
   ALE::SieveBuilder<SieveMesh>::buildCoordinates(sieveMesh, spaceDim, 
 						 coordinates);
 
+  spatialdata::geocoords::CSCart cs;
+  cs.setSpaceDim(spaceDim);
+  cs.initialize();
+  mesh->coordsys(&cs);
 } // _buildMesh
 
+
 // End of file 

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh	2009-01-30 14:56:05 UTC (rev 13999)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestField.hh	2009-02-01 00:15:18 UTC (rev 14000)
@@ -43,9 +43,12 @@
 
   CPPUNIT_TEST( testConstructor );
   CPPUNIT_TEST( testSection );
+  CPPUNIT_TEST( testSpaceDim );
   CPPUNIT_TEST( testNewSection );
-  CPPUNIT_TEST( testSpaceDim );
-  CPPUNIT_TEST( testCopyLayout );
+  CPPUNIT_TEST( testNewSectionPoints );
+  CPPUNIT_TEST( testNewSectionDomain );
+  CPPUNIT_TEST( testNewSectionChart );
+  CPPUNIT_TEST( testNewSectionField );
   CPPUNIT_TEST( testClear );
   CPPUNIT_TEST( testAllocate );
   CPPUNIT_TEST( testZero );
@@ -66,15 +69,24 @@
   /// Test section().
   void testSection(void);
 
+  /// Test spaceDim().
+  void testSpaceDim(void);
+
   /// Test newSection().
   void testNewSection(void);
 
-  /// Test spaceDim().
-  void testSpaceDim(void);
+  /// Test newSection(points).
+  void testNewSectionPoints(void);
 
-  /// Test copyLayout().
-  void testCopyLayout(void);
+  /// Test newSection(domain).
+  void testNewSectionDomain(void);
 
+  /// Test newSection(chart).
+  void testNewSectionChart(void);
+
+  /// Test newSection(field).
+  void testNewSectionField(void);
+
   /// Test clear().
   void testClear(void);
 

Modified: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestMesh.cc	2009-01-30 14:56:05 UTC (rev 13999)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestMesh.cc	2009-02-01 00:15:18 UTC (rev 14000)
@@ -43,7 +43,7 @@
 } // testConstructor
 
 // ----------------------------------------------------------------------
-// Test constructor.
+// Test createSieveMesh().
 void
 pylith::topology::TestMesh::testCreateSieveMesh(void)
 { // testCreateSieveMesh

Added: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSubMesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSubMesh.cc	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSubMesh.cc	2009-02-01 00:15:18 UTC (rev 14000)
@@ -0,0 +1,255 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestSubMesh.hh" // Implementation of class methods
+#include "pylith/topology/SubMesh.hh" // USES SubMesh
+#include "pylith/topology/Mesh.hh" // USES Mesh
+
+#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::topology::TestSubMesh );
+
+// ----------------------------------------------------------------------
+namespace pylith {
+  namespace topology {
+    namespace _TestSubMesh {
+      const int cellDim = 2;
+      const int nvertices = 4;
+      const int ncells = 2;
+      const int ncorners = 3;
+      const int cells[] = {
+	0, 1, 3,
+	0, 3, 2,
+      };
+      const double coordinates[] = {
+	0.0, 0.0,
+	1.0, 0.0,
+	0.0, 1.0,
+	1.0, 1.0,
+      };
+      const char* label = "bc";
+      const int groupSize = 3;
+      const int groupVertices[] = {
+	1, 2, 3
+      };
+      const int submeshVertices[] = {
+	3, 4, 5
+      };
+    } // _TestSubMesh
+  } // topology
+} // pylith
+
+// ----------------------------------------------------------------------
+// Test constructor.
+void
+pylith::topology::TestSubMesh::testConstructor(void)
+{ // testConstructor
+  SubMesh mesh;
+  CPPUNIT_ASSERT(mesh._mesh.isNull());
+  CPPUNIT_ASSERT_EQUAL(0, mesh.dimension());
+  CPPUNIT_ASSERT_EQUAL(false, mesh.debug());
+  CPPUNIT_ASSERT_EQUAL(0, mesh.comm());
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test constructor w/mesh.
+void
+pylith::topology::TestSubMesh::testConstructorMesh(void)
+{ // testConstructorMesh
+  Mesh mesh2D;
+  _buildMesh(&mesh2D);
+  
+  SubMesh mesh(mesh2D, _TestSubMesh::label);
+  CPPUNIT_ASSERT(!mesh._mesh.isNull());
+  CPPUNIT_ASSERT_EQUAL(_TestSubMesh::cellDim-1, mesh.dimension());
+  CPPUNIT_ASSERT_EQUAL(PETSC_COMM_WORLD, mesh.comm());
+
+  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+  CPPUNIT_ASSERT(!vertices.isNull());
+  const int nvertices = _TestSubMesh::groupSize;
+  CPPUNIT_ASSERT_EQUAL(size_t(nvertices), vertices->size());
+  int iV = 0;
+  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter)
+    CPPUNIT_ASSERT_EQUAL(_TestSubMesh::submeshVertices[iV++], *v_iter);
+} // testConstructorMesh
+
+// ----------------------------------------------------------------------
+// Test sieveMesh().
+void
+pylith::topology::TestSubMesh::testSieveMesh(void)
+{ // testSieveMesh
+  Mesh mesh2D;
+  _buildMesh(&mesh2D);
+
+  SubMesh mesh(mesh2D, _TestSubMesh::label);
+  
+  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+  CPPUNIT_ASSERT(!sieveMesh.isNull());
+  CPPUNIT_ASSERT_EQUAL(_TestSubMesh::cellDim-1, mesh.dimension());
+} // testSieveMesh
+
+// ----------------------------------------------------------------------
+// Test createSubMesh().
+void
+pylith::topology::TestSubMesh::testCreateSubMesh(void)
+{ // testCreateSubMesh
+  Mesh mesh2D;
+  _buildMesh(&mesh2D);
+  
+  SubMesh mesh;
+  mesh.createSubMesh(mesh2D, _TestSubMesh::label);
+  CPPUNIT_ASSERT(!mesh._mesh.isNull());
+  CPPUNIT_ASSERT_EQUAL(_TestSubMesh::cellDim-1, mesh.dimension());
+  CPPUNIT_ASSERT_EQUAL(PETSC_COMM_WORLD, mesh.comm());
+
+  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+  CPPUNIT_ASSERT(!vertices.isNull());
+  const int nvertices = _TestSubMesh::groupSize;
+  CPPUNIT_ASSERT_EQUAL(size_t(nvertices), vertices->size());
+  int iV = 0;
+  for (SieveMesh::label_sequence::iterator v_iter=vertices->begin();
+       v_iter != vertices->end();
+       ++v_iter)
+    CPPUNIT_ASSERT_EQUAL(_TestSubMesh::submeshVertices[iV++], *v_iter);
+} // testCreateSubMesh
+
+// ----------------------------------------------------------------------
+// Test coordsys().
+void
+pylith::topology::TestSubMesh::testCoordsys(void)
+{ // testCoordsys
+  Mesh mesh2D;
+  _buildMesh(&mesh2D);
+
+  SubMesh mesh(mesh2D, _TestSubMesh::label);
+
+  CPPUNIT_ASSERT_EQUAL(_TestSubMesh::cellDim, mesh.coordsys()->spaceDim());
+} // testCoordsys
+
+// ----------------------------------------------------------------------
+// Test debug().
+void
+pylith::topology::TestSubMesh::testDebug(void)
+{ // testDebug
+  SubMesh mesh;
+  CPPUNIT_ASSERT_EQUAL(false, mesh.debug());
+
+  mesh.debug(true);
+  CPPUNIT_ASSERT_EQUAL(true, mesh.debug());
+} // testDebug
+
+// ----------------------------------------------------------------------
+// Test dimension().
+void
+pylith::topology::TestSubMesh::testDimension(void)
+{ // testDimension
+  SubMesh mesh;
+  CPPUNIT_ASSERT_EQUAL(0, mesh.dimension());
+
+  Mesh mesh2D;
+  _buildMesh(&mesh2D);
+  SubMesh mesh2(mesh2D, _TestSubMesh::label);
+  CPPUNIT_ASSERT_EQUAL(_TestSubMesh::cellDim-1, mesh2.dimension());
+} // testDimension
+
+// ----------------------------------------------------------------------
+// Test comm().
+void
+pylith::topology::TestSubMesh::testComm(void)
+{ // testComm
+  SubMesh mesh;
+  CPPUNIT_ASSERT_EQUAL(0, mesh.comm());
+
+  Mesh mesh2D;
+  _buildMesh(&mesh2D);
+  mesh.createSubMesh(mesh2D, _TestSubMesh::label);
+
+  CPPUNIT_ASSERT_EQUAL(PETSC_COMM_WORLD, mesh.comm());
+} // testComm
+
+// ----------------------------------------------------------------------
+// Test initialize().
+void
+pylith::topology::TestSubMesh::testInitialize(void)
+{ // testInitialize
+  Mesh mesh2D;
+  _buildMesh(&mesh2D);
+  SubMesh mesh(mesh2D, _TestSubMesh::label);
+
+  mesh.initialize();
+} // testInitialize
+
+// ----------------------------------------------------------------------
+void
+pylith::topology::TestSubMesh::_buildMesh(Mesh* mesh)
+{ // _buildMesh
+  assert(0 != mesh);
+
+  mesh->createSieveMesh(_TestSubMesh::cellDim);
+  const ALE::Obj<SieveMesh>& sieveMesh = mesh->sieveMesh();
+
+  ALE::Obj<SieveMesh::sieve_type> sieve = 
+    new SieveMesh::sieve_type(sieveMesh->comm());
+  CPPUNIT_ASSERT(!sieve.isNull());
+
+  ALE::Obj<ALE::Mesh::sieve_type> s = 
+    new ALE::Mesh::sieve_type(sieve->comm(), sieve->debug());
+  
+  const int cellDim = _TestSubMesh::cellDim;
+  const int ncells = _TestSubMesh::ncells;
+  const int* cells = _TestSubMesh::cells;
+  const int nvertices = _TestSubMesh::nvertices;
+  const int ncorners = _TestSubMesh::ncorners;
+  const int spaceDim = _TestSubMesh::cellDim;
+  const double* coordinates = _TestSubMesh::coordinates;
+  const bool interpolate = false;
+  ALE::SieveBuilder<ALE::Mesh>::buildTopology(s, cellDim, ncells, (int*) cells,
+					      nvertices, interpolate, 
+					      ncorners);
+  std::map<SieveMesh::point_type,SieveMesh::point_type> renumbering;
+  ALE::ISieveConverter::convertSieve(*s, *sieve, renumbering);
+  sieveMesh->setSieve(sieve);
+  sieveMesh->stratify();
+  ALE::SieveBuilder<SieveMesh>::buildCoordinates(sieveMesh, spaceDim, 
+						 coordinates);
+
+  spatialdata::geocoords::CSCart cs;
+  cs.setSpaceDim(spaceDim);
+  cs.initialize();
+  mesh->coordsys(&cs);
+
+  typedef SieveMesh::int_section_type::chart_type chart_type;
+  const ALE::Obj<SieveMesh::int_section_type>& groupField = 
+    sieveMesh->getIntSection(_TestSubMesh::label);
+  assert(!groupField.isNull());
+
+  const int numPoints = _TestSubMesh::groupSize;
+  const int numVertices = sieveMesh->depthStratum(0)->size();
+  const int numCells = sieveMesh->heightStratum(0)->size();
+  groupField->setChart(chart_type(numCells, numCells+numVertices));
+  for(int i=0; i < numPoints; ++i)
+    groupField->setFiberDimension(numCells+_TestSubMesh::groupVertices[i], 1);
+  sieveMesh->allocate(groupField);
+  
+} // _buildMesh
+
+
+// End of file 

Added: short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSubMesh.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSubMesh.hh	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/unittests/libtests/topology/TestSubMesh.hh	2009-02-01 00:15:18 UTC (rev 14000)
@@ -0,0 +1,99 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/topology/TestSubMesh.hh
+ *
+ * @brief C++ unit testing for Mesh.
+ */
+
+#if !defined(pylith_topology_testsubmesh_hh)
+#define pylith_topology_testsubmesh_hh
+
+// Include directives ---------------------------------------------------
+#include <cppunit/extensions/HelperMacros.h>
+
+// Forward declarations -------------------------------------------------
+/// Namespace for pylith package
+namespace pylith {
+  namespace topology {
+    class TestSubMesh;
+
+    class Mesh;
+  } // topology
+} // pylith
+
+// TestSubMesh -------------------------------------------------------------
+/// C++ unit testing for Mesh.
+class pylith::topology::TestSubMesh : public CppUnit::TestFixture
+{ // class TestSubMesh
+
+  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+  CPPUNIT_TEST_SUITE( TestSubMesh );
+
+  CPPUNIT_TEST( testConstructor );
+  CPPUNIT_TEST( testConstructorMesh );
+  CPPUNIT_TEST( testSieveMesh );
+  CPPUNIT_TEST( testCreateSubMesh );
+  CPPUNIT_TEST( testCoordsys );
+  CPPUNIT_TEST( testDebug );
+  CPPUNIT_TEST( testDimension );
+  CPPUNIT_TEST( testComm );
+  CPPUNIT_TEST( testInitialize );
+
+  CPPUNIT_TEST_SUITE_END();
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Test constructor.
+  void testConstructor(void);
+
+  /// Test constructor w/mesh.
+  void testConstructorMesh(void);
+
+  /// Test sieveMesh().
+  void testSieveMesh(void);
+
+  /// Test createSubMesh.
+  void testCreateSubMesh(void);
+
+  /// Test coordsys().
+  void testCoordsys(void);
+
+  /// Test debug().
+  void testDebug(void);
+
+  /// Test dimension().
+  void testDimension(void);
+
+  /// Test comm().
+  void testComm(void);
+
+  /// Test initialize().
+  void testInitialize(void);
+
+// PRIVATE METHODS /////////////////////////////////////////////////////
+private :
+
+  /** Build mesh.
+   *
+   * @param mesh Finite-element mesh.
+   */
+  void _buildMesh(Mesh* mesh);
+
+}; // class TestSubMesh
+
+#endif // pylith_topology_testsubmesh_hh
+
+
+// End of file 



More information about the CIG-COMMITS mailing list