From: eap Date: Tue, 29 Sep 2009 06:57:23 +0000 (+0000) Subject: 0020440: [CEA 349] P1P0 barycentric interpolators X-Git-Tag: V5_1_main_FINAL~337 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=53d640383119b919f3cc6c3c8aad4363c5111dbe;p=tools%2Fmedcoupling.git 0020440: [CEA 349] P1P0 barycentric interpolators + CPPUNIT_TEST( test_UnitTetraIntersectionBary_12 ); --- diff --git a/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx b/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx index c92b25e5e..39cf27175 100644 --- a/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx +++ b/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx @@ -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() { diff --git a/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.hxx b/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.hxx index 26c1be3fd..db36256c9 100644 --- a/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.hxx +++ b/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.hxx @@ -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(); };