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

brad at geodynamics.org brad at geodynamics.org
Mon May 7 17:14:07 PDT 2007


Author: brad
Date: 2007-05-07 17:14:07 -0700 (Mon, 07 May 2007)
New Revision: 6797

Added:
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOCubit.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOCubit.hh
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitHex.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitHex.hh
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitTet.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitTet.hh
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/twohex8.cub
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/twohex8.exo
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/twotet4.cub
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/twotet4.exo
Modified:
   short/3D/PyLith/trunk/NEWS
   short/3D/PyLith/trunk/configure.ac
   short/3D/PyLith/trunk/libsrc/Makefile.am
   short/3D/PyLith/trunk/libsrc/meshio/MeshIOCubit.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.hh
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOAscii.cc
Log:
Added unit tests for importing Cubit Exodus files. Fixed bugs in C++ implementation of importing Exodus files.

Modified: short/3D/PyLith/trunk/NEWS
===================================================================
--- short/3D/PyLith/trunk/NEWS	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/NEWS	2007-05-08 00:14:07 UTC (rev 6797)
@@ -3,22 +3,14 @@
 Please report bugs at <http://geodynamics.org/roundup>.
 Send questions to cig-short at geodynamics.org.
 
-
 Version 0.8.0
 
 * This first version of PyLith is a direct descendant of Lithomop and
   marks the first version that runs in parallel.  The code now uses
   the PETSc Sieve package.
 
-
 Version 0.7.2
 
 * Lithomop3d now uses the GNU Build System (Autoconf, Automake, and
   Libtool).  See the file INSTALL for building and installation
   instructions.
-
-
-Local variables:
-version-control: never
-mode: indented-text
-end:

Modified: short/3D/PyLith/trunk/configure.ac
===================================================================
--- short/3D/PyLith/trunk/configure.ac	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/configure.ac	2007-05-08 00:14:07 UTC (rev 6797)
@@ -192,6 +192,7 @@
 		unittests/libtests/materials/Makefile
 		unittests/libtests/materials/data/Makefile
 		unittests/libtests/meshio/Makefile
+		unittests/libtests/meshio/data/Makefile
 		unittests/pytests/Makefile
 		unittests/pytests/faults/Makefile
 		unittests/pytests/faults/data/Makefile

Modified: short/3D/PyLith/trunk/libsrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/libsrc/Makefile.am	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/libsrc/Makefile.am	2007-05-08 00:14:07 UTC (rev 6797)
@@ -65,7 +65,6 @@
 	meshio/MeshIOCubit.cc
 endif
 
-
 INCLUDES = -I$(top_builddir)/include
 INCLUDES += $(PETSC_INCLUDE)
 

Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIOCubit.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIOCubit.cc	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIOCubit.cc	2007-05-08 00:14:07 UTC (rev 6797)
@@ -16,7 +16,7 @@
 
 #include "pylith/utils/array.hh" // USES double_array, int_array, string_vector
 
-#include "journal/info.h" // USES journal::info_t
+//#include "journal/info.h" // USES journal::info_t
 
 #include <netcdfcpp.h> // USES netcdf
 
@@ -115,13 +115,13 @@
   assert(0 != numVertices);
   assert(0 != numDims);
 
-  journal::info_t info("meshiocubit");
+  //journal::info_t info("meshiocubit");
     
   NcDim* num_nodes = ncfile.get_dim("num_nodes");
   if (0 == num_nodes)
     throw std::runtime_error("Could not get dimension 'num_nodes'.");
   *numVertices = num_nodes->size();
-  info << "Reading " << *numVertices << " vertices." << journal::endl;
+  //info << "Reading " << *numVertices << " vertices." << journal::endl;
 
   NcVar* coord = ncfile.get_var("coord");
   if (0 == coord)
@@ -137,12 +137,18 @@
   *numDims = space_dim->size();
 
   assert((*numVertices)*(*numDims) == size);
-  coordinates->resize(size);
   long* counts = coord->edges();
