[cig-commits] r6875 - in short/3D/PyLith/trunk: libsrc/topology unittests/libtests/topology unittests/libtests/topology/data

brad at geodynamics.org brad at geodynamics.org
Mon May 14 14:59:40 PDT 2007


Author: brad
Date: 2007-05-14 14:59:40 -0700 (Mon, 14 May 2007)
New Revision: 6875

Added:
   short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryHex3D.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryHex3D.hh
   short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryQuad3D.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryQuad3D.hh
   short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataHex3D.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataHex3D.hh
   short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataQuad3D.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataQuad3D.hh
   short/3D/PyLith/trunk/unittests/libtests/topology/data/hex.py
Modified:
   short/3D/PyLith/trunk/libsrc/topology/GeometryQuad3D.cc
   short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am
Log:
Fixed another bug in cell geometry. Finished implementing unit tests for cell geometry.

Modified: short/3D/PyLith/trunk/libsrc/topology/GeometryQuad3D.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/GeometryQuad3D.cc	2007-05-14 19:22:59 UTC (rev 6874)
+++ short/3D/PyLith/trunk/libsrc/topology/GeometryQuad3D.cc	2007-05-14 21:59:40 UTC (rev 6875)
@@ -23,7 +23,7 @@
 // ----------------------------------------------------------------------
 // Default constructor.
 pylith::topology::GeometryQuad3D::GeometryQuad3D(void) :
-  CellGeometry(2, 2, 4)
+  CellGeometry(2, 3, 4)
 { // constructor
 } // constructor
 

Modified: short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am	2007-05-14 19:22:59 UTC (rev 6874)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/Makefile.am	2007-05-14 21:59:40 UTC (rev 6875)
@@ -29,7 +29,9 @@
 	TestGeometryTri2D.cc \
 	TestGeometryTri3D.cc \
 	TestGeometryQuad2D.cc \
+	TestGeometryQuad3D.cc \
 	TestGeometryTet3D.cc \
+	TestGeometryHex3D.cc \
 	test_topology.cc
 
 noinst_HEADERS =
@@ -43,7 +45,9 @@
 	TestGeometryTri2D.hh \
 	TestGeometryTri3D.hh \
 	TestGeometryQuad2D.hh \
-	TestGeometryTet3D.hh
+	TestGeometryQuad3D.hh \
+	TestGeometryTet3D.hh \
+	TestGeometryHex3D.hh
 
 # Source files associated with testing data
 testtopology_SOURCES += \
@@ -57,7 +61,9 @@
 	data/GeomDataTri2D.cc \
 	data/GeomDataTri3D.cc \
 	data/GeomDataQuad2D.cc \
-	data/GeomDataTet3D.cc
+	data/GeomDataQuad3D.cc \
+	data/GeomDataTet3D.cc \
+	data/GeomDataHex3D.cc
 
 noinst_HEADERS += 
 	data/CellGeomData.hh \
@@ -70,7 +76,9 @@
 	data/GeometryDataTri2D.hh \
 	data/GeometryDataTri3D.hh \
 	data/GeometryDataQuad2D.hh \
-	data/GeometryDataTet3D.hh
+	data/GeometryDataQuad3D.hh \
+	data/GeometryDataTet3D.hh \
+	data/GeometryDataHex3D.hh
 
 testtopology_LDFLAGS = $(PETSC_LIB) $(PYTHON_BLDLIBRARY)
 

