]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
0020440: [CEA 349] P1P0 barycentric interpolators
authoreap <eap@opencascade.com>
Tue, 29 Sep 2009 06:57:23 +0000 (06:57 +0000)
committereap <eap@opencascade.com>
Tue, 29 Sep 2009 06:57:23 +0000 (06:57 +0000)
+    CPPUNIT_TEST( test_UnitTetraIntersectionBary_12 );

src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx
src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.hxx

index c92b25e5e81616b0183fffced885360b0123c9e0..39cf2717562f342eea6188622d5cebd9df70097e 100644 (file)
@@ -34,11 +34,15 @@ namespace INTERP_TEST
 {
   void fill_UnitTetraIntersectionBary(UnitTetraIntersectionBary& bary, double nodes[][3])
   {
-    int faceConn[4][3] = { { 0, 2, 1 },
-                           { 0, 1, 3 },
-                           { 1, 2, 3 },
-                           { 3, 2, 0 } };
-    bary.init();
+    int faceConn[4][3] = { { 0, 1, 2 },// inverse order
+                           { 0, 3, 1 },
+                           { 1, 3, 2 },
+                           { 3, 0, 2 } };
+//     int faceConn[4][3] = { { 0, 2, 1 },
+//                            { 0, 1, 3 },
+//                            { 1, 2, 3 },
+//                            { 3, 2, 0 } };
+    bary.init(true);
     for ( int i = 0; i < 4; ++i ) {
       int* faceNodes = faceConn[ i ];
       TransformedTriangle tri(nodes[faceNodes[0]], nodes[faceNodes[1]], nodes[faceNodes[2]]);
@@ -244,6 +248,24 @@ namespace INTERP_TEST
     CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.230952, baryCenter[1], 1e-5);
     CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.260714, baryCenter[2], 1e-5);
   }
+  void UnitTetraIntersectionBaryTest::test_UnitTetraIntersectionBary_12()
+  {
+    // cutting tetra has one corner inside the UT and one its side passes through an UT edge
+    double nodes[4][3] = { { 0.25, 0.25, 0.25 }, // 0
+                           { 1.75,-0.25,-0.25 }, // OX
+                           { 0.5 , 0.25, 0.25 }, // OY
+                           { 0.5 , 0   , 0.5  } };//OZ
+    UnitTetraIntersectionBary bary;
+    fill_UnitTetraIntersectionBary(bary,nodes);
+    double baryCenter[3];
+    bool ok    = bary.getBary( baryCenter );
+    double vol = bary.getVolume();
+    CPPUNIT_ASSERT( ok );
+    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.005208 , vol, 1e-5);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.562500, baryCenter[0], 1e-5);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.125000, baryCenter[1], 1e-5);
+    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.250000, baryCenter[2], 1e-5);
+  }
 
   void UnitTetraIntersectionBaryTest::test_TetraAffineTransform_reverseApply()
   {
index 26c1be3fd450beda5777f3a7601237ac11eca29c..db36256c91364c8a4c778a2b0b5f6af6ba9b91d4 100644 (file)
@@ -33,6 +33,7 @@ namespace INTERP_TEST
   class UnitTetraIntersectionBaryTest : public CppUnit::TestFixture
   {
     CPPUNIT_TEST_SUITE( UnitTetraIntersectionBaryTest );
+    CPPUNIT_TEST( test_UnitTetraIntersectionBary_12 );
     CPPUNIT_TEST( test_UnitTetraIntersectionBary_1 );
     CPPUNIT_TEST( test_UnitTetraIntersectionBary_2 );
     CPPUNIT_TEST( test_UnitTetraIntersectionBary_3 );
@@ -59,6 +60,7 @@ namespace INTERP_TEST
     void test_UnitTetraIntersectionBary_9();
     void test_UnitTetraIntersectionBary_10();
     void test_UnitTetraIntersectionBary_11();
+    void test_UnitTetraIntersectionBary_12();
     void test_TetraAffineTransform_reverseApply();
     void test_barycentric_coords();
   };