-  bool ok = coord->get(&(*coordinates)[0], counts);
+  double_array buffer(size);
+  bool ok = coord->get(&buffer[0], counts);
   delete[] counts; counts = 0;
   if (!ok)
     throw std::runtime_error("Could not get coordinate values.");
+
+  coordinates->resize(size);
+  for (int iVertex=0; iVertex < *numVertices; ++iVertex)
+    for (int iDim=0; iDim < *numDims; ++iDim)
+      (*coordinates)[iVertex*(*numDims)+iDim] = 
+	buffer[iDim*(*numVertices)+iVertex];
 } // _readVertices
 
 // ----------------------------------------------------------------------
@@ -159,7 +165,7 @@
   assert(0 != numCells);
   assert(0 != numCorners);
 
-  journal::info_t info("meshiocubit");
+  //journal::info_t info("meshiocubit");
 
   NcDim* num_elem = ncfile.get_dim("num_elem");
   if (0 == num_elem)
@@ -170,8 +176,8 @@
     throw std::runtime_error("Could not get dimension 'num_el_blk'.");
   const int numMaterials = num_el_blk->size();
 
-  info << "Reading " << numCells << " cells in " << numMaterials 
-       << " blocks." << journal::endl;
+  //info << "Reading " << numCells << " cells in " << numMaterials 
+  //     << " blocks." << journal::endl;
 
   NcVar* eb_prop1 = ncfile.get_var("eb_prop1");
   if (0 == eb_prop1) 
@@ -220,11 +226,12 @@
       throw std::runtime_error("Could not get cell values.");
 	
     for (int i=0; i < blockSize; ++i)
-      materialIds[index+i] = blockIds[iMaterial];
+      (*materialIds)[index+i] = blockIds[iMaterial];
     
     index += blockSize;
   } // for
-  cells -= 1; // use zero index
+
+  *cells -= 1; // use zero index
 } // _readCells
 
 // ----------------------------------------------------------------------
@@ -232,13 +239,13 @@
 void
 pylith::meshio::MeshIOCubit::_readGroups(NcFile& ncfile)
 { // _readGroups
-  journal::info_t info("meshiocubit");
+  //journal::info_t info("meshiocubit");
 
   NcDim* num_node_sets = ncfile.get_dim("num_node_sets");
   if (0 == num_node_sets)
     throw std::runtime_error("Could not get dimension 'num_node_sets'.");
   const int numGroups = num_node_sets->size();
-  info << "Found " << numGroups << " node sets." << journal::endl;
+  //info << "Found " << numGroups << " node sets." << journal::endl;
       
   NcVar* ns_prop1 = ncfile.get_var("ns_prop1");
   if (0 == ns_prop1) 
@@ -257,8 +264,8 @@
     if (0 == node_ns)
       throw std::runtime_error("Could not get node set.");
     const int size = node_ns->num_vals();
-    info << "Reading node set " << ids[iGroup] << " with "
-	 << size << " nodes." << journal::endl;
+    //info << "Reading node set " << ids[iGroup] << " with "
+    //<< size << " nodes." << journal::endl;
 
     points.resize(size);
     long* counts = node_ns->edges();
@@ -267,10 +274,12 @@
     if (!ok)
       throw std::runtime_error("Could not get node set.");
     std::sort(&points[0], &points[size]);
+    points -= 1; // use zero index
 
     GroupPtType type = VERTEX;
-    std::string name = "";
-    _setGroup(name, type, points);
+    std::ostringstream name;
+    name << ids[iGroup];
+    _setGroup(name.str().c_str(), type, points);
   } // for  
 } // _readGroups
 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am	2007-05-08 00:14:07 UTC (rev 6797)
@@ -13,6 +13,8 @@
 subpackage = meshio
 include $(top_srcdir)/subpackage.am
 
+SUBDIRS = data
+
 TESTS = testmeshio
 
 check_PROGRAMS = testmeshio
@@ -21,11 +23,13 @@
 testmeshio_SOURCES = \
 	TestMeshIO.cc \
 	TestMeshIOAscii.cc \
+	TestMeshIOCubit.cc \
 	test_meshio.cc
 
 noinst_HEADERS = \
 	TestMeshIO.hh \
