[cig-commits] r11178 - in short/3D/PyLith/trunk: libsrc/meshio unittests/libtests/meshio unittests/libtests/meshio/data
brad at geodynamics.org
brad at geodynamics.org
Sun Feb 17 09:46:56 PST 2008
Author: brad
Date: 2008-02-17 09:46:55 -0800 (Sun, 17 Feb 2008)
New Revision: 11178
Added:
short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTK.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTK.hh
short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMesh.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMesh.hh
short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMeshLine2.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMeshLine2.hh
short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKData.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKData.hh
short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMesh.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMesh.hh
short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.hh
short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8.mesh
short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2.mesh
short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_cell_t10.vtk
short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_t10.vtk
short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_vertex_t10.vtk
short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4.mesh
short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4.mesh
short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3.mesh
Modified:
short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh
short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am
Log:
Started work on unit tests for DataWriterVTK.
Modified: short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh 2008-02-17 00:14:06 UTC (rev 11177)
+++ short/3D/PyLith/trunk/libsrc/meshio/DataWriterVTK.hh 2008-02-17 17:46:55 UTC (rev 11178)
@@ -24,11 +24,14 @@
namespace pylith {
namespace meshio {
class DataWriterVTK;
+
+ class TestDataWriterVTK; // unit testing
} // meshio
} // pylith
class pylith::meshio::DataWriterVTK : public DataWriter
{ // DataWriterVTK
+ friend class TestDataWriterVTK; // unit testing
// PUBLIC METHODS ///////////////////////////////////////////////////////
public :
Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am 2008-02-17 00:14:06 UTC (rev 11177)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am 2008-02-17 17:46:55 UTC (rev 11178)
@@ -21,18 +21,27 @@
# Primary source files
testmeshio_SOURCES = \
+ TestDataWriterVTK.cc \
+ TestDataWriterVTKMesh.cc \
+ TestDataWriterVTKMeshLine2.cc \
TestMeshIO.cc \
TestMeshIOAscii.cc \
TestMeshIOLagrit.cc \
test_meshio.cc
noinst_HEADERS = \
+ TestDataWriterVTK.hh \
+ TestDataWriterVTKMesh.hh \
+ TestDataWriterVTKMeshLine2.hh \
TestMeshIO.hh \
TestMeshIOAscii.hh \
TestMeshIOLagrit.hh
# Source files associated with testing data
testmeshio_SOURCES += \
+ data/DataWriterVTKData.cc \
+ data/DataWriterVTKDataMesh.cc \
+ data/DataWriterVTKDataMeshLine2.cc \
data/MeshData.cc \
data/MeshData1D.cc \
data/MeshData1Din3D.cc \
@@ -48,6 +57,9 @@
data/MeshDataLagritTet.cc
noinst_HEADERS += \
+ data/DataWriterVTKData.hh \
+ data/DataWriterVTKDataMesh.hh \
+ data/DataWriterVTKDataMeshLine2.hh \
data/MeshData.hh \
data/MeshData1D.hh \
data/MeshData1Din2D.hh \
@@ -88,7 +100,10 @@
mesh1Din3D.txt \
mesh2D.txt \
mesh2Din3D.txt \
- mesh3D.txt
+ mesh3D.txt \
+ line2_t10.vtk \
+ line2_vertex_t10.vtk \
+ line2_cell_t10.vtk
CLEANFILES = $(noinst_tmp)
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTK.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTK.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTK.cc 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,322 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDataWriterVTK.hh" // Implementation of class methods
+
+#include "data/DataWriterVTKData.hh" // USES DataWriterVTKData
+
+#include "pylith/meshio/DataWriterVTK.hh" // USES DataWriterVTK
+
+#include "spatialdata/geocoords/CSCart.hh" // USES CSCart
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterVTK );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::meshio::TestDataWriterVTK::setUp(void)
+{ // setUp
+ _data = 0;
+} // setUp
+
+// ----------------------------------------------------------------------
+// Tear down testing data.
+void
+pylith::meshio::TestDataWriterVTK::tearDown(void)
+{ // tearDown
+ _mesh = 0;
+ delete _data; _data = 0;
+} // tearDown
+
+// ----------------------------------------------------------------------
+// Test constructor
+void
+pylith::meshio::TestDataWriterVTK::testConstructor(void)
+{ // testConstructor
+ DataWriterVTK writer;
+
+ CPPUNIT_ASSERT(0 == writer._viewer);
+ CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
+ CPPUNIT_ASSERT(false == writer._wroteCellHeader);
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test filename()
+void
+pylith::meshio::TestDataWriterVTK::testFilename(void)
+{ // testDebug
+ DataWriterVTK writer;
+
+ const char* filename = "data.vtk";
+ writer.filename(filename);
+ CPPUNIT_ASSERT_EQUAL(std::string(filename), writer._filename);
+} // testFilename
+
+// ----------------------------------------------------------------------
+// Test timeFormat()
+void
+pylith::meshio::TestDataWriterVTK::testTimeFormat(void)
+{ // testTimeFormat
+ DataWriterVTK writer;
+
+ const char* format = "%4.1f";
+ writer.timeFormat(format);
+ CPPUNIT_ASSERT_EQUAL(std::string(format), writer._timeFormat);
+} // testInterpolate
+
+// ----------------------------------------------------------------------
+// Test openTimeStep() and closeTimeStep()
+void
+pylith::meshio::TestDataWriterVTK::testTimeStep(void)
+{ // testTimeStep
+ CPPUNIT_ASSERT(!_mesh.isNull());
+ CPPUNIT_ASSERT(0 != _data);
+
+ DataWriterVTK writer;
+
+ spatialdata::geocoords::CSCart cs;
+ cs.setSpaceDim(_mesh->getDimension());
+
+ writer.filename(_data->timestepFilename);
+ writer.timeFormat(_data->timeFormat);
+
+ CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
+ CPPUNIT_ASSERT(false == writer._wroteCellHeader);
+
+ const double t = _data->time;
+ const int numTimeSteps = 1;
+ writer.open(_mesh, &cs, numTimeSteps);
+ writer.openTimeStep(t, _mesh, &cs);
+
+ CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
+ CPPUNIT_ASSERT(false == writer._wroteCellHeader);
+
+ writer.closeTimeStep();
+ writer.close();
+
+ CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
+ CPPUNIT_ASSERT(false == writer._wroteCellHeader);
+
+ _checkFile(_data->timestepFilename);
+} // testTimeStep
+
+// ----------------------------------------------------------------------
+// Test writeVertexField.
+void
+pylith::meshio::TestDataWriterVTK::testWriteVertexField(void)
+{ // testWriteVertexField
+ CPPUNIT_ASSERT(!_mesh.isNull());
+ CPPUNIT_ASSERT(0 != _data);
+
+ DataWriterVTK writer;
+
+ spatialdata::geocoords::CSCart cs;
+ cs.setSpaceDim(_mesh->getDimension());
+
+ std::vector< ALE::Obj<real_section_type> > vertexFields;
+ _createVertexFields(&vertexFields);
+
+ writer.filename(_data->vertexFilename);
+ writer.timeFormat(_data->timeFormat);
+
+ const int nfields = _data->numVertexFields;
+
+ const double t = _data->time;
+ const int numTimeSteps = 1;
+ writer.open(_mesh, &cs, numTimeSteps);
+ writer.openTimeStep(t, _mesh, &cs);
+ for (int i=0; i < nfields; ++i) {
+ writer.writeVertexField(t, _data->vertexFields[i].name,
+ vertexFields[i], _data->vertexFields[i].field_type,
+ _mesh);
+ CPPUNIT_ASSERT(writer._wroteVertexHeader);
+ CPPUNIT_ASSERT(false == writer._wroteCellHeader);
+ } // for
+ writer.closeTimeStep();
+ writer.close();
+ CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
+ CPPUNIT_ASSERT(false == writer._wroteCellHeader);
+
+ _checkFile(_data->vertexFilename);
+} // testWriteVertexField
+
+// ----------------------------------------------------------------------
+// Test writeCellField.
+void
+pylith::meshio::TestDataWriterVTK::testWriteCellField(void)
+{ // testWriteCellField
+ CPPUNIT_ASSERT(!_mesh.isNull());
+ CPPUNIT_ASSERT(0 != _data);
+
+ DataWriterVTK writer;
+
+ spatialdata::geocoords::CSCart cs;
+ cs.setSpaceDim(_mesh->getDimension());
+
+ std::vector< ALE::Obj<real_section_type> > cellFields;
+ _createCellFields(&cellFields);
+
+ writer.filename(_data->cellFilename);
+ writer.timeFormat(_data->timeFormat);
+
+ const int nfields = _data->numCellFields;
+
+ const double t = _data->time;
+ const int numTimeSteps = 1;
+ writer.open(_mesh, &cs, numTimeSteps);
+ writer.openTimeStep(t, _mesh, &cs);
+ for (int i=0; i < nfields; ++i) {
+ writer.writeCellField(t, _data->cellFields[i].name,
+ cellFields[i], _data->cellFields[i].field_type,
+ _mesh);
+ CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
+ CPPUNIT_ASSERT(writer._wroteCellHeader);
+ } // for
+ writer.closeTimeStep();
+ writer.close();
+ CPPUNIT_ASSERT(false == writer._wroteCellHeader);
+ CPPUNIT_ASSERT(false == writer._wroteCellHeader);
+
+ _checkFile(_data->cellFilename);
+} // testWriteCellField
+
+// ----------------------------------------------------------------------
+// Create vertex fields.
+void
+pylith::meshio::TestDataWriterVTK::_createVertexFields(
+ std::vector< ALE::Obj<real_section_type> >* fields) const
+{ // _createVertexFields
+ CPPUNIT_ASSERT(0 != fields);
+ CPPUNIT_ASSERT(!_mesh.isNull());
+ CPPUNIT_ASSERT(0 != _data);
+
+ try {
+ const int nfields = _data->numVertexFields;
+
+ const ALE::Obj<Mesh::label_sequence>& vertices =
+ _mesh->depthStratum(0);
+ const Mesh::label_sequence::iterator verticesEnd = vertices->end();
+
+ // Set vertex fields
+ fields->resize(nfields);
+ for (int i=0; i < nfields; ++i) {
+ (*fields)[i] = new real_section_type(_mesh->comm(), _mesh->debug());
+ const int fiberDim = _data->vertexFields[i].fiber_dim;
+ (*fields)[i]->setFiberDimension(vertices, fiberDim);
+ _mesh->allocate((*fields)[i]);
+
+ int ipt = 0;
+ for (Mesh::label_sequence::iterator v_iter=vertices->begin();
+ v_iter != verticesEnd;
+ ++v_iter, ++ipt) {
+ const double* values = &_data->vertexFields[i].values[ipt*fiberDim];
+ (*fields)[i]->updatePoint(*v_iter, values);
+ } // for
+ } // for
+ } catch (const ALE::Exception& err) {
+ throw std::runtime_error(err.msg());
+ } // catch
+} // _createVertexFields
+
+// ----------------------------------------------------------------------
+// Create cell fields.
+void
+pylith::meshio::TestDataWriterVTK::_createCellFields(
+ std::vector< ALE::Obj<real_section_type> >* fields) const
+{ // _createCellFields
+ CPPUNIT_ASSERT(0 != fields);
+ CPPUNIT_ASSERT(!_mesh.isNull());
+ CPPUNIT_ASSERT(0 != _data);
+
+ try {
+ const int nfields = _data->numCellFields;
+
+ const ALE::Obj<Mesh::label_sequence>& cells =
+ _mesh->depthStratum(1);
+ const Mesh::label_sequence::iterator cellsEnd = cells->end();
+
+ // Set cell fields
+ fields->resize(nfields);
+ for (int i=0; i < nfields; ++i) {
+ (*fields)[i] = new real_section_type(_mesh->comm(), _mesh->debug());
+ const int fiberDim = _data->cellFields[i].fiber_dim;
+ (*fields)[i]->setFiberDimension(cells, fiberDim);
+ _mesh->allocate((*fields)[i]);
+
+ int icell = 0;
+ for (Mesh::label_sequence::iterator c_iter=cells->begin();
+ c_iter != cellsEnd;
+ ++c_iter, ++icell) {
+ const double* values = &_data->cellFields[i].values[icell*fiberDim];
+ (*fields)[i]->updatePoint(*c_iter, values);
+ } // for
+ } // for
+ } catch (const ALE::Exception& err) {
+ throw std::runtime_error(err.msg());
+ } // catch
+} // _createCellFields
+
+// ----------------------------------------------------------------------
+// Check VTK file against archived file.
+void
+pylith::meshio::TestDataWriterVTK::_checkFile(const char* filenameRoot) const
+{ // _checkFile
+ CPPUNIT_ASSERT(0 != _data);
+ const double t = _data->time;
+
+ const std::string& fileroot = filenameRoot;
+
+ std::ostringstream buffer;
+ const int indexExt = fileroot.find(".vtk");
+ // Add time stamp to filename
+ char sbuffer[256];
+ sprintf(sbuffer, _data->timeFormat, t);
+ std::string timestamp(sbuffer);
+ const int pos = timestamp.find(".");
+ if (pos != timestamp.length())
+ timestamp.erase(pos, 1);
+ buffer
+ << std::string(fileroot, 0, indexExt) << "_t" << timestamp << ".vtk";
+
+ const std::string& filename = buffer.str();
+ const std::string filenameE = "data/" + filename;
+
+ std::ifstream fileInE(filenameE.c_str());
+ CPPUNIT_ASSERT(fileInE.is_open());
+
+ std::ifstream fileIn(filename.c_str());
+ CPPUNIT_ASSERT(fileIn.is_open());
+
+ const int maxLen = 256;
+ char line[maxLen];
+ char lineE[maxLen];
+
+ int i = 0;
+ while(!fileInE.eof()) {
+ fileInE.getline(lineE, maxLen);
+ fileIn.getline(line, maxLen);
+ if (0 != strcmp(line, lineE)) {
+ std::cerr << "Line " << i << " of file '" << filename << " is incorrect."
+ << std::endl;
+ CPPUNIT_ASSERT(false);
+ } // if
+ } // while
+
+ fileInE.close();
+ fileIn.close();
+} // _checkFile
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTK.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTK.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTK.hh 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,113 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/meshio/TestDataWriterVTK.hh
+ *
+ * @brief C++ TestDataWriterVTK object
+ *
+ * C++ unit testing for DataWriterVTK.
+ */
+
+#if !defined(pylith_meshio_testdatawritervtk_hh)
+#define pylith_meshio_testdatawritervtk_hh
+
+#include "pylith/utils/sievetypes.hh" // USES PETSc Mesh
+
+#include <vector> // USES std::vector
+
+#include <cppunit/extensions/HelperMacros.h>
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace meshio {
+ class TestDataWriterVTK;
+
+ class DataWriterVTKData;
+ } // meshio
+} // pylith
+
+/// C++ unit testing for DataWriterVTK
+class pylith::meshio::TestDataWriterVTK : public CppUnit::TestFixture
+{ // class TestDataWriterVTK
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestDataWriterVTK );
+
+ CPPUNIT_TEST( testConstructor );
+ CPPUNIT_TEST( testFilename );
+ CPPUNIT_TEST( testTimeFormat );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+ /// Tear down testing data.
+ void tearDown(void);
+
+ /// Test constructor
+ void testConstructor(void);
+
+ /// Test filename()
+ void testFilename(void);
+
+ /// Test timeFormat()
+ void testTimeFormat(void);
+
+ /// Test openTimeStep() and closeTimeStep()
+ void testTimeStep(void);
+
+ /// Test writeVertexField.
+ void testWriteVertexField(void);
+
+ /// Test writeCellField.
+ void testWriteCellField(void);
+
+ // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+ DataWriterVTKData* _data; ///< Data for testing
+ ALE::Obj<Mesh> _mesh; ///< Mesh for data
+
+ // PRIVATE MEMBERS ////////////////////////////////////////////////////
+private :
+
+ /** Create vertex fields.
+ *
+ * @param fields Vertex fields.
+ */
+ void
+ _createVertexFields(std::vector< ALE::Obj<real_section_type> >* fields) const;
+
+ /** Create cell fields.
+ *
+ * @param fields Cell fields.
+ */
+ void
+ _createCellFields(std::vector< ALE::Obj<real_section_type> >* fields) const;
+
+ /** Check VTK file against archived file.
+ *
+ * @param filename Name of file to check.
+ */
+ void _checkFile(const char* filename) const;
+
+}; // class TestDataWriterVTK
+
+#endif // pylith_meshio_testdatawritervtk_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMesh.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMesh.cc 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,55 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDataWriterVTKMesh.hh" // Implementation of class methods
+
+#include "data/DataWriterVTKData.hh" // USES DataWriterVTKData
+#include "data/DataWriterVTKDataMesh.hh" // USES DataWriterVTKDataMesh
+
+#include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::meshio::TestDataWriterVTKMesh::setUp(void)
+{ // setUp
+ TestDataWriterVTK::setUp();
+ _dataMesh = 0;
+} // setUp
+
+// ----------------------------------------------------------------------
+// Tear down testing data.
+void
+pylith::meshio::TestDataWriterVTKMesh::tearDown(void)
+{ // tearDown
+ TestDataWriterVTK::tearDown();
+ delete _dataMesh; _dataMesh = 0;
+} // tearDown
+
+// ----------------------------------------------------------------------
+// Initialize mesh.
+void
+pylith::meshio::TestDataWriterVTKMesh::_initialize(void)
+{ // _initialize
+ CPPUNIT_ASSERT(0 != _dataMesh);
+
+ MeshIOAscii iohandler;
+ iohandler.filename(_dataMesh->meshFilename);
+ iohandler.read(&_mesh);
+ CPPUNIT_ASSERT(!_mesh.isNull());
+ _mesh->getFactory()->clear();
+} // _initialize
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMesh.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMesh.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMesh.hh 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/meshio/TestDataWriterVTKMesh.hh
+ *
+ * @brief C++ TestDataWriterVTKMesh object
+ *
+ * C++ unit testing for DataWriterVTKMesh.
+ */
+
+#if !defined(pylith_meshio_testdatawritervtkmesh_hh)
+#define pylith_meshio_testdatawritervtkmesh_hh
+
+#include "TestDataWriterVTK.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace meshio {
+ class TestDataWriterVTKMesh;
+
+ class DataWriterVTKDataMesh;
+ } // meshio
+} // pylith
+
+/// C++ unit testing for DataWriterVTK
+class pylith::meshio::TestDataWriterVTKMesh : public TestDataWriterVTK
+{ // class TestDataWriterVTKMesh
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+ /// Tear down testing data.
+ void tearDown(void);
+
+ // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+ /// Initialize mesh.
+ void _initialize(void);
+
+ // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+ DataWriterVTKDataMesh* _dataMesh; ///< Data for testing
+
+}; // class TestDataWriterVTKMesh
+
+#endif // pylith_meshio_testdatawritervtkmesh_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMeshLine2.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMeshLine2.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMeshLine2.cc 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDataWriterVTKMeshLine2.hh" // Implementation of class methods
+
+#include "data/DataWriterVTKDataMeshLine2.hh" // USES DataWriterVTKDataMeshLine2
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterVTKMeshLine2 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::meshio::TestDataWriterVTKMeshLine2::setUp(void)
+{ // setUp
+ TestDataWriterVTKMesh::setUp();
+ _data = new DataWriterVTKDataMeshLine2;
+ _dataMesh = new DataWriterVTKDataMeshLine2;
+ _initialize();
+} // setUp
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMeshLine2.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMeshLine2.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKMeshLine2.hh 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/meshio/TestDataWriterVTKMeshLine2.hh
+ *
+ * @brief C++ TestDataWriterVTKMeshLine2 object
+ *
+ * C++ unit testing for DataWriterVTKMeshLine2.
+ */
+
+#if !defined(pylith_meshio_testdatawritervtkmeshline2_hh)
+#define pylith_meshio_testdatawritervtkmeshline2_hh
+
+#include "TestDataWriterVTKMesh.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace meshio {
+ class TestDataWriterVTKMeshLine2;
+ } // meshio
+} // pylith
+
+/// C++ unit testing for DataWriterVTK
+class pylith::meshio::TestDataWriterVTKMeshLine2 : public TestDataWriterVTKMesh
+{ // class TestDataWriterVTKMeshLine2
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestDataWriterVTKMeshLine2 );
+
+ CPPUNIT_TEST( testTimeStep );
+ CPPUNIT_TEST( testWriteVertexField );
+ CPPUNIT_TEST( testWriteCellField );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestDataWriterVTKMeshLine2
+
+#endif // pylith_meshio_testdatawritervtkmeshline2_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKData.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKData.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKData.cc 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "DataWriterVTKData.hh"
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::meshio::DataWriterVTKData::DataWriterVTKData(void) :
+ timestepFilename(0),
+ vertexFilename(0),
+ cellFilename(0),
+ time(0),
+ timeFormat(0),
+ numVertexFields(0),
+ numVertices(0),
+ vertexFields(0),
+ numCellFields(0),
+ numCells(0),
+ cellFields(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::meshio::DataWriterVTKData::~DataWriterVTKData(void)
+{ // destructor
+} // destructor
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKData.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKData.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKData.hh 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,76 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_datawritervtkdata_hh)
+#define pylith_meshio_datawritervtkdata_hh
+
+#include "pylith/utils/vectorfields.hh" // USES VectorFieldEnum
+
+namespace pylith {
+ namespace meshio {
+ class DataWriterVTKData;
+ } // meshio
+} // pylith
+
+class pylith::meshio::DataWriterVTKData
+{ // DataWriterVTKData
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Constructor
+ DataWriterVTKData(void);
+
+ /// Destructor
+ virtual
+ ~DataWriterVTKData(void);
+
+// PUBLIC STRUCTS ///////////////////////////////////////////////////////
+public:
+
+ struct FieldStruct {
+ char* name; ///< Name of field
+ VectorFieldEnum field_type; ///< Type of field.
+ int fiber_dim; ///< Fiber dimension for field.
+ double* values; ///< Values for field.
+ }; // FieldStruct
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public:
+
+ char* timestepFilename; ///< Name of VTK file without fields.
+ char* vertexFilename; ///< Name of VTK file for vertex fields.
+ char* cellFilename; ///< Name of VTK file for cell fields.
+
+ double time; ///< Time for fields.
+ char* timeFormat; ///< Format for time stamp.
+
+ /// @name Vertex field information.
+ //@{
+ int numVertexFields; ///< Number of vertex fields.
+ int numVertices; ///< Number of vertices.
+ FieldStruct* vertexFields; ///< Array of vertex fields.
+ //@}
+
+ /// @name Cell field information.
+ //@{
+ int numCellFields; ///< Number of cell fields.
+ int numCells; ///< Number of vertices.
+ FieldStruct* cellFields; ///< Array of cell fields.
+ //@}
+
+}; // DataWriterVTKData
+
+#endif // pylith_meshio_datawritervtkdata_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMesh.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMesh.cc 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "DataWriterVTKDataMesh.hh"
+
+// ----------------------------------------------------------------------
+// Constructor
+pylith::meshio::DataWriterVTKDataMesh::DataWriterVTKDataMesh(void) :
+ meshFilename(0)
+{ // constructor
+} // constructor
+
+// ----------------------------------------------------------------------
+// Destructor
+pylith::meshio::DataWriterVTKDataMesh::~DataWriterVTKDataMesh(void)
+{ // destructor
+} // destructor
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMesh.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMesh.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMesh.hh 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_datawritervtkdatamesh_hh)
+#define pylith_meshio_datawritervtkdatamesh_hh
+
+namespace pylith {
+ namespace meshio {
+ class DataWriterVTKDataMesh;
+ } // meshio
+} // pylith
+
+class pylith::meshio::DataWriterVTKDataMesh
+{ // DataWriterVTKDataMesh
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public :
+
+ /// Constructor
+ DataWriterVTKDataMesh(void);
+
+ /// Destructor
+ virtual
+ ~DataWriterVTKDataMesh(void);
+
+// PUBLIC STRUCTS ///////////////////////////////////////////////////////
+public:
+
+// PUBLIC MEMBERS ///////////////////////////////////////////////////////
+public:
+
+ char* meshFilename; ///< Name of mesh file.
+
+}; // DataWriterVTKDataMesh
+
+#endif // pylith_meshio_datawritervtkdatamesh_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.cc 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "DataWriterVTKDataMeshLine2.hh"
+
+const char* pylith::meshio::DataWriterVTKDataMeshLine2::_meshFilename =
+ "data/line2.mesh";
+
+const char* pylith::meshio::DataWriterVTKDataMeshLine2::_timestepFilename =
+ "line2.vtk";
+
+const char* pylith::meshio::DataWriterVTKDataMeshLine2::_vertexFilename =
+ "line2_vertex.vtk";
+
+const char* pylith::meshio::DataWriterVTKDataMeshLine2::_cellFilename =
+ "line2_cell.vtk";
+
+const double pylith::meshio::DataWriterVTKDataMeshLine2::_time = 1.0;
+
+const char* pylith::meshio::DataWriterVTKDataMeshLine2::_timeFormat =
+ "%3.1f";
+
+const int pylith::meshio::DataWriterVTKDataMeshLine2::_numVertexFields = 3;
+const int pylith::meshio::DataWriterVTKDataMeshLine2::_numVertices = 3;
+
+const pylith::meshio::DataWriterVTKData::FieldStruct
+pylith::meshio::DataWriterVTKDataMeshLine2::_vertexFields[] = {
+ { "displacements", VECTOR_FIELD, 1, 0 },
+ { "pressure", SCALAR_FIELD, 1, 0 },
+ { "other", OTHER_FIELD, 2, 0 },
+};
+const double pylith::meshio::DataWriterVTKDataMeshLine2::_vertexField0[] = {
+ 1.1, 2.2, 3.3,
+};
+const double pylith::meshio::DataWriterVTKDataMeshLine2::_vertexField1[] = {
+ 2.1, 3.2, 4.3,
+};
+const double pylith::meshio::DataWriterVTKDataMeshLine2::_vertexField2[] = {
+ 1.2, 2.3,
+ 3.4, 4.5,
+ 5.6, 6.7,
+};
+
+const int pylith::meshio::DataWriterVTKDataMeshLine2::_numCellFields = 3;
+const int pylith::meshio::DataWriterVTKDataMeshLine2::_numCells = 2;
+
+const pylith::meshio::DataWriterVTKData::FieldStruct
+pylith::meshio::DataWriterVTKDataMeshLine2::_cellFields[] = {
+ { "traction", VECTOR_FIELD, 1, 0 },
+ { "pressure", SCALAR_FIELD, 1, 0 },
+ { "other", TENSOR_FIELD, 1, 0 },
+};
+const double pylith::meshio::DataWriterVTKDataMeshLine2::_cellField0[] = {
+ 1.1, 2.2,
+};
+const double pylith::meshio::DataWriterVTKDataMeshLine2::_cellField1[] = {
+ 2.1, 2.2,
+};
+const double pylith::meshio::DataWriterVTKDataMeshLine2::_cellField2[] = {
+ 1.2, 2.3,
+};
+
+pylith::meshio::DataWriterVTKDataMeshLine2::DataWriterVTKDataMeshLine2(void)
+{ // constructor
+ meshFilename = const_cast<char*>(_meshFilename);
+
+ timestepFilename = const_cast<char*>(_timestepFilename);
+ vertexFilename = const_cast<char*>(_vertexFilename);
+ cellFilename = const_cast<char*>(_cellFilename);
+
+ time = _time;
+ timeFormat = const_cast<char*>(_timeFormat);
+
+ numVertexFields = _numVertexFields;
+ numVertices = _numVertices;
+ vertexFields = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFields[0].values = const_cast<double*>(_vertexField0);
+ vertexFields[1].values = const_cast<double*>(_vertexField1);
+ vertexFields[2].values = const_cast<double*>(_vertexField2);
+
+ numCellFields = _numCellFields;
+ numVertices = _numVertices;
+ cellFields = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFields[0].values = const_cast<double*>(_cellField0);
+ cellFields[1].values = const_cast<double*>(_cellField1);
+ cellFields[2].values = const_cast<double*>(_cellField2);
+} // constructor
+
+pylith::meshio::DataWriterVTKDataMeshLine2::~DataWriterVTKDataMeshLine2(void)
+{}
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataMeshLine2.hh 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_datawritervtkdatameshline2_hh)
+#define pylith_meshio_datawritervtkdatameshline2_hh
+
+#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterVTKDataMesh.hh" // ISA DataWriterVTKDataMesh
+
+namespace pylith {
+ namespace meshio {
+ class DataWriterVTKDataMeshLine2;
+ } // meshio
+} // pylith
+
+class pylith::meshio::DataWriterVTKDataMeshLine2 :
+ public DataWriterVTKData,
+ public DataWriterVTKDataMesh
+{ // DataWriterVTKDataMeshLine2
+
+public:
+
+ /// Constructor
+ DataWriterVTKDataMeshLine2(void);
+
+ /// Destructor
+ ~DataWriterVTKDataMeshLine2(void);
+
+private:
+
+ static const char* _meshFilename; ///< Name of mesh file.
+
+ static const char* _timestepFilename; ///< Name of VTK file without fields.
+ static const char* _vertexFilename; ///< Name of VTK file for vertex fields.
+ static const char* _cellFilename; ///< Name of VTK file for cell fields.
+
+ static const double _time; ///< Time for fields.
+ static const char* _timeFormat; ///< Format for time stamp.
+
+ /// @name Vertex field information.
+ //@{
+ static const int _numVertexFields; ///< Number of vertex fields.
+ static const int _numVertices; ///< Number of vertices.
+ static const FieldStruct _vertexFields[]; ///< Array of vertex fields.
+
+ static const double _vertexField0[]; ///< Values for vertex field 0.
+ static const double _vertexField1[]; ///< Values for vertex field 1.
+ static const double _vertexField2[]; ///< Values for vertex field 2.
+ //@}
+
+ /// @name Cell field information.
+ //@{
+ static const int _numCellFields; ///< Number of cell fields.
+ static const int _numCells; ///< Number of cells.
+ static const FieldStruct _cellFields[]; ///< Array of cell fields.
+
+ static const double _cellField0[]; ///< Values for cell field 0.
+ static const double _cellField1[]; ///< Values for cell field 1.
+ static const double _cellField2[]; ///< Values for cell field 2.
+ //@}
+
+}; // DataWriterVTKDataMeshLine2
+
+#endif // pylith_meshio_datawritervtkdatameshline2_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 2008-02-17 00:14:06 UTC (rev 11177)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am 2008-02-17 17:46:55 UTC (rev 11178)
@@ -20,7 +20,11 @@
twoquad4.exo \
twotet4.exo \
twohex8.exo \
- mesh2D_comments.txt
+ mesh2D_comments.txt \
+ line2.mesh \
+ line2_t10.vtk \
+ line2_vertex_t10.vtk \
+ line2_cell_t10.vtk
noinst_TMP =
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8.mesh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8.mesh 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,79 @@
+// Original
+//
+// 11 -----10
+// / | / |
+// / | / |
+// 9 ----- 8 |
+// / | 5 /-|-- 4
+// / | / / | /
+// 7 ----- 6 |/ Cell 1
+// | 3 --|-- 2
+// | / | /
+// |/ |/ Cell 0
+// 1 ----- 0
+//
+//
+// Sieve mesh
+//
+// 13 -----12
+// / | / |
+// / | / |
+// 11 -----10 |
+// / | 7 /-|-- 6
+// / | / / | /
+// 9 ----- 8 |/ 1
+// | 5 --|-- 4
+// | / | /
+// |/ |/ 0
+// 3 ----- 2
+//
+mesh = {
+ dimension = 3
+ use-index-zero = true
+ vertices = {
+ dimension = 3
+ count = 12
+ coordinates = {
+ 0 -1.0 -1.0 -1.0
+ 1 -1.0 1.0 -1.0
+ 2 0.0 -1.0 -1.0
+ 3 0.0 1.0 -1.0
+ 4 1.0 -1.0 -1.0
+ 5 1.0 1.0 -1.0
+ 6 -1.0 -1.0 1.0
+ 7 -1.0 1.0 1.0
+ 8 0.0 -1.0 1.0
+ 9 0.0 1.0 1.0
+ 10 1.0 -1.0 1.0
+ 11 1.0 1.0 1.0
+ }
+ }
+ cells = {
+ count = 2
+ num-corners = 8
+ simplices = {
+ 0 0 2 3 1 6 8 9 7
+ 1 2 4 5 3 8 10 11 9
+ }
+ material-ids = {
+ 0 0
+ 1 0
+ }
+ }
+ group = {
+ name = bc
+ type = vertices
+ count = 4
+ indices = {
+ 0 1 6 7
+ }
+ }
+ group = {
+ name = bc2
+ type = vertices
+ count = 6
+ indices = {
+ 0 2 4 6 8 10
+ }
+ }
+}
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2.mesh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2.mesh 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,50 @@
+// Original mesh
+//
+// 0 ----- 1 ----- 2
+// 0 1
+//
+// Sieve mesh
+// 2 ----- 3 ----- 4
+// 0 1
+//
+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 = bc0
+ type = vertices
+ count = 2
+ indices = {
+ 0 2
+ }
+ }
+ group = {
+ name = bc1
+ type = vertices
+ count = 1
+ indices = {
+ 0
+ }
+ }
+}
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_cell_t10.vtk
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_cell_t10.vtk (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_cell_t10.vtk 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,26 @@
+# vtk DataFile Version 2.0
+Simplicial Mesh Example
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 3 double
+-1 0.0 0.0
+0 0.0 0.0
+1 0.0 0.0
+CELLS 2 6
+2 0 1
+2 1 2
+CELL_TYPES 2
+3
+3
+CELL_DATA 2
+VECTORS traction double
+1.1 0.0 0.0
+2.2 0.0 0.0
+SCALARS pressure double 1
+LOOKUP_TABLE default
+2.1
+2.2
+SCALARS other double 1
+LOOKUP_TABLE default
+1.2
+2.3
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_t10.vtk
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_t10.vtk (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_t10.vtk 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,14 @@
+# vtk DataFile Version 2.0
+Simplicial Mesh Example
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 3 double
+-1 0.0 0.0
+0 0.0 0.0
+1 0.0 0.0
+CELLS 2 6
+2 0 1
+2 1 2
+CELL_TYPES 2
+3
+3
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_vertex_t10.vtk
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_vertex_t10.vtk (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_vertex_t10.vtk 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,29 @@
+# vtk DataFile Version 2.0
+Simplicial Mesh Example
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 3 double
+-1 0.0 0.0
+0 0.0 0.0
+1 0.0 0.0
+CELLS 2 6
+2 0 1
+2 1 2
+CELL_TYPES 2
+3
+3
+POINT_DATA 3
+VECTORS displacements double
+1.1 0.0 0.0
+2.2 0.0 0.0
+3.3 0.0 0.0
+SCALARS pressure double 1
+LOOKUP_TABLE default
+2.1
+3.2
+4.3
+SCALARS other double 2
+LOOKUP_TABLE default
+1.2 2.3
+3.4 4.5
+5.6 6.7
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4.mesh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4.mesh 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,68 @@
+// Original mesh
+//
+// 1 ----- 3 ----- 5
+// | | |
+// | 0 | 1 |
+// | | |
+// 0 ----- 2 ----- 4
+//
+// Sieve mesh
+//
+// 3 ----- 5 ----- 7
+// | | |
+// | 0 | 1 |
+// | | |
+// 2 ----- 4 ----- 6
+//
+mesh = {
+ dimension = 2
+ use-index-zero = true
+ vertices = {
+ dimension = 2
+ count = 6
+ coordinates = {
+ 0 -1.0 -1.0
+ 1 -1.0 1.0
+ 2 0.0 -1.0
+ 3 0.0 1.0
+ 4 1.0 -1.0
+ 5 1.0 1.0
+ }
+ }
+ cells = {
+ count = 2
+ num-corners = 4
+ simplices = {
+ 0 0 2 3 1
+ 1 2 4 5 3
+ }
+ material-ids = {
+ 0 0
+ 1 0
+ }
+ }
+ group = {
+ name = bc
+ type = vertices
+ count = 3
+ indices = {
+ 0 1 4
+ }
+ }
+ group = {
+ name = bc2
+ type = vertices
+ count = 4
+ indices = {
+ 0 1 4 5
+ }
+ }
+ group = {
+ name = bc3
+ type = vertices
+ count = 3
+ indices = {
+ 0 2 4
+ }
+ }
+}
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4.mesh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4.mesh 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,48 @@
+mesh = {
+ dimension = 3
+ use-index-zero = true
+ vertices = {
+ dimension = 3
+ count = 4
+ coordinates = {
+ 0 0.0 0.0 0.0
+ 1 1.0 0.0 0.0
+ 2 0.0 1.0 0.0
+ 3 0.0 0.0 1.0
+ }
+ }
+ cells = {
+ count = 1
+ num-corners = 4
+ simplices = {
+ 0 0 1 2 3
+ }
+ material-ids = {
+ 0 0
+ }
+ }
+ group = {
+ name = bc
+ type = vertices
+ count = 1
+ indices = {
+ 2
+ }
+ }
+ group = {
+ name = bc2
+ type = vertices
+ count = 3
+ indices = {
+ 0 2 3
+ }
+ }
+ group = {
+ name = bc3
+ type = vertices
+ count = 3
+ indices = {
+ 1 2 3
+ }
+ }
+}
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3.mesh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3.mesh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3.mesh 2008-02-17 17:46:55 UTC (rev 11178)
@@ -0,0 +1,60 @@
+// Original mesh
+// 2
+// / | \
+// / | \
+// 0 0 | 1 3
+// \ | /
+// \ | /
+// 1
+//
+// Sieve mesh
+// 4
+// / | \
+// / | \
+// 2 0 | 1 5
+// \ | /
+// \ | /
+// 3
+//
+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 1 2
+ 1 1 3 2
+ }
+ material-ids = {
+ 0 0
+ 1 0
+ }
+ }
+ group = {
+ name = bc
+ type = vertices
+ count = 2
+ indices = {
+ 1 3
+ }
+ }
+ group = {
+ name = bc2
+ type = vertices
+ count = 2
+ indices = {
+ 2 3
+ }
+ }
+}
More information about the cig-commits
mailing list