[cig-commits] r7710 - in short/3D/PyLith/trunk: libsrc/faults libsrc/feassemble unittests/libtests/faults unittests/libtests/feassemble

brad at geodynamics.org brad at geodynamics.org
Thu Jul 19 09:58:11 PDT 2007


Author: brad
Date: 2007-07-19 09:58:10 -0700 (Thu, 19 Jul 2007)
New Revision: 7710

Modified:
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.hh
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
   short/3D/PyLith/trunk/libsrc/feassemble/CellGeometry.hh
   short/3D/PyLith/trunk/libsrc/feassemble/CellGeometry.icc
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestCellGeometry.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestCellGeometry.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryHex3D.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryLine1D.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryLine2D.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryLine3D.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryPoint1D.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryPoint2D.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryPoint3D.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryQuad2D.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryQuad3D.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryTet3D.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryTri2D.hh
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryTri3D.hh
Log:
Switched to using orientation functions that are now in CellGeometry instead of old ones in FaultCohesive. Updated unit tests accordingly.

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.cc	2007-07-19 16:58:10 UTC (rev 7710)
@@ -51,112 +51,5 @@
                            _useLagrangeConstraints());
 } // adjustTopology
 
-// ----------------------------------------------------------------------
-// Compute weighted orientation of fault for cohesive cell between
-// 1-D elements.
-void
-pylith::faults::FaultCohesive::_orient1D(double_array* orientation,
-					 const double_array& jacobian,
-					 const double jacobianDet,
-					 const double_array& upDir)
-{ // _orient1D
-  assert(0 != orientation);
-  assert(1 == orientation->size());
-  (*orientation) = 1.0;
-} // _orient1D
-		
-// ----------------------------------------------------------------------
-// Compute weighted orientation of fault for cohesive cell between
-// 2-D elements.
-void
-pylith::faults::FaultCohesive::_orient2D(double_array* orientation,
-					 const double_array& jacobian,
-					 const double jacobianDet,
-					 const double_array& upDir)
-{ // _orient2D
-  const int orientSize = 4;
-  assert(0 != orientation);
-  assert(orientSize == orientation->size());
-  const int jacobianSize = 2;
-  assert(jacobianSize == jacobian.size());
 
-  // cellDim is 1
-  const int spaceDim = 2;
-
-  const double j1 = jacobian[0];
-  const double j2 = jacobian[1];
-  (*orientation)[0] =  j1;
-  (*orientation)[1] =  j2;
-  (*orientation)[2] =  j2;
-  (*orientation)[3] = -j1;
-} // _orient2D
-		
-// ----------------------------------------------------------------------
-// Compute weighted orientation of fault for cohesive cell between
-// 3-D elements.
-void
-pylith::faults::FaultCohesive::_orient3D(double_array* orientation,
-					 const double_array& jacobian,
-					 const double jacobianDet,
-					 const double_array& upDir)
-{ // _orient3D
-  const int orientSize = 9;
-  assert(0 != orientation);
-  assert(orientSize == orientation->size());
-  const int jacobianSize = 6;
-  assert(jacobianSize == jacobian.size());
-  assert(3 == upDir.size());
-
-  const int cellDim = 2;
-  const int spaceDim = 3;
-
-  const double j00 = jacobian[0];
-  const double j01 = jacobian[1];
-  const double j10 = jacobian[2];
-  const double j11 = jacobian[3];
-  const double j20 = jacobian[4];
-  const double j21 = jacobian[5];
-
-  // Compute normal using Jacobian
-  double r0 =  j10*j21 - j20*j11;
-  double r1 = -j00*j21 + j20*j01;
-  double r2 =  j00*j11 - j10*j01;
-  // Make unit vector
-  double mag = sqrt(r0*r0 + r1*r1 + r2*r2);
-  assert(mag > 0.0);
-  r0 /= mag;
-  r1 /= mag;
-  r2 /= mag;
-  
-  // Compute along-strike direction; cross product of "up" and normal
-  double p0 =  upDir[1]*r2 - upDir[2]*r1;
-  double p1 = -upDir[0]*r2 + upDir[2]*r0;
-  double p2 =  upDir[0]*r1 - upDir[1]*r0;
-  // Make unit vector
-  mag = sqrt(p0*p0 + p1*p1 + p2*p2);
-  assert(mag > 0.0);
-  p0 /= mag;
-  p1 /= mag;
-  p2 /= mag;
-  
-  // Compute up-dip direction; cross product of normal and along-strike
-  const double q0 =  r1*p2 - r2*p1;
-  const double q1 = -r0*p2 + r2*p0;
-  const double q2 =  r0*p1 - r1*p0;
-  mag = sqrt(q0*q0 + q1*q1 + q2*q2);
-  assert(mag > 0.0);
-  
-  const double wt = jacobianDet;
-  (*orientation)[0] =  p0*wt;
-  (*orientation)[1] =  p1*wt;
-  (*orientation)[2] =  p2*wt;
-  (*orientation)[3] =  q0*wt;
-  (*orientation)[4] =  q1*wt;
-  (*orientation)[5] =  q2*wt;
-  (*orientation)[6] =  r0*wt;
-  (*orientation)[7] =  r1*wt;
-  (*orientation)[8] =  r2*wt;
-} // _orient3D
-
-
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesive.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -54,15 +54,6 @@
    */
   void adjustTopology(const ALE::Obj<ALE::Mesh>& mesh);
 