-	TestMeshIOAscii.hh
+	TestMeshIOAscii.hh \
+	TestMeshIOCubit.hh
 
 # Source files associated with testing data
 testmeshio_SOURCES += \
@@ -35,7 +39,9 @@
 	data/MeshData1Din2D.cc \
 	data/MeshData2D.cc \
 	data/MeshData2Din3D.cc \
-	data/MeshData3D.cc
+	data/MeshData3D.cc \
+	data/MeshDataCubitHex.cc \
+	data/MeshDataCubitTet.cc
 
 noinst_HEADERS += \
 	data/MeshData.hh \
@@ -44,9 +50,11 @@
 	data/MeshData1Din2D.hh \
 	data/MeshData2D.hh \
 	data/MeshData2Din3D.hh \
-	data/MeshData3D.hh
+	data/MeshData3D.hh \
+	data/MeshDataCubitHex.hh \
+	data/MeshDataCubitTet.hh
 
-testmeshio_LDFLAGS = $(PETSC_LIB)
+testmeshio_LDFLAGS = $(PETSC_LIB) $(PYTHON_BLDLIBRARY)
 
 AM_CPPFLAGS = $(PETSC_SIEVE_FLAGS) $(PETSC_INCLUDE)
 
@@ -54,6 +62,11 @@
 	-lcppunit -ldl \
 	$(top_builddir)/libsrc/libpylith.la
 
+if ENABLE_CUBIT
+  testmeshio_LDADD += -lnetcdf_c++ -lnetcdf
+endif
+
+
 noinst_tmp = \
 	mesh1D.txt \
 	mesh1Din2D.txt \

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.cc	2007-05-08 00:14:07 UTC (rev 6797)
@@ -26,8 +26,8 @@
 // ----------------------------------------------------------------------
 // Get simple mesh for testing I/O.
 ALE::Obj<ALE::Mesh>*
-pylith::meshio::TestMeshIO::createMesh(const MeshData& data)
-{ // createMesh
+pylith::meshio::TestMeshIO::_createMesh(const MeshData& data)
+{ // _createMesh
   // buildTopology() requires zero based index
   CPPUNIT_ASSERT(true == data.useIndexZero);
 
@@ -93,14 +93,14 @@
   } // for
 
   return mesh;
-} // createMesh
+} // _createMesh
 
 // ----------------------------------------------------------------------
 // Check values in mesh against data.
 void
-pylith::meshio::TestMeshIO::checkVals(const ALE::Obj<Mesh>& mesh,
-				      const MeshData& data)
-{ // checkVals
+pylith::meshio::TestMeshIO::_checkVals(const ALE::Obj<Mesh>& mesh,
+				       const MeshData& data)
+{ // _checkVals
   // Check mesh dimension
   CPPUNIT_ASSERT_EQUAL(data.cellDim, mesh->getDimension());
 
@@ -109,6 +109,8 @@
   const ALE::Obj<Mesh::real_section_type>& coordsField =
     mesh->getRealSection("coordinates");
   const int numVertices = vertices->size();
+  CPPUNIT_ASSERT(!vertices.isNull());
+  CPPUNIT_ASSERT(!coordsField.isNull());
   CPPUNIT_ASSERT_EQUAL(data.numVertices, numVertices);
   CPPUNIT_ASSERT_EQUAL(data.spaceDim, 
 		       coordsField->getFiberDimension(*vertices->begin()));
@@ -120,6 +122,7 @@
       ++v_iter) {
     const Mesh::real_section_type::value_type *vertexCoords = 
       coordsField->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) {
@@ -198,13 +201,13 @@
     for (int i=0; i < numPoints; ++i)
       CPPUNIT_ASSERT_EQUAL(data.groups[index++], points[i]);
   } // for
-} // checkVals
+} // _checkVals
 
 // ----------------------------------------------------------------------
 // Test debug()
 void
 pylith::meshio::TestMeshIO::_testDebug(MeshIO& iohandler)
