[cig-commits] r11286 - in short/3D/PyLith/trunk/unittests/libtests/meshio: . data
brad at geodynamics.org
brad at geodynamics.org
Wed Feb 27 22:34:55 PST 2008
Author: brad
Date: 2008-02-27 22:34:55 -0800 (Wed, 27 Feb 2008)
New Revision: 11286
Added:
short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKSubMeshTri3.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKSubMeshTri3.hh
short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.hh
short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_sub_cell_t10.vtk
short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_sub_t10.vtk
short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_sub_vertex_t10.vtk
Modified:
short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTK.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am
short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_sub_cell_t10.vtk
Log:
Worked on unit tests for output of portion of mesh (material).
Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am 2008-02-28 05:56:03 UTC (rev 11285)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am 2008-02-28 06:34:55 UTC (rev 11286)
@@ -29,6 +29,7 @@
TestDataWriterVTKMeshTet4.cc \
TestDataWriterVTKMeshHex8.cc \
TestDataWriterVTKSubMeshLine2.cc \
+ TestDataWriterVTKSubMeshTri3.cc \
TestMeshIO.cc \
TestMeshIOAscii.cc \
TestMeshIOLagrit.cc \
@@ -43,6 +44,7 @@
TestDataWriterVTKMeshTet4.hh \
TestDataWriterVTKMeshHex8.hh \
TestDataWriterVTKSubMeshLine2.hh \
+ TestDataWriterVTKSubMeshTri3.hh \
TestMeshIO.hh \
TestMeshIOAscii.hh \
TestMeshIOLagrit.hh
@@ -57,6 +59,7 @@
data/DataWriterVTKDataMeshTet4.cc \
data/DataWriterVTKDataMeshHex8.cc \
data/DataWriterVTKDataSubMeshLine2.cc \
+ data/DataWriterVTKDataSubMeshTri3.cc \
data/MeshData.cc \
data/MeshData1D.cc \
data/MeshData1Din3D.cc \
@@ -80,6 +83,7 @@
data/DataWriterVTKDataMeshTet4.hh \
data/DataWriterVTKDataMeshHex8.hh \
data/DataWriterVTKDataSubMeshLine2.hh \
+ data/DataWriterVTKDataSubMeshTri3.hh \
data/MeshData.hh \
data/MeshData1D.hh \
data/MeshData1Din2D.hh \
Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTK.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTK.cc 2008-02-28 05:56:03 UTC (rev 11285)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTK.cc 2008-02-28 06:34:55 UTC (rev 11286)
@@ -201,9 +201,9 @@
} // else
for (int i=0; i < nfields; ++i) {
writer.writeCellField(t, _data->cellFieldsInfo[i].name,
- cellFields[i],
+ cellFields[i],
_data->cellFieldsInfo[i].field_type,
- _mesh);
+ _mesh);
CPPUNIT_ASSERT(false == writer._wroteVertexHeader);
CPPUNIT_ASSERT(writer._wroteCellHeader);
} // for
@@ -328,7 +328,7 @@
char line[maxLen];
char lineE[maxLen];
- int i = 0;
+ int i = 1;
while(!fileInE.eof()) {
fileInE.getline(lineE, maxLen);
fileIn.getline(line, maxLen);
@@ -337,6 +337,7 @@
<< std::endl;
CPPUNIT_ASSERT(false);
} // if
+ ++i;
} // while
fileInE.close();
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKSubMeshTri3.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKSubMeshTri3.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKSubMeshTri3.cc 2008-02-28 06:34:55 UTC (rev 11286)
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestDataWriterVTKSubMeshTri3.hh" // Implementation of class methods
+
+#include "data/DataWriterVTKDataSubMeshTri3.hh" // USES DataWriterVTKDataMeshTri3
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterVTKSubMeshTri3 );
+
+// ----------------------------------------------------------------------
+// Setup testing data.
+void
+pylith::meshio::TestDataWriterVTKSubMeshTri3::setUp(void)
+{ // setUp
+ TestDataWriterVTKMesh::setUp();
+ _data = new DataWriterVTKDataSubMeshTri3;
+ _dataMesh = new DataWriterVTKDataSubMeshTri3;
+ _initialize();
+} // setUp
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKSubMeshTri3.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKSubMeshTri3.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKSubMeshTri3.hh 2008-02-28 06:34:55 UTC (rev 11286)
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/meshio/TestDataWriterVTKSubMeshTri3.hh
+ *
+ * @brief C++ TestDataWriterVTKSubMeshTri3 object
+ *
+ * C++ unit testing for DataWriterVTKSubMeshTri3.
+ */
+
+#if !defined(pylith_meshio_testdatawritervtksubmeshtri3_hh)
+#define pylith_meshio_testdatawritervtksubmeshtri3_hh
+
+#include "TestDataWriterVTKMesh.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+ namespace meshio {
+ class TestDataWriterVTKSubMeshTri3;
+ } // meshio
+} // pylith
+
+/// C++ unit testing for DataWriterVTK
+class pylith::meshio::TestDataWriterVTKSubMeshTri3 : public TestDataWriterVTKMesh
+{ // class TestDataWriterVTKSubMeshTri3
+
+ // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+ CPPUNIT_TEST_SUITE( TestDataWriterVTKSubMeshTri3 );
+
+ CPPUNIT_TEST( testTimeStep );
+ CPPUNIT_TEST( testWriteVertexField );
+ CPPUNIT_TEST( testWriteCellField );
+
+ CPPUNIT_TEST_SUITE_END();
+
+ // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+ /// Setup testing data.
+ void setUp(void);
+
+}; // class TestDataWriterVTKSubMeshTri3
+
+#endif // pylith_meshio_testdatawritervtksubmeshtri3_hh
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.cc (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.cc 2008-02-28 06:34:55 UTC (rev 11286)
@@ -0,0 +1,126 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "DataWriterVTKDataSubMeshTri3.hh"
+
+#include <assert.h> // USES assert()
+
+const char* pylith::meshio::DataWriterVTKDataSubMeshTri3::_meshFilename =
+ "data/tri3.mesh";
+
+const char* pylith::meshio::DataWriterVTKDataSubMeshTri3::_cellsLabel =
+ "material-id";
+const int pylith::meshio::DataWriterVTKDataSubMeshTri3::_labelId = 0;
+
+const char* pylith::meshio::DataWriterVTKDataSubMeshTri3::_faultLabel =
+ "fault";
+const int pylith::meshio::DataWriterVTKDataSubMeshTri3::_faultId = 100;
+
+const char* pylith::meshio::DataWriterVTKDataSubMeshTri3::_timestepFilename =
+ "tri3_sub.vtk";
+
+const char* pylith::meshio::DataWriterVTKDataSubMeshTri3::_vertexFilename =
+ "tri3_sub_vertex.vtk";
+
+const char* pylith::meshio::DataWriterVTKDataSubMeshTri3::_cellFilename =
+ "tri3_sub_cell.vtk";
+
+const double pylith::meshio::DataWriterVTKDataSubMeshTri3::_time = 1.0;
+
+const char* pylith::meshio::DataWriterVTKDataSubMeshTri3::_timeFormat =
+ "%3.1f";
+
+const int pylith::meshio::DataWriterVTKDataSubMeshTri3::_numVertexFields = 3;
+const int pylith::meshio::DataWriterVTKDataSubMeshTri3::_numVertices = 6;
+
+const pylith::meshio::DataWriterVTKData::FieldStruct
+pylith::meshio::DataWriterVTKDataSubMeshTri3::_vertexFields[] = {
+ { "displacements", VECTOR_FIELD, 2 },
+ { "pressure", SCALAR_FIELD, 1 },
+ { "other", OTHER_FIELD, 2 },
+};
+const double pylith::meshio::DataWriterVTKDataSubMeshTri3::_vertexField0[] = {
+ 1.1, 2.2,
+ 3.3, 4.4,
+ 5.5, 6.6,
+ 7.7, 8.8,
+ 9.9, 10.0,
+ 11.1, 12.2
+};
+const double pylith::meshio::DataWriterVTKDataSubMeshTri3::_vertexField1[] = {
+ 2.1, 3.2, 4.3, 5.4, 6.5, 7.6
+};
+const double pylith::meshio::DataWriterVTKDataSubMeshTri3::_vertexField2[] = {
+ 1.2, 2.3,
+ 3.4, 4.5,
+ 5.6, 6.7,
+ 7.8, 8.9,
+ 9.0, 10.1,
+ 11.2, 12.3
+};
+
+const int pylith::meshio::DataWriterVTKDataSubMeshTri3::_numCellFields = 3;
+const int pylith::meshio::DataWriterVTKDataSubMeshTri3::_numCells = 1;
+
+const pylith::meshio::DataWriterVTKData::FieldStruct
+pylith::meshio::DataWriterVTKDataSubMeshTri3::_cellFields[] = {
+ { "traction", VECTOR_FIELD, 2 },
+ { "pressure", SCALAR_FIELD, 1 },
+ { "other", TENSOR_FIELD, 3 },
+};
+const double pylith::meshio::DataWriterVTKDataSubMeshTri3::_cellField0[] = {
+ 1.1, 2.2,
+};
+const double pylith::meshio::DataWriterVTKDataSubMeshTri3::_cellField1[] = {
+ 2.1,
+};
+const double pylith::meshio::DataWriterVTKDataSubMeshTri3::_cellField2[] = {
+ 1.2, 2.3, 3.4,
+};
+
+pylith::meshio::DataWriterVTKDataSubMeshTri3::DataWriterVTKDataSubMeshTri3(void)
+{ // constructor
+ meshFilename = const_cast<char*>(_meshFilename);
+ cellsLabel = const_cast<char*>(_cellsLabel);
+ labelId = _labelId;
+ faultLabel = const_cast<char*>(_faultLabel);
+ faultId = _faultId;
+
+ 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;
+ assert(3 == numVertexFields);
+ vertexFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_vertexFields);
+ vertexFields[0] = const_cast<double*>(_vertexField0);
+ vertexFields[1] = const_cast<double*>(_vertexField1);
+ vertexFields[2] = const_cast<double*>(_vertexField2);
+
+ numCellFields = _numCellFields;
+ numVertices = _numVertices;
+ assert(3 == numCellFields);
+ cellFieldsInfo = const_cast<DataWriterVTKData::FieldStruct*>(_cellFields);
+ cellFields[0] = const_cast<double*>(_cellField0);
+ cellFields[1] = const_cast<double*>(_cellField1);
+ cellFields[2] = const_cast<double*>(_cellField2);
+} // constructor
+
+pylith::meshio::DataWriterVTKDataSubMeshTri3::~DataWriterVTKDataSubMeshTri3(void)
+{}
+
+
+// End of file
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.hh (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataSubMeshTri3.hh 2008-02-28 06:34:55 UTC (rev 11286)
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_datawritervtkdatasubmeshtri3_hh)
+#define pylith_meshio_datawritervtkdatasubmeshtri3_hh
+
+#include "DataWriterVTKData.hh" // ISA DataWriterVTKData
+#include "DataWriterVTKDataMesh.hh" // ISA DataWriterVTKDataMesh
+
+namespace pylith {
+ namespace meshio {
+ class DataWriterVTKDataSubMeshTri3;
+ } // meshio
+} // pylith
+
+class pylith::meshio::DataWriterVTKDataSubMeshTri3 :
+ public DataWriterVTKData,
+ public DataWriterVTKDataMesh
+{ // DataWriterVTKDataSubMeshTri3
+
+public:
+
+ /// Constructor
+ DataWriterVTKDataSubMeshTri3(void);
+
+ /// Destructor
+ ~DataWriterVTKDataSubMeshTri3(void);
+
+private:
+
+ static const char* _meshFilename; ///< Name of mesh file.
+ static const char* _cellsLabel; ///< Label defining subset of cells.
+ static const int _labelId; /// Value for label defining subset of cells.
+ static const char* _faultLabel; ///< Name of group of vertices for fault.
+ static const int _faultId; ///< Material identifier for fault.
+
+ 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.
+ //@}
+
+}; // DataWriterVTKDataSubMeshTri3
+
+#endif // pylith_meshio_datawritervtkdatasubmeshtri3_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-28 05:56:03 UTC (rev 11285)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am 2008-02-28 06:34:55 UTC (rev 11286)
@@ -43,7 +43,10 @@
hex8_cell_t10.vtk \
line2_sub_t10.vtk \
line2_sub_vertex_t10.vtk \
- line2_sub_cell_t10.vtk
+ line2_sub_cell_t10.vtk \
+ tri3_sub_t10.vtk \
+ tri3_sub_vertex_t10.vtk \
+ tri3_sub_cell_t10.vtk
noinst_TMP =
Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_sub_cell_t10.vtk
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_sub_cell_t10.vtk 2008-02-28 05:56:03 UTC (rev 11285)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_sub_cell_t10.vtk 2008-02-28 06:34:55 UTC (rev 11286)
@@ -11,7 +11,7 @@
2 0 3
CELL_TYPES 1
3
-CELL_DATA 2
+CELL_DATA 1
VECTORS traction double
1.1 0.0 0.0
SCALARS pressure double 1
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_sub_cell_t10.vtk
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_sub_cell_t10.vtk (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_sub_cell_t10.vtk 2008-02-28 06:34:55 UTC (rev 11286)
@@ -0,0 +1,23 @@
+# vtk DataFile Version 2.0
+Simplicial Mesh Example
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 6 double
+-1 0 0.0
+0 -1 0.0
+0 1 0.0
+1 0 0.0
+0 -1 0.0
+0 1 0.0
+CELLS 1 4
+3 1 3 2
+CELL_TYPES 1
+5
+CELL_DATA 1
+VECTORS traction double
+1.1 2.2 0.0
+SCALARS pressure double 1
+LOOKUP_TABLE default
+2.1
+VECTORS other double
+1.2 2.3 3.4
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_sub_t10.vtk
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_sub_t10.vtk (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_sub_t10.vtk 2008-02-28 06:34:55 UTC (rev 11286)
@@ -0,0 +1,15 @@
+# vtk DataFile Version 2.0
+Simplicial Mesh Example
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 6 double
+-1 0 0.0
+0 -1 0.0
+0 1 0.0
+1 0 0.0
+0 -1 0.0
+0 1 0.0
+CELLS 1 4
+3 1 3 2
+CELL_TYPES 1
+5
Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_sub_vertex_t10.vtk
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_sub_vertex_t10.vtk (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_sub_vertex_t10.vtk 2008-02-28 06:34:55 UTC (rev 11286)
@@ -0,0 +1,39 @@
+# vtk DataFile Version 2.0
+Simplicial Mesh Example
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 6 double
+-1 0 0.0
+0 -1 0.0
+0 1 0.0
+1 0 0.0
+0 -1 0.0
+0 1 0.0
+CELLS 1 4
+3 1 3 2
+CELL_TYPES 1
+5
+POINT_DATA 6
+VECTORS displacements double
+1.1 2.2 0.0
+3.3 4.4 0.0
+5.5 6.6 0.0
+7.7 8.8 0.0
+9.9 10 0.0
+11.1 12.2 0.0
+SCALARS pressure double 1
+LOOKUP_TABLE default
+2.1
+3.2
+4.3
+5.4
+6.5
+7.6
+SCALARS other double 2
+LOOKUP_TABLE default
+1.2 2.3
+3.4 4.5
+5.6 6.7
+7.8 8.9
+9 10.1
+11.2 12.3
More information about the cig-commits
mailing list