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

brad at geodynamics.org brad at geodynamics.org
Mon Sep 19 15:47:11 PDT 2011


Author: brad
Date: 2011-09-19 15:47:11 -0700 (Mon, 19 Sep 2011)
New Revision: 18943

Modified:
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDyn.cc
   short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicitLgDeform.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc
   short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicitLgDeform.cc
   short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.cc
Log:
Updated tolerances to use tighter tolerances with double precision values.

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDyn.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDyn.cc	2011-09-19 22:45:55 UTC (rev 18942)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveDyn.cc	2011-09-19 22:47:11 UTC (rev 18943)
@@ -401,7 +401,7 @@
     const PylithScalar* valsE = _data->slipSlipE;
     int iVertex = 0; // variable to use as index into valsE array
     const int fiberDimE = spaceDim; // number of values per point
-    const PylithScalar tolerance = 1.0e-05;
+    const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-05;
     for (SieveMesh::label_sequence::iterator v_iter = verticesBegin; v_iter
 	   != verticesEnd;
 	 ++v_iter, ++iVertex) { // loop over fault vertices
@@ -474,7 +474,7 @@
     const PylithScalar* valsE = _data->fieldIncrOpenE; // Expected values for dispIncr
     int iVertex = 0; // variable to use as index into valsE array
     const int fiberDimE = spaceDim; // number of values per point
-    const PylithScalar tolerance = 8.0e-06;
+    const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-05;
     for (SieveMesh::label_sequence::iterator v_iter = verticesBegin;
 	 v_iter != verticesEnd;
 	 ++v_iter, ++iVertex) { // loop over all vertices in mesh
@@ -525,7 +525,7 @@
     const PylithScalar* valsE = _data->slipOpenE;
     int iVertex = 0; // variable to use as index into valsE array
     const int fiberDimE = spaceDim; // number of values per point
-    const PylithScalar tolerance = 8.0e-06;
+    const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-05;
     for (SieveMesh::label_sequence::iterator v_iter = verticesBegin; v_iter
 	   != verticesEnd;
 	 ++v_iter, ++iVertex) { // loop over fault vertices

Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc	2011-09-19 22:45:55 UTC (rev 18942)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesiveKin.cc	2011-09-19 22:47:11 UTC (rev 18943)
@@ -287,7 +287,7 @@
     const PylithScalar* valsE = _data->residual;
     iVertex = 0;
     const int fiberDimE = spaceDim;
-    const PylithScalar tolerance = 4.0e-06;
+    const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-05;
     for (SieveMesh::label_sequence::iterator v_iter=verticesBegin;
         v_iter != verticesEnd;
         ++v_iter, ++iVertex) {
@@ -318,7 +318,7 @@
     const PylithScalar* valsE = _data->residualIncr;
     iVertex = 0;
     const int fiberDimE = spaceDim;
-    const PylithScalar tolerance = 4.0e-06;
+    const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-05;
     for (SieveMesh::label_sequence::iterator v_iter=verticesBegin;
 	 v_iter != verticesEnd;
 	 ++v_iter, ++iVertex) {
@@ -570,7 +570,7 @@
   CPPUNIT_ASSERT(!solutionSection.isNull());
 
   int i = 0;
-  const PylithScalar tolerance = 8.0e-06;
+  const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-05;
   const PylithScalar* solutionE = _data->fieldIncrAdjusted;
   for (SieveMesh::label_sequence::iterator v_iter=verticesBegin;
        v_iter != verticesEnd;

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc	2011-09-19 22:45:55 UTC (rev 18942)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicit.cc	2011-09-19 22:47:11 UTC (rev 18943)
@@ -209,7 +209,7 @@
     std::cout << "  " << valsE[i] << std::endl;
 #endif
 
-  const PylithScalar tolerance = 4.0e-06;
+  const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-05;
   for (int i=0; i < size; ++i)
     if (fabs(valsE[i]) > 1.0)
       CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/valsE[i], tolerance);
@@ -249,7 +249,7 @@
     std::cout << "  " << valsE[i] << std::endl;
 #endif
 
-  const PylithScalar tolerance = 4.0e-06;
+  const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-05;
   for (int i=0; i < size; ++i)
     if (fabs(valsE[i]) > 1.0)
       CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/valsE[i], tolerance);

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicitLgDeform.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicitLgDeform.cc	2011-09-19 22:45:55 UTC (rev 18942)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityExplicitLgDeform.cc	2011-09-19 22:47:11 UTC (rev 18943)
@@ -121,7 +121,7 @@
   const int size = residualSection->sizeWithBC();
   CPPUNIT_ASSERT_EQUAL(sizeE, size);
 
-  const PylithScalar tolerance = 1.0e-04;
+  const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-04;
   for (int i=0; i < size; ++i)
     if (fabs(valsE[i]) > 1.0)
       CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/valsE[i], tolerance);
@@ -161,7 +161,7 @@
     std::cout << "  " << valsE[i] << std::endl;
 #endif
 
-  const PylithScalar tolerance = 1.0e-04;
+  const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-04;
   for (int i=0; i < size; ++i)
     if (fabs(valsE[i]) > 1.0)
       CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/valsE[i], tolerance);

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc	2011-09-19 22:45:55 UTC (rev 18942)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicit.cc	2011-09-19 22:47:11 UTC (rev 18943)
@@ -179,7 +179,7 @@
   const int size = residualSection->sizeWithBC();
   CPPUNIT_ASSERT_EQUAL(sizeE, size);
 
-  const PylithScalar tolerance = 4.0e-05;
+  const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 4.0e-05;
   for (int i=0; i < size; ++i)
     if (fabs(valsE[i]) > 1.0)
       CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/valsE[i], tolerance);
@@ -234,7 +234,7 @@
   for (int iCol=0; iCol < ncols; ++iCol)
     cols[iCol] = iCol;
   MatGetValues(jDense, nrows, &rows[0], ncols, &cols[0], &vals[0]);
-  const PylithScalar tolerance = 1.0e-04;
+  const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-04;
   for (int iRow=0; iRow < nrows; ++iRow)
     for (int iCol=0; iCol < ncols; ++iCol) {
       const int index = ncols*iRow+iCol;

Modified: short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicitLgDeform.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicitLgDeform.cc	2011-09-19 22:45:55 UTC (rev 18942)
+++ short/3D/PyLith/trunk/unittests/libtests/feassemble/TestElasticityImplicitLgDeform.cc	2011-09-19 22:47:11 UTC (rev 18943)
@@ -121,7 +121,7 @@
   const int size = residualSection->sizeWithBC();
   CPPUNIT_ASSERT_EQUAL(sizeE, size);
 
-  const PylithScalar tolerance = 1.0e-04;
+  const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-04;
   for (int i=0; i < size; ++i)
     if (fabs(valsE[i]) > 1.0)
       CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[i]/valsE[i], tolerance);
@@ -174,12 +174,15 @@
   for (int iCol=0; iCol < ncols; ++iCol)
     cols[iCol] = iCol;
   MatGetValues(jDense, nrows, &rows[0], ncols, &cols[0], &vals[0]);
-  const PylithScalar tolerance = 1.0e-04;
+  const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-04;
   for (int iRow=0; iRow < nrows; ++iRow)
     for (int iCol=0; iCol < ncols; ++iCol) {
       const int index = ncols*iRow+iCol;
-      if (fabs(valsE[index]) > 1.0)
+      if (fabs(valsE[index]) > 1.0) 
+	{
+	  std::cout << "valE: " << valsE[index] << ", val: " << vals[index] << std::endl;
 	CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, vals[index]/valsE[index], tolerance);
+	}
       else
 	CPPUNIT_ASSERT_DOUBLES_EQUAL(valsE[index], vals[index], tolerance);
     } // for