-{ // testDebug
+{ // _testDebug
   bool debug = false;
   iohandler.debug(debug);
   CPPUNIT_ASSERT_EQUAL(debug, iohandler.debug());
@@ -212,13 +215,13 @@
   debug = true;
   iohandler.debug(debug);
   CPPUNIT_ASSERT_EQUAL(debug, iohandler.debug());  
-} // testDebug
+} // _testDebug
 
 // ----------------------------------------------------------------------
 // Test interpolate()
 void
 pylith::meshio::TestMeshIO::_testInterpolate(MeshIO& iohandler)
-{ // testInterpolate
+{ // _testInterpolate
   bool interpolate = false;
   iohandler.interpolate(interpolate);
   CPPUNIT_ASSERT_EQUAL(interpolate, iohandler.interpolate());
@@ -226,7 +229,7 @@
   interpolate = true;
   iohandler.interpolate(interpolate);
   CPPUNIT_ASSERT_EQUAL(interpolate, iohandler.interpolate());  
-} // testInterpolate
+} // _testInterpolate
 
 
 // End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.hh	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIO.hh	2007-05-08 00:14:07 UTC (rev 6797)
@@ -39,8 +39,8 @@
 class pylith::meshio::TestMeshIO : public CppUnit::TestFixture
 { // class TestMeshIO
 
-  // PUBLIC METHODS /////////////////////////////////////////////////////
-public :
+// PROTECTED METHODS ////////////////////////////////////////////////////
+protected :
 
   /** Get simple mesh for testing I/O.
    *
@@ -48,19 +48,16 @@
    *
    * @returns PETSc mesh
    */
-  ALE::Obj<ALE::Mesh>* createMesh(const MeshData& data);
+  ALE::Obj<ALE::Mesh>* _createMesh(const MeshData& data);
 
   /** Check values in mesh against data.
    *
    * @param mesh PETSc mesh
    * @param data Mesh data
    */
-  void checkVals(const ALE::Obj<ALE::Mesh>& mesh,
-		 const MeshData& data);
+  void _checkVals(const ALE::Obj<ALE::Mesh>& mesh,
+		  const MeshData& data);
 
-  // PROTECTED METHODS //////////////////////////////////////////////////
-protected :
-
   /** Test debug().
    *
    * @param iohandler MeshIO object.

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOAscii.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOAscii.cc	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOAscii.cc	2007-05-08 00:14:07 UTC (rev 6797)
@@ -132,7 +132,7 @@
 pylith::meshio::TestMeshIOAscii::_testWriteRead(const MeshData& data,
 						const char* filename)
 { // _testWriteRead
-  ALE::Obj<Mesh>* meshOut = createMesh(data);
+  ALE::Obj<Mesh>* meshOut = _createMesh(data);
 
   // Write mesh
   MeshIOAscii iohandler;
@@ -145,7 +145,7 @@
   iohandler.read(&meshIn);
 
   // Make sure meshIn matches data
-  checkVals(meshIn, data);
+  _checkVals(meshIn, data);
 } // _testWriteRead
 
 // End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOCubit.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOCubit.cc	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOCubit.cc	2007-05-08 00:14:07 UTC (rev 6797)
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestMeshIOCubit.hh" // Implementation of class methods
+
+#include "pylith/meshio/MeshIOCubit.hh"
+
+#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
+
+#include "data/MeshDataCubitTet.hh"
+#include "data/MeshDataCubitHex.hh"
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestMeshIOCubit );
+
+// ----------------------------------------------------------------------
+// Test constructor
+void
+pylith::meshio::TestMeshIOCubit::testConstructor(void)
+{ // testConstructor
+  MeshIOCubit iohandler;
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test debug()
+void
+pylith::meshio::TestMeshIOCubit::testDebug(void)
+{ // testDebug
+  MeshIOCubit iohandler;
+  _testDebug(iohandler);
+} // testDebug
+
+// ----------------------------------------------------------------------
+// Test interpolate()
+void
+pylith::meshio::TestMeshIOCubit::testInterpolate(void)
+{ // testInterpolate
+  MeshIOCubit iohandler;
+  _testInterpolate(iohandler);
+} // testInterpolate
+
+// ----------------------------------------------------------------------
+// Test filename()
+void
+pylith::meshio::TestMeshIOCubit::testFilename(void)
+{ // testFilename
+  MeshIOCubit iohandler;
+
+  const char* filename = "hi.txt";
+  iohandler.filename(filename);
+  CPPUNIT_ASSERT(0 == strcasecmp(filename, iohandler.filename()));
+} // testFilename
+
+// ----------------------------------------------------------------------
+// Test read() for mesh with tetrahedral cells.
+void
+pylith::meshio::TestMeshIOCubit::testReadTet(void)
+{ // testReadTet
+  MeshDataCubitTet data;
+  const char* filename = "data/twotet4.exo";
+  _testRead(data, filename);
+} // testReadTet
+
+// ----------------------------------------------------------------------
+// Test read() for mesh with tetrahedral cells.
+void
+pylith::meshio::TestMeshIOCubit::testReadHex(void)
+{ // testReadHex
+  MeshDataCubitHex data;
+  const char* filename = "data/twohex8.exo";
+  _testRead(data, filename);
+} // testReadHex
+
+// ----------------------------------------------------------------------
+// Build mesh, perform read(), and then check values.
+void
+pylith::meshio::TestMeshIOCubit::_testRead(const MeshData& data,
+					   const char* filename)
+{ // _testRead
+  MeshIOCubit iohandler;
+  iohandler.filename(filename);
+
+  // Read mesh
+  ALE::Obj<Mesh> mesh;
+  iohandler.read(&mesh);
+
+  // Make sure meshIn matches data
+  _checkVals(mesh, data);
+} // _testRead
+
+
+// End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOCubit.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOCubit.hh	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOCubit.hh	2007-05-08 00:14:07 UTC (rev 6797)
@@ -0,0 +1,85 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/meshio/TestMeshIOCubit.hh
+ *
+ * @brief C++ TestMeshIOCubit object
+ *
+ * C++ unit testing for MeshIOCubit.
+ */
+
+#if !defined(pylith_meshio_testmeshiocubit_hh)
+#define pylith_meshio_testmeshiocubit_hh
+
+#include "TestMeshIO.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+  namespace meshio {
+    class TestMeshIOCubit;
+    class MeshData;
+  } // meshio
+} // pylith
+
+/// C++ unit testing for Quadrature1D
+class pylith::meshio::TestMeshIOCubit : public TestMeshIO
+{ // class TestMeshIOCubit
+
+  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+  CPPUNIT_TEST_SUITE( TestMeshIOCubit );
+  CPPUNIT_TEST( testConstructor );
+  CPPUNIT_TEST( testDebug );
+  CPPUNIT_TEST( testInterpolate );
+  CPPUNIT_TEST( testFilename );
+  CPPUNIT_TEST( testReadTet );
+  CPPUNIT_TEST( testReadHex );
+  CPPUNIT_TEST_SUITE_END();
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Test constructor
+  void testConstructor(void);
+
+  /// Test debug()
+  void testDebug(void);
+
+  /// Test interpolate()
+  void testInterpolate(void);
+
+  /// Test filename()
+  void testFilename(void);
+
+  /// Test read() for mesh with tetrahedral cells.
+  void testReadTet(void);
+
+  /// Test read() for mesh with hexahedral cells.
+  void testReadHex(void);
+
+  // PRIVATE METHODS ////////////////////////////////////////////////////
+private :
+
+  /** Perform read() and then check values.
+   *
+   * @param data Mesh data
+   * @param filename Name of mesh file to read
+   */
+  void _testRead(const MeshData& data,
+		 const char* filename);
+
+}; // class TestMeshIOCubit
+
+#endif // pylith_meshio_testmeshiocubit_hh
+
+
+// End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am	2007-05-08 00:14:07 UTC (rev 6797)
@@ -0,0 +1,31 @@
+# -*- Makefile -*-
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+noinst_DATA = \
+	twohex8.exo \
+	twotet4.exo
+
+noinst_TMP =
+
+# 'export' the input files by performing a mock install
+export_datadir = $(top_builddir)/unittests/libtests/meshio/data
+export-data: $(noinst_DATA)
+	for f in $(noinst_DATA); do $(install_sh_DATA) $(srcdir)/$$f $(export_datadir); done
+
+BUILT_SOURCES = export-data
+
+CLEANFILES = \
+	$(export_datadir)/$(noinst_DATA) \
+	$(export_datadir)/$(noinst_TMP)
+
+
+# End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitHex.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitHex.cc	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitHex.cc	2007-05-08 00:14:07 UTC (rev 6797)
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "MeshDataCubitHex.hh"
+
+const int pylith::meshio::MeshDataCubitHex::_numVertices = 12;
+
+const int pylith::meshio::MeshDataCubitHex::_spaceDim = 3;
+
+const int pylith::meshio::MeshDataCubitHex::_numCells = 2;
+
+const int pylith::meshio::MeshDataCubitHex::_cellDim = 3;
+
+const int pylith::meshio::MeshDataCubitHex::_numCorners = 8;
+
+const double pylith::meshio::MeshDataCubitHex::_vertices[] = {
+  -2.0, -1.0,  1.0,
+  -2.0, -1.0, -1.0,
+  -2.0,  1.0, -1.0,
+  -2.0,  1.0,  1.0,
+   0.0, -1.0,  1.0,
+   0.0, -1.0, -1.0,
+   0.0,  1.0, -1.0,
+   0.0,  1.0,  1.0,
+   2.0, -1.0,  1.0,
+   2.0, -1.0, -1.0,
+   2.0,  1.0, -1.0,
+   2.0,  1.0,  1.0
+};
+
+const int pylith::meshio::MeshDataCubitHex::_cells[] = {
+  0,  1,  2,  3,  4,  5,  6,  7,
+  4,  5,  6,  7,  8,  9, 10, 11
+};
+const int pylith::meshio::MeshDataCubitHex::_materialIds[] = {
+  7, 8
+};
+
+const int pylith::meshio::MeshDataCubitHex::_numGroups = 2;
+
+const int pylith::meshio::MeshDataCubitHex::_groupSizes[] = 
+  { 4, 6 };
+
+const int pylith::meshio::MeshDataCubitHex::_groups[] = {
+  8,  9, 10, 11,
+  0,  3,  4,  7,  8, 11
+};
+
+const char* pylith::meshio::MeshDataCubitHex::_groupNames[] = {
+  "2", "4"
+};
+
+const char* pylith::meshio::MeshDataCubitHex::_groupTypes[] = {
+  "vertex", "vertex"
+};
+
+const bool pylith::meshio::MeshDataCubitHex::_useIndexZero = true;
+
+pylith::meshio::MeshDataCubitHex::MeshDataCubitHex(void)
+{ // constructor
+  numVertices = _numVertices;
+  spaceDim = _spaceDim;
+  numCells = _numCells;
+  cellDim = _cellDim;
+  numCorners = _numCorners;
+  vertices = const_cast<double*>(_vertices);
+  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;
+  useIndexZero = _useIndexZero;
+} // constructor
+
+pylith::meshio::MeshDataCubitHex::~MeshDataCubitHex(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitHex.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitHex.hh	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitHex.hh	2007-05-08 00:14:07 UTC (rev 6797)
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_meshdatacubithex_hh)
+#define pylith_meshio_meshdatacubithex_hh
+
+#include "MeshData.hh"
+
+namespace pylith {
+  namespace meshio {
+     class MeshDataCubitHex;
+  } // pylith
+} // meshio
+
+class pylith::meshio::MeshDataCubitHex : public MeshData
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public: 
+
+  /// Constructor
+  MeshDataCubitHex(void);
+
+  /// Destructor
+  ~MeshDataCubitHex(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 int _numCorners; ///< Number of vertices in cell
+
+  static const double _vertices[]; ///< Pointer to coordinates of vertices
+  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 bool _useIndexZero; ///< First vertex is 0 if true, 1 if false
+
+};
+
+#endif // pylith_meshio_meshdatacubithex_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitTet.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitTet.cc	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitTet.cc	2007-05-08 00:14:07 UTC (rev 6797)
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "MeshDataCubitTet.hh"
+
+const int pylith::meshio::MeshDataCubitTet::_numVertices = 5;
+
+const int pylith::meshio::MeshDataCubitTet::_spaceDim = 3;
+
+const int pylith::meshio::MeshDataCubitTet::_numCells = 2;
+
+const int pylith::meshio::MeshDataCubitTet::_cellDim = 3;
+
+const int pylith::meshio::MeshDataCubitTet::_numCorners = 4;
+
+const double pylith::meshio::MeshDataCubitTet::_vertices[] = {
+  -2.0,  0.0,  0.0,
+   0.0, -1.0,  0.0,
+   0.0,  1.0,  0.0,
+   0.0,  0.0,  2.0,
+   2.0,  0.0,  0.0
+};
+
+const int pylith::meshio::MeshDataCubitTet::_cells[] = {
+  0,  1,  2,  3,
+  1,  4,  2,  3
+};
+const int pylith::meshio::MeshDataCubitTet::_materialIds[] = {
+  1, 2
+};
+
+const int pylith::meshio::MeshDataCubitTet::_numGroups = 2;
+
+const int pylith::meshio::MeshDataCubitTet::_groupSizes[] = 
+  { 3, 4 };
+
+const int pylith::meshio::MeshDataCubitTet::_groups[] = {
+  1, 2, 3,
+  0, 1, 2, 4
+};
+
+const char* pylith::meshio::MeshDataCubitTet::_groupNames[] = {
+  "100", "101"
+};
+
+const char* pylith::meshio::MeshDataCubitTet::_groupTypes[] = {
+  "vertex", "vertex"
+};
+
+const bool pylith::meshio::MeshDataCubitTet::_useIndexZero = true;
+
+pylith::meshio::MeshDataCubitTet::MeshDataCubitTet(void)
+{ // constructor
+  numVertices = _numVertices;
+  spaceDim = _spaceDim;
+  numCells = _numCells;
+  cellDim = _cellDim;
+  numCorners = _numCorners;
+  vertices = const_cast<double*>(_vertices);
+  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;
+  useIndexZero = _useIndexZero;
+} // constructor
+
+pylith::meshio::MeshDataCubitTet::~MeshDataCubitTet(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitTet.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitTet.hh	2007-05-07 21:30:13 UTC (rev 6796)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataCubitTet.hh	2007-05-08 00:14:07 UTC (rev 6797)
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_meshdatacubittet_hh)
+#define pylith_meshio_meshdatacubittet_hh
+
+#include "MeshData.hh"
+
+namespace pylith {
+  namespace meshio {
+     class MeshDataCubitTet;
+  } // pylith
+} // meshio
+
+class pylith::meshio::MeshDataCubitTet : public MeshData
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public: 
+
+  /// Constructor
+  MeshDataCubitTet(void);
+
+  /// Destructor
+  ~MeshDataCubitTet(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 int _numCorners; ///< Number of vertices in cell
+
+  static const double _vertices[]; ///< Pointer to coordinates of vertices
+  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 bool _useIndexZero; ///< First vertex is 0 if true, 1 if false
+
+};
+
+#endif // pylith_meshio_meshdatacubittet_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/twohex8.cub
===================================================================
(Binary files differ)


Property changes on: short/3D/PyLith/trunk/unittests/libtests/meshio/data/twohex8.cub
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/twohex8.exo
===================================================================
(Binary files differ)


Property changes on: short/3D/PyLith/trunk/unittests/libtests/meshio/data/twohex8.exo
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/twotet4.cub
===================================================================
(Binary files differ)


Property changes on: short/3D/PyLith/trunk/unittests/libtests/meshio/data/twotet4.cub
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/twotet4.exo
===================================================================
(Binary files differ)


Property changes on: short/3D/PyLith/trunk/unittests/libtests/meshio/data/twotet4.exo
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream



More information about the cig-commits mailing list