-  // PROTECTED TYPEDEFS /////////////////////////////////////////////////
-protected :
-
-  /// Function type for orientation methods.
-  typedef void (*orient_fn_type)(double_array*, 
-				 const double_array&,
-				 const double,
-				 const double_array&);
-
   // PROTECTED METHODS //////////////////////////////////////////////////
 protected :
 
@@ -74,75 +65,6 @@
   virtual
   bool _useLagrangeConstraints(void) const = 0;
 
-  /** Compute weighted orientation of fault for cohesive cell between
-   * 1-D elements. Orientation is either at vertices or quadrature
-   * points, depending on whether the arguments have been evaluated at
-   * the vertices or quadrature points.
-   *
-   * The orientation is returned as an array of direction cosines.
-   *
-   * size = spaceDim*spaceDim
-   * index = iDir*spaceDim + iComponent
-   *
-   * @param orientation Array of direction cosines.
-   * @param jacobian Jacobian matrix at point.
-   * @param jacobianDet Determinant of Jacobian matrix at point.
-   * @param upDir Direction perpendicular to along-strike direction that is 
-   *   not collinear with fault normal (usually "up" direction but could 
-   *   be up-dip direction).
-   */
-  static
-  void _orient1D(double_array* orientation,
-		 const double_array& jacobian,
-		 const double jacobianDet,
-		 const double_array& upDir);
-		
-  /** Compute weighted orientation of fault for cohesive cell between
-   * 2-D elements. Orientation is either at vertices or quadrature
-   * points, depending on whether the arguments have been evaluated at
-   * the vertices or quadrature points.
-   *
-   * The orientation is returned as an array of direction cosines.
-   *
-   * size = spaceDim*spaceDim
-   * index = iDir*spaceDim + iComponent
-   *
-   * @param orientation Array of direction cosines.
-   * @param jacobian Jacobian matrix at point.
-   * @param jacobianDet Determinant of Jacobian matrix at point.
-   * @param upDir Direction perpendicular to along-strike direction that is 
-   *   not collinear with fault normal (usually "up" direction but could 
-   *   be up-dip direction).
-   */
-  static 
-  void _orient2D(double_array* orientation,
-		 const double_array& jacobian,
-		 const double jacobianDet,
-		 const double_array& upDir);
-		
-  /** Compute weighted orientation of fault for cohesive cell between
-   * 3-D elements. Orientation is either at vertices or quadrature
-   * points, depending on whether the arguments have been evaluated at
-   * the vertices or quadrature points.
-   *
-   * The orientation is returned as an array of direction cosines.
-   *
-   * size = spaceDim*spaceDim
-   * index = iDir*spaceDim + iComponent
-   *
-   * @param orientation Array of direction cosines.
-   * @param jacobian Jacobian matrix at point.
-   * @param jacobianDet Determinant of Jacobian matrix at point.
-   * @param upDir Direction perpendicular to along-strike direction that is 
-   *   not collinear with fault normal (usually "up" direction but could 
-   *   be up-dip direction).
-   */
-  static
-  void _orient3D(double_array* orientation,
-		 const double_array& jacobian,
-		 const double jacobianDet,
-		 const double_array& upDir);
-		
   // NOT IMPLEMENTED ////////////////////////////////////////////////////
 private :
 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2007-07-19 16:58:10 UTC (rev 7710)
