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

brad at geodynamics.org brad at geodynamics.org
Tue Feb 14 17:54:08 PST 2012


Author: brad
Date: 2012-02-14 17:54:08 -0800 (Tue, 14 Feb 2012)
New Revision: 19634

Added:
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsHex8.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsHex8.hh
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsQuad4.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsQuad4.hh
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsTet4.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsTet4.hh
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_points_t10.vtk
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_points_vertex_t10.vtk
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_points_t10.vtk
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_points_vertex_t10.vtk
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_points_t10.vtk
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_points_vertex_t10.vtk
Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKPointsCases.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKPointsCases.hh
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am
Log:
More work on unit tests for VTK output for solution interpolated to points.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2012-02-15 01:26:11 UTC (rev 19633)
+++ short/3D/PyLith/trunk/TODO	2012-02-15 01:54:08 UTC (rev 19634)
@@ -16,6 +16,11 @@
   - Order of tensor components for Xdmf files
   - Drucker Prager fit to yield surface
   - Slip-weakening healing parameter
+  - Green's functions
+    + Interpolation
+      * Approximate for quad4 and hex8 cells
+        (assume Jacobian is uniform throughout cell =? rhomboid)
+        (should be much better than nearest)
 
 * configure
   

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc	2012-02-15 01:26:11 UTC (rev 19633)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc	2012-02-15 01:54:08 UTC (rev 19634)
@@ -97,6 +97,10 @@
   _pointsMesh->createSieveMesh(meshDim);
   assert(_pointsMesh);
 
+  const spatialdata::geocoords::CoordSys* csMesh = mesh->coordsys();
+  assert(csMesh);
+  assert(csMesh->spaceDim() == spaceDim);
+
   scalar_array pointsArray(points, numPoints*spaceDim);
   int_array cells(numPoints);
   for (int i=0; i < numPoints; ++i)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am	2012-02-15 01:26:11 UTC (rev 19633)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am	2012-02-15 01:54:08 UTC (rev 19634)
@@ -139,6 +139,9 @@
 	data/OutputSolnPointsDataHex8.cc \
 	data/DataWriterDataPoints.cc \
 	data/DataWriterVTKDataPointsTri3.cc \
+	data/DataWriterVTKDataPointsQuad4.cc \
+	data/DataWriterVTKDataPointsTet4.cc \
+	data/DataWriterVTKDataPointsHex8.cc \
 	data/MeshData.cc \
 	data/MeshData1D.cc \
 	data/MeshData1Din3D.cc \
@@ -209,6 +212,9 @@
 	data/OutputSolnPointsDataHex8.hh \
 	data/DataWriterDataPoints.hh \
 	data/DataWriterVTKDataPointsTri3.hh \
+	data/DataWriterVTKDataPointsQuad4.hh \
+	data/DataWriterVTKDataPointsTet4.hh \
+	data/DataWriterVTKDataPointsHex8.hh \
 	data/MeshData.hh \
 	data/MeshData1D.hh \
 	data/MeshData1Din2D.hh \

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKPointsCases.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKPointsCases.cc	2012-02-15 01:26:11 UTC (rev 19633)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKPointsCases.cc	2012-02-15 01:54:08 UTC (rev 19634)
@@ -21,16 +21,16 @@
 #include "TestDataWriterVTKPointsCases.hh" // Implementation of class methods
 
 #include "data/DataWriterVTKDataPointsTri3.hh" // USES DataWriterVTKDataPointsTri3
-//#include "data/DataWriterVTKDataPointsQuad4.hh" // USES DataWriterVTKDataPointsQuad4
-//#include "data/DataWriterVTKDataPointsTet4.hh" // USES DataWriterVTKDataPointsTet4
-//#include "data/DataWriterVTKDataPointsHex8.hh" // USES DataWriterVTKDataPointsHex8
+#include "data/DataWriterVTKDataPointsQuad4.hh" // USES DataWriterVTKDataPointsQuad4
+#include "data/DataWriterVTKDataPointsTet4.hh" // USES DataWriterVTKDataPointsTet4
+#include "data/DataWriterVTKDataPointsHex8.hh" // USES DataWriterVTKDataPointsHex8
 
 
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterVTKPointsTri3 );
-//CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterVTKPointsQuad4 );
-//CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterVTKPointsTet4 );
-//CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterVTKPointsHex8 );
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterVTKPointsQuad4 );
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterVTKPointsTet4 );
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterVTKPointsHex8 );
 
 
 // ----------------------------------------------------------------------