Added: short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryHex3D.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryHex3D.cc	2007-05-14 19:22:59 UTC (rev 6874)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryHex3D.cc	2007-05-14 21:59:40 UTC (rev 6875)
@@ -0,0 +1,92 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestGeometryHex3D.hh" // Implementation of class methods
+
+#include "pylith/topology/GeometryHex3D.hh"
+#include "pylith/topology/GeometryQuad3D.hh"
+#include "pylith/topology/GeometryPoint2D.hh"
+
+#include "pylith/utils/array.hh" // USES double_array
+
+#include "data/GeomDataHex3D.hh"
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::topology::TestGeometryHex3D );
+
+// ----------------------------------------------------------------------
+// Test constructor
+void
+pylith::topology::TestGeometryHex3D::testConstructor(void)
+{ // testConstructor
+  GeometryHex3D geometry;
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test cellDim()
+void
+pylith::topology::TestGeometryHex3D::testCellDim(void)
+{ // testCellDim
+  GeometryHex3D geometry;
+  GeomDataHex3D data;
+  _testCellDim(geometry, data);
+} // testCellDim
+
+// ----------------------------------------------------------------------
+// Test spaceDim()
+void
+pylith::topology::TestGeometryHex3D::testSpaceDim(void)
+{ // testSpaceDim
+  GeometryHex3D geometry;
+  GeomDataHex3D data;
+  _testSpaceDim(geometry, data);
+} // testSpaceDim
+
+// ----------------------------------------------------------------------
+// Test numCorners()
+void
+pylith::topology::TestGeometryHex3D::testNumCorners(void)
+{ // testNumCorners
+  GeometryHex3D geometry;
+  GeomDataHex3D data;
+  _testNumCorners(geometry, data);
+} // testNumCorners
+
+// ----------------------------------------------------------------------
+// Test geometryLowerDim().
+void
+pylith::topology::TestGeometryHex3D::testGeomLowerDim(void)
+{ // testGeomLowerDim
+  GeometryHex3D geometry;
+  CellGeometry* geometryLD = geometry.geometryLowerDim();
+  GeometryQuad3D* geometryPt = dynamic_cast<GeometryQuad3D*>(geometryLD);
+  CPPUNIT_ASSERT(0 != geometryPt);
+  GeometryPoint2D* geometryPt2 = dynamic_cast<GeometryPoint2D*>(geometryLD);
+  CPPUNIT_ASSERT(0 == geometryPt2);
+  delete geometryLD; geometryLD = 0;
+} // testGeomLowerDim
+
+// ----------------------------------------------------------------------
+// Test jacobian().
+void
+pylith::topology::TestGeometryHex3D::testJacobian(void)
+{ // testJacobian
+  GeometryHex3D geometry;
+  GeomDataHex3D data;
+
+  _testJacobian(&geometry, data);
+} // testJacobian
+
+
+// End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryHex3D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryHex3D.hh	2007-05-14 19:22:59 UTC (rev 6874)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryHex3D.hh	2007-05-14 21:59:40 UTC (rev 6875)
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/topology/TestGeometryHex3D.hh
+ *
+ * @brief C++ TestGeometryHex3D object
+ *
+ * C++ unit testing for TopologyAscii.
+ */
+
+#if !defined(pylith_topology_testgeometryhex3d_hh)
+#define pylith_topology_testgeometryhex3d_hh
+
+#include "TestCellGeometry.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+  namespace topology {
+    class TestGeometryHex3D;
+    class CellGeomData;
+  } // topology
+} // pylith
+
+/// C++ unit testing for Quadrature3D
+class pylith::topology::TestGeometryHex3D : public TestCellGeometry
+{ // class TestGeometryHex3D
+
+  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+  CPPUNIT_TEST_SUITE( TestGeometryHex3D );
+  CPPUNIT_TEST( testConstructor );
+  CPPUNIT_TEST( testCellDim );
+  CPPUNIT_TEST( testSpaceDim );
+  CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testGeomLowerDim );
+  CPPUNIT_TEST( testJacobian );
+  CPPUNIT_TEST_SUITE_END();
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Test constructor
+  void testConstructor(void);
+
+  /// Test cellDim()
+  void testCellDim(void);
+
+  /// Test spaceDim()
+  void testSpaceDim(void);
+
+  /// Test numCorners()
+  void testNumCorners(void);
+
+  /// Test geometryLowerDim().
+  void testGeomLowerDim(void);
+
+  /// Test jacobian().
+  void testJacobian(void);
+
+}; // class TestGeometryHex3D
+
+#endif // pylith_topology_testgeometryhex3d_hh
+
+// End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryQuad3D.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryQuad3D.cc	2007-05-14 19:22:59 UTC (rev 6874)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryQuad3D.cc	2007-05-14 21:59:40 UTC (rev 6875)
@@ -0,0 +1,92 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+#include <portinfo>
+
+#include "TestGeometryQuad3D.hh" // Implementation of class methods
+
+#include "pylith/topology/GeometryQuad3D.hh"
+#include "pylith/topology/GeometryLine3D.hh"
+#include "pylith/topology/GeometryPoint2D.hh"
+
+#include "pylith/utils/array.hh" // USES double_array
+
+#include "data/GeomDataQuad3D.hh"
+
+// ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::topology::TestGeometryQuad3D );
+
+// ----------------------------------------------------------------------
+// Test constructor
+void
+pylith::topology::TestGeometryQuad3D::testConstructor(void)
+{ // testConstructor
+  GeometryQuad3D geometry;
+} // testConstructor
+
+// ----------------------------------------------------------------------
+// Test cellDim()
+void
+pylith::topology::TestGeometryQuad3D::testCellDim(void)
+{ // testCellDim
+  GeometryQuad3D geometry;
+  GeomDataQuad3D data;
+  _testCellDim(geometry, data);
+} // testCellDim
+
+// ----------------------------------------------------------------------
+// Test spaceDim()
+void
+pylith::topology::TestGeometryQuad3D::testSpaceDim(void)
+{ // testSpaceDim
+  GeometryQuad3D geometry;
+  GeomDataQuad3D data;
+  _testSpaceDim(geometry, data);
+} // testSpaceDim
+
+// ----------------------------------------------------------------------
+// Test numCorners()
+void
+pylith::topology::TestGeometryQuad3D::testNumCorners(void)
+{ // testNumCorners
+  GeometryQuad3D geometry;
+  GeomDataQuad3D data;
+  _testNumCorners(geometry, data);
+} // testNumCorners
+
+// ----------------------------------------------------------------------
+// Test geometryLowerDim().
+void
+pylith::topology::TestGeometryQuad3D::testGeomLowerDim(void)
+{ // testGeomLowerDim
+  GeometryQuad3D geometry;
+  CellGeometry* geometryLD = geometry.geometryLowerDim();
+  GeometryLine3D* geometryPt = dynamic_cast<GeometryLine3D*>(geometryLD);
+  CPPUNIT_ASSERT(0 != geometryPt);
+  GeometryPoint2D* geometryPt2 = dynamic_cast<GeometryPoint2D*>(geometryLD);
+  CPPUNIT_ASSERT(0 == geometryPt2);
+  delete geometryLD; geometryLD = 0;
+} // testGeomLowerDim
+
+// ----------------------------------------------------------------------
+// Test jacobian().
+void
+pylith::topology::TestGeometryQuad3D::testJacobian(void)
+{ // testJacobian
+  GeometryQuad3D geometry;
+  GeomDataQuad3D data;
+
+  _testJacobian(&geometry, data);
+} // testJacobian
+
+
+// End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryQuad3D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryQuad3D.hh	2007-05-14 19:22:59 UTC (rev 6874)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/TestGeometryQuad3D.hh	2007-05-14 21:59:40 UTC (rev 6875)
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/**
+ * @file unittests/libtests/topology/TestGeometryQuad3D.hh
+ *
+ * @brief C++ TestGeometryQuad3D object
+ *
+ * C++ unit testing for TopologyAscii.
+ */
+
+#if !defined(pylith_topology_testgeometryquad3d_hh)
+#define pylith_topology_testgeometryquad3d_hh
+
+#include "TestCellGeometry.hh"
+
+/// Namespace for pylith package
+namespace pylith {
+  namespace topology {
+    class TestGeometryQuad3D;
+    class CellGeomData;
+  } // topology
+} // pylith
+
+/// C++ unit testing for Quadrature3D
+class pylith::topology::TestGeometryQuad3D : public TestCellGeometry
+{ // class TestGeometryQuad3D
+
+  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+  CPPUNIT_TEST_SUITE( TestGeometryQuad3D );
+  CPPUNIT_TEST( testConstructor );
+  CPPUNIT_TEST( testCellDim );
+  CPPUNIT_TEST( testSpaceDim );
+  CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testGeomLowerDim );
+  CPPUNIT_TEST( testJacobian );
+  CPPUNIT_TEST_SUITE_END();
+
+  // PUBLIC METHODS /////////////////////////////////////////////////////
+public :
+
+  /// Test constructor
+  void testConstructor(void);
+
+  /// Test cellDim()
+  void testCellDim(void);
+
+  /// Test spaceDim()
+  void testSpaceDim(void);
+
+  /// Test numCorners()
+  void testNumCorners(void);
+
+  /// Test geometryLowerDim().
+  void testGeomLowerDim(void);
+
+  /// Test jacobian().
+  void testJacobian(void);
+
+}; // class TestGeometryQuad3D
+
+#endif // pylith_topology_testgeometryquad3d_hh
+
+// End of file 

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataHex3D.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataHex3D.cc	2007-05-14 19:22:59 UTC (rev 6874)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataHex3D.cc	2007-05-14 21:59:40 UTC (rev 6875)
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "GeomDataHex3D.hh"
+
+const int pylith::topology::GeomDataHex3D::_cellDim = 3;
+
+const int pylith::topology::GeomDataHex3D::_spaceDim = 3;
+
+const int pylith::topology::GeomDataHex3D::_numCorners = 8;
+
+const int pylith::topology::GeomDataHex3D::_numLocs = 9;
+
+const double pylith::topology::GeomDataHex3D::_vertices[] = {
+  -1.3, -1.4, -0.8,
+  1.2, -1.5, -0.9,
+  1.4, 0.7, -1.2,
+  -1.6, 0.4, -0.5,
+  -1.7, -0.8, 1.8,
+  2.1, -1.7, 0.6,
+  2.3, 0.2, 1.9, 
+  -1.8, 0.3, 2.2
+};
+
+const double pylith::topology::GeomDataHex3D::_locations[] = {
+  0.0, 0.0, 0.0,
+  1.0, 0.0, 0.0,
+  0.0, 1.0, 0.0,
+  1.0, 1.0, 0.0,
+  0.0, 0.0, 1.0,
+  1.0, 0.0, 1.0,
+  0.0, 1.0, 1.0,
+  1.0, 1.0, 1.0,
+  0.2, 0.8, 0.7
+};
+
+const double pylith::topology::GeomDataHex3D::_jacobian[] = {
+  2.5, -0.3, -0.4, -0.1, 1.8, 0.6, -0.1, 0.3, 2.6,
+  2.5, 0.2, 0.9, -0.1, 2.2, -0.2, -0.1, -0.3, 1.5,
+  3.0, -0.3, -0.2, 0.3, 1.8, -0.1, -0.7, 0.3, 2.7,
+  3.0, 0.2, 0.9, 0.3, 2.2, -0.5, -0.7, -0.3, 3.1,
+  3.8, -0.1, -0.4, -0.9, 1.1, 0.6, -1.2, 0.4, 2.6,
+  3.8, 0.2, 0.9, -0.9, 1.9, -0.2, -1.2, 1.3, 1.5,
+  4.1, -0.1, -0.2, -0.1, 1.1, -0.1, -0.3, 0.4, 2.7,
+  4.1, 0.2, 0.9, -0.1, 1.9, -0.5, -0.3, 1.3, 3.1,
+  3.698, -0.088, -0.012, -0.116, 1.446, -0.056, -0.51, 0.46, 2.7
+};
+
+pylith::topology::GeomDataHex3D::GeomDataHex3D(void)
+{ // constructor
+  cellDim = _cellDim;
+  spaceDim = _spaceDim;
+  numCorners = _numCorners;
+  numLocs = _numLocs;
+  vertices = const_cast<double*>(_vertices);
+  locations = const_cast<double*>(_locations);
+  jacobian = const_cast<double*>(_jacobian);
+} // constructor
+
+pylith::topology::GeomDataHex3D::~GeomDataHex3D(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataHex3D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataHex3D.hh	2007-05-14 19:22:59 UTC (rev 6874)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataHex3D.hh	2007-05-14 21:59:40 UTC (rev 6875)
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_geomdatahex3d_hh)
+#define pylith_meshio_geomdatahex3d_hh
+
+#include "CellGeomData.hh"
+
+namespace pylith {
+  namespace topology {
+     class GeomDataHex3D;
+  } // topology
+} // pylith
+
+class pylith::topology::GeomDataHex3D : public CellGeomData
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public: 
+
+  /// Constructor
+  GeomDataHex3D(void);
+
+  /// Destructor
+  ~GeomDataHex3D(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+  static const int _cellDim; ///< Number of dimensions associated with cell
+  static const int _spaceDim; ///< Number of dimensions in vertex coordinates
+  static const int _numCorners; ///< Number of vertices in cell
+
+  static const int _numLocs; ///< Number of locations for computing Jacobian
+
+  static const double _vertices[]; ///< Coordinates of cell's vertices
+  static const double _locations[]; ///< Locations to compute Jacobian
+  static const double _jacobian[]; ///< Jacobian at locations
+
+};
+
+#endif // pylith_meshio_geomdatahex3d_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataQuad3D.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataQuad3D.cc	2007-05-14 19:22:59 UTC (rev 6874)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataQuad3D.cc	2007-05-14 21:59:40 UTC (rev 6875)
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#include "GeomDataQuad3D.hh"
+
+const int pylith::topology::GeomDataQuad3D::_cellDim = 2;
+
+const int pylith::topology::GeomDataQuad3D::_spaceDim = 3;
+
+const int pylith::topology::GeomDataQuad3D::_numCorners = 4;
+
+const int pylith::topology::GeomDataQuad3D::_numLocs = 5;
+
+const double pylith::topology::GeomDataQuad3D::_vertices[] = {
+  1.1, -0.9, 0.1,
+  1.0, 0.7, 0.8,
+  -0.4, 0.6, 1.2,
+  -0.3, -1.3, -0.1
+};
+
+const double pylith::topology::GeomDataQuad3D::_locations[] = {
+  0.0, 0.0,
+  1.0, 0.0,
+  0.0, 1.0,
+  1.0, 1.0,
+  0.3, 0.8
+};
+
+const double pylith::topology::GeomDataQuad3D::_jacobian[] = {
+  -0.1, -1.4, 1.6, -0.4, 0.7, -0.2,
+  -0.1, -1.4, 1.6, -0.1, 0.7, 0.4,
+  -0.1, -1.4, 1.9, -0.4, 1.3, -0.2,
+  -0.1, -1.4, 1.9, -0.1, 1.3, 0.4,
+  -0.1, -1.4, 1.84, -0.31, 1.18, -0.02
+};
+
+pylith::topology::GeomDataQuad3D::GeomDataQuad3D(void)
+{ // constructor
+  cellDim = _cellDim;
+  spaceDim = _spaceDim;
+  numCorners = _numCorners;
+  numLocs = _numLocs;
+  vertices = const_cast<double*>(_vertices);
+  locations = const_cast<double*>(_locations);
+  jacobian = const_cast<double*>(_jacobian);
+} // constructor
+
+pylith::topology::GeomDataQuad3D::~GeomDataQuad3D(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataQuad3D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataQuad3D.hh	2007-05-14 19:22:59 UTC (rev 6874)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/GeomDataQuad3D.hh	2007-05-14 21:59:40 UTC (rev 6875)
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_meshio_geomdataquad3d_hh)
+#define pylith_meshio_geomdataquad3d_hh
+
+#include "CellGeomData.hh"
+
+namespace pylith {
+  namespace topology {
+     class GeomDataQuad3D;
+  } // topology
+} // pylith
+
+class pylith::topology::GeomDataQuad3D : public CellGeomData
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public: 
+
+  /// Constructor
+  GeomDataQuad3D(void);
+
+  /// Destructor
+  ~GeomDataQuad3D(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+  static const int _cellDim; ///< Number of dimensions associated with cell
+  static const int _spaceDim; ///< Number of dimensions in vertex coordinates
+  static const int _numCorners; ///< Number of vertices in cell
+
+  static const int _numLocs; ///< Number of locations for computing Jacobian
+
+  static const double _vertices[]; ///< Coordinates of cell's vertices
+  static const double _locations[]; ///< Locations to compute Jacobian
+  static const double _jacobian[]; ///< Jacobian at locations
+
+};
+
+#endif // pylith_meshio_geomdataquad3d_hh
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/topology/data/hex.py
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/topology/data/hex.py	2007-05-14 19:22:59 UTC (rev 6874)
+++ short/3D/PyLith/trunk/unittests/libtests/topology/data/hex.py	2007-05-14 21:59:40 UTC (rev 6875)
@@ -0,0 +1,104 @@
+from numpy import *
+
+p0 = array([-1.3, -1.4, -0.8], dtype=float64)
+p1 = array([1.2, -1.5, -0.9], dtype=float64)
+p2 = array([1.4, 0.7, -1.2], dtype=float64)
+p3 = array([-1.6, 0.4, -0.5], dtype=float64)
+p4 = array([-1.7, -0.8, 1.8], dtype=float64)
+p5 = array([2.1, -1.7, 0.6], dtype=float64)
+p6 = array([2.3, 0.2, 1.9], dtype=float64)
+p7 = array([-1.8, 0.3, 2.2], dtype=float64)
+
+j000 = zeros( (3,3), dtype=float64)
+j000[:,0] = p1-p0
+j000[:,1] = p3-p0
+j000[:,2] = p4-p0
+print 'j000\n',j000
+
+j100 = zeros( (3,3), dtype=float64)
+j100[:,0] = p1-p0
+j100[:,1] = p2-p1
+j100[:,2] = p5-p1
+print 'j100\n',j100
+
+j010 = zeros( (3,3), dtype=float64)
+j010[:,0] = p2-p3
+j010[:,1] = p3-p0
+j010[:,2] = p7-p3
+print 'j010\n',j010
+
+j110 = zeros( (3,3), dtype=float64)
+j110[:,0] = p2-p3
+j110[:,1] = p2-p1
+j110[:,2] = p6-p2
+print 'j110\n',j110
+
+j001 = zeros( (3,3), dtype=float64)
+j001[:,0] = p5-p4
+j001[:,1] = p7-p4
+j001[:,2] = p4-p0
+print 'j001\n',j001
+
+j101 = zeros( (3,3), dtype=float64)
+j101[:,0] = p5-p4
+j101[:,1] = p6-p5
+j101[:,2] = p5-p1
+print 'j101\n',j101
+
+j011 = zeros( (3,3), dtype=float64)
+j011[:,0] = p6-p7
+j011[:,1] = p7-p4
+j011[:,2] = p7-p3
+print 'j011\n',j011
+
+j111 = zeros( (3,3), dtype=float64)
+j111[:,0] = p6-p7
+j111[:,1] = p6-p5
+j111[:,2] = p6-p2
+print 'j111\n',j111
+
+(x0,y0,z0) = p0
+(x1,y1,z1) = p1
+(x2,y2,z2) = p2
+(x3,y3,z3) = p3
+(x4,y4,z4) = p4
+(x5,y5,z5) = p5
+(x6,y6,z6) = p6
+(x7,y7,z7) = p7
+x = 0.2
+y = 0.8
+z = 0.7
+
+f_xy = x2-x1-x3+x0
+g_xy = y2-y1-y3+y0
+h_xy = z2-z1-z3+z0
+
+f_yz = x7-x3-x4+x0
+g_yz = y7-y3-y4+y0
+h_yz = z7-z3-z4+z0
+
+f_xz = x5-x1-x4+x0
+g_xz = y5-y1-y4+y0
+h_xz = z5-z1-z4+z0
+
+f_xyz = x6-x0+x1-x2+x3+x4-x5-x7
+g_xyz = y6-y0+y1-y2+y3+y4-y5-y7
+h_xyz = z6-z0+z1-z2+z3+z4-z5-z7
+
+j00 = x1-x0 + f_xy*y + f_xz*z + f_xyz*y*z
+j10 = y1-y0 + g_xy*y + g_xz*z + g_xyz*y*z
+j20 = z1-z0 + h_xy*y + h_xz*z + h_xyz*y*z
+
+j01 = x3-x0 + f_xy*x + f_yz*z + f_xyz*x*z
+j11 = y3-y0 + g_xy*x + g_yz*z + g_xyz*x*z
+j21 = z3-z0 + h_xy*x + h_yz*z + h_xyz*x*z
+
+j02 = x4-x0 + f_xz*x + f_yz*y + f_xyz*x*y
+j12 = y4-y0 + g_xz*x + g_yz*y + g_xyz*x*y
+j22 = z4-z0 + h_xz*x + h_yz*y + h_xyz*x*y
+
+j = array([ [j00, j01, j02],
+            [j10, j11, j12],
+            [j20, j21, j22] ], dtype=float64)
+print 'j\n',j
+



More information about the cig-commits mailing list