[cig-commits] r6602 - in short/3D/PyLith/trunk/unittests/libtests/faults: . data

brad at geodynamics.org brad at geodynamics.org
Wed Apr 18 17:29:40 PDT 2007


Author: brad
Date: 2007-04-18 17:29:40 -0700 (Wed, 18 Apr 2007)
New Revision: 6602

Added:
   short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataQuad4.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataQuad4.hh
   short/3D/PyLith/trunk/unittests/libtests/faults/data/meshQuad4A.txt
Modified:
   short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh
   short/3D/PyLith/trunk/unittests/libtests/faults/data/Makefile.am
Log:
Added test for creating cohesive elements for quad4.

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am	2007-04-19 00:04:36 UTC (rev 6601)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/Makefile.am	2007-04-19 00:29:40 UTC (rev 6602)
@@ -34,12 +34,14 @@
 	data/CohesiveData.cc \
 	data/CohesiveDataLine2.cc \
 	data/CohesiveDataTri3.cc \
+	data/CohesiveDataQuad4.cc \
 	data/CohesiveDataTet4.cc
 
 noinst_HEADERS += \
 	data/CohesiveData.hh \
 	data/CohesiveDataLine2.hh \
 	data/CohesiveDataTri3.hh \
+	data/CohesiveDataQuad4.hh \
 	data/CohesiveDataTet4.hh
 
 testfaults_LDFLAGS = $(PETSC_LIB)

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc	2007-04-19 00:04:36 UTC (rev 6601)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc	2007-04-19 00:29:40 UTC (rev 6602)
@@ -22,6 +22,7 @@
 
 #include "data/CohesiveDataLine2.hh" // USES CohesiveDataLine2
 #include "data/CohesiveDataTri3.hh" // USES CohesiveDataTri3
+#include "data/CohesiveDataQuad4.hh" // USES CohesiveDataQuad4
 #include "data/CohesiveDataTet4.hh" // USES CohesiveDataTet4
 
 
@@ -47,6 +48,15 @@
 } // testAdjustTopologyTri3
 
 // ----------------------------------------------------------------------
+// Test adjustTopology() with 2-D quadrilateral element.
+void
+pylith::faults::TestFaultCohesive::testAdjustTopologyQuad4(void)
+{ // testAdjustTopologyQuad4
+  CohesiveDataQuad4 data;
+  _testAdjustTopology(data);
+} // testAdjustTopologyQuad4
+
+// ----------------------------------------------------------------------
 // Test adjustTopology() with 3-D tetrahedral element.
 void
 pylith::faults::TestFaultCohesive::testAdjustTopologyTet4(void)

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh	2007-04-19 00:04:36 UTC (rev 6601)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh	2007-04-19 00:29:40 UTC (rev 6602)
@@ -42,6 +42,7 @@
   CPPUNIT_TEST_SUITE( TestFaultCohesive );
   CPPUNIT_TEST( testAdjustTopologyLine2 );
   CPPUNIT_TEST( testAdjustTopologyTri3 );
+  CPPUNIT_TEST( testAdjustTopologyQuad4 );
   CPPUNIT_TEST( testAdjustTopologyTet4 );
   CPPUNIT_TEST_SUITE_END();
 
@@ -54,6 +55,9 @@
   /// Test adjustTopology() with 2-D triangular element.
   void testAdjustTopologyTri3(void);
 
+  /// Test adjustTopology() with 2-D quadrilateral element.
+  void testAdjustTopologyQuad4(void);
+
   /// Test adjustTopology() with 3-D tetrahedral element.
   void testAdjustTopologyTet4(void);
 

