Salome HOME
Correction of bug concerning UNIV info status.
[tools/medcoupling.git] / src / INTERP_KERNELTest / ThreeDSurfProjectionTest.cxx
index f052edbb4c67d8278024ae78886c4e18bf1de3fc..2a84b503a2fdf86aa70e1dd308c36ea55c2e9b06 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015  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
@@ -24,6 +24,8 @@ class MyMeshType
 {
 public:
   static const int MY_SPACEDIM=3;
+  static const int MY_MESHDIM=3;
+  static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
   typedef int MyConnType;
 };
 
@@ -48,7 +50,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<MyMeshType,MyMatrixType>::projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,0.5,true);
+  ret=INTERP_KERNEL::PlanarIntersector<MyMeshType,MyMatrixType>::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 +61,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<MyMeshType,MyMatrixType>::projection(tmp0,tmp1,3,3,1e-2,1e-8/* <- */,0.5,true);
+  ret=INTERP_KERNEL::PlanarIntersector<MyMeshType,MyMatrixType>::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<MyMeshType,MyMatrixType>::projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,0.5,true);
+  ret=INTERP_KERNEL::PlanarIntersector<MyMeshType,MyMatrixType>::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.};
@@ -93,12 +95,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<MyMeshType,MyMatrixType>::projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,0.5,true);
+  ret=INTERP_KERNEL::PlanarIntersector<MyMeshType,MyMatrixType>::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<MyMeshType,MyMatrixType>::projection(tmp0,tmp1,3,3,1e-2,1e-8/* <- */,0.5,true);
+  ret=INTERP_KERNEL::PlanarIntersector<MyMeshType,MyMatrixType>::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<MyMeshType,MyMatrixType>::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<MyMeshType,MyMatrixType>::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<MyMeshType,MyMatrixType>::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<MyMeshType,MyMatrixType>::Projection(tmp0,tmp1,3,3,1e-2,1e-5/* <- */,0.51/* <- */,0.5,true);
   CPPUNIT_ASSERT_EQUAL(0,ret);
   //
   delete [] tmp0;