@@ -45,7 +45,6 @@
 } // setUp
 
 
-#if 0
 // ----------------------------------------------------------------------
 // Setup testing data.
 void
@@ -80,7 +79,6 @@
   _flipFault = true;
   _initialize();
 } // setUp
-#endif
 
 
 // End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKPointsCases.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKPointsCases.hh	2012-02-15 01:26:11 UTC (rev 19633)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterVTKPointsCases.hh	2012-02-15 01:54:08 UTC (rev 19634)
@@ -32,9 +32,9 @@
 namespace pylith {
   namespace meshio {
     class TestDataWriterVTKPointsTri3;
-    //class TestDataWriterVTKPointsQuad4;
-    //class TestDataWriterVTKPointsTet4;
-    //class TestDataWriterVTKPointsHex8;
+    class TestDataWriterVTKPointsQuad4;
+    class TestDataWriterVTKPointsTet4;
+    class TestDataWriterVTKPointsHex8;
   } // meshio
 } // pylith
 
@@ -61,7 +61,6 @@
 }; // class TestDataWriterVTKPointsTri3
 
 
-#if 0
 // ----------------------------------------------------------------------
 /// C++ unit testing for DataWriterVTK
 class pylith::meshio::TestDataWriterVTKPointsQuad4 : public TestDataWriterVTKPoints
@@ -126,7 +125,6 @@
   void setUp(void);
 
 }; // class TestDataWriterVTKPointsHex8
