[cig-commits] r17210 - in short/3D/PyLith/trunk: . libsrc/topology unittests/libtests/topology unittests/libtests/topology/data

brad at geodynamics.org brad at geodynamics.org
Wed Sep 22 16:22:50 PDT 2010


Author: brad
Date: 2010-09-22 16:22:50 -0700 (Wed, 22 Sep 2010)
New Revision: 17210

Added:
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.hh
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.hh
   short/3D/PyLith/trunk/unittests/libtests/topology/data/fourtri3.mesh
Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/libsrc/topology/RefineUniform.cc
   short/3D/PyLith/trunk/libsrc/topology/RefineUniform.hh
   short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.hh
   short/3D/PyLith/trunk/unittests/libtests/topology/data/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/twotet4.mesh
Log:
Added C++ unit tests for uniform global refinement of tri3 cells. Fixed some additional errors in refinement of tet4 cells with cohesive cells.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2010-09-22 00:14:50 UTC (rev 17209)
+++ short/3D/PyLith/trunk/TODO	2010-09-22 23:22:50 UTC (rev 17210)
@@ -3,11 +3,6 @@
 ======================================================================
 
 * Unform global refinement for tets with faults
-  tet4, level 2
-  Cleanup implementation
-    Cleanup RefineUniform
-    reorder refined cells for optimized looping
-
   tri3, level 2
   hex8, level 2
   quad4, level 2

Modified: short/3D/PyLith/trunk/libsrc/topology/RefineUniform.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/RefineUniform.cc	2010-09-22 00:14:50 UTC (rev 17209)
+++ short/3D/PyLith/trunk/libsrc/topology/RefineUniform.cc	2010-09-22 23:22:50 UTC (rev 17210)
@@ -64,43 +64,6 @@
 { // refine
   assert(0 != newMesh);
 
-  const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-  assert(!sieveMesh.isNull());
-
-  const ALE::Obj<SieveMesh::label_sequence>& cells = 
-    sieveMesh->heightStratum(0);
-  assert(!cells.isNull());
-
-  newMesh->debug(mesh.debug());
-
-  // Assume number of corners per cell is the same for the entire mesh
-  assert(cells->size() > 0);
-  const int cellNumCorners = sieveMesh->getNumCellCorners(*cells->begin());
-
-  if (3 == mesh.dimension() && 4 == cellNumCorners)
-    _refineTet4(newMesh, mesh, levels);
-
-  // TODO: Add other refinement cases here
-
-  else {
-    std::ostringstream msg;
-    msg << "Unknown case for uniform global refinement.\n"
-	<< "mesh dimension: " << mesh.dimension()
-	<< ", number of corners in cell: " << cellNumCorners;
-    throw std::runtime_error(msg.str());
-  } // else
-} // refine
-    
-
-// ----------------------------------------------------------------------
-// Refine tet4 mesh.
-void
-pylith::topology::RefineUniform::_refineTet4(Mesh* const newMesh,
-					     const Mesh& mesh,
-					     const int levels)
-{ // _refineTet4
-  assert(0 != newMesh);
-
   typedef SieveMesh::point_type point_type;
   typedef Edge<point_type> edge_type;
 
@@ -117,7 +80,7 @@
   ALE::MeshBuilder<SieveMesh>::refineGeneral< SieveMesh,
     ALE::MeshBuilder<SieveMesh>::CellRefiner<SieveMesh,edge_type> >(*sieveMesh, *newSieveMesh, refiner);
 
-  // Fix material ids
+  // Set material ids
   const ALE::Obj<SieveMesh::label_sequence>& cells = 
     sieveMesh->heightStratum(0);
   assert(!cells.isNull());
@@ -150,13 +113,14 @@
       newSieveMesh->setValue(newMaterials, *cNew_iter, material);
   } // for
   
-  // Fix groups, assuming vertex groups
+  // Recreate groups, assuming vertex groups
   const int numNewVertices = newSieveMesh->depthStratum(0)->size();
   const int numNewCells = newSieveMesh->heightStratum(0)->size();
   const ALE::Obj<std::set<std::string> >& sectionNames =
     sieveMesh->getIntSections();
   
