]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
staffan :
authorvbd <vbd>
Thu, 23 Aug 2007 14:23:23 +0000 (14:23 +0000)
committervbd <vbd>
Thu, 23 Aug 2007 14:23:23 +0000 (14:23 +0000)
* updated test to use LOG macro instead of std::cout
* added use of epsilonEqualRelative in Interpolation3D tests

src/INTERP_KERNEL/Test/Interpolation3DTest.cxx
src/INTERP_KERNEL/Test/Interpolation3DTest.hxx
src/INTERP_KERNEL/Test/TestInterpKernel.cxx
src/INTERP_KERNEL/Test/TransformedTriangleIntersectTest.cxx
src/INTERP_KERNEL/Test/TransformedTriangleTest.cxx
src/INTERP_KERNEL/Test/TransformedTriangleTest.hxx

index 22a346ddc9fa0300d46f5e0c6257dab70f60cefa..9276d95e18efb2912e000be03e0b6c389a16cdbe 100644 (file)
@@ -5,10 +5,20 @@
 #include <map>
 #include <vector>
 #include <cmath>
+#include <algorithm>
 
 #include "VectorUtils.hxx"
 
-#define VOL_PREC 1.0e-11
+// Levels : 
+// 1 - titles and volume results
+// 2 - empty
+// 3 - symmetry / diagonal results
+// 4 - intersection matrix output
+// 5 - misc
+#include "Log.hxx"
+
+
+#define VOL_PREC 1.0e-6
 
 using namespace MEDMEM;
 using namespace std;
