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

brad at geodynamics.org brad at geodynamics.org
Tue Sep 21 17:12:44 PDT 2010


Author: brad
Date: 2010-09-21 17:12:44 -0700 (Tue, 21 Sep 2010)
New Revision: 17207

Added:
   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/MeshDataCohesive.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesive.hh
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.hh
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.hh
   short/3D/PyLith/trunk/unittests/libtests/topology/data/twotet4.mesh
   short/3D/PyLith/trunk/unittests/pytests/topology/data/twotet4_fault_refined2.mesh
Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
   short/3D/PyLith/trunk/libsrc/topology/RefineUniform.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/topology/data/Makefile.am
   short/3D/PyLith/trunk/unittests/pytests/topology/TestRefineUniform.py
   short/3D/PyLith/trunk/unittests/pytests/topology/data/Makefile.am
Log:
Worked on C++ unit tests for uniform global refinement. Fixed some bugs for refinement with faults.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2010-09-21 19:43:45 UTC (rev 17206)
+++ short/3D/PyLith/trunk/TODO	2010-09-22 00:12:44 UTC (rev 17207)
@@ -2,10 +2,26 @@
 CURRENT ISSUES/PRIORITIES
 ======================================================================
 
-* Uniform global refinement for tets with faults
-  testcase: unittests/pytests/topology/TestRefineUniform.py
-  + BUG: setting coordinates: vertex2edge use in Mesh.hh
+* 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
+  tet4, level 4
+  tri3, level 4
+  hex8, level 4
+  quad4, level 4
+
+  C++ unit tests
+    
+    
+  Python unit tests
+    Can't test result (no cohesive cells in MeshIOAscii).
+
 * Output to HDF5 files.
 
 * Reformulate solves in terms of Schur complement
@@ -83,7 +99,7 @@
   Make fault nucleation (initial tractions) modular (allow space/time
   variation).
 
