X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNELTest%2FThreeDSurfProjectionTest.cxx;h=a8962ce1a36e25d6477a06bc83e97b1002c1f620;hb=8411b13fec372c7635bf04d2bb81a869dc038fdd;hp=f052edbb4c67d8278024ae78886c4e18bf1de3fc;hpb=72f740f3390fe173ddd3af29380b54dd7acd8174;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx b/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx index f052edbb4..a8962ce1a 100644 --- a/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx +++ b/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D +// Copyright (C) 2007-2020 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,12 +19,15 @@ #include "ThreeDSurfProjectionTest.hxx" #include "PlanarIntersector.txx" +#include "MCIdType.hxx" class MyMeshType { public: static const int MY_SPACEDIM=3; - typedef int MyConnType; + static const int MY_MESHDIM=3; + static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE; + typedef mcIdType MyConnType; }; class MyMatrixType @@ -48,7 +51,7 @@ void INTERP_TEST::ThreeDSurfProjectionTest::test1() // here the max 3D distance is 1e-5 > 1e-6 so 1 is expected std::copy(coo,coo+9,tmp0); std::copy(coo2,coo2+9,tmp1); - ret=INTERP_KERNEL::PlanarIntersector::projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,0.5,true); + ret=INTERP_KERNEL::PlanarIntersector::Projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,-1.,0.5,true); CPPUNIT_ASSERT_EQUAL(1,ret); const double expected0[9]={0.,0.,0.,1.,0.,0.,0.,1.,0.}; for(int i=0;i<9;i++) @@ -59,12 +62,12 @@ void INTERP_TEST::ThreeDSurfProjectionTest::test1() // here the max 3D distance is 1e-8 < 1e-6 so 0 is expected std::copy(coo,coo+9,tmp0); std::copy(coo2,coo2+9,tmp1); - ret=INTERP_KERNEL::PlanarIntersector::projection(tmp0,tmp1,3,3,1e-2,1e-8/* <- */,0.5,true); + ret=INTERP_KERNEL::PlanarIntersector::Projection(tmp0,tmp1,3,3,1e-2,1e-8/* <- */,-1.,0.5,true); CPPUNIT_ASSERT_EQUAL(0,ret); // here testing when max 3D distance is 1e-5 > 1e-6 with inverted cells std::copy(coo,coo+9,tmp0); std::copy(coo2,coo2+3,tmp1+6); std::copy(coo2+3,coo2+6,tmp1+3); std::copy(coo2+6,coo2+9,tmp1); - ret=INTERP_KERNEL::PlanarIntersector::projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,0.5,true); + ret=INTERP_KERNEL::PlanarIntersector::Projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,-1.,0.5,true); CPPUNIT_ASSERT_EQUAL(-1,ret); const double expected1[9]={-0.7071067811865476,-0.7071067811865476,0.,0.,-1.4142135623730951,0.,-1.4142135623730951,-1.4142135623730951,0.}; const double expected2[9]={-1.4142135623730951,-1.4142135623730951,0.,0.,-1.4142135623730951,0.,-0.7071067811865476,-0.7071067811865476,0.}; @@ -81,7 +84,7 @@ void INTERP_TEST::ThreeDSurfProjectionTest::test1() void INTERP_TEST::ThreeDSurfProjectionTest::test2() {// here the two triangles have their center of inertia very close (eps) but the angle between the two planes is "big" //coo=DataArrayDouble([0.,0.,0.,1.,0.,0.,0.,1.,0.],3,3) - //coocpy=coo.deepCpy() + //coocpy=coo.deepCopy() //MEDCouplingPointSet.Rotate3DAlg([0.,0.,0.],[-1,-1.,0.],pi/3,coocpy) //coocpy+=[eps*sqrt(3)/2,eps/2,eps*0.] // @@ -93,12 +96,32 @@ void INTERP_TEST::ThreeDSurfProjectionTest::test2() // here the max 3D distance is 1e-5 > 1e-6 so 1 is expected std::copy(coo,coo+9,tmp0); std::copy(coo2,coo2+9,tmp1); - ret=INTERP_KERNEL::PlanarIntersector::projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,0.5,true); + ret=INTERP_KERNEL::PlanarIntersector::Projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,-1.,0.5,true); CPPUNIT_ASSERT_EQUAL(1,ret); // here the max 3D distance is 1e-8 < 1e-6 so 0 is expected std::copy(coo,coo+9,tmp0); std::copy(coo2,coo2+9,tmp1); - ret=INTERP_KERNEL::PlanarIntersector::projection(tmp0,tmp1,3,3,1e-2,1e-8/* <- */,0.5,true); + ret=INTERP_KERNEL::PlanarIntersector::Projection(tmp0,tmp1,3,3,1e-2,1e-8/* <- */,-1.,0.5,true); + CPPUNIT_ASSERT_EQUAL(0,ret); + // again max 3D distance is 1e-5 > 1e-6 so 1 is expected + std::copy(coo,coo+9,tmp0); + std::copy(coo2,coo2+9,tmp1); + ret=INTERP_KERNEL::PlanarIntersector::Projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,-1.,0.5,true); + CPPUNIT_ASSERT_EQUAL(1,ret); + // again max 3D distance is 1e-5 > 1e-6 but minDot set to 0.8. 0 expected. because the angle is pi/4 so cos(pi/3) > 0.8 + std::copy(coo,coo+9,tmp0); + std::copy(coo2,coo2+9,tmp1); + ret=INTERP_KERNEL::PlanarIntersector::Projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,0.8/* <- */,0.5,true); + CPPUNIT_ASSERT_EQUAL(0,ret); + // again max 3D distance is 1e-5 > 1e-6 but minDot set to 0.7. 1 expected. because the angle is pi/4 so cos(pi/3) < 0.49 + std::copy(coo,coo+9,tmp0); + std::copy(coo2,coo2+9,tmp1); + ret=INTERP_KERNEL::PlanarIntersector::Projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,0.49/* <- */,0.5,true); + CPPUNIT_ASSERT_EQUAL(1,ret); + // again max 3D distance is 1e-5 > 1e-6 but minDot set to 0.7. 0 expected. because the angle is pi/4 so cos(pi/3) > 0.51 + std::copy(coo,coo+9,tmp0); + std::copy(coo2,coo2+9,tmp1); + ret=INTERP_KERNEL::PlanarIntersector::Projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,0.51/* <- */,0.5,true); CPPUNIT_ASSERT_EQUAL(0,ret); // delete [] tmp0;