Modified: short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.cc	2011-09-19 22:45:55 UTC (rev 18942)
+++ short/3D/PyLith/trunk/unittests/libtests/materials/TestElasticMaterial.cc	2011-09-19 22:47:11 UTC (rev 18943)
@@ -492,7 +492,7 @@
     const PylithScalar* stressE = &data->stress[iLoc*tensorSize];
     CPPUNIT_ASSERT(0 != stressE);
 
-    const PylithScalar tolerance = 1.0e-04;
+    const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-05;
     for (int i=0; i < tensorSize; ++i)
       if (fabs(stressE[i]) > tolerance)
 	CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, stress[i]/stressE[i], 
@@ -562,7 +562,7 @@
     const PylithScalar* elasticConstsE = &data->elasticConsts[iLoc*numConsts];
     CPPUNIT_ASSERT(0 != elasticConstsE);
     
-    const PylithScalar tolerance = 1.0e-05;
+    const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-05;
     for (int i=0; i < numConsts; ++i)
       if (fabs(elasticConstsE[i]) > tolerance)
 	CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, elasticConsts[i]/elasticConstsE[i], 
@@ -618,7 +618,7 @@
     CPPUNIT_ASSERT( (0 < numVarsQuadPt && 0 != stateVarsE) ||
 		    (0 == numVarsQuadPt && 0 == stateVarsE) );
 
-    const PylithScalar tolerance = 1.0e-05;
+    const PylithScalar tolerance = (8 == sizeof(PylithScalar)) ? 1.0e-06 : 1.0e-05;
     for (int i=0; i < numVarsQuadPt; ++i)
       if (fabs(stateVarsE[i]) > tolerance)
 	CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, stateVars[i]/stateVarsE[i], 



More information about the CIG-COMMITS mailing list