@@ -141,21 +141,6 @@
   const int cohesiveDim = mesh->getDimension()-1;
   assert(cohesiveDim == _quadrature->cellDim());
   assert(spaceDim == _quadrature->spaceDim());
-  orient_fn_type orientFn;
-  switch (cohesiveDim)
-    { // switch
-    case 0 :
-      orientFn = _orient1D;
-      break;
-    case 1 :
-      orientFn = _orient2D;
-      break;
-    case 2 :
-      orientFn = _orient3D;
-      break;
-    default :
-      assert(0);
-    } // switch
 
   // Loop over cohesive cells, computing orientation at constraint vertices
   const int numBasis = _quadrature->numBasis();
@@ -198,7 +183,8 @@
       cellGeometry.jacobian(&jacobian, &jacobianDet, faceVertices, vertex);
 
       // Compute orientation
-      orientFn(&vertexOrientation, jacobian, jacobianDet, upDir);
+      cellGeometry.orientation(&vertexOrientation, jacobian, jacobianDet, 
+			       upDir);
       
       // Update orientation
       _orientation->updateAddPoint(*v_iter, &vertexOrientation[0]);

Modified: short/3D/PyLith/trunk/libsrc/feassemble/CellGeometry.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/CellGeometry.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/libsrc/feassemble/CellGeometry.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -24,11 +24,14 @@
 namespace pylith {
   namespace feassemble {
     class CellGeometry;
+
+    class TestCellGeometry; // unit testing
   } // feassemble
 } // pylith
 
 class pylith::feassemble::CellGeometry
 { // CellGeometry
+  friend class TestCellGeometry; // unit testing
 
 // PUBLIC METHODS ///////////////////////////////////////////////////////
 public :
@@ -109,7 +112,7 @@
   void orientation(double_array* orientation,
 		   const double_array& jacobian,
 		   const double jacobianDet,
-		   const double_array& upDir);
+		   const double_array& upDir) const;
 
 // PROTECTED ////////////////////////////////////////////////////////////
 protected :

Modified: short/3D/PyLith/trunk/libsrc/feassemble/CellGeometry.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/CellGeometry.icc	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/libsrc/feassemble/CellGeometry.icc	2007-07-19 16:58:10 UTC (rev 7710)
@@ -43,7 +43,7 @@
 pylith::feassemble::CellGeometry::orientation(double_array* orientation,
 					      const double_array& jacobian,
 					      const double jacobianDet,
-					      const double_array& upDir) {
+					      const double_array& upDir) const {
   if (0 != _orientFn)
     _orientFn(orientation, jacobian, jacobianDet, upDir);
 } // orientation

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc	2007-07-19 16:58:10 UTC (rev 7710)
@@ -440,111 +440,6 @@
 } // testAdjustTopologyHex8Lagrange
 
 // ----------------------------------------------------------------------