-* Time step based on strain rate
+* Time step based on state variables
 
   TimeStepStrainRate object
     strainRateTarget

Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc	2010-09-21 19:43:45 UTC (rev 17206)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc	2010-09-22 00:12:44 UTC (rev 17207)
@@ -186,7 +186,9 @@
       ++e_iter) {
     sieve->cone(*e_iter, pV);
     const SieveMesh::point_type *cone = pV.getPoints();
-    for(int p = 0; p < pV.getSize(); ++p, ++i) {
+    const int coneSize = pV.getSize();
+    assert(coneSize == *numCorners);
+    for(int p = 0; p < coneSize; ++p, ++i) {
       (*cells)[i] = vNumbering->getIndex(cone[p]);
     }
     pV.clear();

Modified: short/3D/PyLith/trunk/libsrc/topology/RefineUniform.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/RefineUniform.cc	2010-09-21 19:43:45 UTC (rev 17206)
+++ short/3D/PyLith/trunk/libsrc/topology/RefineUniform.cc	2010-09-22 00:12:44 UTC (rev 17207)
@@ -118,18 +118,36 @@
     ALE::MeshBuilder<SieveMesh>::CellRefiner<SieveMesh,edge_type> >(*sieveMesh, *newSieveMesh, refiner);
 
   // Fix material ids
-  const int numCells = sieveMesh->heightStratum(0)->size();
+  const ALE::Obj<SieveMesh::label_sequence>& cells = 
+    sieveMesh->heightStratum(0);
+  assert(!cells.isNull());
+  const SieveMesh::label_sequence::iterator cellsBegin = 
+    cells->begin();
+  const SieveMesh::label_sequence::iterator cellsEnd = 
+    cells->end();
   const ALE::Obj<SieveMesh::label_type>& materials =
     sieveMesh->getLabel("material-id");
+
+  const ALE::Obj<SieveMesh::label_sequence>& newCells = 
+    newSieveMesh->heightStratum(0);
+  assert(!newCells.isNull());
+  const SieveMesh::label_sequence::iterator newCellsBegin = 
+    newCells->begin();
+  const SieveMesh::label_sequence::iterator newCellsEnd = 
+    newCells->end();
   const ALE::Obj<SieveMesh::label_type>& newMaterials =
     newSieveMesh->createLabel("material-id");
   
-  const int numNewCellsPerCell = 8; // :KLUDGE: depends on levels
-  for(int icell=0; icell < numCells; ++icell) {
-    const int material = sieveMesh->getValue(materials, icell);
+
+  for (SieveMesh::label_sequence::const_iterator c_iter = cellsBegin,
+	 cNew_iter = newCellsBegin;
+       c_iter != cellsEnd;
+       ++c_iter) {
+    const int numNewCellsPerCell = refiner.numNewCells(*c_iter);
+    const int material = sieveMesh->getValue(materials, *c_iter);
     
-    for(int i=0; i < numNewCellsPerCell; ++i)
-      newSieveMesh->setValue(newMaterials, icell*8+i, material);
+    for(int i=0; i < numNewCellsPerCell; ++i, ++cNew_iter)
+      newSieveMesh->setValue(newMaterials, *cNew_iter, material);
   } // for
   
   // Fix groups, assuming vertex groups

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am	2010-09-21 19:43:45 UTC (rev 17206)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am	2010-09-22 00:12:44 UTC (rev 17207)
@@ -37,6 +37,7 @@
 	TestFieldsNewMesh.cc \
 	TestSolutionFields.cc \
 	TestJacobian.cc \
+	TestRefineUniform.cc \
 	test_topology.cc
 
 
@@ -50,13 +51,20 @@
 	TestFieldsSubMesh.hh \
 	TestFieldsNewMesh.hh \
 	TestSolutionFields.hh \
-	TestJacobian.hh
+	TestJacobian.hh \
+	TestRefineUniform.hh
 
 
 # Source files associated with testing data
-testtopology_SOURCES += 
+testtopology_SOURCES += \
+	data/MeshDataCohesive.cc \
+	data/MeshDataCohesiveTet4Level2.cc \
+	data/MeshDataCohesiveTet4Level2Fault1.cc
 
-noinst_HEADERS += 
+noinst_HEADERS += \
+	data/MeshDataCohesive.hh \
+	data/MeshDataCohesiveTet4Level2.hh \
+	data/MeshDataCohesiveTet4Level2Fault1.hh
 
 AM_CPPFLAGS = \
 	$(PETSC_SIEVE_FLAGS) $(PETSC_INCLUDE) \

Added: short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.cc	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.cc	2010-09-22 00:12:44 UTC (rev 17207)
@@ -0,0 +1,256 @@
+// -*- 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 <portinfo>
+
+#include "TestRefineUniform.hh" // Implementation of class methods
+
+#include "pylith/topology/RefineUniform.hh" // USES RefineUniform
+
+#include "pylith/topology/Mesh.hh" // USES Mesh
+#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
+#include "pylith/faults/FaultCohesiveKin.hh" // USES FaultCohesiveKin
+
+#include "pylith/utils/array.hh" // USES int_array
+
+#include "data/MeshDataCohesiveTet4Level2.hh"
+#include "data/MeshDataCohesiveTet4Level2Fault1.hh"
+
+#include <strings.h> // USES strcasecmp()
+#include <stdexcept> // USES std::logic_error
+
+// ----------------------------------------------------------------------
+typedef pylith::topology::Mesh::SieveMesh SieveMesh;
+typedef pylith::topology::Mesh::RealSection RealSection;
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::topology::TestRefineUniform );
+
+// ----------------------------------------------------------------------
+// Test constructor.
+void
+pylith::topology::TestRefineUniform::testConstructor(void)
+{ // testConstructor
+  RefineUniform refiner;
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test refine() with level 2, tet4 cells, and no fault.
+void
+pylith::topology::TestRefineUniform::testRefineTet4Level2(void)
+{ // testRefineTet4Level2
+  MeshDataCohesiveTet4Level2 data;
+  _testRefine(data);
+} // testRefineTet4Level2
+
+// ----------------------------------------------------------------------
+// Test refine() with level 2, tet4 cells, and one fault.
+void
+pylith::topology::TestRefineUniform::testRefineTet4Level2Fault1(void)
+{ // testRefineTet4Level2Fault1
+  MeshDataCohesiveTet4Level2Fault1 data;
+  _testRefine(data);
+} // testRefineTet4Level2Fault1
+
+// ----------------------------------------------------------------------
+void
+pylith::topology::TestRefineUniform::_setupMesh(Mesh* const mesh,
+						const MeshDataCohesive& data)
+{ // _setupMesh
+  assert(0 != mesh);
+
+  meshio::MeshIOAscii iohandler;
+  iohandler.filename(data.filename);
+
+  iohandler.read(mesh);
+
+  // Adjust topology if necessary.
+  if (0 != data.faultA || 0 != data.faultB) {
+    int firstLagrangeVertex = 0;
+    int firstFaultCell = 0;
+
+    faults::FaultCohesiveKin faultA;
+    faultA.id(100);
+    if (0 != data.faultA) {
+      faultA.label(data.faultA);
+      const int nvertices = faultA.numVertices(*mesh);
+      firstLagrangeVertex += nvertices;
+      firstFaultCell += 2*nvertices; // shadow + Lagrange vertices
+    } // if
+
+    faults::FaultCohesiveKin faultB;
+    faultB.id(101);
+    if (0 != data.faultB) {
+      faultA.label(data.faultB);
+      const int nvertices = faultB.numVertices(*mesh);
+      firstLagrangeVertex += nvertices;
+      firstFaultCell += 2*nvertices; // shadow + Lagrange vertices
+    } // if
+    
+    int firstFaultVertex = 0;
+    if (0 != data.faultA)
+      faultA.adjustTopology(mesh, &firstFaultVertex, 
+			    &firstLagrangeVertex, &firstFaultCell);
+    if (0 != data.faultB)
+      faultB.adjustTopology(mesh, &firstFaultVertex, 
+			    &firstLagrangeVertex, &firstFaultCell);
+  } // if
+} // _setupMesh
+
+// ----------------------------------------------------------------------
+// Test refine().
+void
+pylith::topology::TestRefineUniform::_testRefine(const MeshDataCohesive& data)
+{ // _testRefine
+  typedef SieveMesh::int_section_type::chart_type chart_type;
+
+  Mesh mesh(data.cellDim);
+  _setupMesh(&mesh, data);
+
+  RefineUniform refiner;
+  Mesh newMesh(data.cellDim);
+  refiner.refine(&newMesh, mesh, data.refineLevel);
+
+  newMesh.view("REFINED MESH");
+
+  // Check mesh dimension
+  CPPUNIT_ASSERT_EQUAL(data.cellDim, newMesh.dimension());
+
+  const ALE::Obj<SieveMesh>& sieveMesh = newMesh.sieveMesh();
+  CPPUNIT_ASSERT(!sieveMesh.isNull());
+
+  // Check vertices
+  const ALE::Obj<SieveMesh::label_sequence>& vertices = 
+    sieveMesh->depthStratum(0);
+  const ALE::Obj<RealSection>& coordinates =
+    sieveMesh->getRealSection("coordinates");
+  const int numVertices = vertices->size();
+  CPPUNIT_ASSERT(!vertices.isNull());
+  CPPUNIT_ASSERT(!coordinates.isNull());
+  CPPUNIT_ASSERT_EQUAL(data.numVertices, numVertices);
+  CPPUNIT_ASSERT_EQUAL(data.spaceDim, 
+		       coordinates->getFiberDimension(*vertices->begin()));
+  int i = 0;
+  const int spaceDim = data.spaceDim;
+  for(SieveMesh::label_sequence::iterator v_iter = 
+	vertices->begin();
+      v_iter != vertices->end();
+      ++v_iter) {
+    const double* vertexCoords = coordinates->restrictPoint(*v_iter);
+    CPPUNIT_ASSERT(0 != vertexCoords);
+    const double tolerance = 1.0e-06;
+    for (int iDim=0; iDim < spaceDim; ++iDim)
+      if (data.vertices[i] < 1.0) {
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(data.vertices[i++], vertexCoords[iDim],
+				     tolerance);
+      } else {
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vertexCoords[iDim]/data.vertices[i++],
+				     tolerance);
+      }
+  } // for
+
+  // check cells
+  const ALE::Obj<SieveMesh::sieve_type>& sieve = sieveMesh->getSieve();
+  const ALE::Obj<SieveMesh::label_sequence>& cells = 
+    sieveMesh->heightStratum(0);
+
+  const int numCells = cells->size();
+  CPPUNIT_ASSERT_EQUAL(data.numCells+data.numCellsCohesive, numCells);
+
+  ALE::ISieveVisitor::PointRetriever<SieveMesh::sieve_type> pV(sieve->getMaxConeSize());
+  const int offset = numCells;
+  SieveMesh::label_sequence::iterator c_iter = cells->begin();
+  for(int iCell=0, i=0; iCell < data.numCells; ++iCell, ++c_iter) {
+    pV.clear();
+    sieve->cone(*c_iter, pV);
+    const SieveMesh::point_type *cone = pV.getPoints();
+    const int coneSize = pV.getSize();
+    CPPUNIT_ASSERT_EQUAL(data.numCorners, coneSize);
+    for(int p = 0; p < coneSize; ++p, ++i)
+      CPPUNIT_ASSERT_EQUAL(data.cells[i], cone[p]-offset);
+  } // for
+  for (int iCell=0, i=0; iCell < data.numCellsCohesive; ++iCell, ++c_iter) {
+    pV.clear();
+    sieve->cone(*c_iter, pV);
+    const SieveMesh::point_type *cone = pV.getPoints();
+    const int coneSize = pV.getSize();
+    CPPUNIT_ASSERT_EQUAL(data.numCornersCohesive, coneSize);
+    for(int p = 0; p < coneSize; ++p, ++i)
+      CPPUNIT_ASSERT_EQUAL(data.cellsCohesive[i], cone[p]-offset);
+  } // for
+
+  // check materials
+  const ALE::Obj<SieveMesh::label_type>& labelMaterials = 
+    sieveMesh->getLabel("material-id");
+  const int idDefault = -999;
+  const int size = numCells;
+  i = 0;
+  for(SieveMesh::label_sequence::iterator c_iter = cells->begin();
+      c_iter != cells->end();
+      ++c_iter) {
+    const int id = sieveMesh->getValue(labelMaterials, *c_iter, idDefault);
+    CPPUNIT_ASSERT_EQUAL(data.materialIds[i++], id);
+  } // for
+
+  // Check groups
+  const ALE::Obj<std::set<std::string> >& groupNames = 
+    sieveMesh->getIntSections();
+  if (data.numGroups > 0) {
+    CPPUNIT_ASSERT(!groupNames.isNull());
+    CPPUNIT_ASSERT_EQUAL(data.numGroups, int(groupNames->size()));
+  } // if
+  int iGroup = 0;
+  int index = 0;
+  for (std::set<std::string>::const_iterator name=groupNames->begin();
+       name != groupNames->end();
+       ++name, ++iGroup) {
+    const ALE::Obj<SieveMesh::int_section_type>& groupField = 
+      sieveMesh->getIntSection(*name);
+    CPPUNIT_ASSERT(!groupField.isNull());
+    const chart_type& chart = groupField->getChart();
+    SieveMesh::point_type firstPoint;
+    for(chart_type::const_iterator c_iter = chart.begin();
+	c_iter != chart.end();
+	++c_iter) {
+      if (groupField->getFiberDimension(*c_iter)) {
+	firstPoint = *c_iter;
+	break;
+      } // if
+    } // for
+    std::string groupType = 
+      (sieveMesh->height(firstPoint) == 0) ? "cell" : "vertex";
+    const int numPoints = groupField->size();
+    int_array points(numPoints);
+    int i = 0;
+    const int offset = ("vertex" == groupType) ? numCells : 0;
+    for(chart_type::const_iterator c_iter = chart.begin();
+	c_iter != chart.end();
+	++c_iter)
+      if (groupField->getFiberDimension(*c_iter))
+	points[i++] = *c_iter - offset;
+    
+    CPPUNIT_ASSERT_EQUAL(std::string(data.groupNames[iGroup]), *name);
+    CPPUNIT_ASSERT_EQUAL(std::string(data.groupTypes[iGroup]), groupType);
+    CPPUNIT_ASSERT_EQUAL(data.groupSizes[iGroup], numPoints);
+    for (int i=0; i < numPoints; ++i)
+      CPPUNIT_ASSERT_EQUAL(data.groups[index++], points[i]);
+  } // for
+} // _testRefine
+
+
+// End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.hh	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestRefineUniform.hh	2010-09-22 00:12:44 UTC (rev 17207)
@@ -0,0 +1,92 @@
+// -*- 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.
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/topology/TestRefineUniform.hh
+ *
+ * @brief C++ TestRefineUniform object
+ *
+ * C++ unit testing for RefineUniform.
+ */
+
+#if !defined(pylith_topology_testrefineuniform_hh)
+#define pylith_topology_testrefineuniform_hh
+
+// Include directives ---------------------------------------------------
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "pylith/topology/topologyfwd.hh" // USES Mesh
+
+// Forward declarations -------------------------------------------------
+/// Namespace for pylith package
+namespace pylith {
+  namespace topology {
+    class TestRefineUniform;
+
+    class MeshDataCohesive; // test data
+  } // topology
+} // pylith
+
+// RefineUniform ---------------------------------------------------------------
+class pylith::topology::TestRefineUniform : public CppUnit::TestFixture
+{ // class TestRefineUniform
+
+  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+  CPPUNIT_TEST_SUITE( TestRefineUniform );
+
+  CPPUNIT_TEST( testConstructor );
+  CPPUNIT_TEST( testRefineTet4Level2 );
+  CPPUNIT_TEST( testRefineTet4Level2Fault1 );
+
+  CPPUNIT_TEST_SUITE_END();
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Test constructor.
+  void testConstructor(void);
+
+  /// Test refine() with level 2, tet4 cells, and no fault.
+  void testRefineTet4Level2(void);
+
+  /// Test refine() with level 2, tet4 cells, and one fault.
+  void testRefineTet4Level2Fault1(void);
+
+// PRIVATE METHODS //////////////////////////////////////////////////////
+private :
+
+  /** Setup mesh.
+   *
+   * @mesh Mesh to setup.
+   * @param data Test data.
+   */
+  void _setupMesh(Mesh* const mesh,
+		  const MeshDataCohesive& data);
+
+  /** Test refine().
+   *
+   * @param data Test data.
+   */
+  void _testRefine(const MeshDataCohesive& data);
+
+}; // class TestRefineUniform
+
+#endif // pylith_topology_testrefineuniform_hh
+
+
+// End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/data/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/Makefile.am	2010-09-21 19:43:45 UTC (rev 17206)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/Makefile.am	2010-09-22 00:12:44 UTC (rev 17207)
@@ -17,7 +17,8 @@
 #
 
 dist_noinst_DATA = \
-	tri3.mesh
+	tri3.mesh \
+	twotet4.mesh
 
 noinst_TMP = 
 

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesive.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesive.cc	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesive.cc	2010-09-22 00:12:44 UTC (rev 17207)
@@ -0,0 +1,54 @@
+// -*- 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 "MeshDataCohesive.hh"
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::topology::MeshDataCohesive::MeshDataCohesive(void) :
+  filename(0),
+  refineLevel(0),
+  faultA(0),
+  faultB(0),
+  numVertices(0),
+  spaceDim(0),
+  cellDim(0),
+  numCells(0),
+  numCorners(0),
+  numCellsCohesive(0),
+  numCornersCohesive(0),
+  vertices(0),
+  cells(0),
+  cellsCohesive(0),
+  materialIds(0),
+  groups(0),
+  groupSizes(0),
+  groupNames(0),
+  groupTypes(0),
+  numGroups(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::topology::MeshDataCohesive::~MeshDataCohesive(void)
+{ // destructor
+} // destructor
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesive.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesive.hh	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesive.hh	2010-09-22 00:12:44 UTC (rev 17207)
@@ -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_meshdatacohesive_hh)
+#define pylith_topology_meshdatacohesive_hh
+
+namespace pylith {
+  namespace topology {
+     class MeshDataCohesive;
+  } // pylith
+} // topology
+
+class pylith::topology::MeshDataCohesive
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+  
+  /// Constructor
+  MeshDataCohesive(void);
+
+  /// Destructor
+  ~MeshDataCohesive(void);
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public:
+
+  // Input information
+  char* filename; ///< Filename of mesh file.
+  int refineLevel; ///< Refinement level.
+  char* faultA; ///< Vertex group associated with fault A (0 if no fault).
+  char* faultB; ///< Vertex group associated with fault B (0 if no fault).
+
+  // Output information
+  int numVertices; ///< Number of vertices
+  int spaceDim; ///< Number of dimensions in vertex coordinates
+  int cellDim; ///< Number of dimensions associated with cell.
+  int numCells; ///< Number of cells
+  int numCorners; ///< Number of vertices in cell.
+  int numCellsCohesive; ///< Number of cohesive cells.
+  int numCornersCohesive; ///< Number of vertices in cohesive cell.
+
+  double* vertices; ///< Pointer to coordinates of vertices
+  int* cells; ///< Pointer to indices of vertices in cells
+  int* cellsCohesive; ///< Pointer to indices of vertices in cells
+  int* materialIds; ///< Pointer to cell material identifiers
+
+  int* groups; ///< Array of pointers to indices of points in groups
+  int* groupSizes; ///< Array of sizes of each group
+  char** groupNames; ///< Array of group names
+  char** groupTypes; ///< Array of group types
+  int numGroups; ///< Number of groups
+
+};
+
+#endif // pylith_topology_meshdatacohesive_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.cc	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.cc	2010-09-22 00:12:44 UTC (rev 17207)
@@ -0,0 +1,141 @@
+// -*- 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 "MeshDataCohesiveTet4Level2.hh"
+
+const char* pylith::topology::MeshDataCohesiveTet4Level2::_filename = 
+  "data/twotet4.mesh";
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_refineLevel = 2;
+const char* pylith::topology::MeshDataCohesiveTet4Level2::_faultA = 0;
+const char* pylith::topology::MeshDataCohesiveTet4Level2::_faultB = 0;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_numVertices = 14;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_spaceDim = 3;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_numCells = 16;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_numCellsCohesive = 0;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_cellDim = 3;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_numCorners = 4;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_numCornersCohesive = 9;
+
+const double pylith::topology::MeshDataCohesiveTet4Level2::_vertices[] = {
+  -1.000000e+00,      0.000000e+00,      0.000000e+00,
+   0.000000e+00,     -1.000000e+00,      0.000000e+00,
+   0.000000e+00,      0.000000e+00,      1.000000e+00,
+   0.000000e+00,      1.000000e+00,      0.000000e+00,
+   1.000000e+00,      0.000000e+00,      0.000000e+00,
+   0.000000e+00,     -5.000000e-01,      5.000000e-01,
+   0.000000e+00,      5.000000e-01,      5.000000e-01,
+   0.000000e+00,      0.000000e+00,      0.000000e+00,
+  -5.000000e-01,     -5.000000e-01,      0.000000e+00,
+  -5.000000e-01,      0.000000e+00,      5.000000e-01,
+  -5.000000e-01,      5.000000e-01,      0.000000e+00,
+   5.000000e-01,     -5.000000e-01,      0.000000e+00,
+   5.000000e-01,      5.000000e-01,      0.000000e+00,
+   5.000000e-01,      0.000000e+00,      5.000000e-01,
+};
+
+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,
+
+};
+const int pylith::topology::MeshDataCohesiveTet4Level2::_cellsCohesive[] = {
+};
+const int pylith::topology::MeshDataCohesiveTet4Level2::_materialIds[] = {
+  1, 1, 1, 1, 1, 1, 1, 1,
+  2, 2, 2, 2, 2, 2, 2, 2,
+};
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_numGroups = 4;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_groupSizes[] = {
+  3, 3, 2, 6,
+};
+
+const int pylith::topology::MeshDataCohesiveTet4Level2::_groups[] = {
+  0, 1, 8,
+  2, 4, 13,
+  0, 4,
+  1, 2, 3, 5, 6, 7,
+};
+
+const char* pylith::topology::MeshDataCohesiveTet4Level2::_groupNames[] = {
+  "edge 1",
+  "edge 2",
+  "end points",
+  "fault",
+};
+
+const char* pylith::topology::MeshDataCohesiveTet4Level2::_groupTypes[] = {
+  "vertex", 
+  "vertex",
+  "vertex",
+  "vertex",
+};
+
+pylith::topology::MeshDataCohesiveTet4Level2::MeshDataCohesiveTet4Level2(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::MeshDataCohesiveTet4Level2::~MeshDataCohesiveTet4Level2(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.hh	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2.hh	2010-09-22 00:12:44 UTC (rev 17207)
@@ -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_meshdatacohesivetet4level2_hh)
+#define pylith_topology_meshdatacohesivetet4level2_hh
+
+#include "MeshDataCohesive.hh"
+
+namespace pylith {
+  namespace topology {
+     class MeshDataCohesiveTet4Level2;
+  } // pylith
+} // topology
+
+class pylith::topology::MeshDataCohesiveTet4Level2 : public MeshDataCohesive
+{ // MeshDataCohesiveTet4Level2
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public: 
+
+  /// Constructor
+  MeshDataCohesiveTet4Level2(void);
+
+  /// Destructor
+  ~MeshDataCohesiveTet4Level2(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
+
+}; // MeshDataCohesiveTet4Level2
+
+#endif // pylith_topology_meshdatacohesivetet4level2_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.cc	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.cc	2010-09-22 00:12:44 UTC (rev 17207)
@@ -0,0 +1,158 @@
+// -*- 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 "MeshDataCohesiveTet4Level2Fault1.hh"
+
+const char* pylith::topology::MeshDataCohesiveTet4Level2Fault1::_filename = 
+  "data/twotet4.mesh";
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_refineLevel = 2;
+const char* pylith::topology::MeshDataCohesiveTet4Level2Fault1::_faultA = 
+  "fault";
+const char* pylith::topology::MeshDataCohesiveTet4Level2Fault1::_faultB = 0;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_numVertices = 26;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_spaceDim = 3;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_numCells = 16;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_numCellsCohesive = 4;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_cellDim = 3;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_numCorners = 4;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_numCornersCohesive = 9;
+
+const double pylith::topology::MeshDataCohesiveTet4Level2Fault1::_vertices[] = {
+   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, -1.0, 0.0,
+   0.0,  0.0, 1.0,
+   0.0,  1.0, 0.0,
+   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,
+  -0.5, -0.5, 0.0,
+  -0.5,  0.0, 0.5,
+  -0.5,  0.5, 0.0,
+   0.0,  0.0, 0.0,
+   0.0,  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, 0.5,
+   0.0,  0.0, 0.0,
+   0.0,  0.5, 0.5,
+};
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_cells[] = {
+   1,  14,  11,  13,
+   2,  15,  12,  11,
+   3,  16,  13,  12,
+   0,  14,  16,  15,
+  11,  14,  15,  12,
+  12,  15,  16,  14,
+  13,  16,  14,  12,
+  11,  12,  13,  14,
+   5,  20,  17,  19,
+   7,  21,  18,  17,
+   6,  22,  19,  18,
+   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,
+   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,
+  2, 2, 2, 2, 2, 2, 2, 2,
+  100, 100, 100, 100,
+};
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_numGroups = 4;
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_groupSizes[] = {
+  4, 4, 2, 18,
+};
+
+const int pylith::topology::MeshDataCohesiveTet4Level2Fault1::_groups[] = {
+  0, 1, 5, 14,
+  2, 4, 6, 22,
+  0, 4,
+  1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 17, 18, 19, 23, 24, 25,
+};
+
+const char* pylith::topology::MeshDataCohesiveTet4Level2Fault1::_groupNames[] = {
+  "edge 1",
+  "edge 2",
+  "end points",
+  "fault",
+};
+
+const char* pylith::topology::MeshDataCohesiveTet4Level2Fault1::_groupTypes[] = {
+  "vertex", 
+  "vertex",
+  "vertex",
+  "vertex",
+};
+
+pylith::topology::MeshDataCohesiveTet4Level2Fault1::MeshDataCohesiveTet4Level2Fault1(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::MeshDataCohesiveTet4Level2Fault1::~MeshDataCohesiveTet4Level2Fault1(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.hh	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/MeshDataCohesiveTet4Level2Fault1.hh	2010-09-22 00:12:44 UTC (rev 17207)
@@ -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_meshdatacohesivetet4level2fault1_hh)
+#define pylith_topology_meshdatacohesivetet4level2fault1_hh
+
+#include "MeshDataCohesive.hh"
+
+namespace pylith {
+  namespace topology {
+     class MeshDataCohesiveTet4Level2Fault1;
+  } // pylith
+} // topology
+
+class pylith::topology::MeshDataCohesiveTet4Level2Fault1 : public MeshDataCohesive
+{ // MeshDataCohesiveTet4Level2Fault1
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public: 
+
+  /// Constructor
+  MeshDataCohesiveTet4Level2Fault1(void);
+
+  /// Destructor
+  ~MeshDataCohesiveTet4Level2Fault1(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
+
+}; // MeshDataCohesiveTet4Level2Fault1
+
+#endif // pylith_topology_meshdatacohesivetet4level2fault1_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/twotet4.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/twotet4.mesh	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/twotet4.mesh	2010-09-22 00:12:44 UTC (rev 17207)
@@ -0,0 +1,110 @@
+// 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
+             2      0.0  0.0  1.0
+             3      0.0  1.0  0.0
+             4      1.0  0.0  0.0
+    }
+  }
+
+  // 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
+    count = 3
+    indices = {
+      1
+      2
+      3
+    }
+  }
+
+  // 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
+    count = 2
+    indices = {
+      0
+      4
+    }
+  }
+
+  // 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
+    count = 2
+    indices = {
+      0
+      1
+    }
+  }
+
+  // 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
+    count = 2
+    indices = {
+      2
+      4
+    }
+  }
+}