-  ALE::MeshBuilder<SieveMesh>::CellRefiner<SieveMesh,edge_type>::edge_map_type& edge2vertex = refiner.getEdgeToVertex();
+  ALE::MeshBuilder<SieveMesh>::CellRefiner<SieveMesh,edge_type>::edge_map_type& edge2vertex =
+    refiner.getEdgeToVertex();
 
   const std::set<std::string>::const_iterator namesBegin = 
     sectionNames->begin();
@@ -207,7 +171,7 @@
 	  newGroup->updatePoint(e_iter->second, group->restrictPoint(vertexA));
     } // for
   } // for
-} // _refineTet4
+} // refine
+    
 
-
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/topology/RefineUniform.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/RefineUniform.hh	2010-09-22 00:14:50 UTC (rev 17209)
+++ short/3D/PyLith/trunk/libsrc/topology/RefineUniform.hh	2010-09-22 23:22:50 UTC (rev 17210)
@@ -53,19 +53,6 @@
 	      const Mesh& mesh,
 	      const int levels =2);
 
-// PRIVATE MEMBERS //////////////////////////////////////////////////////
-private :
-
-  /** Refine tet4 mesh.
-   *
-   * @param newMesh Refined mesh (result).
-   * @param mesh Mesh to refine.
-   * @param levels Number of levels to refine.
-   */
-  void _refineTet4(Mesh* const newMesh,
-		   const Mesh& mesh,
-		   const int levels =2);
-
 // NOT IMPLEMENTED //////////////////////////////////////////////////////
 private :
 

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am	2010-09-22 00:14:50 UTC (rev 17209)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am	2010-09-22 23:22:50 UTC (rev 17210)
@@ -58,11 +58,15 @@
 # Source files associated with testing data
 testtopology_SOURCES += \
 	data/MeshDataCohesive.cc \
+	data/MeshDataCohesiveTri3Level2.cc \
+	data/MeshDataCohesiveTri3Level2Fault1.cc \
 	data/MeshDataCohesiveTet4Level2.cc \
 	data/MeshDataCohesiveTet4Level2Fault1.cc
 
 noinst_HEADERS += \
 	data/MeshDataCohesive.hh \
+	data/MeshDataCohesiveTri3Level2.hh \
+	data/MeshDataCohesiveTri3Level2Fault1.hh \
 	data/MeshDataCohesiveTet4Level2.hh \
 	data/MeshDataCohesiveTet4Level2Fault1.hh
 

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.cc	2010-09-22 00:14:50 UTC (rev 17209)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.cc	2010-09-22 23:22:50 UTC (rev 17210)
@@ -28,6 +28,8 @@
 
 #include "pylith/utils/array.hh" // USES int_array
 
+#include "data/MeshDataCohesiveTri3Level2.hh"
+#include "data/MeshDataCohesiveTri3Level2Fault1.hh"
 #include "data/MeshDataCohesiveTet4Level2.hh"
 #include "data/MeshDataCohesiveTet4Level2Fault1.hh"
 
@@ -50,6 +52,24 @@
 } // testConstructor
 
 // ----------------------------------------------------------------------
+// Test refine() with level 2, tri3 cells, and no fault.
+void
+pylith::topology::TestRefineUniform::testRefineTri3Level2(void)
+{ // testRefineTri3Level2
+  MeshDataCohesiveTri3Level2 data;
+  _testRefine(data);
+} // testRefineTri3Level2
+
+// ----------------------------------------------------------------------
+// Test refine() with level 2, tri3 cells, and one fault.
+void
+pylith::topology::TestRefineUniform::testRefineTri3Level2Fault1(void)
+{ // testRefineTri3Level2Fault1
+  MeshDataCohesiveTri3Level2Fault1 data;
+  _testRefine(data);
+} // testRefineTri3Level2Fault1
+
+// ----------------------------------------------------------------------
 // Test refine() with level 2, tet4 cells, and no fault.
 void
 pylith::topology::TestRefineUniform::testRefineTet4Level2(void)