-// Test _orient1D().
-void
-pylith::faults::TestFaultCohesive::testOrient1D(void)
-{ // testOrient1D
-  double_array jacobian;
-  double jacobianDet;
-  double_array upDir;
-  double_array orientation(1);
-  
-  FaultCohesive::_orient1D(&orientation, jacobian, jacobianDet, upDir);
-
-  const int size = orientation.size();
-  CPPUNIT_ASSERT_EQUAL(1, size);
-  const double tolerance = 1.0e-6;
-  for (int i=0; i < size; ++i)
-    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, orientation[i], tolerance);
-} // testOrient1D
-
-// ----------------------------------------------------------------------
-// Test _orient2D().
-void
-pylith::faults::TestFaultCohesive::testOrient2D(void)
-{ // testOrient2D
-  const int numLocs = 2;
-  const int spaceDim = 2;
-  const int orientSize = 4;
-
-  const double jacobianVals[] = {
-    -1.0, 2.0,
-    -0.5, 1.0
-  };
-  const double orientationE[] = {
-    -1.0,  2.0,  2.0, 1.0,
-    -0.5,  1.0,  1.0, 0.5
-  };
-
-  const int jacobianSize = spaceDim*(spaceDim-1);
-  for (int iLoc=0; iLoc < numLocs; ++iLoc) {
-    double_array jacobian(&jacobianVals[iLoc*jacobianSize], jacobianSize);
-    double jacobianDet;
-    double_array upDir;
-    double_array orientation(orientSize);
-
-    FaultCohesive::_orient2D(&orientation, jacobian, jacobianDet, upDir);
-
-    const int size = orientation.size();
-    CPPUNIT_ASSERT_EQUAL(orientSize, size);
-    const double tolerance = 1.0e-6;
-    for (int i=0; i < size; ++i)
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(orientationE[iLoc*orientSize+i],
-				   orientation[i], tolerance);
-  } // for
-} // testOrient2D
-
-// ----------------------------------------------------------------------
-// Test _orient3D().
-void
-pylith::faults::TestFaultCohesive::testOrient3D(void)
-{ // testOrient3D
-  const int numLocs = 2;
-  const int spaceDim = 3;
-  const int orientSize = 9;
-
-  const double jacobianVals[] = {
-    2.0,  -0.5,
-    1.0,  -0.2,
-    0.5,   2.0,
-
-    -1.0,  2.0,
-    -3.0, -0.2,
-    -0.3,  0.3,
-  };
-  const double jacobianDetVals[] = {
-    1.3, 0.7
-  };
-  const double upDirVals[] = { 0.0, 0.0, 1.0 };
-  const double orientationE[] = {
-    1.1654847299258313, 0.57588657243394026, 0.0, 
-    -0.012145479112634533, 0.024580136299379406, 1.2997108540889502, 
-    0.57575848378190342, -1.1652255028919474, 0.027417070656281111,
-
-    0.20879249519516274, -0.66813598462452073, 0.0,
-    0.65951433797689429, 0.20609823061777949, 0.11209084413599232, 
-    -0.10698846644884991, -0.033433895765265592, 0.69096717914882233
-  };
-
-  double_array upDir(upDirVals, 3);
-  const int jacobianSize = spaceDim*(spaceDim-1);
-  for (int iLoc=0; iLoc < numLocs; ++iLoc) {
-    double_array jacobian(&jacobianVals[iLoc*jacobianSize], jacobianSize);
-    double jacobianDet = jacobianDetVals[iLoc];
-    double_array orientation(orientSize);
-
-    FaultCohesive::_orient3D(&orientation, jacobian, jacobianDet, upDir);
-
-    const int size = orientation.size();
-    CPPUNIT_ASSERT_EQUAL(orientSize, size);
-    const double tolerance = 1.0e-6;
-    for (int i=0; i < size; ++i)
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(orientationE[iLoc*orientSize+i],
-				   orientation[i], tolerance);
-  } // for
-} // testOrient3D
-
-// ----------------------------------------------------------------------
 // Test adjustTopology().
 void
 pylith::faults::TestFaultCohesive::_testAdjustTopology(Fault* fault,

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -80,10 +80,6 @@
   CPPUNIT_TEST( testAdjustTopologyTet4Lagrange );
   CPPUNIT_TEST( testAdjustTopologyHex8Lagrange );
 
-  CPPUNIT_TEST( testOrient1D );
-  CPPUNIT_TEST( testOrient2D );
-  CPPUNIT_TEST( testOrient3D );
-
   CPPUNIT_TEST_SUITE_END();
 
   // PUBLIC METHODS /////////////////////////////////////////////////////
@@ -205,18 +201,6 @@
   /// multipliers.
   void testAdjustTopologyHex8Lagrange(void);
 
-  /// Test _orientationSize().
-  void testOrientationSize(void);
-
-  /// Test _orient1D().
-  void testOrient1D(void);
-
-  /// Test _orient2D().
-  void testOrient2D(void);
-
-  /// Test _orient3D().
-  void testOrient3D(void);
-
   // PROTECTED METHODS //////////////////////////////////////////////////
 public :
 

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestCellGeometry.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestCellGeometry.cc	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestCellGeometry.cc	2007-07-19 16:58:10 UTC (rev 7710)
@@ -20,6 +20,9 @@
 #include "data/CellGeomData.hh" // USES CellGeomData
 
 // ----------------------------------------------------------------------
+CPPUNIT_TEST_SUITE_REGISTRATION( pylith::feassemble::TestCellGeometry );
+
+// ----------------------------------------------------------------------
 // Setup data.
 void 
 pylith::feassemble::TestCellGeometry::setUp(void)
@@ -38,6 +41,111 @@
 } // tearDown
 
 // ----------------------------------------------------------------------
