[cig-commits] r6800 - in short/3D/PyLith/trunk: libsrc/meshio
unittests/libtests/meshio unittests/libtests/meshio/data
brad at geodynamics.org
brad at geodynamics.org
Tue May 8 13:37:16 PDT 2007
Author: brad
Date: 2007-05-08 13:37:16 -0700 (Tue, 08 May 2007)
New Revision: 6800
Added:
short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOLagrit.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOLagrit.hh
short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataLagritTet.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataLagritTet.hh
short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2.lagrit
short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_ascii.gmv
short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_ascii.pset
short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_binary.gmv
short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_binary.pset
Modified:
short/3D/PyLith/trunk/libsrc/meshio/GMVFileAscii.cc
short/3D/PyLith/trunk/libsrc/meshio/GMVFileBinary.cc
short/3D/PyLith/trunk/libsrc/meshio/PsetFileAscii.cc
short/3D/PyLith/trunk/libsrc/meshio/PsetFileBinary.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am
Log:
Added unit tests for reading LaGriT GMV and pset files. Fixed bugs in reading LaGriT files. Still need to test on big endian machine.
Modified: short/3D/PyLith/trunk/libsrc/meshio/GMVFileAscii.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/GMVFileAscii.cc 2007-05-08 00:40:01 UTC (rev 6799)
+++ short/3D/PyLith/trunk/libsrc/meshio/GMVFileAscii.cc 2007-05-08 20:37:16 UTC (rev 6800)
@@ -163,6 +163,7 @@
info << "Done." << journal::endl;
} // readVertices
+#include <iostream>
// ----------------------------------------------------------------------
void
pylith::meshio::GMVFileAscii::_readCells(std::ifstream& fin,
@@ -176,6 +177,8 @@
journal::info_t info("gmvfile");
+ *numCorners = 0;
+
fin >> *numCells;
std::string cellString = "";
info << "Reading " << numCells << " cells." << journal::endl;
@@ -184,7 +187,7 @@
int numCornersCur = 0;
fin >> cellStringCur;
fin >> numCornersCur;
- if (0 != numCorners) {
+ if (0 != *numCorners) {
if (cellStringCur != cellString) {
std::ostringstream msg;
msg
@@ -201,8 +204,19 @@
} // if/else
for (int iCorner=0; iCorner < *numCorners; ++iCorner)
fin >> (*cells)[iCell*(*numCorners)+iCorner];
+ fin >> std::ws;
} // for
+ *cells -= 1; // use zero base
+
+ if (cellString == "tet")
+ // reverse order
+ for (int iCell=0; iCell < *numCells; ++iCell) {
+ const int tmp = (*cells)[iCell*(*numCorners)+1];
+ (*cells)[iCell*(*numCorners)+1] = (*cells)[iCell*(*numCorners)+2];
+ (*cells)[iCell*(*numCorners)+2] = tmp;
+ } // for
+
info << "Done." << journal::endl;
} // readCells
Modified: short/3D/PyLith/trunk/libsrc/meshio/GMVFileBinary.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/GMVFileBinary.cc 2007-05-08 00:40:01 UTC (rev 6799)
+++ short/3D/PyLith/trunk/libsrc/meshio/GMVFileBinary.cc 2007-05-08 20:37:16 UTC (rev 6800)
@@ -80,8 +80,9 @@
_readHeader(fin);
- std::string token;
- while (fin >> token) {
+ const int tokenLen = 8;
+ std::string token = BinaryIO::readString(fin, tokenLen);
+ while (!fin.eof() && fin.good()) {
if (token == "nodes")
_readVertices(fin, coordinates, numVertices, spaceDim);
else if (token == "cells")
@@ -92,6 +93,7 @@
_readFlags(fin, *numVertices, *numCells);
else if (token == "material")
_readMaterials(fin, materialIds, *numVertices, *numCells);
+ token = BinaryIO::readString(fin, tokenLen);
} // while
assert(coordinates->size() == (*numVertices) * (*spaceDim));
@@ -174,7 +176,7 @@
(*coordinates)[iVertex*(*spaceDim)+iDim] = buffer[i++];
info << "Done." << journal::endl;
-} // _readNodes
+} // _readVertices
// ----------------------------------------------------------------------
void
@@ -182,7 +184,7 @@
int_array* cells,
int* numCells,
int* numCorners)
-{ // readCells
+{ // _readCells
assert(0 != cells);
assert(0 != numCells);
assert(0 != numCorners);
@@ -223,9 +225,20 @@
} // for
if (_flipEndian)
BinaryIO::swapByteOrder((char*) &(*cells)[0],
- (*numCells)*(*numCorners), sizeof(int));
+ (*numCells)*(*numCorners), sizeof(int));
+
+ *cells -= 1; // use zero base
+
+ if (cellString == "tet")
+ // reverse order
+ for (int iCell=0; iCell < *numCells; ++iCell) {
+ const int tmp = (*cells)[iCell*(*numCorners)+1];
+ (*cells)[iCell*(*numCorners)+1] = (*cells)[iCell*(*numCorners)+2];
+ (*cells)[iCell*(*numCorners)+2] = tmp;
+ } // for
+
info << "Done." << journal::endl;
-} // readCells
+} // _readCells
// ----------------------------------------------------------------------
void
Modified: short/3D/PyLith/trunk/libsrc/meshio/PsetFileAscii.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/PsetFileAscii.cc 2007-05-08 00:40:01 UTC (rev 6799)
+++ short/3D/PyLith/trunk/libsrc/meshio/PsetFileAscii.cc 2007-05-08 20:37:16 UTC (rev 6800)
@@ -135,7 +135,7 @@
journal::info_t info("psetfile");
int size = 0;
- fin >> group->id >> group->name >> size;
+ fin >> group->name >> group->id >> size;
info << "Reading point set '" << group->name << "' with " << size
<< " points." << journal::endl;
@@ -157,7 +157,7 @@
info << "Writing point set '" << group.name << "' with " << size
<< " points." << journal::endl;
- fout << group.id << " " << group.name << " " << size << std::endl;
+ fout << group.name << " " << group.id << " " << size << std::endl;
const int numCols = 10;
for (int i=0, iCol=0; i < size; ++i) {
Modified: short/3D/PyLith/trunk/libsrc/meshio/PsetFileBinary.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/PsetFileBinary.cc 2007-05-08 00:40:01 UTC (rev 6799)
+++ short/3D/PyLith/trunk/libsrc/meshio/PsetFileBinary.cc 2007-05-08 20:37:16 UTC (rev 6800)
@@ -142,11 +142,13 @@
journal::info_t info("psetfile");
+ group->name = BinaryIO::readString(fin, 32);
+
int id = 0;
fin.read((char*) &id, sizeof(int));
if (_flipEndian)
BinaryIO::swapByteOrder((char*) &id, 1, sizeof(id));
- group->name = BinaryIO::readString(fin, 8);
+
int size = 0;
fin.read((char*) &size, sizeof(int));
if (_flipEndian)
@@ -174,13 +176,13 @@
info << "Writing point set '" << group.name << "' with " << size
<< " points." << journal::endl;
+ fout.write((char*) group.name.c_str(), 32);
+
int id = group.id;
if (_flipEndian)
BinaryIO::swapByteOrder((char*) &id, 1, sizeof(id));
fout.write((char*) &id, sizeof(int));
- fout.write((char*) group.name.c_str(), 8);
-
int sizeIO = size;
if (_flipEndian)
BinaryIO::swapByteOrder((char*) &sizeIO, 1, sizeof(sizeIO));
Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am 2007-05-08 00:40:01 UTC (rev 6799)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am 2007-05-08 20:37:16 UTC (rev 6800)
@@ -24,12 +24,14 @@
TestMeshIO.cc \
TestMeshIOAscii.cc \
TestMeshIOCubit.cc \
+ TestMeshIOLagrit.cc \
test_meshio.cc
noinst_HEADERS = \
TestMeshIO.hh \
TestMeshIOAscii.hh \
- TestMeshIOCubit.hh
+ TestMeshIOCubit.hh \
+ TestMeshIOLagrit.hh
# Source files associated with testing data
testmeshio_SOURCES += \
@@ -41,7 +43,8 @@
data/MeshData2Din3D.cc \
data/MeshData3D.cc \
data/MeshDataCubitHex.cc \
- data/MeshDataCubitTet.cc
+ data/MeshDataCubitTet.cc \
+ data/MeshDataLagritTet.cc
noinst_HEADERS += \
data/MeshData.hh \
@@ -52,7 +55,8 @@
data/MeshData2Din3D.hh \
data/MeshData3D.hh \
data/MeshDataCubitHex.hh \
- data/MeshDataCubitTet.hh
+ data/MeshDataCubitTet.hh \
+ data/MeshDataLagritTet.hh
testmeshio_LDFLAGS = $(PETSC_LIB) $(PYTHON_BLDLIBRARY)
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOLagrit.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOLagrit.cc 2007-05-08 00:40:01 UTC (rev 6799)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOLagrit.cc 2007-05-08 20:37:16 UTC (rev 6800)
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestMeshIOLagrit.hh" // Implementation of class methods
+
+#include "pylith/meshio/MeshIOLagrit.hh"
+
+#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
+
+#include "data/MeshDataLagritTet.hh"
+
+#if defined(WORDS_BIGENDIAN)
+#define NATIVE_BIG_ENDIAN
+#else
+#define NATIVE_LITTLE_ENDIAN
+#endif
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestMeshIOLagrit );
+
+// ----------------------------------------------------------------------
+// Test constructor
+void
+pylith::meshio::TestMeshIOLagrit::testConstructor(void)
+{ // testConstructor
+ MeshIOLagrit iohandler;
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test debug()
+void
+pylith::meshio::TestMeshIOLagrit::testDebug(void)
+{ // testDebug
+ MeshIOLagrit iohandler;
+ _testDebug(iohandler);
+} // testDebug
+
+// ----------------------------------------------------------------------
+// Test interpolate()
+void
+pylith::meshio::TestMeshIOLagrit::testInterpolate(void)
+{ // testInterpolate
+ MeshIOLagrit iohandler;
+ _testInterpolate(iohandler);
+} // testInterpolate
+
+// ----------------------------------------------------------------------
+// Test filename()
+void
+pylith::meshio::TestMeshIOLagrit::testFilename(void)
+{ // testFilename
+ MeshIOLagrit iohandler;
+
+ const char* filenameGmv = "hi.txt";
+ const char* filenamePset = "hi2.txt";
+ iohandler.filenameGmv(filenameGmv);
+ iohandler.filenamePset(filenamePset);
+
+ CPPUNIT_ASSERT(0 == strcasecmp(filenameGmv, iohandler.filenameGmv()));
+ CPPUNIT_ASSERT(0 == strcasecmp(filenamePset, iohandler.filenamePset()));
+} // testFilename
+
+// ----------------------------------------------------------------------
+// Test read() for mesh with ASCII files.
+void
+pylith::meshio::TestMeshIOLagrit::testReadTetAscii(void)
+{ // testReadTetAscii
+ MeshDataLagritTet data;
+ const char* filenameGmv = "data/cube2_ascii.gmv";
+ const char* filenamePset = "data/cube2_ascii.pset";
+ _testRead(data, filenameGmv, filenamePset);
+} // testReadTetAscii
+
+// ----------------------------------------------------------------------
+// Test read() for mesh with binary files.
+void
+pylith::meshio::TestMeshIOLagrit::testReadTetBinary(void)
+{ // testReadTetBinary
+ MeshDataLagritTet data;
+ const char* filenameGmv = "data/cube2_binary.gmv";
+ const char* filenamePset = "data/cube2_binary.pset";
+ _testRead(data, filenameGmv, filenamePset);
+} // testReadTetBinary
+
+// ----------------------------------------------------------------------
+// Build mesh, perform read(), and then check values.
+void
+pylith::meshio::TestMeshIOLagrit::_testRead(const MeshData& data,
+ const char* filenameGmv,
+ const char* filenamePset)
+{ // _testRead
+ MeshIOLagrit iohandler;
+ iohandler.filenameGmv(filenameGmv);
+ iohandler.filenamePset(filenamePset);
+
+ // LaGriT file was created on little endian machine, so flip endian if
+ // running test on big endian machine.
+#if defined(NATIVE_LITTLE_ENDIAN)
+ iohandler.flipEndian(false);
+#else
+ iohandler.flipEndian(true);
+#endif
+
+ // 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/TestMeshIOLagrit.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOLagrit.hh 2007-05-08 00:40:01 UTC (rev 6799)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestMeshIOLagrit.hh 2007-05-08 20:37:16 UTC (rev 6800)
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/meshio/TestMeshIOLagrit.hh
+ *
+ * @brief C++ TestMeshIOLagrit object
+ *
+ * C++ unit testing for MeshIOLagrit.
+ */
+
+#if !defined(pylith_meshio_testmeshiolagrit_hh)
+#define pylith_meshio_testmeshiolagrit_hh
+
+#include "TestMeshIO.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace meshio {
+ class TestMeshIOLagrit;
+ class MeshData;
+ } // meshio
+} // pylith
+
+/// C++ unit testing for Quadrature1D
+class pylith::meshio::TestMeshIOLagrit : public TestMeshIO
+{ // class TestMeshIOLagrit
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestMeshIOLagrit );
+ CPPUNIT_TEST( testConstructor );
+ CPPUNIT_TEST( testDebug );
+ CPPUNIT_TEST( testInterpolate );
+ CPPUNIT_TEST( testFilename );
+ CPPUNIT_TEST( testReadTetAscii );
+ CPPUNIT_TEST( testReadTetBinary );
+ 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 ASCII files.
+ void testReadTetAscii(void);
+
+ /// Test read() for mesh with binary files.
+ void testReadTetBinary(void);
+
+ // PRIVATE METHODS ////////////////////////////////////////////////////
+private :
+
+ /** Perform read() and then check values.
+ *
+ * @param data Mesh data
+ * @param filenameGmv Name of mesh GMV file to read
+ * @param filenamePset Name of mesh Pset file to read
+ */
+ void _testRead(const MeshData& data,
+ const char* filenameGmv,
+ const char* filenamePset);
+
+}; // class TestMeshIOLagrit
+
+#endif // pylith_meshio_testmeshiolagrit_hh
+
+
+// End of file
Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am 2007-05-08 00:40:01 UTC (rev 6799)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am 2007-05-08 20:37:16 UTC (rev 6800)
@@ -11,6 +11,10 @@
#
noinst_DATA = \
+ cube2_ascii.gmv \
+ cube2_ascii.pset \
+ cube2_binary.gmv \
+ cube2_binary.pset \
twohex8.exo \
twotet4.exo
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataLagritTet.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataLagritTet.cc 2007-05-08 00:40:01 UTC (rev 6799)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataLagritTet.cc 2007-05-08 20:37:16 UTC (rev 6800)
@@ -0,0 +1,105 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "MeshDataLagritTet.hh"
+
+const int pylith::meshio::MeshDataLagritTet::_numVertices = 12;
+
+const int pylith::meshio::MeshDataLagritTet::_spaceDim = 3;
+
+const int pylith::meshio::MeshDataLagritTet::_numCells = 12;
+
+const int pylith::meshio::MeshDataLagritTet::_cellDim = 3;
+
+const int pylith::meshio::MeshDataLagritTet::_numCorners = 4;
+
+const double pylith::meshio::MeshDataLagritTet::_vertices[] = {
+ 0.00000E+000, -5.00000E-001, -5.00000E-001,
+ 0.00000E+000, -5.00000E-001, 5.00000E-001,
+ 1.00000E+000, -5.00000E-001, -5.00000E-001,
+ 1.00000E+000, -5.00000E-001, 5.00000E-001,
+ 0.00000E+000, 5.00000E-001, -5.00000E-001,
+ 0.00000E+000, 5.00000E-001, 5.00000E-001,
+ 1.00000E+000, 5.00000E-001, -5.00000E-001,
+ 1.00000E+000, 5.00000E-001, 5.00000E-001,
+ -1.00000E+000, -5.00000E-001, -5.00000E-001,
+ -1.00000E+000, -5.00000E-001, 5.00000E-001,
+ -1.00000E+000, 5.00000E-001, -5.00000E-001,
+ -1.00000E+000, 5.00000E-001, 5.00000E-001
+};
+
+const int pylith::meshio::MeshDataLagritTet::_cells[] = {
+ 9, 5, 8, 10,
+ 8, 9, 1, 5,
+ 1, 3, 2, 4,
+ 8, 5, 4, 10,
+ 8, 1, 4, 5,
+ 5, 3, 6, 7,
+ 4, 3, 2, 6,
+ 5, 3, 4, 6,
+ 1, 3, 4, 5,
+ 9, 5, 10, 11,
+ 8, 1, 0, 4,
+ 0, 1, 2, 4
+};
+const int pylith::meshio::MeshDataLagritTet::_materialIds[] = {
+ 2, 2, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1
+};
+
+const int pylith::meshio::MeshDataLagritTet::_numGroups = 7;
+
+const int pylith::meshio::MeshDataLagritTet::_groupSizes[] =
+ { 4, 4, 4, 6, 6, 6, 6 };
+
+const int pylith::meshio::MeshDataLagritTet::_groups[] = {
+ 0, 1, 4, 5,
+ 8, 9, 10, 11,
+ 2, 3, 6, 7,
+ 0, 1, 2, 3, 8, 9,
+ 4, 5, 6, 7, 10, 11,
+ 0, 2, 4, 6, 8, 10,
+ 1, 3, 5, 7, 9, 11
+};
+
+const char* pylith::meshio::MeshDataLagritTet::_groupNames[] = {
+ "fault", "xm", "xp", "ym", "yp", "zm", "zp"
+};
+
+const char* pylith::meshio::MeshDataLagritTet::_groupTypes[] = {
+ "vertex", "vertex", "vertex", "vertex", "vertex", "vertex", "vertex"
+};
+
+const bool pylith::meshio::MeshDataLagritTet::_useIndexZero = true;
+
+pylith::meshio::MeshDataLagritTet::MeshDataLagritTet(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::MeshDataLagritTet::~MeshDataLagritTet(void)
+{}
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataLagritTet.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataLagritTet.hh 2007-05-08 00:40:01 UTC (rev 6799)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/MeshDataLagritTet.hh 2007-05-08 20:37:16 UTC (rev 6800)
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_meshdatalagrittet_hh)
+#define pylith_meshio_meshdatalagrittet_hh
+
+#include "MeshData.hh"
+
+namespace pylith {
+ namespace meshio {
+ class MeshDataLagritTet;
+ } // pylith
+} // meshio
+
+class pylith::meshio::MeshDataLagritTet : public MeshData
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public:
+
+ /// Constructor
+ MeshDataLagritTet(void);
+
+ /// Destructor
+ ~MeshDataLagritTet(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_meshdatalagrittet_hh
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2.lagrit
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2.lagrit 2007-05-08 00:40:01 UTC (rev 6799)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2.lagrit 2007-05-08 20:37:16 UTC (rev 6800)
@@ -0,0 +1,170 @@
+* -*- LaGriT -*-
+*
+* ----------------------------------------------------------------------
+*
+* Brad T. Aagaard
+* U.S. Geological Survey
+*
+* <LicenseText>
+*
+* ----------------------------------------------------------------------
+*
+* Mesh a double cube using tetrahedral elements.
+* (2 cubes with a fault separating them)
+* Domain is 2m x 1m x 1m
+* x: -1.0m to 1.0m
+* y: -0.5m to 0.5m
+* z: -0.5m to 0.5m
+*
+* Domain is constructed with the region command after constructing the
+* boundaries of the domain using the surface command with the plane
+* attribue (construct the 3-D domain from boundary surfaces).
+*
+* ----------------------------------------------------------------------
+* CREATE GEOMETRY
+* ----------------------------------------------------------------------
+*
+* Create a mesh object and name it cubemesh
+cmo / create / cubemesh /
+*
+* Create boundary surfaces.
+surface / surf_xm / reflect / plane / &
+ -1.0 0.0 0.0 / &
+ -1.0 0.0 1.0 / &
+ -1.0 1.0 0.0
+surface / surf_xp / reflect / plane / &
+ 1.0 0.0 0.0 / &
+ 1.0 1.0 0.0 / &
+ 1.0 0.0 1.0
+surface / surf_zp / reflect / plane / &
+ 0.0 0.0 0.5 / &
+ 0.0 1.0 0.5 / &
+ -1.0 1.0 0.5
+surface / surf_zm / reflect / plane / &
+ 0.0 0.0 -0.5 / &
+ -1.0 0.0 -0.5 / &
+ 0.0 1.0 -0.5
+surface / surf_ym / reflect / plane / &
+ 0.0 -0.5 0.0 / &
+ 0.0 -0.5 1.0 / &
+ -1.0 -0.5 0.0
+surface / surf_yp / reflect / plane / &
+ 0.0 0.5 0.0 / &
+ -1.0 0.5 0.0 / &
+ 0.0 0.5 1.0
+*
+* Create fault plane
+surface / surf_fault / intrface / plane / &
+ 0.0 0.0 0.0 / &
+ 0.0 1.0 0.0 / &
+ 0.0 0.0 1.0 /
+*
+* Create regions
+region / region_p / le surf_xp &
+ and ge surf_fault &
+ and le surf_ym &
+ and le surf_yp &
+ and le surf_zm &
+ and le surf_zp /
+region / region_m / lt surf_fault &
+ and le surf_xm &
+ and le surf_ym &
+ and le surf_yp &
+ and le surf_zm &
+ and le surf_zp /
+*
+* Create material regions
+mregion / material_p / le surf_xp &
+ and gt surf_fault &
+ and le surf_ym &
+ and le surf_yp &
+ and le surf_zm &
+ and le surf_zp /
+mregion / material_m / lt surf_fault &
+ and le surf_xm &
+ and le surf_ym &
+ and le surf_yp &
+ and le surf_zm &
+ and le surf_zp /
+*
+* ----------------------------------------------------------------------
+* CREATE MESH
+* ----------------------------------------------------------------------
+*
+define / dx / 1.0
+define / nx / 3
+define / ny / 2
+
+* Create points for ray shooting
+createpts / xyz / nx,ny,1 / &
+ -1.0 -0.5 1.1 / &
+ 1.0 0.5 1.1 / &
+ 1,1,0 /
+pset / rayend / seq / 0,0,0
+regnpts / region_p / dx / pset,get,rayend / xyz / &
+ 0.0 0.0 -1.0 / &
+ 0.0 1.0 -1.0 / &
+ 1.0 0.0 -1.0 / &
+ 0,0
+regnpts / region_m / dx / pset,get,rayend / xyz / &
+ 0.0 0.0 -1.0 / &
+ 0.0 1.0 -1.0 / &
+ 1.0 0.0 -1.0 / &
+ 0,0
+cmo/setatt//itp/pset,get,rayend/dud
+pset / rayend / delete
+*
+* Remove duplicate points
+filter / 1,0,0 / 0.01
+rmpoint / compress
+*
+* Set node type and material
+setpts
+*
+* Connect the points into a Delaunay tetrahedral mesh
+connect
+*
+* Set elements to tetrahedra
+settets / geometry
+resetpts/cell_color
+*
+* Remove parent/child hierarchy
+resetpts
+rmpoint / compress
+*
+* ----------------------------------------------------------------------
+* IDENTIFY GROUPS
+* ----------------------------------------------------------------------
+*
+* Identify nodes on fault surface
+pset / fault / surface / surf_fault /
+pset / fault / list
+*
+* Identify nodes on boundaries
+pset / xm / surface / surf_xm /
+pset / xm / list
+pset / xp / surface / surf_xp /
+pset / xp / list
+pset / ym / surface / surf_ym /
+pset / ym / list
+pset / yp / surface / surf_yp /
+pset / yp / list
+pset / zm / surface / surf_zm /
+pset / zm / list
+pset / zp / surface / surf_zp /
+pset / zp / list
+*
+* ----------------------------------------------------------------------
+* WRITE MESH
+* ----------------------------------------------------------------------
+*
+* Write mesh to file
+cmo / setatt / cubemesh / ipolydat / no
+dump / gmv / cube2_ascii.gmv / / ascii
+dump / gmv / cube2_binary.gmv / / binary
+
+pset / -all- / write / cube2_ascii.pset / ascii
+pset / -all- / write / cube2_binary.pset / binary
+
+* ======================================================================
+finish
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_ascii.gmv
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_ascii.gmv 2007-05-08 00:40:01 UTC (rev 6799)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_ascii.gmv 2007-05-08 20:37:16 UTC (rev 6800)
@@ -0,0 +1,52 @@
+gmvinput ascii
+codename LaGriT
+simdate 05/08/07
+nodes 12
+ 0.00000E+000 0.00000E+000 1.00000E+000 1.00000E+000 0.00000E+000 0.00000E+000 1.00000E+000 1.00000E+000 -1.00000E+000 -1.00000E+000
+ -1.00000E+000 -1.00000E+000
+ -5.00000E-001 -5.00000E-001 -5.00000E-001 -5.00000E-001 5.00000E-001 5.00000E-001 5.00000E-001 5.00000E-001 -5.00000E-001 -5.00000E-001
+ 5.00000E-001 5.00000E-001
+ -5.00000E-001 5.00000E-001 -5.00000E-001 5.00000E-001 -5.00000E-001 5.00000E-001 -5.00000E-001 5.00000E-001 -5.00000E-001 5.00000E-001
+ -5.00000E-001 5.00000E-001
+cells 12
+tet 4 10 9 6 11
+tet 4 9 2 10 6
+tet 4 2 3 4 5
+tet 4 9 5 6 11
+tet 4 9 5 2 6
+tet 4 6 7 4 8
+tet 4 5 3 4 7
+tet 4 6 5 4 7
+tet 4 2 5 4 6
+tet 4 10 11 6 12
+tet 4 9 1 2 5
+tet 4 1 3 2 5
+variable
+imt1 1
+ 2.00000E+000 2.00000E+000 1.00000E+000 1.00000E+000 2.00000E+000 1.00000E+000 1.00000E+000 1.00000E+000 2.00000E+000 2.00000E+000
+ 2.00000E+000 2.00000E+000
+itp1 1
+ 1.20000E+001 1.20000E+001 1.00000E+001 1.00000E+001 1.20000E+001 1.20000E+001 1.00000E+001 1.00000E+001 1.00000E+001 1.00000E+001
+ 1.00000E+001 1.00000E+001
+icr1 1
+ 1.10000E+001 1.20000E+001 1.30000E+001 1.40000E+001 1.70000E+001 1.80000E+001 1.90000E+001 2.00000E+001 1.50000E+001 1.60000E+001
+ 2.10000E+001 2.20000E+001
+isn1 1
+ 0.00000E+000 0.00000E+000 0.00000E+000 0.00000E+000 0.00000E+000 0.00000E+000 0.00000E+000 0.00000E+000 0.00000E+000 0.00000E+000
+ 0.00000E+000 0.00000E+000
+endvars
+flags
+imt1 3 1
+material
+material
+ERROR
+ 2 2 1 1 2 1 1 1 2 2 2 2
+endflag
+material 3 0
+material
+material
+ERROR
+ 2 2 1 2 2 1 1 1 1 2 2 1
+cycleno 0
+probtime 0.00000E+000
+endgmv
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_ascii.pset
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_ascii.pset 2007-05-08 00:40:01 UTC (rev 6799)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_ascii.pset 2007-05-08 20:37:16 UTC (rev 6800)
@@ -0,0 +1,16 @@
+pset ascii
+ 7
+fault 1 4
+ 1 2 5 6
+xm 2 4
+ 9 10 11 12
+xp 3 4
+ 3 4 7 8
+ym 4 6
+ 1 2 3 4 9 10
+yp 5 6
+ 5 6 7 8 11 12
+zm 6 6
+ 1 3 5 7 9 11
+zp 7 6
+ 2 4 6 8 10 12
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_binary.gmv
===================================================================
(Binary files differ)
Property changes on: short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_binary.gmv
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_binary.pset
===================================================================
(Binary files differ)
Property changes on: short/3D/PyLith/trunk/unittests/libtests/meshio/data/cube2_binary.pset
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the cig-commits
mailing list