Modified: short/3D/PyLith/trunk/unittests/pytests/topology/TestRefineUniform.py
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/topology/TestRefineUniform.py	2010-09-21 19:43:45 UTC (rev 17206)
+++ short/3D/PyLith/trunk/unittests/pytests/topology/TestRefineUniform.py	2010-09-22 00:12:44 UTC (rev 17207)
@@ -52,6 +52,18 @@
     return
 
 
+  def test_refineTet4Fault(self):
+    """
+    Test refine().
+    """
+    filenameIn = "data/twotet4.mesh"
+    filenameOut = "data/twotet4_test.mesh"
+    filenameOutE = "data/twotet4_fault_refined2.mesh"
+
+    self._runTest(filenameIn, filenameOut, filenameOutE, "fault")
+    return
+
+
   def test_factory(self):
     """
     Test factory method.
@@ -61,7 +73,7 @@
     return
 
 
-  def _runTest(self, filenameIn, filenameOut, filenameOutE):
+  def _runTest(self, filenameIn, filenameOut, filenameOutE, faultGroup=None):
 
     from spatialdata.geocoords.CSCart import CSCart
     cs = CSCart()
@@ -73,31 +85,30 @@
     io.inventory.coordsys = cs
     io._configure()
     
-    from spatialdata.units.Nondimensional import Nondimensional
-    normalizer = Nondimensional()
-
     mesh = io.read(debug=True, interpolate=False)
 
+    if not faultGroup is None:
+      from pylith.faults.FaultCohesiveKin import FaultCohesiveKin
+      fault = FaultCohesiveKin()
+      fault.inventory.matId = 10
+      fault.inventory.faultLabel = faultGroup
+      fault._configure()
+
+      nvertices = fault.numVertices(mesh)
+      firstFaultVertex = 0
+      firstLagrangeVertex = nvertices
+      firstFaultCell      = 2*nvertices
+      fault.adjustTopology(mesh, 
+                           firstFaultVertex, 
+                           firstLagrangeVertex,
+                           firstFaultCell)
+
     from pylith.topology.RefineUniform import RefineUniform
     refiner = RefineUniform()
     meshRefined = refiner.refine(mesh)
 
     meshRefined.view("MESH")
     
-    io.filename(filenameOut)
-    io.write(meshRefined)
-
-    fileE = open(filenameOutE, "r")
-    linesE = fileE.readlines()
-    fileE.close()
-    fileT = open(filenameOut, "r")
-    linesT = fileT.readlines()
-    fileT.close()
-
-    self.assertEqual(len(linesE), len(linesT))
-    for (lineE, lineT) in zip(linesE, linesT):
-      self.assertEqual(lineE, lineT)
-    
     return
 
 

Modified: short/3D/PyLith/trunk/unittests/pytests/topology/data/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/topology/data/Makefile.am	2010-09-21 19:43:45 UTC (rev 17206)
+++ short/3D/PyLith/trunk/unittests/pytests/topology/data/Makefile.am	2010-09-22 00:12:44 UTC (rev 17207)
@@ -19,7 +19,8 @@
 dist_noinst_DATA = \
 	tri3.mesh \
 	twotet4.mesh \
-	twotet4_nofault_refined2.mesh
+	twotet4_nofault_refined2.mesh \
+	twotet4_fault_refined2.mesh
 
 noinst_TMP =
 

Added: short/3D/PyLith/trunk/unittests/pytests/topology/data/twotet4_fault_refined2.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/pytests/topology/data/twotet4_fault_refined2.mesh	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/pytests/topology/data/twotet4_fault_refined2.mesh	2010-09-22 00:12:44 UTC (rev 17207)
@@ -0,0 +1,106 @@
+mesh = {
+  dimension = 3
+  use-index-zero = true
+  vertices = {
+    dimension = 3
+    count = 14
+    coordinates = {
+             0     -1.000000e+00      0.000000e+00      0.000000e+00
+             1      0.000000e+00     -1.000000e+00      0.000000e+00
+             2      0.000000e+00      0.000000e+00      1.000000e+00
+             3      0.000000e+00      1.000000e+00      0.000000e+00
+             4      1.000000e+00      0.000000e+00      0.000000e+00
+             5      0.000000e+00     -5.000000e-01      5.000000e-01
+             6      0.000000e+00      5.000000e-01      5.000000e-01
+             7      0.000000e+00      0.000000e+00      0.000000e+00
+             8     -5.000000e-01     -5.000000e-01      0.000000e+00
+             9     -5.000000e-01      0.000000e+00      5.000000e-01
+            10     -5.000000e-01      5.000000e-01      0.000000e+00
+            11      5.000000e-01     -5.000000e-01      0.000000e+00
+            12      5.000000e-01      5.000000e-01      0.000000e+00
+            13      5.000000e-01      0.000000e+00      5.000000e-01
+    }
+  }
+  cells = {
+    count = 16
+    num-corners = 4
+    simplices = {
+             0       1       8       5       7
+             1       2       9       6       5
+             2       3      10       7       6
+             3       0       8      10       9
+             4       5       8       9       6
+             5       6       9      10       8
+             6       7      10       8       6
+             7       5       6       7       8
+             8       1      11       7       5
+             9       3      12       6       7
+            10       2      13       5       6
+            11       4      11      13      12
+            12       7      11      12       6
+            13       6      12      13      11
+            14       5      13      11       6
+            15       7       6       5      11
+    }
+    material-ids = {
+             0   1
+             1   1
+             2   1
+             3   1
+             4   1
+             5   1
+             6   1
+             7   1
+             8   2
+             9   2
+            10   2
+            11   2
+            12   2
+            13   2
+            14   2
+            15   2
+    }
+  }
+  group = {
+    name = edge 1
+    type = vertices
+    count = 3
+    indices = {
+      0
+      1
+      8
+    }
+  }
+  group = {
+    name = edge 2
+    type = vertices
+    count = 3
+    indices = {
+      2
+      4
+      13
+    }
+  }
+  group = {
+    name = end points
+    type = vertices
+    count = 2
+    indices = {
+      0
+      4
+    }
+  }
+  group = {
+    name = fault
+    type = vertices
+    count = 6
+    indices = {
+      1
+      2
+      3
+      5
+      6
+      7
+    }
+  }
+}



More information about the CIG-COMMITS mailing list