+// Test _orient1D().
+void
+pylith::feassemble::TestCellGeometry::testOrient1D(void)
+{ // testOrient1D
+  double_array jacobian;
+  double jacobianDet;
+  double_array upDir;
+  double_array orientation(1);
+  
+  CellGeometry::_orient1D(&orientation, jacobian, jacobianDet, upDir);
+
+  const int size = orientation.size();
+  CPPUNIT_ASSERT_EQUAL(1, size);
+  const double tolerance = 1.0e-6;
+  for (int i=0; i < size; ++i)
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, orientation[i], tolerance);
+} // testOrient1D
+
+// ----------------------------------------------------------------------
+// Test _orient2D().
+void
+pylith::feassemble::TestCellGeometry::testOrient2D(void)
+{ // testOrient2D
+  const int numLocs = 2;
+  const int spaceDim = 2;
+  const int orientSize = 4;
+
+  const double jacobianVals[] = {
+    -1.0, 2.0,
+    -0.5, 1.0
+  };
+  const double orientationE[] = {
+    -1.0,  2.0,  2.0, 1.0,
+    -0.5,  1.0,  1.0, 0.5
+  };
+
+  const int jacobianSize = spaceDim*(spaceDim-1);
+  for (int iLoc=0; iLoc < numLocs; ++iLoc) {
+    double_array jacobian(&jacobianVals[iLoc*jacobianSize], jacobianSize);
+    double jacobianDet;
+    double_array upDir;
+    double_array orientation(orientSize);
+
+    CellGeometry::_orient2D(&orientation, jacobian, jacobianDet, upDir);
+
+    const int size = orientation.size();
+    CPPUNIT_ASSERT_EQUAL(orientSize, size);
+    const double tolerance = 1.0e-6;
+    for (int i=0; i < size; ++i)
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(orientationE[iLoc*orientSize+i],
+				   orientation[i], tolerance);
+  } // for
+} // testOrient2D
+
+// ----------------------------------------------------------------------
+// Test _orient3D().
+void
+pylith::feassemble::TestCellGeometry::testOrient3D(void)
+{ // testOrient3D
+  const int numLocs = 2;
+  const int spaceDim = 3;
+  const int orientSize = 9;
+
+  const double jacobianVals[] = {
+    2.0,  -0.5,
+    1.0,  -0.2,
+    0.5,   2.0,
+
+    -1.0,  2.0,
+    -3.0, -0.2,
+    -0.3,  0.3,
+  };
+  const double jacobianDetVals[] = {
+    1.3, 0.7
+  };
+  const double upDirVals[] = { 0.0, 0.0, 1.0 };
+  const double orientationE[] = {
+    1.1654847299258313, 0.57588657243394026, 0.0, 
+    -0.012145479112634533, 0.024580136299379406, 1.2997108540889502, 
+    0.57575848378190342, -1.1652255028919474, 0.027417070656281111,
+
+    0.20879249519516274, -0.66813598462452073, 0.0,
+    0.65951433797689429, 0.20609823061777949, 0.11209084413599232, 
+    -0.10698846644884991, -0.033433895765265592, 0.69096717914882233
+  };
+
+  double_array upDir(upDirVals, 3);
+  const int jacobianSize = spaceDim*(spaceDim-1);
+  for (int iLoc=0; iLoc < numLocs; ++iLoc) {
+    double_array jacobian(&jacobianVals[iLoc*jacobianSize], jacobianSize);
+    double jacobianDet = jacobianDetVals[iLoc];
+    double_array orientation(orientSize);
+
+    CellGeometry::_orient3D(&orientation, jacobian, jacobianDet, upDir);
+
+    const int size = orientation.size();
+    CPPUNIT_ASSERT_EQUAL(orientSize, size);
+    const double tolerance = 1.0e-6;
+    for (int i=0; i < size; ++i)
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(orientationE[iLoc*orientSize+i],
+				   orientation[i], tolerance);
+  } // for
+} // testOrient3D
+
+// ----------------------------------------------------------------------
 // Test clone()
 void
 pylith::feassemble::TestCellGeometry::testClone(void)
