[cig-commits] r6597 - in short/3D/PyLith/trunk: . libsrc/meshio unittests/libtests/faults unittests/libtests/faults/data unittests/libtests/meshio

brad at geodynamics.org brad at geodynamics.org
Wed Apr 18 15:53:04 PDT 2007


Author: brad
Date: 2007-04-18 15:53:04 -0700 (Wed, 18 Apr 2007)
New Revision: 6597

Added:
   short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData.hh
   short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData1D.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData1D.hh
   short/3D/PyLith/trunk/unittests/libtests/faults/data/meshLine.txt
   short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTet4A.txt
   short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTri3A.txt
Removed:
   short/3D/PyLith/trunk/unittests/libtests/faults/data/meshLine_orig.txt
   short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTet4A_orig.txt
   short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTri3A_orig.txt
Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh
   short/3D/PyLith/trunk/unittests/libtests/faults/data/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc
Log:
Fixed a couple minor bugs in TestMeshIO (don't need numbering to get cells; only used in MeshIO to insure numbering is consecutive and starts at zero). Setup data objects for testing cohesive elements and implemented testing of mesh after creating cohesive elements.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/TODO	2007-04-18 22:53:04 UTC (rev 6597)
@@ -11,7 +11,6 @@
   Use MeshIOAscii to get mesh information into Python tests?
 
 0. Start implementing faults
-   a. Create Faults object
    b. Add creation of cohesive elements
    c. Start implementing integrator for faults
    d. Create unit tests at C++ level

Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc	2007-04-18 22:53:04 UTC (rev 6597)
@@ -36,7 +36,6 @@
 // Destructor
 pylith::meshio::MeshIO::~MeshIO(void)
 { // destructor
-  assert(0 == _mesh);
 } // destructor
   
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am	2007-04-18 22:53:04 UTC (rev 6597)
@@ -30,9 +30,13 @@
 	TestFault.hh
 
 # Source files associated with testing data
-testfaults_SOURCES +=
+testfaults_SOURCES += \
+	data/CohesiveData.cc \
+	data/CohesiveData1D.cc
 
-noinst_HEADERS +=
+noinst_HEADERS += \
+	data/CohesiveData.hh \
+	data/CohesiveData1D.hh
 
 testfaults_LDFLAGS = $(PETSC_LIB)
 

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc	2007-04-18 22:53:04 UTC (rev 6597)
@@ -14,11 +14,12 @@
 
 #include "TestFaultCohesive.hh" // Implementation of class methods
 
-//#include "data/FaultCohesiveData.hh" // USES FaultCohesiveData
+#include "data/CohesiveData1D.hh" // USES CohesiveData1D
 
 #include "pylith/faults/FaultCohesiveKin.hh" // USES FaultsCohesiveKin
 
 #include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
+#include "pylith/utils/array.hh" // USES int_array
 #include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
 
 #include <stdexcept> // TEMPORARY
@@ -31,21 +32,20 @@
 void
 pylith::faults::TestFaultCohesive::testAdjustTopologyLine(void)
 { // testAdjustTopologyLine
-  // Also have "data/meshTri3A_orig.txt"
-  const char* filename = "data/meshTet4A_orig.txt";
-  _testAdjustTopology(filename);
+  CohesiveData1D data;
+  _testAdjustTopology(data);
 } // testAdjustTopologyLine
 
 // ----------------------------------------------------------------------
 // Test adjustTopology().
 void
-pylith::faults::TestFaultCohesive::_testAdjustTopology(const char* filename)
+pylith::faults::TestFaultCohesive::_testAdjustTopology(const CohesiveData& data)
 { // _testAdjustTopology
   ALE::Obj<ALE::Mesh> mesh;
   meshio::MeshIOAscii iohandler;
-  iohandler.filename(filename);
+  iohandler.filename(data.filename);
   iohandler.debug(true);
-  iohandler.interpolate(true);
+  iohandler.interpolate(false);
   iohandler.read(&mesh);
 
   FaultCohesiveKin fault;
@@ -55,7 +55,102 @@
 
   mesh->view("Mesh");
 
-  throw std::logic_error("Unit test not fully implemented.");
+  CPPUNIT_ASSERT_EQUAL(data.cellDim, mesh->getDimension());
+
+  // Check vertices
+  const ALE::Obj<Mesh::label_sequence>& vertices = mesh->depthStratum(0);
+  const ALE::Obj<Mesh::real_section_type>& coordsField =
+    mesh->getRealSection("coordinates");
+  const int numVertices = vertices->size();
+  CPPUNIT_ASSERT_EQUAL(data.numVertices, numVertices);
+  CPPUNIT_ASSERT_EQUAL(data.spaceDim, 
+		       coordsField->getFiberDimension(*vertices->begin()));
+  int i = 0;
+  const int spaceDim = data.spaceDim;
+  for(Mesh::label_sequence::iterator v_iter = 
+	vertices->begin();
+      v_iter != vertices->end();
+      ++v_iter) {
+    const Mesh::real_section_type::value_type *vertexCoords = 
+      coordsField->restrictPoint(*v_iter);
+    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<sieve_type>& sieve = mesh->getSieve();
+  const ALE::Obj<Mesh::label_sequence>& cells = mesh->heightStratum(0);
+
+  const int numCells = cells->size();
+  CPPUNIT_ASSERT_EQUAL(data.numCells, numCells);
+
+  i = 0;
+  const int offset = numCells;
+  for(Mesh::label_sequence::iterator c_iter = cells->begin();
+      c_iter != cells->end();
+      ++c_iter) {
+    const int numCorners = sieve->nCone(*c_iter, mesh->depth())->size();
+    CPPUNIT_ASSERT_EQUAL(data.numCorners[i], numCorners);
+    const ALE::Obj<sieve_type::traits::coneSequence>& cone = 
+      sieve->cone(*c_iter);
+    for(sieve_type::traits::coneSequence::iterator v_iter = cone->begin();
+	v_iter != cone->end();
+	++v_iter)
+      CPPUNIT_ASSERT_EQUAL(data.cells[i++], *v_iter - offset);
+  } // for
+
+  // check materials
+  const ALE::Obj<Mesh::label_type>& labelMaterials = 
+    mesh->getLabel("material-id");
+  const int idDefault = -999;
+  const int size = numCells;
+  int_array materialIds(size);
+  i = 0;
+  for(Mesh::label_sequence::iterator c_iter = cells->begin();
+      c_iter != cells->end();
+      ++c_iter)
+    materialIds[i++] = mesh->getValue(labelMaterials, *c_iter, idDefault);
+  
+  for (int iCell=0; iCell < numCells; ++iCell)
+    CPPUNIT_ASSERT_EQUAL(data.materialIds[iCell], materialIds[iCell]);
+
+  // Check groups
+  const ALE::Obj<std::set<std::string> >& groupNames = 
+    mesh->getIntSections();
+  int iGroup = 0;
+  int index = 0;
+  for (std::set<std::string>::const_iterator name=groupNames->begin();
+       name != groupNames->end();
+       ++name, ++iGroup) {
+    const ALE::Obj<int_section_type>& groupField = mesh->getIntSection(*name);
+    CPPUNIT_ASSERT(!groupField.isNull());
+    const int_section_type::chart_type& chart = groupField->getChart();
+    const Mesh::point_type firstPoint = *chart.begin();
+    std::string groupType = 
+      (mesh->height(firstPoint) == 0) ? "cell" : "vertex";
+    const int numPoints = chart.size();
+    int_array points(numPoints);
+    int i = 0;
+    const int offset = ("vertex" == groupType) ? numCells : 0;
+    for(int_section_type::chart_type::iterator c_iter = chart.begin();
+	c_iter != chart.end();
+	++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
+  
 } // _testAdjustTopology
 
 // End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh	2007-04-18 22:53:04 UTC (rev 6597)
@@ -30,7 +30,7 @@
   namespace faults {
     class Fault;
     class TestFaultCohesive;
-    class FaultData;
+    class CohesiveData;
   } // faults
 } // pylith
 
@@ -53,7 +53,7 @@
 public :
 
   /// Test adjustTopology().
-  void _testAdjustTopology(const char* filename);
+  void _testAdjustTopology(const CohesiveData& data);
 
 }; // class TestFaultCohesive
 

Added: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData.cc	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData.cc	2007-04-18 22:53:04 UTC (rev 6597)
@@ -0,0 +1,42 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "CohesiveData.hh"
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::faults::CohesiveData::CohesiveData(void) :
+  numVertices(0),
+  spaceDim(0),
+  numCells(0),
+  cellDim(0),
+  vertices(0),
+  numCorners(0),
+  cells(0),
+  materialIds(0),
+  groups(0),
+  groupSizes(0),
+  groupNames(0),
+  groupTypes(0),
+  numGroups(0),
+  filename(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::faults::CohesiveData::~CohesiveData(void)
+{ // destructor
+} // destructor
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData.hh	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData.hh	2007-04-18 22:53:04 UTC (rev 6597)
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_faults_cohesivedata_hh)
+#define pylith_faults_cohesivedata_hh
+
+namespace pylith {
+  namespace faults {
+     class CohesiveData;
+  } // pylith
+} // faults
+
+class pylith::faults::CohesiveData
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+  
+  /// Constructor
+  CohesiveData(void);
+
+  /// Destructor
+  ~CohesiveData(void);
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public:
+
+  int numVertices; ///< Number of vertices
+  int spaceDim; ///< Number of dimensions in vertex coordinates
+  int numCells; ///< Number of cells
+  int cellDim; ///< Number of dimensions associated with cell
+
+  double* vertices; ///< Pointer to coordinates of vertices
+  int* numCorners; ///< Number of vertices in cell
+  int* cells; ///< 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
+
+  char* filename; ///< Filename for input mesh
+};
+
+#endif // pylith_faults_cohesivedata_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData1D.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData1D.cc	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData1D.cc	2007-04-18 22:53:04 UTC (rev 6597)
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "CohesiveData1D.hh"
+
+const int pylith::faults::CohesiveData1D::_numVertices = 3;
+
+const int pylith::faults::CohesiveData1D::_spaceDim = 1;
+
+const int pylith::faults::CohesiveData1D::_numCells = 3;
+
+const int pylith::faults::CohesiveData1D::_cellDim = 1;
+
+const double pylith::faults::CohesiveData1D::_vertices[] = {
+  -1.0,
+   0.0,
+   1.0
+};
+
+const int pylith::faults::CohesiveData1D::_numCorners[] = {
+  2,
+  2,
+  2
+};
+
+const int pylith::faults::CohesiveData1D::_cells[] = {
+       0,  1,
+       3,  2,
+       1,  3,
+};
+
+const int pylith::faults::CohesiveData1D::_materialIds[] = {
+  0,  0,
+  2
+};
+
+const int pylith::faults::CohesiveData1D::_numGroups = 2;
+
+const int pylith::faults::CohesiveData1D::_groupSizes[] = 
+  { 1, 2 };
+
+const int pylith::faults::CohesiveData1D::_groups[] = {
+  1,
+  0, 1
+};
+
+const char* pylith::faults::CohesiveData1D::_groupNames[] = {
+  "fault", "output"
+};
+
+const char* pylith::faults::CohesiveData1D::_groupTypes[] = {
+  "vertex", "vertex"
+};
+
+const char* pylith::faults::CohesiveData1D::_filename = "data/meshLine.txt";
+
+pylith::faults::CohesiveData1D::CohesiveData1D(void)
+{ // constructor
+  numVertices = _numVertices;
+  spaceDim = _spaceDim;
+  numCells = _numCells;
+  cellDim = _cellDim;
+  vertices = const_cast<double*>(_vertices);
+  numCorners = const_cast<int*>(_numCorners);
+  cells = const_cast<int*>(_cells);
+  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;
+  filename = const_cast<char*>(_filename);
+} // constructor
+
+pylith::faults::CohesiveData1D::~CohesiveData1D(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData1D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData1D.hh	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveData1D.hh	2007-04-18 22:53:04 UTC (rev 6597)
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_faults_cohesivedata1d_hh)
+#define pylith_faults_cohesivedata1d_hh
+
+#include "CohesiveData.hh"
+
+namespace pylith {
+  namespace faults {
+     class CohesiveData1D;
+  } // pylith
+} // faults
+
+class pylith::faults::CohesiveData1D : public CohesiveData
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public: 
+
+  /// Constructor
+  CohesiveData1D(void);
+
+  /// Destructor
+  ~CohesiveData1D(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+  static const int _numVertices; ///< Number of vertices
+  static const int _spaceDim; ///< Number of dimensions in vertex coordinates
+  static const int _numCells; ///< Number of cells
+  static const int _cellDim; ///< Number of dimensions associated with cell
+
+  static const double _vertices[]; ///< Pointer to coordinates of vertices
+  static const int _numCorners[]; ///< Number of vertices in cell
+  static const int _cells[]; ///< Pointer to indices of vertices in 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
+
+  static const char* _filename; ///< Filename of input mesh
+};
+
+#endif // pylith_faults_cohesivedata1d_hh
+
+// End of file

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/data/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/Makefile.am	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/Makefile.am	2007-04-18 22:53:04 UTC (rev 6597)
@@ -11,9 +11,9 @@
 #
 
 noinst_DATA = \
-	meshLine_orig.txt \
-	meshTri3A_orig.txt \
-	meshTet4A_orig.txt
+	meshLine.txt \
+	meshTri3A.txt \
+	meshTet4A.txt
 
 noinst_TMP =
 

Copied: short/3D/PyLith/trunk/unittests/libtests/faults/data/meshLine.txt (from rev 6596, short/3D/PyLith/trunk/unittests/libtests/faults/data/meshLine_orig.txt)
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/meshLine_orig.txt	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/meshLine.txt	2007-04-18 22:53:04 UTC (rev 6597)
@@ -0,0 +1,42 @@
+mesh = {
+  dimension = 1
+  use-index-zero = true
+  vertices = {
+    dimension = 1
+    count = 3
+    coordinates = {
+             0     -1.0
+             1      0.0
+             2      1.0
+    }
+  }
+  cells = {
+    count = 2
+    num-corners = 2
+    simplices = {
+             0       0       1
+             1       1       2
+    }
+    material-ids = {
+             0   0
+             1   0
+    }
+  }
+  group = {
+    name = fault
+    type = vertices
+    count = 1
+    indices = {
+      1
+    }
+  }
+  group = {
+    name = output
+    type = vertices
+    count = 2
+    indices = {
+      0
+      1
+    }
+  }
+}

Deleted: short/3D/PyLith/trunk/unittests/libtests/faults/data/meshLine_orig.txt
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/meshLine_orig.txt	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/meshLine_orig.txt	2007-04-18 22:53:04 UTC (rev 6597)
@@ -1,33 +0,0 @@
-mesh = {
-  dimension = 1
-  use-index-zero = true
-  vertices = {
-    dimension = 1
-    count = 3
-    coordinates = {
-             0     -1.0
-             1      0.0
-             2      1.0
-    }
-  }
-  cells = {
-    count = 2
-    num-corners = 2
-    simplices = {
-             0       0       1
-             1       1       2
-    }
-    material-ids = {
-             0   0
-             1   0
-    }
-  }
-  group = {
-    name = fault
-    type = vertices
-    count = 1
-    indices = {
-      1
-    }
-  }
-}

Copied: short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTet4A.txt (from rev 6596, short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTet4A_orig.txt)
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTet4A_orig.txt	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTet4A.txt	2007-04-18 22:53:04 UTC (rev 6597)
@@ -0,0 +1,47 @@
+mesh = {
+  dimension = 3
+  use-index-zero = true
+  vertices = {
+    dimension = 3
+    count = 5
+    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
+    }
+  }
+  cells = {
+    count = 2
+    num-corners = 4
+    simplices = {
+             0       1  2  3  0
+             1       1  3  2  4
+    }
+    material-ids = {
+             0   0
+             1   0
+    }
+  }
+  group = {
+    name = fault
+    type = vertices
+    count = 3
+    indices = {
+      1
+      2
+      3
+    }
+  }
+  group = {
+    name = output
+    type = vertices
+    count = 3
+    indices = {
+      0
+      2
+      3
+    }
+  }
+}

