Salome HOME
Load interpolation matrix from the outside
[tools/medcoupling.git] / src / INTERP_KERNELTest / ThreeDSurfProjectionTest.cxx
index cce28e644b8af8abb4a536c891162506d1fcd980..e25aec49cde4937d606eef3e6c91fc43c2ee1f0f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  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;
 };
 
@@ -81,7 +83,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.]
   //
@@ -100,6 +102,26 @@ void INTERP_TEST::ThreeDSurfProjectionTest::test2()
   std::copy(coo2,coo2+9,tmp1);
   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;
   delete [] tmp1;