@@ -172,6 +192,7 @@
   const int numCells = cells->size();
   CPPUNIT_ASSERT_EQUAL(data.numCells+data.numCellsCohesive, numCells);
 
+  // Normal cells
   ALE::ISieveVisitor::PointRetriever<SieveMesh::sieve_type> pV(sieve->getMaxConeSize());
   const int offset = numCells;
   SieveMesh::label_sequence::iterator c_iter = cells->begin();
@@ -184,6 +205,7 @@
     for(int p = 0; p < coneSize; ++p, ++i)
       CPPUNIT_ASSERT_EQUAL(data.cells[i], cone[p]-offset);
   } // for
+  // Cohesive cells
   for (int iCell=0, i=0; iCell < data.numCellsCohesive; ++iCell, ++c_iter) {
     pV.clear();
     sieve->cone(*c_iter, pV);

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.hh	2010-09-22 00:14:50 UTC (rev 17209)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.hh	2010-09-22 23:22:50 UTC (rev 17210)
@@ -50,6 +50,9 @@
   CPPUNIT_TEST_SUITE( TestRefineUniform );
 
   CPPUNIT_TEST( testConstructor );
+
+  CPPUNIT_TEST( testRefineTri3Level2 );
+  CPPUNIT_TEST( testRefineTri3Level2Fault1 );
   CPPUNIT_TEST( testRefineTet4Level2 );
   CPPUNIT_TEST( testRefineTet4Level2Fault1 );
 
@@ -61,6 +64,12 @@
   /// Test constructor.
   void testConstructor(void);
 
+  /// Test refine() with level 2, tri3 cells, and no fault.
+  void testRefineTri3Level2(void);
+
+  /// Test refine() with level 2, tri3 cells, and one fault.
+  void testRefineTri3Level2Fault1(void);
+
   /// Test refine() with level 2, tet4 cells, and no fault.
   void testRefineTet4Level2(void);
 

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/Makefile.am	2010-09-22 00:14:50 UTC (rev 17209)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/Makefile.am	2010-09-22 23:22:50 UTC (rev 17210)
@@ -18,6 +18,7 @@
 
 dist_noinst_DATA = \
 	tri3.mesh \
+	fourtri3.mesh \
 	twotet4.mesh
 
 noinst_TMP = 

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.cc	2010-09-22 00:14:50 UTC (rev 17209)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.cc	2010-09-22 23:22:50 UTC (rev 17210)
@@ -57,23 +57,22 @@
 };
 
 const int pylith::topology::MeshDataCohesiveTet4Level2::_cells[] = {
-  1,       8,       5,       7,
-  2,       9,       6,       5,
-  3,      10,       7,       6,
-  0,       8,      10,       9,
-  5,       8,       9,       6,
-  6,       9,      10,       8,
-  7,      10,       8,       6,
-  5,       6,       7,       8,
-  1,      11,       7,       5,
-  3,      12,       6,       7,
-  2,      13,       5,       6,
-  4,      11,      13,      12,
-  7,      11,      12,       6,
-  6,      12,      13,      11,
-  5,      13,      11,       6,
-  7,       6,       5,      11,
-
+  1,   8,  5,  7,
+  5,   6,  7,  8,
+  5,   8,  9,  6,
+  2,   9,  6,  5,
+  7,  10,  8,  6,
+  3,  10,  7,  6,
+  6,   9, 10,  8,
+  0,   8, 10,  9,
+  1,  11,  7,  5,
+  7,   6,  5, 11,
+  7,  11, 12,  6,
+  3,  12,  6,  7,
+  5,  13, 11,  6,
+  2,  13,  5,  6,
+  6,  12, 13, 11,
+  4,  11, 13, 12,
 };
 const int pylith::topology::MeshDataCohesiveTet4Level2::_cellsCohesive[] = {
 };

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.cc	2010-09-22 00:14:50 UTC (rev 17209)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.cc	2010-09-22 23:22:50 UTC (rev 17210)
@@ -41,6 +41,7 @@
 const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_numCornersCohesive = 9;
 
 const double pylith::topology::MeshDataCohesiveTet4Level2Fault1::_vertices[] = {
+  -1.0,  0.0, 0.0,
    0.0, -1.0, 0.0,
    0.0,  0.0, 1.0,
    0.0,  1.0, 0.0,
@@ -51,7 +52,6 @@
    0.0, -1.0, 0.0,
    0.0,  0.0, 1.0,
    0.0,  1.0, 0.0,
-  -1.0,  0.0, 0.0,
    0.0, -0.5, 0.5,
    0.0,  0.5, 0.5,
    0.0,  0.0, 0.0,
@@ -70,28 +70,28 @@
 };
 
 const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_cells[] = {
-   1,  14,  11,  13,
+   1,  14,  11,  13, // original cell 1
+  11,  12,  13,  14,
+  11,  14,  15,  12,
    2,  15,  12,  11,
+  13,  16,  14,  12,
    3,  16,  13,  12,
+  12,  15,  16,  14,
    0,  14,  16,  15,
-  11,  14,  15,  12,
-  12,  15,  16,  14,
-  13,  16,  14,  12,
-  11,  12,  13,  14,
-   5,  20,  17,  19,
+   5,  20,  17,  19, // original cell 2
+  17,  18,  19,  20,
+  17,  20,  21,  18,
    7,  21,  18,  17,
+  19,  22,  20,  18,
    6,  22,  19,  18,
+  18,  21,  22,  20,
    4,  20,  22,  21,
-  17,  20,  21,  18,
-  18,  21,  22,  20,
-  19,  22,  20,  18,
-  17,  18,  19,  20,
 };
 const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_cellsCohesive[] = {
    2,  11,  12,   6,  19,  18,   9,  23,  25,
+  11,  13,  12,  19,  17,  18,  23,  24,  25,
    1,  13,  11,   5,  17,  19,   8,  24,  23,
    3,  12,  13,   7,  18,  17,  10,  25,  24,
-  11,  13,  12,  19,  17,  18,  23,  24,  25,
 };
 const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_materialIds[] = {
   1, 1, 1, 1, 1, 1, 1, 1,

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.cc	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.cc	2010-09-22 23:22:50 UTC (rev 17210)
@@ -0,0 +1,139 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "MeshDataCohesiveTri3Level2.hh"
+
+const char* pylith::topology::MeshDataCohesiveTri3Level2::_filename = 
+  "data/fourtri3.mesh";
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_refineLevel = 2;
+const char* pylith::topology::MeshDataCohesiveTri3Level2::_faultA = 0;
+const char* pylith::topology::MeshDataCohesiveTri3Level2::_faultB = 0;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_numVertices = 13;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_spaceDim = 2;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_numCells = 16;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_numCellsCohesive = 0;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_cellDim = 2;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_numCorners = 3;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_numCornersCohesive = 6;
+
+const double pylith::topology::MeshDataCohesiveTri3Level2::_vertices[] = {
+  -1.0,  0.0,
+   0.0, -1.0,
+   0.0,  0.0,
+   0.0,  1.0,
+   1.0,  0.0,
+  -0.5, -0.5,
+   0.0, -0.5,
+  -0.5,  0.0,
+   0.0,  0.5,
+  -0.5,  0.5,
+   0.5, -0.5,
+   0.5,  0.0,
+   0.5,  0.5,
+};
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_cells[] = {
+   0,  5,  7,
+   5,  6,  7,
+   1,  6,  5,
+   2,  7,  6,
+   2,  8,  7,
+   8,  9,  7,
+   3,  9,  8,
+   0,  7,  9,
+   2,  6, 11,
+   6, 10, 11,
+   1, 10,  6,
+   4, 11, 10,
+   2, 11,  8,
+  11, 12,  8,
+   4, 12, 11,
+   3,  8, 12,
+};
+const int pylith::topology::MeshDataCohesiveTri3Level2::_cellsCohesive[] = {
+};
+const int pylith::topology::MeshDataCohesiveTri3Level2::_materialIds[] = {
+  1, 1, 1, 1, 1, 1, 1, 1,
+  2, 2, 2, 2, 2, 2, 2, 2,
+};
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_numGroups = 4;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_groupSizes[] = {
+  5, 3, 2, 5,
+};
+
+const int pylith::topology::MeshDataCohesiveTri3Level2::_groups[] = {
+  0, 1, 3, 5, 9,
+  1, 4, 10,
+  0, 4,
+  1, 2, 3, 6, 8,
+};
+
+const char* pylith::topology::MeshDataCohesiveTri3Level2::_groupNames[] = {
+  "edge 1",
+  "edge 2",
+  "end points",
+  "fault",
+};
+
+const char* pylith::topology::MeshDataCohesiveTri3Level2::_groupTypes[] = {
+  "vertex", 
+  "vertex",
+  "vertex",
+  "vertex",
+};
+
+pylith::topology::MeshDataCohesiveTri3Level2::MeshDataCohesiveTri3Level2(void)
+{ // constructor
+  filename = const_cast<char*>(_filename);
+  refineLevel = _refineLevel;
+  faultA = const_cast<char*>(_faultA);
+  faultB = const_cast<char*>(_faultB);
+
+  numVertices = _numVertices;
+  spaceDim = _spaceDim;
+  cellDim = _cellDim;
+  numCells = _numCells;
+  numCorners = _numCorners;
+  numCellsCohesive = _numCellsCohesive;
+  numCornersCohesive = _numCornersCohesive;
+  vertices = const_cast<double*>(_vertices);
+  cells = const_cast<int*>(_cells);
+  cellsCohesive = const_cast<int*>(_cellsCohesive);
+  materialIds = const_cast<int*>(_materialIds);
+  groups = const_cast<int*>(_groups);
+  groupSizes = const_cast<int*>(_groupSizes);
+  groupNames = const_cast<char**>(_groupNames);
+  groupTypes = const_cast<char**>(_groupTypes);
+  numGroups = _numGroups;
+} // constructor
+
+pylith::topology::MeshDataCohesiveTri3Level2::~MeshDataCohesiveTri3Level2(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.hh	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2.hh	2010-09-22 23:22:50 UTC (rev 17210)
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_topology_meshdatacohesivetri3level2_hh)
+#define pylith_topology_meshdatacohesivetri3level2_hh
+
+#include "MeshDataCohesive.hh"
+
+namespace pylith {
+  namespace topology {
+     class MeshDataCohesiveTri3Level2;
+  } // pylith
+} // topology
+
+class pylith::topology::MeshDataCohesiveTri3Level2 : public MeshDataCohesive
+{ // MeshDataCohesiveTri3Level2
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public: 
+
+  /// Constructor
+  MeshDataCohesiveTri3Level2(void);
+
+  /// Destructor
+  ~MeshDataCohesiveTri3Level2(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+  static const char* _filename; ///< Filename of mesh file.
+  static const int _refineLevel; ///< Refinement level.
+  static const char* _faultA; ///< Vertex group associated with fault A (0 if no fault).
+  static const char* _faultB; ///< Vertex group associated with fault B (0 if no fault).
+
+  static const int _numVertices; ///< Number of vertices
+  static const int _spaceDim; ///< Number of dimensions in vertex coordinates
+  static const int _cellDim; ///< Number of dimensions associated with cell
+  static const int _numCells; ///< Number of cells
+  static const int _numCorners; ///< Number of vertices in cell
+  static const int _numCellsCohesive; ///< Number of cohesive cells.
+  static const int _numCornersCohesive; ///< Number of vertices in cohesive cell.
+
+  static const double _vertices[]; ///< Pointer to coordinates of vertices
+  static const int _cells[]; ///< Pointer to indices of vertices in cells
+  static const int _cellsCohesive[]; ///< Pointer to indices of vertices in cohseive cells
+  static const int _materialIds[]; ///< Pointer to cell material identifiers
+
+  static const int _groups[]; ///< Groups of points
+  static const int _groupSizes[]; ///< Sizes of groups
+  static const char* _groupNames[]; ///< Array of group names
+  static const char* _groupTypes[]; ///< Array of group types
+  static const int _numGroups; ///< Number of groups
+
+}; // MeshDataCohesiveTri3Level2
+
+#endif // pylith_topology_meshdatacohesivetri3level2_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.cc	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.cc	2010-09-22 23:22:50 UTC (rev 17210)
@@ -0,0 +1,157 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "MeshDataCohesiveTri3Level2Fault1.hh"
+
+const char* pylith::topology::MeshDataCohesiveTri3Level2Fault1::_filename = 
+  "data/fourtri3.mesh";
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_refineLevel = 2;
+const char* pylith::topology::MeshDataCohesiveTri3Level2Fault1::_faultA = 
+  "fault";
+const char* pylith::topology::MeshDataCohesiveTri3Level2Fault1::_faultB = 0;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_numVertices = 23;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_spaceDim = 2;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_numCells = 16;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_numCellsCohesive = 4;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_cellDim = 2;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_numCorners = 3;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_numCornersCohesive = 6;
+
+const double pylith::topology::MeshDataCohesiveTri3Level2Fault1::_vertices[] = {
+  -1.0,  0.0,
+   0.0, -1.0,
+   0.0,  0.0,
+   0.0,  1.0,
+   1.0,  0.0,
+   0.0, -1.0,
+   0.0,  0.0,
+   0.0,  1.0,
+   0.0, -1.0,
+   0.0,  0.0,
+   0.0,  1.0,
+  -0.5, -0.5,
+   0.0, -0.5,
+  -0.5,  0.0,
+   0.0,  0.5,
+  -0.5,  0.5,
+   0.0, -0.5,
+   0.5, -0.5,
+   0.5,  0.0,
+   0.5,  0.5,
+   0.0,  0.5,
+   0.0, -0.5,
+   0.0,  0.5,
+};
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_cells[] = {
+     0, 11, 13,
+    11, 12, 13,
+     1, 12, 11, 
+     2, 13, 12,
+     2, 14, 13, 
+    14, 15, 13, 
+     3, 15, 14, 
+     0, 13, 15, 
+     6, 16, 18, 
+    16, 17, 18, 
+     5, 17, 16, 
+     4, 18, 17, 
+     6, 18, 20, 
+    18, 19, 20, 
+     4, 19, 18, 
+     7, 20, 19, 
+
+};
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_cellsCohesive[] = {
+   1,  12,   5,  16,   8,  21, 
+  12,   2,  16,   6,  21,   9, 
+   2,  14,   6,  20,   9,  22,
+  14,   3,  20,   7,  22,  10, 
+
+};
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_materialIds[] = {
+  1, 1, 1, 1, 1, 1, 1, 1,
+  2, 2, 2, 2, 2, 2, 2, 2,
+  100, 100, 100, 100,
+};
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_numGroups = 4;
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_groupSizes[] = {
+  7, 4, 2, 15,
+};
+
+const int pylith::topology::MeshDataCohesiveTri3Level2Fault1::_groups[] = {
+  0, 1, 3, 5, 7, 11, 15,
+  1, 4, 5, 17,
+  0, 4,
+  1, 2, 3, 5, 6, 7, 8, 9, 10, 12, 14, 16, 20, 21, 22,
+};
+
+const char* pylith::topology::MeshDataCohesiveTri3Level2Fault1::_groupNames[] = {
+  "edge 1",
+  "edge 2",
+  "end points",
+  "fault",
+};
+
+const char* pylith::topology::MeshDataCohesiveTri3Level2Fault1::_groupTypes[] = {
+  "vertex", 
+  "vertex",
+  "vertex",
+  "vertex",
+};
+
+pylith::topology::MeshDataCohesiveTri3Level2Fault1::MeshDataCohesiveTri3Level2Fault1(void)
+{ // constructor
+  filename = const_cast<char*>(_filename);
+  refineLevel = _refineLevel;
+  faultA = const_cast<char*>(_faultA);
+  faultB = const_cast<char*>(_faultB);
+
+  numVertices = _numVertices;
+  spaceDim = _spaceDim;
+  cellDim = _cellDim;
+  numCells = _numCells;
+  numCorners = _numCorners;
+  numCellsCohesive = _numCellsCohesive;
+  numCornersCohesive = _numCornersCohesive;
+  vertices = const_cast<double*>(_vertices);
+  cells = const_cast<int*>(_cells);
+  cellsCohesive = const_cast<int*>(_cellsCohesive);
+  materialIds = const_cast<int*>(_materialIds);
+  groups = const_cast<int*>(_groups);
+  groupSizes = const_cast<int*>(_groupSizes);
+  groupNames = const_cast<char**>(_groupNames);
+  groupTypes = const_cast<char**>(_groupTypes);
+  numGroups = _numGroups;
+} // constructor
+
+pylith::topology::MeshDataCohesiveTri3Level2Fault1::~MeshDataCohesiveTri3Level2Fault1(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.hh	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTri3Level2Fault1.hh	2010-09-22 23:22:50 UTC (rev 17210)
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_topology_meshdatacohesivetri3level2fault1_hh)
+#define pylith_topology_meshdatacohesivetri3level2fault1_hh
+
+#include "MeshDataCohesive.hh"
+
+namespace pylith {
+  namespace topology {
+     class MeshDataCohesiveTri3Level2Fault1;
+  } // pylith
+} // topology
+
+class pylith::topology::MeshDataCohesiveTri3Level2Fault1 : public MeshDataCohesive
+{ // MeshDataCohesiveTri3Level2Fault1
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public: 
+
+  /// Constructor
+  MeshDataCohesiveTri3Level2Fault1(void);
+
+  /// Destructor
+  ~MeshDataCohesiveTri3Level2Fault1(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+  static const char* _filename; ///< Filename of mesh file.
+  static const int _refineLevel; ///< Refinement level.
+  static const char* _faultA; ///< Vertex group associated with fault A (0 if no fault).
+  static const char* _faultB; ///< Vertex group associated with fault B (0 if no fault).
+
+  static const int _numVertices; ///< Number of vertices
+  static const int _spaceDim; ///< Number of dimensions in vertex coordinates
+  static const int _cellDim; ///< Number of dimensions associated with cell
+  static const int _numCells; ///< Number of cells
+  static const int _numCorners; ///< Number of vertices in cell
+  static const int _numCellsCohesive; ///< Number of cohesive cells.
+  static const int _numCornersCohesive; ///< Number of vertices in cohesive cell.
+
+  static const double _vertices[]; ///< Pointer to coordinates of vertices
+  static const int _cells[]; ///< Pointer to indices of vertices in cells
+  static const int _cellsCohesive[]; ///< Pointer to indices of vertices in cohseive cells
+  static const int _materialIds[]; ///< Pointer to cell material identifiers
+
+  static const int _groups[]; ///< Groups of points
+  static const int _groupSizes[]; ///< Sizes of groups
+  static const char* _groupNames[]; ///< Array of group names
+  static const char* _groupTypes[]; ///< Array of group types
+  static const int _numGroups; ///< Number of groups
+
+}; // MeshDataCohesiveTri3Level2Fault1
+
+#endif // pylith_topology_meshdatacohesivetri3level2fault1_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/fourtri3.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/fourtri3.mesh	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/fourtri3.mesh	2010-09-22 23:22:50 UTC (rev 17210)
@@ -0,0 +1,75 @@
+mesh = {
+  dimension = 2
+  use-index-zero = true
+  vertices = {
+    dimension = 2
+    count = 5
+    coordinates = {
+             0     -1.0  0.0
+             1      0.0 -1.0
+             2      0.0  0.0
+             3      0.0  1.0
+             4      1.0  0.0
+    }
+  }
+
+  cells = {
+    count = 4
+    num-corners = 3
+    simplices = {
+             0       0  1  2
+             1       2  3  0
+             2       2  1  4
+             3       2  4  3
+    }
+
+    material-ids = {
+             0   1
+             1   1
+             1   2
+             1   2
+    }
+  }
+
+  group = {
+    name = fault
+    type = vertices
+    count = 3
+    indices = {
+      1
+      2
+      3
+    }
+  }
+
+  group = {
+    name = end points
+    type = vertices
+    count = 2
+    indices = {
+      0
+      4
+    }
+  }
+
+  group = {
+    name = edge 1
+    type = vertices
+    count = 3
+    indices = {
+      0
+      1
+      3
+    }
+  }
+
+  group = {
+    name = edge 2
+    type = vertices
+    count = 2
+    indices = {
+      1
+      4
+    }
+  }
+}

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/twotet4.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/twotet4.mesh	2010-09-22 00:14:50 UTC (rev 17209)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/twotet4.mesh	2010-09-22 23:22:50 UTC (rev 17210)
@@ -1,25 +1,9 @@
-// Global mesh object.
-// This defines a mesh composed of two tetrahedral elements.
 mesh = {
-
-  // This is a 3D mesh.
   dimension = 3
-
-  // We are using zero-indexing (default) rather than one-indexing.
   use-index-zero = true
-
-  // Describe the vertices (nodes) defining the mesh.
   vertices = {
-
-    // The vertices are defined in a 3D coordinate system.
     dimension = 3
-
-    // There are 5 vertices.
     count = 5
-
-    // List the coordinates as:
-    // Vertex number (starting from zero), x-coord, y-coord, z-coord
-    // Use coordinate units that are consistent with the other units used.
     coordinates = {
              0     -1.0  0.0  0.0
              1      0.0 -1.0  0.0
@@ -29,38 +13,19 @@
     }
   }
 
-  // Describe the cells (elements) composing the mesh.
   cells = {
-
-    // There are 2 cells.
     count = 2
-
-    // These are linear tetrahedral cells, so there are 4 corners per cell.
     num-corners = 4
-
-    // List the vertices composing each cell (see manual for ordering).
-    // List the information as:
-    // Cell number (starting from zero), vertex 0, vertex 1, vertex 2, vertex 3
     simplices = {
              0       1  2  3  0
              1       1  3  2  4
     }
-
-    // List the material ID's associated with each cell.
-    // Different ID's may be used to specify a different material type, or
-    // to use a different spatial database for each material ID.
-    // In this example, cells 0 and 1 both are associated with material ID 1.
     material-ids = {
              0   1
              1   2
     }
   }
 
-  // Here we list different groups (cells or vertices) that we want to associate
-  // with a particular name (ID).
-
-  // This group of vertices may be used to define a fault.
-  // There are 3 vertices corresponding to indices 1, 2 and 3.
   group = {
     name = fault
     type = vertices
@@ -72,8 +37,6 @@
     }
   }
 
-  // This group of vertices may be used to specify boundary conditions.
-  // There are 2 vertices corresponding to indices 0 and 4.
   group = {
     name = end points
     type = vertices
@@ -84,8 +47,6 @@
     }
   }
 
-  // This group of vertices may be used to specify boundary conditions.
-  // There are 2 vertices corresponding to indices 0, 1.
   group = {
     name = edge 1
     type = vertices
@@ -96,8 +57,6 @@
     }
   }
 
-  // This group of vertices may be used to specify boundary conditions.
-  // There are 2 vertices corresponding to indices 2, 4.
   group = {
     name = edge 2
     type = vertices



More information about the CIG-COMMITS mailing list