Deleted: short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTet4A_orig.txt
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTet4A_orig.txt	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTet4A_orig.txt	2007-04-18 22:53:04 UTC (rev 6597)
@@ -1,37 +0,0 @@
-mesh = {
-  dimension = 3
-  use-index-zero = true
-  vertices = {
-    dimension = 3
-    count = 5
-    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
-    }
-  }
-  cells = {
-    count = 2
-    num-corners = 4
-    simplices = {
-             0       1  2  3  0
-             1       1  3  2  4
-    }
-    material-ids = {
-             0   0
-             1   0
-    }
-  }
-  group = {
-    name = fault
-    type = vertices
-    count = 3
-    indices = {
-      1
-      2
-      3
-    }
-  }
-}

Copied: short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTri3A.txt (from rev 6596, short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTri3A_orig.txt)
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTri3A_orig.txt	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTri3A.txt	2007-04-18 22:53:04 UTC (rev 6597)
@@ -0,0 +1,45 @@
+mesh = {
+  dimension = 2
+  use-index-zero = true
+  vertices = {
+    dimension = 2
+    count = 4
+    coordinates = {
+             0     -1.0  0.0
+             1      0.0  1.0
+             2      0.0 -1.0
+             3      1.0  0.0
+    }
+  }
+  cells = {
+    count = 2
+    num-corners = 3
+    simplices = {
+             0       0  2  1
+             1       1  2  3
+    }
+    material-ids = {
+             0   0
+             1   0
+    }
+  }
+  group = {
+    name = fault
+    type = vertices
+    count = 2
+    indices = {
+      1
+      2
+    }
+  }
+  group = {
+    name = output
+    type = vertices
+    count = 3
+    indices = {
+      1
+      2
+      3
+    }
+  }
+}