Added: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataQuad4.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataQuad4.cc	2007-04-19 00:04:36 UTC (rev 6601)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataQuad4.cc	2007-04-19 00:29:40 UTC (rev 6602)
@@ -0,0 +1,120 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/* Original mesh
+ *
+ *       1 -------- 3 -------- 5
+ *       |          |          |
+ *       |          |          |
+ *       |          |          |
+ *       |          |          |
+ *       |          |          |
+ *       |          |          |
+ *       |          |          |
+ *       |          |          |
+ *       0 -------- 2 -------- 4
+ *
+ * After adding cohesive elements
+ *
+ *       1 -------- 3 -- 7 -------- 5
+ *       |          |    |          |
+ *       |          |    |          |
+ *       |          |    |          |
+ *       |          |    |          |
+ *       |          |    |          |
+ *       |          |    |          |
+ *       |          |    |          |
+ *       |          |    |          |
+ *       0 -------- 2 -- 6 -------- 4
+ */
+
+#include "CohesiveDataQuad4.hh"
+
+const int pylith::faults::CohesiveDataQuad4::_numVertices = 8;
+
+const int pylith::faults::CohesiveDataQuad4::_spaceDim = 2;
+
+const int pylith::faults::CohesiveDataQuad4::_numCells = 3;
+
+const int pylith::faults::CohesiveDataQuad4::_cellDim = 2;
+
+const double pylith::faults::CohesiveDataQuad4::_vertices[] = {
+  -2.0, -1.0,
+  -2.0,  1.0,
+   0.0, -1.0,
+   0.0,  1.0,
+   2.0, -1.0,
+   2.0,  1.0,
+   0.0, -1.0,
+   0.0,  1.0,
+};
+
+const int pylith::faults::CohesiveDataQuad4::_numCorners[] = {
+  4,
+  4,
+  4
+};
+
+const int pylith::faults::CohesiveDataQuad4::_cells[] = {
+  0,  2,  3,  1,
+  4,  5,  7,  6,
+  2,  3,  6,  7,
+};
+
+const int pylith::faults::CohesiveDataQuad4::_materialIds[] = {
+  0,  0,
+  1
+};
+
+const int pylith::faults::CohesiveDataQuad4::_numGroups = 2;
+
+const int pylith::faults::CohesiveDataQuad4::_groupSizes[] = 
+  { 2, 3 };
+
+const int pylith::faults::CohesiveDataQuad4::_groups[] = {
+  2, 3,
+  1, 3, 5
+};
+
+const char* pylith::faults::CohesiveDataQuad4::_groupNames[] = {
+  "fault", "output"
+};
+
+const char* pylith::faults::CohesiveDataQuad4::_groupTypes[] = {
+  "vertex", "vertex"
+};
+
+const char* pylith::faults::CohesiveDataQuad4::_filename = "data/meshQuad4A.txt";
+
+pylith::faults::CohesiveDataQuad4::CohesiveDataQuad4(void)
+{ // constructor
+  numVertices = _numVertices;
+  spaceDim = _spaceDim;
+  numCells = _numCells;
+  cellDim = _cellDim;
+  vertices = const_cast<double*>(_vertices);
+  numCorners = const_cast<int*>(_numCorners);
+  cells = const_cast<int*>(_cells);
+  materialIds = const_cast<int*>(_materialIds);
+  groups = const_cast<int*>(_groups);
+  groupSizes = const_cast<int*>(_groupSizes);
+  groupNames = const_cast<char**>(_groupNames);
+  groupTypes = const_cast<char**>(_groupTypes);
+  numGroups = _numGroups;
+  filename = const_cast<char*>(_filename);
+} // constructor
+
+pylith::faults::CohesiveDataQuad4::~CohesiveDataQuad4(void)
+{}
+
+
+// End of file

Added: short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataQuad4.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataQuad4.hh	2007-04-19 00:04:36 UTC (rev 6601)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/CohesiveDataQuad4.hh	2007-04-19 00:29:40 UTC (rev 6602)
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+#if !defined(pylith_faults_cohesivedataquad4_hh)
+#define pylith_faults_cohesivedataquad4_hh
+
+#include "CohesiveData.hh"
+
+namespace pylith {
+  namespace faults {
+     class CohesiveDataQuad4;
+  } // pylith
+} // faults
+
+class pylith::faults::CohesiveDataQuad4 : public CohesiveData
+{
+
+// PUBLIC METHODS ///////////////////////////////////////////////////////
+public: 
+
+  /// Constructor
+  CohesiveDataQuad4(void);
+
+  /// Destructor
+  ~CohesiveDataQuad4(void);
+
+// PRIVATE MEMBERS //////////////////////////////////////////////////////
+private:
+
+  static const int _numVertices; ///< Number of vertices
+  static const int _spaceDim; ///< Number of dimensions in vertex coordinates
+  static const int _numCells; ///< Number of cells
+  static const int _cellDim; ///< Number of dimensions associated with cell
+
+  static const double _vertices[]; ///< Pointer to coordinates of vertices
+  static const int _numCorners[]; ///< Number of vertices in cell
+  static const int _cells[]; ///< Pointer to indices of vertices in cells
+  static const int _materialIds[]; ///< Pointer to cell material identifiers
+
+  static const int _groups[]; ///< Groups of points
+  static const int _groupSizes[]; ///< Sizes of groups
+  static const char* _groupNames[]; ///< Array of group names
+  static const char* _groupTypes[]; ///< Array of group types
+  static const int _numGroups; ///< Number of groups
+
+  static const char* _filename; ///< Filename of input mesh
+};
+
+#endif // pylith_faults_cohesivedataquad4_hh
+
+// End of file

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/data/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/Makefile.am	2007-04-19 00:04:36 UTC (rev 6601)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/Makefile.am	2007-04-19 00:29:40 UTC (rev 6602)
@@ -13,6 +13,7 @@
 noinst_DATA = \
 	meshLine.txt \
 	meshTri3A.txt \
+	meshQuad4A.txt \
 	meshTet4A.txt
 
 noinst_TMP =

Added: short/3D/PyLith/trunk/unittests/libtests/faults/data/meshQuad4A.txt
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/data/meshQuad4A.txt	2007-04-19 00:04:36 UTC (rev 6601)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/data/meshQuad4A.txt	2007-04-19 00:29:40 UTC (rev 6602)
@@ -0,0 +1,47 @@
+mesh = {
+  dimension = 2
+  use-index-zero = true
+  vertices = {
+    dimension = 2
+    count = 6
+    coordinates = {
+             0     -2.0 -1.0
+             1     -2.0  1.0
+             2      0.0 -1.0
+             3      0.0  1.0
+             4      2.0 -1.0
+             5      2.0  1.0
+    }
+  }
+  cells = {
+    count = 2
+    num-corners = 4
+    simplices = {
+             0       0  2  3  1
+             1       4  5  3  2
+    }
+    material-ids = {
+             0   0
+             1   0
+    }
+  }
+  group = {
+    name = fault
+    type = vertices
+    count = 2
+    indices = {
+      2
+      3
+    }
+  }
+  group = {
+    name = output
+    type = vertices
+    count = 3
+    indices = {
+      1
+      3
+      5
+    }
+  }
+}



More information about the cig-commits mailing list