@@ -16,14 +26,22 @@ using namespace INTERP_UTILS;
 
 double Interpolation3DTest::sumVolume(const IntersectionMatrix& m) const
 {
-  double vol = 0.0;
+  
+  vector<double> volumes;
   for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
     {
       for(map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
        {
-         vol += fabs(iter2->second);
+         volumes.push_back(iter2->second);
+         //      vol += std::abs(iter2->second);
        }
     }
+  
+  // sum in ascending order to avoid rounding errors
+
+  sort(volumes.begin(), volumes.end());
+  const double vol = accumulate(volumes.begin(), volumes.end(), 0.0);
+
   return vol;
 }
 
@@ -38,9 +56,9 @@ bool Interpolation3DTest::areCompatitable(const IntersectionMatrix& m1, const In
          int j = iter2->first;
          if(m2.at(j-1).count(i+1) == 0)
            {
-             if(!epsilonEqual(iter2->second, 0.0))
+             if(!epsilonEqualRelative(iter2->second, 0.0, VOL_PREC))
                {
-                 std::cout << "V1( " << i << ", " << j << ") exists, but V2( " << j - 1 << ", " << i + 1 << ") " << " does not " << std::endl;
+                 LOG(3, "V1( " << i << ", " << j << ") exists, but V2( " << j - 1 << ", " << i + 1 << ") " << " does not " );
                  compatitable = false;
                }
            }
@@ -56,9 +74,9 @@ bool Interpolation3DTest::testSymmetric(const IntersectionMatrix& m1, const Inte
   int i = 0;
   bool isSymmetric = true;
 
-  std::cout << "Checking symmetry src - target" << std::endl;
+  LOG(1, "Checking symmetry src - target" );
   isSymmetric = isSymmetric & areCompatitable(m1, m2) ;
-  std::cout << "Checking symmetry target - src" << std::endl;
+  LOG(1, "Checking symmetry target - src" );
   isSymmetric = isSymmetric & areCompatitable(m2, m1);
 
  for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter)
@@ -73,8 +91,8 @@ bool Interpolation3DTest::testSymmetric(const IntersectionMatrix& m1, const Inte
          const double v2 = theMap[i + 1];
          if(v1 != v2)
            {
-             std::cout << "V1( " << i << ", " << j << ") = " << v1 << " which is different from V2( " << j - 1 << ", " << i + 1 << ") = " << v2 << " | diff = " << v1 - v2 << std::endl;
-             if(!epsilonEqual(v1, v2, VOL_PREC))
+             LOG(3, "V1( " << i << ", " << j << ") = " << v1 << " which is different from V2( " << j - 1 << ", " << i + 1 << ") = " << v2 << " | diff = " << v1 - v2 );
+             if(!epsilonEqualRelative(v1, v2, VOL_PREC))
                {
                  isSymmetric = false;
                }
@@ -87,7 +105,7 @@ bool Interpolation3DTest::testSymmetric(const IntersectionMatrix& m1, const Inte
 
 bool Interpolation3DTest::testDiagonal(const IntersectionMatrix& m) const
 {
-  std::cout << "Checking if matrix is diagonal" << std::endl;
+  LOG(1, "Checking if matrix is diagonal" );
   int i = 1;
   bool isDiagonal = true;
   for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
@@ -98,8 +116,8 @@ bool Interpolation3DTest::testDiagonal(const IntersectionMatrix& m) const
          const double vol = iter2->second;
          if(vol != 0.0 && (i != j))
            {
-             std::cout << "V( " << i - 1 << ", " << j << ") = " << vol << " which is not zero" << std::endl;
-             if(!epsilonEqual(vol, 0.0, VOL_PREC))
+             LOG(3, "V( " << i - 1 << ", " << j << ") = " << vol << " which is not zero" );
+             if(!epsilonEqualRelative(vol, 0.0, VOL_PREC))
                {
                  isDiagonal = false;
                }
@@ -113,18 +131,18 @@ bool Interpolation3DTest::testDiagonal(const IntersectionMatrix& m) const
 void Interpolation3DTest::dumpIntersectionMatrix(const IntersectionMatrix& m) const
 {
   int i = 0;
-  cout << "Intersection matrix is " << endl;
+  std::cout << "Intersection matrix is " << endl;
   for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter)
     {
       for(map<int, double>::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2)
        {
          
-         cout << "V(" << i << ", " << iter2->first << ") = " << iter2->second << endl;
+         std::cout << "V(" << i << ", " << iter2->first << ") = " << iter2->second << endl;
          
        }
       ++i;
     }
-  std::cout << "Sum of volumes = " << sumVolume(m) << std::endl << std::endl;
+  std::cout << "Sum of volumes = " << sumVolume(m) << std::endl;
 }
 
 void Interpolation3DTest::setUp()
@@ -141,22 +159,23 @@ void Interpolation3DTest::calcIntersectionMatrix(const char* mesh1path, const ch
 {
   const string dataDir = getenv("DATA_DIR");
 
-  std::cout << std::endl << "=== -> intersecting src = " << mesh1 << ", target = " << mesh2 << std::endl;
+  LOG(1, std::endl << "=== -> intersecting src = " << mesh1 << ", target = " << mesh2 );
 
-  std::cout << "Loading " << mesh1 << " from " << mesh1path << endl;
+  LOG(5, "Loading " << mesh1 << " from " << mesh1path);
   const MESH sMesh(MED_DRIVER, dataDir+mesh1path, mesh1);
 
-  std::cout << "Loading " << mesh2 << " from " << mesh2path << endl;
+  LOG(5, "Loading " << mesh2 << " from " << mesh2path);
   const MESH tMesh(MED_DRIVER, dataDir+mesh2path, mesh2);
 
   m = interpolator->interpol_maillages(sMesh, tMesh);
 
-  std::cout << "Intersection calculation done. " << std::endl << std::endl;
+  LOG(1, "Intersection calculation done. " << std::endl );
+  
 }
 
 void Interpolation3DTest::intersectMeshes(const char* mesh1path, const char* mesh1, const char* mesh2path, const char* mesh2, const double correctVol, const double prec) const
 {
-  std::cout << std::endl << std::endl << "=============================" << std::endl;
+  LOG(1, std::endl << std::endl << "=============================" );
 
   using std::string;
   const string path1 = string(mesh1path) + string(mesh1);
@@ -166,30 +185,43 @@ void Interpolation3DTest::intersectMeshes(const char* mesh1path, const char* mes
 
   IntersectionMatrix matrix1;
   calcIntersectionMatrix(mesh1path, mesh1, mesh2path, mesh2, matrix1);
-  dumpIntersectionMatrix(matrix1);
+
+#ifdef LOG_ACTIVE
+  if(LOG_LEVEL >= 4 )
+    {
+      dumpIntersectionMatrix(matrix1);
+    }
+#endif
+
   std::cout.precision(16);
 
   const double vol1 = sumVolume(matrix1);
 
   if(isTestReflexive)
     {
-      std::cout << "vol =  " << vol1 <<"  correctVol = " << correctVol <<  std::endl;
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(correctVol, vol1, prec);
+      LOG(1, "vol =  " << vol1 <<"  correctVol = " << correctVol );
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(correctVol, vol1, prec * std::max(correctVol, vol1));
       CPPUNIT_ASSERT_EQUAL_MESSAGE("Reflexive test failed", true, testDiagonal(matrix1));
     }
   else
     {
       IntersectionMatrix matrix2;
       calcIntersectionMatrix(mesh2path, mesh2, mesh1path, mesh1, matrix2);    
-      dumpIntersectionMatrix(matrix2);
+
+#ifdef LOG_ACTIVE      
+      if(LOG_LEVEL >= 4 )
+       {
+         dumpIntersectionMatrix(matrix2);
+       }
+#endif
       
       const double vol2 = sumVolume(matrix2);
 
-      std::cout << "vol1 =  " << vol1 << ", vol2 = " << vol2 << ", correctVol = " << correctVol <<   std::endl;
+      LOG(1, "vol1 =  " << vol1 << ", vol2 = " << vol2 << ", correctVol = " << correctVol );
 
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(correctVol, vol1, prec);
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(correctVol, vol2, prec);
-      CPPUNIT_ASSERT_DOUBLES_EQUAL(vol1, vol2, prec);
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(correctVol, vol1, prec * std::max(vol1, correctVol));
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(correctVol, vol2, prec * std::max(vol2, correctVol));
+      CPPUNIT_ASSERT_DOUBLES_EQUAL(vol1, vol2, prec * std::max(vol1, vol2));
       CPPUNIT_ASSERT_EQUAL_MESSAGE("Symmetry test failed", true, testSymmetric(matrix1, matrix2));
     }
 
index 18a85c4d090e541d0e3cca6313089f83f0879ab3..7de5c6a244a29ef4807aa5bb02143342e8bdf6c0 100644 (file)
@@ -11,15 +11,11 @@ using MEDMEM::Interpolation3D;
 class Interpolation3DTest : public CppUnit::TestFixture
 {
 
-  CPPUNIT_TEST_SUITE( Interpolation3DTest );
-
   // single - element
-  //#if 0
+  CPPUNIT_TEST_SUITE( Interpolation3DTest );
 
   CPPUNIT_TEST( tetraReflexiveUnit );
-
   CPPUNIT_TEST( tetraReflexiveGeneral );
-
   CPPUNIT_TEST( tetraNudgedSimpler );
   CPPUNIT_TEST( tetraNudged );
   CPPUNIT_TEST( tetraCorner );
@@ -31,38 +27,28 @@ class Interpolation3DTest : public CppUnit::TestFixture
   CPPUNIT_TEST( tetraHalfstripOnly2 );
   CPPUNIT_TEST( tetraSimpleHalfstripOnly );
   CPPUNIT_TEST( generalTetra );
-
   CPPUNIT_TEST( trickyTetra1 );
 
-  // multi - element
+  CPPUNIT_TEST( inconsistentTetra );
+
+
+  // multi - element  
+  
+
   CPPUNIT_TEST( tetraComplexIncluded );
   CPPUNIT_TEST( dividedUnitTetraSimplerReflexive );
   CPPUNIT_TEST( dividedUnitTetraReflexive );
   CPPUNIT_TEST( nudgedDividedUnitTetra );
   CPPUNIT_TEST( nudgedDividedUnitTetraSimpler );
   CPPUNIT_TEST( dividedGenTetra );
-  //#endif
   CPPUNIT_TEST( boxReflexive );
-
-
   CPPUNIT_TEST( boxReflexiveModerate );
-  //#if 0
-
   CPPUNIT_TEST( tetraBoxes );
-
   CPPUNIT_TEST( moderateBoxes );
-
   CPPUNIT_TEST( moderateBoxesSmaller );
-
-
   CPPUNIT_TEST( moderateBoxSmallReflexive );
-
-
   CPPUNIT_TEST( moderateBoxEvenSmallerReflexive );
-
   CPPUNIT_TEST( tinyBoxReflexive );
-  //#endif
-
 
   CPPUNIT_TEST_SUITE_END();
 
@@ -101,12 +87,12 @@ public:
 
   void tetraSimpleIncluded()
   {
-    intersectMeshes("meshes/SimpleIncludedTetra.med", "SimpleIncludedTetra", "meshes/SimpleIncludingTetra.med", "SimpleIncludingTetra", 17.0156, 1.0e-4);
+    intersectMeshes("meshes/SimpleIncludedTetra.med", "SimpleIncludedTetra", "meshes/SimpleIncludingTetra.med", "SimpleIncludingTetra", 17.0156);
   }
 
   void tetraComplexIncluded()
   {
-    intersectMeshes("meshes/ComplexIncludedTetra.med", "ComplexIncludedTetra", "meshes/ComplexIncludingTetra.med", "ComplexIncludingTetra", 17.0156, 1.0e-4);
+    intersectMeshes("meshes/ComplexIncludedTetra.med", "ComplexIncludedTetra", "meshes/ComplexIncludingTetra.med", "ComplexIncludingTetra", 17.0156);
   }
 
   void tetraHalfstripOnly()
@@ -132,14 +118,20 @@ public:
 
   void generalTetra()
   {
-    intersectMeshes("meshes/GenTetra1.med", "GenTetra1", "meshes/GenTetra2.med", "GenTetra2", 4.91393, 1.0e-5);
+    intersectMeshes("meshes/GenTetra1.med", "GenTetra1", "meshes/GenTetra2.med", "GenTetra2", 4.91393);
   }
 
   void trickyTetra1()
   {
-    intersectMeshes("meshes/UnitTetra.med", "UnitTetra", "meshes/TrickyTetra1.med", "TrickyTetra1", 0.0, 1.0e-8);
+    intersectMeshes("meshes/UnitTetra.med", "UnitTetra", "meshes/TrickyTetra1.med", "TrickyTetra1", 0.0);
+  }
+
+  void inconsistentTetra()
+  {
+    intersectMeshes("meshes/LargeUnitTetra.med", "LargeUnitTetra", "meshes/LargeInconsistentTetra.med", "LargeInconsistent", 7.86231e7);
   }
 
+
   void tetraDegenEdge()
   {
     intersectMeshes("meshes/UnitTetraDegenT.med", "UnitTetraDegenT", "meshes/DegenEdgeXY.med", "DegenEdgeXY", 0.0);
@@ -182,42 +174,42 @@ public:
 
   void boxReflexive()
   {
-    intersectMeshes("meshes/Box3.med", "Box3", "meshes/Box3.med", "Box3", 13.9954,  1.0e-4);
+    intersectMeshes("meshes/Box3.med", "Box3", "meshes/Box3.med", "Box3", 13.9954);
   }
 
   void boxReflexiveModerate()
   {
-    intersectMeshes("meshes/Box1Moderate.med", "Box1Moderate", "meshes/Box1Moderate.med", "Box1Moderate", 1.0e6,  1.0);
+    intersectMeshes("meshes/Box1Moderate.med", "Box1Moderate", "meshes/Box1Moderate.med", "Box1Moderate", 1.0e6);
   }
 
   void tetraBoxes()
   {
-    intersectMeshes("meshes/Box1.med", "Box1", "meshes/Box2.med", "Box2", 124.197, 1.0e-3);
+    intersectMeshes("meshes/Box1.med", "Box1", "meshes/Box2.med", "Box2", 124.197);
   }
 
   void moderateBoxes()
   {
-    intersectMeshes("meshes/Box1Moderate.med", "Box1Moderate", "meshes/Box2Moderate.med", "Box2Moderate", 376856, 1.0);
+    intersectMeshes("meshes/Box1Moderate.med", "Box1Moderate", "meshes/Box2Moderate.med", "Box2Moderate", 376856);
   }
 
   void moderateBoxesSmaller()
   {
-    intersectMeshes("meshes/BoxModSmall1.med", "BoxModSmall1", "meshes/BoxModSmall2.med", "BoxModSmall2", 321853, 1.0);
+    intersectMeshes("meshes/BoxModSmall1.med", "BoxModSmall1", "meshes/BoxModSmall2.med", "BoxModSmall2", 321853);
   }
 
   void moderateBoxSmallReflexive()
   {
-    intersectMeshes("meshes/BoxModSmall1.med", "BoxModSmall1", "meshes/BoxModSmall1.med", "BoxModSmall1", 1.44018e6, 1.0);
+    intersectMeshes("meshes/BoxModSmall1.med", "BoxModSmall1", "meshes/BoxModSmall1.med", "BoxModSmall1", 1.44018e6);
   }
 
   void moderateBoxEvenSmallerReflexive()
   {
-    intersectMeshes("meshes/BoxEvenSmaller1.med", "BoxEvenSmaller1", "meshes/BoxEvenSmaller1.med", "BoxEvenSmaller1", 1.44018e6, 1.0);
+    intersectMeshes("meshes/BoxEvenSmaller1.med", "BoxEvenSmaller1", "meshes/BoxEvenSmaller1.med", "BoxEvenSmaller1", 1.44018e6);
   }
 
   void tinyBoxReflexive()
   {
-    intersectMeshes("meshes/TinyBox.med", "TinyBox", "meshes/TinyBox.med", "TinyBox", 979200, 1.0);
+    intersectMeshes("meshes/TinyBox.med", "TinyBox", "meshes/TinyBox.med", "TinyBox", 979200);
   }
   
 private:
index 19b64a60c86ac36fb0d59e0037161d82d6a86aca..4fa72200245eaa29919ab7180f5c47b2e8303eba 100644 (file)
 #include "Interpolation3DTest.hxx"
 
 // --- Registers the fixture into the 'registry'
-
+//CPPUNIT_TEST_SUITE_REGISTRATION( Interpolation3DTestMultiElement );
 CPPUNIT_TEST_SUITE_REGISTRATION( Interpolation3DTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( TransformedTriangleIntersectTest );
 CPPUNIT_TEST_SUITE_REGISTRATION( TransformedTriangleTest );
-CPPUNIT_TEST_SUITE_REGISTRATION( TestBogusClass );
+//CPPUNIT_TEST_SUITE_REGISTRATION( TestBogusClass );
 
 // --- generic Main program from KERNEL_SRC/src/Basics/Test
 
index 5d922d2cecf74e812237e8dff314df9098178761..e3b4e7ef3aee86226fe03c440deb9b133642accb 100644 (file)
@@ -1,5 +1,8 @@
 #include "TransformedTriangleIntersectTest.hxx"
 #include <iostream>
+
+#include "Log.hxx"
+
 ////////////////////////////////////////////////////////////////////////////////////////////////////////
 // Intersection tests
 // Each method in this file runs all the intersection tests with some triangle. The goal is to cover all
@@ -84,6 +87,8 @@
 
 void TransformedTriangleIntersectTest::testTriangle1()
 {
+  LOG(1, "+++++++ Testing triangle 1" );
+
   typedef TransformedTriangle TT;
 
   double coords[9] = 
@@ -225,7 +230,7 @@ void TransformedTriangleIntersectTest::testTriangle1()
 
 void TransformedTriangleIntersectTest::testTriangle2()
 {
-
+  LOG(1, "+++++++ Testing triangle 2" );
     typedef TransformedTriangle TT;
 
     double coords[9] =
@@ -364,7 +369,7 @@ void TransformedTriangleIntersectTest::testTriangle2()
 
 void TransformedTriangleIntersectTest::testTriangle3()
 {
-
+  LOG(1, "+++++++ Testing triangle 3" );
     typedef TransformedTriangle TT;
 
     double coords[9] =
@@ -503,7 +508,7 @@ void TransformedTriangleIntersectTest::testTriangle3()
 
 void TransformedTriangleIntersectTest::testTriangle4()
 {
-
+  LOG(1, "+++++++ Testing triangle 4" );
     typedef TransformedTriangle TT;
 
     double coords[9] =
@@ -644,7 +649,8 @@ void TransformedTriangleIntersectTest::testTriangle4()
 
 void TransformedTriangleIntersectTest::testTriangle5()
 {
-  // std::cout << std::endl << "+++++++ Testing triangle 5" << std::endl;
+  LOG(1, "+++++++ Testing triangle 5" );
+  
     typedef TransformedTriangle TT;
 
     double coords[9] =
@@ -785,17 +791,17 @@ void TransformedTriangleIntersectTest::testTriangle5()
 
 void TransformedTriangleIntersectTest::testTriangle6()
 {
-  //  std::cout << std::endl << "+++++++ Testing triangle 6" << std::endl;
-
-    typedef TransformedTriangle TT;
+  LOG(1, "+++++++ Testing triangle 6" );
 
-    double coords[9] =
+  typedef TransformedTriangle TT;
+  
+  double coords[9] =
     {
       1.5, 0.5, 1.35,  // P
       0.5, -0.5, 2.1,  // Q
       -3.0, 3.0, -0.5   // R
     };
-
+  
   TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
 
   // run all intersection tests and ensure that the ones
@@ -928,6 +934,7 @@ void TransformedTriangleIntersectTest::testTriangle6()
 void TransformedTriangleIntersectTest::testTriangle7()
 {
 
+  LOG(1, "+++++++ Testing triangle 7" );
     typedef TransformedTriangle TT;
 
     double coords[9] =
@@ -1068,7 +1075,7 @@ void TransformedTriangleIntersectTest::testTriangle7()
 
 void TransformedTriangleIntersectTest::testTriangle8()
 {
-
+  LOG(1, "+++++++ Testing triangle 8" );
     typedef TransformedTriangle TT;
 
     double coords[9] =
@@ -1209,7 +1216,7 @@ void TransformedTriangleIntersectTest::testTriangle8()
 
 void TransformedTriangleIntersectTest::testTriangle9()
 {
-
+  LOG(1, "+++++++ Testing triangle 9" );
     typedef TransformedTriangle TT;
 
     double coords[9] =
@@ -1350,7 +1357,7 @@ void TransformedTriangleIntersectTest::testTriangle9()
 
 void TransformedTriangleIntersectTest::testTriangle10()
 {
-
+  LOG(1, "+++++++ Testing triangle 10" );
     typedef TransformedTriangle TT;
 
     double coords[9] =
@@ -1491,7 +1498,7 @@ void TransformedTriangleIntersectTest::testTriangle10()
 
 void TransformedTriangleIntersectTest::testTriangle11()
 {
-  
+  LOG(1, "+++++++ Testing triangle 11" );  
   typedef TransformedTriangle TT;
   
   double coords[9] =
@@ -1633,7 +1640,7 @@ void TransformedTriangleIntersectTest::testTriangle11()
 
 void TransformedTriangleIntersectTest::testTriangle12()
 {
-
+  LOG(1, "+++++++ Testing triangle 12" );
     typedef TransformedTriangle TT;
 
     double coords[9] =
@@ -1775,7 +1782,7 @@ void TransformedTriangleIntersectTest::testTriangle12()
 
 void TransformedTriangleIntersectTest::testTriangle13()
 {
-
+  LOG(1, "+++++++ Testing triangle 13" );
     typedef TransformedTriangle TT;
 
     double coords[9] =
@@ -1930,7 +1937,7 @@ void TransformedTriangleIntersectTest::testTriangle13()
 
 void TransformedTriangleIntersectTest::testTriangleX()
 {
-
+  LOG(1, "+++++++ Testing triangle X" );
     typedef TransformedTriangle TT;
 
     double coords[9] =
index 05a8fe01c66576d3862faa7b1482bec64ffa1581..4ecfad909cea1ce68d1ad8cad6ea77b8600a3b78 100644 (file)
@@ -235,7 +235,7 @@ void TransformedTriangleTest::test_calcStableC_Consistency()
       
       //      if(consistency != 0.0) {
       //      if(num_zeros == 2 || num_neg == 0 || num_neg == 3) 
-      if((num_zero == 1 && num_neg != 1) || num_zero == 2 || num_neg == 0 || num_neg == 3 )
+      if((num_zero == 1 && num_neg != 1) || num_zero == 2 || num_neg == 0 && num_zero !=3 || num_neg == 3 )
        {
          ++num_cases;
        
@@ -323,3 +323,39 @@ void TransformedTriangleTest::test_calcStableC_Consistency()
       CPPUNIT_ASSERT_DOUBLES_EQUAL(correct_c_vals[i], c_vals[i], ERR_TOL);
     }
 }
+
+#if 0
+void TransformedTriangleTest::inconsistent2()
+{
+
+  typedef TransformedTriangle::TriSegment TriSegment;
+  typedef TransformedTriangle::TetraCorner TetraCorner;
+
+  const double x = 54946.35168415842;
+  const double y = 84351.32165113264;
+  const double z = 14845.65498715654;
+
+  double coords[9] = 
+    {
+      x+0.000001, y, z,
+      -x, -y, -z,
+      0.5*x, 0.25*y, -10.0
+    };
+
+  std::cout << "test : " << coords[0]*coords[4] - coords[1]*coords[3] << std::endl;
+  std::cout << "test : " << coords[0]*coords[5] - coords[2]*coords[3] << std::endl;
+  std::cout << "test : " << coords[1]*coords[5] - coords[2]*coords[4] << std::endl;
+  
+  TransformedTriangle* tri = new TransformedTriangle(&coords[0], &coords[3], &coords[6]);
+
+  for(TriSegment seg = TransformedTriangle::PQ ; seg <= TransformedTriangle::RP ; seg = TriSegment(seg + 1))
+    {
+      std::cout << "seg " << seg << " consistent? = " << tri->areDoubleProductsConsistent(seg) << std::endl;
+    }
+
+  tri->calculateIntersectionVolume();
+
+  delete tri;
+  
+}
+#endif
index 8024843074e23ffc7972a568d8753bc2de24a920..0a0032d9ca1e5d01110d186d932714085de4f86c 100644 (file)
@@ -34,7 +34,10 @@ public:
   void test_calcUnstableT();
 
   void test_calcStableC_Consistency();
-  
+#if 0
+  void inconsistent2();
+#endif
+
   double p1[3], q1[3], r1[3];
   double hp1, hq1, hr1;
   double Hp1, Hq1, Hr1;