Deleted: short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTri3A_orig.txt
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTri3A_orig.txt	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/meshTri3A_orig.txt	2007-04-18 22:53:04 UTC (rev 6597)
@@ -1,35 +0,0 @@
-mesh = {
-  dimension = 2
-  use-index-zero = true
-  vertices = {
-    dimension = 2
-    count = 4
-    coordinates = {
-             0     -1.0  0.0
-             1      0.0  1.0
-             2      0.0 -1.0
-             2      1.0  0.0
-    }
-  }
-  cells = {
-    count = 2
-    num-corners = 3
-    simplices = {
-             0       0  2  1
-             1       1  2  3
-    }
-    material-ids = {
-             0   0
-             1   0
-    }
-  }
-  group = {
-    name = fault
-    type = vertices
-    count = 2
-    indices = {
-      1
-      2
-    }
-  }
-}

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc	2007-04-18 18:43:47 UTC (rev 6596)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc	2007-04-18 22:53:04 UTC (rev 6597)
@@ -141,10 +141,7 @@
 				      mesh->depth())->size();
   CPPUNIT_ASSERT_EQUAL(data.numCorners, numCorners);
 
-  const ALE::Obj<Mesh::numbering_type>& vNumbering = 
-    mesh->getFactory()->getLocalNumbering(mesh, 0);
-
-  const int offset = (data.useIndexZero) ? 0 : 1;
+  const int offset = (data.useIndexZero) ? numCells : numCells-1;
   i = 0;
   for(Mesh::label_sequence::iterator e_iter = cells->begin();
       e_iter != cells->end();
@@ -154,8 +151,7 @@
     for(sieve_type::traits::coneSequence::iterator c_iter = cone->begin();
 	c_iter != cone->end();
 	++c_iter)
-      CPPUNIT_ASSERT_EQUAL(data.cells[i++], 
-			   vNumbering->getIndex(*c_iter) + offset);
+      CPPUNIT_ASSERT_EQUAL(data.cells[i++], *c_iter-offset);
   } // for
 
   // check materials
@@ -185,24 +181,16 @@
     CPPUNIT_ASSERT(!groupField.isNull());
     const int_section_type::chart_type& chart = groupField->getChart();
     const Mesh::point_type firstPoint = *chart.begin();
-    ALE::Obj<Mesh::numbering_type> numbering;
-    std::string groupType = "";
-    if (mesh->height(firstPoint) == 0) {
-      groupType = "cell";
-      numbering = mesh->getFactory()->getNumbering(mesh, mesh->depth());
-    } else {
-      groupType = "vertex";
-      numbering = mesh->getFactory()->getNumbering(mesh, 0);
-    } // if/else
+    std::string groupType = 
+      (mesh->height(firstPoint) == 0) ? "cell" : "vertex";
     const int numPoints = chart.size();
     int_array points(numPoints);
     int i = 0;
+    const int offset = ("vertex" == groupType) ? numCells : 0;
     for(int_section_type::chart_type::iterator c_iter = chart.begin();
 	c_iter != chart.end();
-	++c_iter) {
-      CPPUNIT_ASSERT(!numbering.isNull());
-      points[i++] = numbering->getIndex(*c_iter);
-    } // for
+	++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);



More information about the cig-commits mailing list