@@ -80,6 +188,32 @@
 } // testNumConers
 
 // ----------------------------------------------------------------------
+// Test orientFn.
+void
+pylith::feassemble::TestCellGeometry::testOrientFn(void)
+{ // testOrientFn
+  CPPUNIT_ASSERT(0 != _object);
+  CPPUNIT_ASSERT(0 != _data);
+  switch (_data->cellDim)
+    { // switch
+    case 0 :
+      CPPUNIT_ASSERT(CellGeometry::_orient1D == _object->_orientFn);
+      break;
+    case 1 :
+      CPPUNIT_ASSERT(CellGeometry::_orient2D == _object->_orientFn);
+      break;
+    case 2 :
+      CPPUNIT_ASSERT(CellGeometry::_orient3D == _object->_orientFn);
+      break;
+    case 3 :
+      CPPUNIT_ASSERT(0 == _object->_orientFn);
+      break;
+    default :
+      assert(0);
+    } // switch
+} // testOrientFn
+
+// ----------------------------------------------------------------------
 // Test jacobian().
 void
 pylith::feassemble::TestCellGeometry::testJacobian(void)

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestCellGeometry.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestCellGeometry.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestCellGeometry.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -37,6 +37,15 @@
 class pylith::feassemble::TestCellGeometry : public CppUnit::TestFixture
 { // class TestCellGeometry
 
+  // CPPUNIT TEST SUITE /////////////////////////////////////////////////
+  CPPUNIT_TEST_SUITE( TestCellGeometry );
+
+  CPPUNIT_TEST( testOrient1D );
+  CPPUNIT_TEST( testOrient2D );
+  CPPUNIT_TEST( testOrient3D );
+
+  CPPUNIT_TEST_SUITE_END();
+
 // PUBLIC METHODS ///////////////////////////////////////////////////////
 public :
 
@@ -46,6 +55,15 @@
   /// Tear down data.
   void tearDown(void);
 
+  /// Test _orient1D().
+  void testOrient1D(void);
+
+  /// Test _orient2D().
+  void testOrient2D(void);
+
+  /// Test _orient3D().
+  void testOrient3D(void);
+
   /// Test clone().
   void testClone(void);
 
@@ -58,6 +76,9 @@
   /// Test numCorners().
   void testNumCorners(void);
 
+  /// Test orientFn.
+  void testOrientFn(void);
+
   /// Test jacobian().
   void testJacobian(void);
 

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryHex3D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryHex3D.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryHex3D.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -44,6 +44,7 @@
   CPPUNIT_TEST( testCellDim );
   CPPUNIT_TEST( testSpaceDim );
   CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testOrientFn );
   CPPUNIT_TEST( testJacobian );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryLine1D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryLine1D.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryLine1D.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -44,6 +44,7 @@
   CPPUNIT_TEST( testCellDim );
   CPPUNIT_TEST( testSpaceDim );
   CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testOrientFn );
   CPPUNIT_TEST( testJacobian );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryLine2D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryLine2D.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryLine2D.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -44,6 +44,7 @@
   CPPUNIT_TEST( testCellDim );
   CPPUNIT_TEST( testSpaceDim );
   CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testOrientFn );
   CPPUNIT_TEST( testJacobian );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryLine3D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryLine3D.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryLine3D.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -44,6 +44,7 @@
   CPPUNIT_TEST( testCellDim );
   CPPUNIT_TEST( testSpaceDim );
   CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testOrientFn );
   CPPUNIT_TEST( testJacobian );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryPoint1D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryPoint1D.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryPoint1D.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -44,6 +44,7 @@
   CPPUNIT_TEST( testCellDim );
   CPPUNIT_TEST( testSpaceDim );
   CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testOrientFn );
   CPPUNIT_TEST( testJacobian );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryPoint2D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryPoint2D.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryPoint2D.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -44,6 +44,7 @@
   CPPUNIT_TEST( testCellDim );
   CPPUNIT_TEST( testSpaceDim );
   CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testOrientFn );
   CPPUNIT_TEST( testJacobian );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryPoint3D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryPoint3D.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryPoint3D.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -45,6 +45,7 @@
   CPPUNIT_TEST( testCellDim );
   CPPUNIT_TEST( testSpaceDim );
   CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testOrientFn );
   CPPUNIT_TEST( testJacobian );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryQuad2D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryQuad2D.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryQuad2D.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -45,6 +45,7 @@
   CPPUNIT_TEST( testCellDim );
   CPPUNIT_TEST( testSpaceDim );
   CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testOrientFn );
   CPPUNIT_TEST( testJacobian );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryQuad3D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryQuad3D.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryQuad3D.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -45,6 +45,7 @@
   CPPUNIT_TEST( testCellDim );
   CPPUNIT_TEST( testSpaceDim );
   CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testOrientFn );
   CPPUNIT_TEST( testJacobian );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryTet3D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryTet3D.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryTet3D.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -45,6 +45,7 @@
   CPPUNIT_TEST( testCellDim );
   CPPUNIT_TEST( testSpaceDim );
   CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testOrientFn );
   CPPUNIT_TEST( testJacobian );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryTri2D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryTri2D.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryTri2D.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -45,6 +45,7 @@
   CPPUNIT_TEST( testCellDim );
   CPPUNIT_TEST( testSpaceDim );
   CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testOrientFn );
   CPPUNIT_TEST( testJacobian );
 
   CPPUNIT_TEST_SUITE_END();

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryTri3D.hh
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryTri3D.hh	2007-07-19 04:53:17 UTC (rev 7709)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestGeometryTri3D.hh	2007-07-19 16:58:10 UTC (rev 7710)
@@ -45,6 +45,7 @@
   CPPUNIT_TEST( testCellDim );
   CPPUNIT_TEST( testSpaceDim );
   CPPUNIT_TEST( testNumCorners );
+  CPPUNIT_TEST( testOrientFn );
   CPPUNIT_TEST( testJacobian );
 
   CPPUNIT_TEST_SUITE_END();



More information about the cig-commits mailing list