-#endif
 
 
 #endif // pylith_meshio_testdatawritervtkpointscases_hh

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsHex8.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsHex8.cc	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsHex8.cc	2012-02-15 01:54:08 UTC (rev 19634)
@@ -0,0 +1,157 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2011 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "DataWriterVTKDataPointsHex8.hh"
+
+#include <assert.h> // USES assert()
+
+const char* pylith::meshio::DataWriterVTKDataPointsHex8::_meshFilename = 
+  "data/hex8.mesh";
+
+const char* pylith::meshio::DataWriterVTKDataPointsHex8::_faultLabel = 
+  "fault";
+const int pylith::meshio::DataWriterVTKDataPointsHex8::_faultId = 100;
+
+const char* pylith::meshio::DataWriterVTKDataPointsHex8::_timestepFilename = 
+  "hex8_points.vtk";
+
+const char* pylith::meshio::DataWriterVTKDataPointsHex8::_vertexFilename = 
+  "hex8_points_vertex.vtk";
+
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsHex8::_time = 1.0;
+
+const char* pylith::meshio::DataWriterVTKDataPointsHex8::_timeFormat = 
+  "%3.1f";
+
+const int pylith::meshio::DataWriterVTKDataPointsHex8::_numVertexFields = 3;
+const int pylith::meshio::DataWriterVTKDataPointsHex8::_numVertices = 20;
+
+const pylith::meshio::DataWriterData::FieldStruct
+pylith::meshio::DataWriterVTKDataPointsHex8::_vertexFields[] = {
+  { "displacements", topology::FieldBase::VECTOR, 2 },
+  { "pressure", topology::FieldBase::SCALAR, 1 },
+  { "other", topology::FieldBase::OTHER, 2 },
+};
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsHex8::_vertexField0[] = {
+  1.1, 2.2, 3.3, // 0
+  4.4, 5.5, 6.6, // 1
+  7.7, 8.8, 9.9, // 2
+  10.1, 11.2, 12.3, // 3
+  1.2, 2.3, 3.4, // 4
+  4.5, 5.6, 6.7, // 5
+  7.8, 8.9, 9.0, // 6
+  10.2, 11.3, 12.4, // 7
+  1.3, 2.4, 3.5, // 8
+  4.6, 5.7, 6.8, // 9
+  7.9, 8.0, 9.1, // 10
+  10.2, 11.3, 12.4, // 11
+  13.5, 14.6, 15.7, // 12
+  16.8, 17.9, 18.1, // 13
+  19.2, 20.3, 21.4, // 14
+  22.5, 23.6, 24.7, // 15
+  25.8, 26.9, 27.1, // 16
+  28.8, 29.9, 30.1, // 17
+  31.8, 32.9, 33.1, // 18
+  34.8, 35.9, 36.1, // 19
+};
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsHex8::_vertexField1[] = {
+  2.1, // 0
+  3.2, // 1
+  4.3, // 2 
+  5.4, // 3
+  6.5, // 4
+  7.6, // 5
+  8.7, // 6
+  9.8, // 7
+  10.0, // 8
+  12.1, // 9
+  11.1, // 10
+  13.1, // 11
+  14.1, // 12
+  15.1, // 13
+  16.1, // 14
+  17.1, // 15
+  18.1, // 16
+  19.1, // 17
+  20.1, // 18
+  21.2, // 19
+};
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsHex8::_vertexField2[] = {
+  1.2, 2.3, // 0
+  3.4, 4.5, // 1
+  5.6, 6.7, // 2
+  7.8, 8.9, // 3
+  1.3, 2.4, // 4
+  3.5, 4.6, // 5
+  5.7, 6.8, // 6
+  7.9, 8.0, // 7
+  1.3, 2.4, // 8
+  3.5, 4.6, // 9
+  5.7, 6.8, // 10
+  8.0, 1.4, // 11
+  2.5, 3.6, // 12
+  4.8, 1.5, // 13
+  2.6, 3.7, // 14
+  4.8, 5.9, // 15
+  6.1, 7.2, // 16
+  7.1, 8.2, // 17
+  8.1, 9.2, // 18
+  9.1, 10.1, // 19
+};
+
+const int pylith::meshio::DataWriterVTKDataPointsHex8::_numPoints = 4;
+const int pylith::meshio::DataWriterVTKDataPointsHex8::_spaceDim = 3;
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsHex8::_points[] = {
+  -0.5, 0.0, 0.5,
+  -0.00000001, 0.0, 0.0,
+  -0.00000001, 0.0, 0.99999999,
+   0.99999999, 0.99999999, -0.99999999,
+};
+
+
+pylith::meshio::DataWriterVTKDataPointsHex8::DataWriterVTKDataPointsHex8(void)
+{ // constructor
+  meshFilename = const_cast<char*>(_meshFilename);
+  faultLabel = const_cast<char*>(_faultLabel);
+  faultId = _faultId;
+
+  timestepFilename = const_cast<char*>(_timestepFilename);
+  vertexFilename = const_cast<char*>(_vertexFilename);
+
+  time = _time;
+  timeFormat = const_cast<char*>(_timeFormat);
+  
+  numVertexFields = _numVertexFields;
+  numVertices = _numVertices;
+  assert(3 == numVertexFields);
+  vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
+  vertexFields[0] = const_cast<PylithScalar*>(_vertexField0);
+  vertexFields[1] = const_cast<PylithScalar*>(_vertexField1);
+  vertexFields[2] = const_cast<PylithScalar*>(_vertexField2);
+
+  numPoints = _numPoints;
+  spaceDim = _spaceDim;
+  points = const_cast<PylithScalar*>(_points);
+} // constructor
+
+
+pylith::meshio::DataWriterVTKDataPointsHex8::~DataWriterVTKDataPointsHex8(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsHex8.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsHex8.hh	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsHex8.hh	2012-02-15 01:54:08 UTC (rev 19634)
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2011 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_datawritervtkdatapointshex8_hh)
+#define pylith_meshio_datawritervtkdatapointshex8_hh
+
+#include "DataWriterDataPoints.hh" // ISA DataWriterData
+
+namespace pylith {
+  namespace meshio {
+     class DataWriterVTKDataPointsHex8;
+  } // meshio
+} // pylith
+
+class pylith::meshio::DataWriterVTKDataPointsHex8 : public DataWriterDataPoints
+{ // DataWriterVTKDataPointsHex8
+
+public: 
+
+  /// Constructor
+  DataWriterVTKDataPointsHex8(void);
+
+  /// Destructor
+  ~DataWriterVTKDataPointsHex8(void);
+
+private:
+
+  static const char* _meshFilename; ///< Name of mesh file.
+  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 PylithScalar _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 PylithScalar _vertexField0[]; ///< Values for vertex field 0.
+  static const PylithScalar _vertexField1[]; ///< Values for vertex field 1.
+  static const PylithScalar _vertexField2[]; ///< Values for vertex field 2.
+  //@}
+
+  /// @name Point information.
+  //@{
+  static const int _numPoints; ///< Number of points.
+  static const int _spaceDim; ///< Spatial dimension.
+  static const PylithScalar _points[]; ///< Coordinates of points.
+  //@}  
+
+}; // DataWriterVTKDataPointsHex8
+
+#endif // pylith_meshio_datawritervtkdatapointshex8_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsQuad4.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsQuad4.cc	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsQuad4.cc	2012-02-15 01:54:08 UTC (rev 19634)
@@ -0,0 +1,108 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2011 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "DataWriterVTKDataPointsQuad4.hh"
+
+#include <assert.h> // USES assert()
+
+const char* pylith::meshio::DataWriterVTKDataPointsQuad4::_meshFilename = 
+  "data/quad4.mesh";
+
+const char* pylith::meshio::DataWriterVTKDataPointsQuad4::_timestepFilename = 
+  "quad4_points.vtk";
+
+const char* pylith::meshio::DataWriterVTKDataPointsQuad4::_vertexFilename = 
+  "quad4_points_vertex.vtk";
+
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsQuad4::_time = 1.0;
+
+const char* pylith::meshio::DataWriterVTKDataPointsQuad4::_timeFormat = 
+  "%3.1f";
+
+const int pylith::meshio::DataWriterVTKDataPointsQuad4::_numVertexFields = 3;
+const int pylith::meshio::DataWriterVTKDataPointsQuad4::_numVertices = 6;
+
+const pylith::meshio::DataWriterData::FieldStruct
+pylith::meshio::DataWriterVTKDataPointsQuad4::_vertexFields[] = {
+  { "displacements", topology::FieldBase::VECTOR, 2 },
+  { "pressure", topology::FieldBase::SCALAR, 1 },
+  { "other", topology::FieldBase::OTHER, 2 },
+};
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsQuad4::_vertexField0[] = {
+  1.1, 2.2, // 0
+  3.3, 4.4, // 1
+  5.5, 6.6, // 2
+  7.7, 8.8, // 3
+  9.9, 10.1, // 4
+  11.2, 12.3, // 5
+};
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsQuad4::_vertexField1[] = {
+  2.1, // 0
+  3.2, // 1
+  4.3, // 2
+  5.4, // 3
+  6.5, // 4
+  7.6, // 5
+};
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsQuad4::_vertexField2[] = {
+  1.2, 2.3, // 0
+  3.4, 4.5, // 1
+  5.6, 6.7, // 2
+  7.8, 8.9, // 3
+  9.8, 7.6, // 4
+  6.5, 5.4, // 5
+};
+
+const int pylith::meshio::DataWriterVTKDataPointsQuad4::_numPoints = 3;
+const int pylith::meshio::DataWriterVTKDataPointsQuad4::_spaceDim = 2;
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsQuad4::_points[] = {
+ -0.5, 0.0,
+  0.00000001, 0.0,
+  0.99999999, -0.99999999,
+};
+
+
+pylith::meshio::DataWriterVTKDataPointsQuad4::DataWriterVTKDataPointsQuad4(void)
+{ // constructor
+  meshFilename = const_cast<char*>(_meshFilename);
+
+  timestepFilename = const_cast<char*>(_timestepFilename);
+  vertexFilename = const_cast<char*>(_vertexFilename);
+
+  time = _time;
+  timeFormat = const_cast<char*>(_timeFormat);
+  
+  numVertexFields = _numVertexFields;
+  numVertices = _numVertices;
+  assert(3 == numVertexFields);
+  vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
+  vertexFields[0] = const_cast<PylithScalar*>(_vertexField0);
+  vertexFields[1] = const_cast<PylithScalar*>(_vertexField1);
+  vertexFields[2] = const_cast<PylithScalar*>(_vertexField2);
+
+  numPoints = _numPoints;
+  spaceDim = _spaceDim;
+  points = const_cast<PylithScalar*>(_points);
+} // constructor
+
+
+pylith::meshio::DataWriterVTKDataPointsQuad4::~DataWriterVTKDataPointsQuad4(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsQuad4.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsQuad4.hh	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsQuad4.hh	2012-02-15 01:54:08 UTC (rev 19634)
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2011 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_datawritervtkdatapointsquad4_hh)
+#define pylith_meshio_datawritervtkdatapointsquad4_hh
+
+#include "DataWriterDataPoints.hh" // ISA DataWriterData
+
+namespace pylith {
+  namespace meshio {
+     class DataWriterVTKDataPointsQuad4;
+  } // meshio
+} // pylith
+
+class pylith::meshio::DataWriterVTKDataPointsQuad4 : public DataWriterDataPoints
+{ // DataWriterVTKDataPointsQuad4
+
+public: 
+
+  /// Constructor
+  DataWriterVTKDataPointsQuad4(void);
+
+  /// Destructor
+  ~DataWriterVTKDataPointsQuad4(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 PylithScalar _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 PylithScalar _vertexField0[]; ///< Values for vertex field 0.
+  static const PylithScalar _vertexField1[]; ///< Values for vertex field 1.
+  static const PylithScalar _vertexField2[]; ///< Values for vertex field 2.
+  //@}
+
+  /// @name Point information.
+  //@{
+  static const int _numPoints; ///< Number of points.
+  static const int _spaceDim; ///< Spatial dimension.
+  static const PylithScalar _points[]; ///< Coordinates of points.
+  //@}  
+
+}; // DataWriterVTKDataPointsQuad4
+
+#endif // pylith_meshio_datawritervtkdatapointsquad4_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsTet4.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsTet4.cc	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsTet4.cc	2012-02-15 01:54:08 UTC (rev 19634)
@@ -0,0 +1,130 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2011 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#include "DataWriterVTKDataPointsTet4.hh"
+
+#include <assert.h> // USES assert()
+
+const char* pylith::meshio::DataWriterVTKDataPointsTet4::_meshFilename = 
+  "data/tet4.mesh";
+
+const char* pylith::meshio::DataWriterVTKDataPointsTet4::_faultLabel = 
+  "fault";
+const int pylith::meshio::DataWriterVTKDataPointsTet4::_faultId = 100;
+
+const char* pylith::meshio::DataWriterVTKDataPointsTet4::_timestepFilename = 
+  "tet4_points.vtk";
+
+const char* pylith::meshio::DataWriterVTKDataPointsTet4::_vertexFilename = 
+  "tet4_points_vertex.vtk";
+
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsTet4::_time = 1.0;
+
+const char* pylith::meshio::DataWriterVTKDataPointsTet4::_timeFormat = 
+  "%3.1f";
+
+const int pylith::meshio::DataWriterVTKDataPointsTet4::_numVertexFields = 3;
+const int pylith::meshio::DataWriterVTKDataPointsTet4::_numVertices = 11;
+
+const pylith::meshio::DataWriterData::FieldStruct
+pylith::meshio::DataWriterVTKDataPointsTet4::_vertexFields[] = {
+  { "displacements", topology::FieldBase::VECTOR, 2 },
+  { "pressure", topology::FieldBase::SCALAR, 1 },
+  { "other", topology::FieldBase::OTHER, 2 },
+};
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsTet4::_vertexField0[] = {
+  1.1, 2.2, 3.3, // 0
+  4.4, 5.5, 6.6, // 1
+  7.7, 8.8, 9.9, // 2
+  10.0, 11.1, 12.2, // 3
+  13.3, 14.4, 15.5, // 4
+  16.6, 17.7, 18.8, // 5
+  19.9, 20.0, 21.1, // 6
+  22.2, 23.3, 24.4, // 7
+  25.5, 26.6, 27.7, // 8
+  28.8, 29.9, 30.0, // 9
+  31.1, 32.2, 33.3, // 10
+};
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsTet4::_vertexField1[] = {
+  2.1, // 0
+  3.2, // 1
+  4.3, // 2
+  5.4, // 3
+  6.5, // 4
+  7.6, // 5
+  8.7, // 6
+  9.8,  // 7
+  10.9, // 8
+  11.0, // 9
+  12.1, // 10
+};
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsTet4::_vertexField2[] = {
+  1.2, 2.3, // 0
+  3.4, 4.5, // 1
+  5.6, 6.7, // 2
+  7.8, 8.9, // 3
+  9.0, 10.1, // 4
+  11.2, 12.3, // 5
+  13.4, 14.5, // 6
+  15.6, 16.7, // 7
+  17.8, 18.9, // 8
+  19.0, 20.1, // 9
+  21.2, 22.3, // 10
+};
+
+const int pylith::meshio::DataWriterVTKDataPointsTet4::_numPoints = 4;
+const int pylith::meshio::DataWriterVTKDataPointsTet4::_spaceDim = 3;
+const PylithScalar pylith::meshio::DataWriterVTKDataPointsTet4::_points[] = {
+  -0.33333333, 0.0, 0.33333333,
+  +0.00000001, 0.0, 0.33333333,
+  +0.00000001, 0.0, 0.00000001,
+  +0.00000001, -0.99999999, 0.00000001,
+};
+
+
+pylith::meshio::DataWriterVTKDataPointsTet4::DataWriterVTKDataPointsTet4(void)
+{ // constructor
+  meshFilename = const_cast<char*>(_meshFilename);
+  faultLabel = const_cast<char*>(_faultLabel);
+  faultId = _faultId;
+
+  timestepFilename = const_cast<char*>(_timestepFilename);
+  vertexFilename = const_cast<char*>(_vertexFilename);
+
+  time = _time;
+  timeFormat = const_cast<char*>(_timeFormat);
+  
+  numVertexFields = _numVertexFields;
+  numVertices = _numVertices;
+  assert(3 == numVertexFields);
+  vertexFieldsInfo = const_cast<DataWriterData::FieldStruct*>(_vertexFields);
+  vertexFields[0] = const_cast<PylithScalar*>(_vertexField0);
+  vertexFields[1] = const_cast<PylithScalar*>(_vertexField1);
+  vertexFields[2] = const_cast<PylithScalar*>(_vertexField2);
+
+  numPoints = _numPoints;
+  spaceDim = _spaceDim;
+  points = const_cast<PylithScalar*>(_points);
+} // constructor
+
+
+pylith::meshio::DataWriterVTKDataPointsTet4::~DataWriterVTKDataPointsTet4(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsTet4.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsTet4.hh	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/DataWriterVTKDataPointsTet4.hh	2012-02-15 01:54:08 UTC (rev 19634)
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+// Brad T. Aagaard, U.S. Geological Survey
+// Charles A. Williams, GNS Science
+// Matthew G. Knepley, University of Chicago
+//
+// This code was developed as part of the Computational Infrastructure
+// for Geodynamics (http://geodynamics.org).
+//
+// Copyright (c) 2010-2011 University of California, Davis
+//
+// See COPYING for license information.
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_datawritervtkdatapointstet4_hh)
+#define pylith_meshio_datawritervtkdatapointstet4_hh
+
+#include "DataWriterDataPoints.hh" // ISA DataWriterData
+
+namespace pylith {
+  namespace meshio {
+     class DataWriterVTKDataPointsTet4;
+  } // meshio
+} // pylith
+
+class pylith::meshio::DataWriterVTKDataPointsTet4 : public DataWriterDataPoints
+{ // DataWriterVTKDataPointsTet4
+
+public: 
+
+  /// Constructor
+  DataWriterVTKDataPointsTet4(void);
+
+  /// Destructor
+  ~DataWriterVTKDataPointsTet4(void);
+
+private:
+
+  static const char* _meshFilename; ///< Name of mesh file.
+  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 PylithScalar _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 PylithScalar _vertexField0[]; ///< Values for vertex field 0.
+  static const PylithScalar _vertexField1[]; ///< Values for vertex field 1.
+  static const PylithScalar _vertexField2[]; ///< Values for vertex field 2.
+  //@}
+
+  /// @name Point information.
+  //@{
+  static const int _numPoints; ///< Number of points.
+  static const int _spaceDim; ///< Spatial dimension.
+  static const PylithScalar _points[]; ///< Coordinates of points.
+  //@}  
+
+}; // DataWriterVTKDataPointsTet4
+
+#endif // pylith_meshio_datawritervtkdatapointstet4_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	2012-02-15 01:26:11 UTC (rev 19633)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/Makefile.am	2012-02-15 01:54:08 UTC (rev 19634)
@@ -188,7 +188,13 @@
 	hex8_fault_vertex.h5 \
 	hex8_fault_cell.h5 \
 	tri3_points_t10.vtk \
-	tri3_points_vertex_t10.vtk
+	tri3_points_vertex_t10.vtk \
+	quad4_points_t10.vtk \
+	quad4_points_vertex_t10.vtk \
+	tet4_points_t10.vtk \
+	tet4_points_vertex_t10.vtk \
+	hex8_points_t10.vtk \
+	hex8_points_vertex_t10.vtk
 
 noinst_TMP =
 

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_points_t10.vtk
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_points_t10.vtk	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_points_t10.vtk	2012-02-15 01:54:08 UTC (rev 19634)
@@ -0,0 +1,19 @@
+# vtk DataFile Version 2.0
+Simplicial Mesh Example
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 4 double
+-5.000000e-01 0.000000e+00 5.000000e-01
+-1.000000e-08 0.000000e+00 0.000000e+00
+-1.000000e-08 0.000000e+00 1.000000e+00
+1.000000e+00 1.000000e+00 -1.000000e+00
+CELLS 4 8
+1  0
+1  1
+1  2
+1  3
+CELL_TYPES 4
+1
+1
+1
+1

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_points_vertex_t10.vtk
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_points_vertex_t10.vtk	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_points_vertex_t10.vtk	2012-02-15 01:54:08 UTC (rev 19634)
@@ -0,0 +1,19 @@
+# vtk DataFile Version 2.0
+Simplicial Mesh Example
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 4 double
+-5.000000e-01 0.000000e+00 5.000000e-01
+-1.000000e-07 0.000000e+00 0.000000e+00
+-1.000000e-07 0.000000e+00 1.000000e+00
+1.000000e+00 1.000000e+00 -1.000000e+00
+CELLS 4 8
+1  0
+1  1
+1  2
+1  3
+CELL_TYPES 4
+1
+1
+1
+1

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_points_t10.vtk
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_points_t10.vtk	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_points_t10.vtk	2012-02-15 01:54:08 UTC (rev 19634)
@@ -0,0 +1,16 @@
+# vtk DataFile Version 2.0
+Simplicial Mesh Example
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 3 double
+-5.000000e-01 0.000000e+00 0.0
+1.000000e-08 0.000000e+00 0.0
+1.000000e+00 -1.000000e+00 0.0
+CELLS 3 6
+1  0
+1  1
+1  2
+CELL_TYPES 3
+1
+1
+1

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_points_vertex_t10.vtk
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_points_vertex_t10.vtk	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_points_vertex_t10.vtk	2012-02-15 01:54:08 UTC (rev 19634)
@@ -0,0 +1,16 @@
+# vtk DataFile Version 2.0
+Simplicial Mesh Example
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 3 double
+-5.000000e-01 0.000000e+00 0.0
+1.000000e-07 0.000000e+00 0.0
+9.999999e-01 -1.000000e+00 0.0
+CELLS 3 6
+1  0
+1  1
+1  2
+CELL_TYPES 3
+1
+1
+1

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_points_t10.vtk
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_points_t10.vtk	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_points_t10.vtk	2012-02-15 01:54:08 UTC (rev 19634)
@@ -0,0 +1,19 @@
+# vtk DataFile Version 2.0
+Simplicial Mesh Example
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 4 double
+-3.333333e-01 0.000000e+00 3.333333e-01
+1.000000e-08 0.000000e+00 3.333333e-01
+1.000000e-08 0.000000e+00 1.000000e-08
+1.000000e-08 -1.000000e+00 1.000000e-08
+CELLS 4 8
+1  0
+1  1
+1  2
+1  3
+CELL_TYPES 4
+1
+1
+1
+1

Added: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_points_vertex_t10.vtk
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_points_vertex_t10.vtk	                        (rev 0)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_points_vertex_t10.vtk	2012-02-15 01:54:08 UTC (rev 19634)
@@ -0,0 +1,37 @@
+# vtk DataFile Version 2.0
+Simplicial Mesh Example
+ASCII
+DATASET UNSTRUCTURED_GRID
+POINTS 4 double
+-3.333333e-01 0.000000e+00 3.333333e-01
+1.000000e-09 0.000000e+00 3.333333e-01
+1.000000e-09 0.000000e+00 1.000000e-12
+1.000000e-09 -1.000000e+00 1.000000e-09
+CELLS 4 8
+1  0
+1  1
+1  2
+1  3
+CELL_TYPES 4
+1
+1
+1
+1
+POINT_DATA 4
+VECTORS displacements double
+9.300000e+00 1.073333e+01 0.0
+8.900000e+00 1.000000e+01 0.0
+1.100000e+00 2.200000e+00 0.0
+3.300000e+00 4.400000e+00 0.0
+SCALARS pressure double 1
+LOOKUP_TABLE default
+6.866667e+00
+6.500000e+00
+2.100000e+00
+3.200000e+00
+SCALARS other double 2
+LOOKUP_TABLE default
+9.733333e+00 1.083333e+01
+9.000000e+00 1.010000e+01
+1.200000e+00 2.300000e+00
+3.400000e+00 4.500000e+00



More information about the CIG-COMMITS mailing list