Salome HOME
Bug fix: BuildIntersectCells() should no try to merge points at all. Done before.
[tools/medcoupling.git] / src / INTERP_KERNEL / InterpolationPlanar.txx
index 52ec125574229b0ead4dce11784a2d06259ed3c4..5c3fc9a244121ec5964f7948683ee2e6fd12edfb 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
@@ -40,6 +40,8 @@
 #include "PlanarIntersectorP1P0PL.txx"
 #include "PlanarIntersectorP1P1PL.hxx"
 #include "PlanarIntersectorP1P1PL.txx"
+#include "MappedBarycentric2DIntersectorP1P1.hxx"
+#include "MappedBarycentric2DIntersectorP1P1.txx"
 #include "VectorUtils.hxx"
 #include "BBTree.txx"
 
@@ -77,7 +79,7 @@ namespace INTERP_KERNEL
    *   - Values: positive real number.
    *   - Default: 1.0E-12.
    *  -# PrintLevel: Level of verboseness during the computations.
-   *   - Values: interger between 0 and 3.
+   *   - Values: integer between 0 and 3.
    *   - Default: 0.
    */
   template<class RealPlanar>
@@ -164,6 +166,7 @@ namespace INTERP_KERNEL
             intersector=new TriangulationIntersector<MyMeshType,MatrixType,PlanarIntersectorP0P0>(myMeshT,myMeshS,_dim_caracteristic,
                                                                                                   InterpolationOptions::getPrecision(),
                                                                                                   InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                  InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                                   InterpolationOptions::getMedianPlane(),
                                                                                                   InterpolationOptions::getOrientation(),
                                                                                                   InterpolationOptions::getPrintLevel());
@@ -172,6 +175,7 @@ namespace INTERP_KERNEL
             intersector=new ConvexIntersector<MyMeshType,MatrixType,PlanarIntersectorP0P0>(myMeshT,myMeshS,_dim_caracteristic,
                                                                                            InterpolationOptions::getPrecision(),
                                                                                            InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                           InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                            InterpolationOptions::getMedianPlane(),
                                                                                            InterpolationOptions::getDoRotate(),
                                                                                            InterpolationOptions::getOrientation(),
@@ -180,6 +184,7 @@ namespace INTERP_KERNEL
           case Geometric2D:
             intersector=new Geometric2DIntersector<MyMeshType,MatrixType,PlanarIntersectorP0P0>(myMeshT, myMeshS, _dim_caracteristic,
                                                                                                 InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                                 InterpolationOptions::getMedianPlane(),
                                                                                                 InterpolationOptions::getPrecision(),
                                                                                                 InterpolationOptions::getOrientation());
@@ -187,6 +192,7 @@ namespace INTERP_KERNEL
           case PointLocator:
             intersector=new PointLocator2DIntersector<MyMeshType,MatrixType,PlanarIntersectorP0P0>(myMeshT, myMeshS, _dim_caracteristic,
                                                                                                    InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                   InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                                    InterpolationOptions::getMedianPlane(),
                                                                                                    InterpolationOptions::getPrecision(),
                                                                                                    InterpolationOptions::getOrientation());
@@ -203,6 +209,7 @@ namespace INTERP_KERNEL
             intersector=new TriangulationIntersector<MyMeshType,MatrixType,PlanarIntersectorP0P1>(myMeshT,myMeshS,_dim_caracteristic,
                                                                                                   InterpolationOptions::getPrecision(),
                                                                                                   InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                  InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                                   InterpolationOptions::getMedianPlane(),
                                                                                                   InterpolationOptions::getOrientation(),
                                                                                                   InterpolationOptions::getPrintLevel());
@@ -211,6 +218,7 @@ namespace INTERP_KERNEL
             intersector=new ConvexIntersector<MyMeshType,MatrixType,PlanarIntersectorP0P1>(myMeshT,myMeshS,_dim_caracteristic,
                                                                                            InterpolationOptions::getPrecision(),
                                                                                            InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                           InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                            InterpolationOptions::getMedianPlane(),
                                                                                            InterpolationOptions::getDoRotate(),
                                                                                            InterpolationOptions::getOrientation(),
@@ -219,6 +227,7 @@ namespace INTERP_KERNEL
           case Geometric2D:
             intersector=new Geometric2DIntersector<MyMeshType,MatrixType,PlanarIntersectorP0P1>(myMeshT, myMeshS, _dim_caracteristic,
                                                                                                 InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                                 InterpolationOptions::getMedianPlane(),
                                                                                                 InterpolationOptions::getPrecision(),
                                                                                                 InterpolationOptions::getOrientation());
@@ -226,6 +235,7 @@ namespace INTERP_KERNEL
           case PointLocator:
             intersector=new PlanarIntersectorP0P1PL<MyMeshType,MatrixType>(myMeshT, myMeshS, _dim_caracteristic,
                                                                            InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                           InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                            InterpolationOptions::getMedianPlane(),
                                                                            InterpolationOptions::getPrecision(),
                                                                            InterpolationOptions::getOrientation());
@@ -234,6 +244,7 @@ namespace INTERP_KERNEL
             intersector=new TriangulationIntersector<MyMeshType,MatrixType,PlanarIntersectorP0P1Bary>(myMeshT,myMeshS,_dim_caracteristic,
                                                                                                       InterpolationOptions::getPrecision(),
                                                                                                       InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                      InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                                       InterpolationOptions::getMedianPlane(),
                                                                                                       InterpolationOptions::getOrientation(),
                                                                                                       InterpolationOptions::getPrintLevel());
@@ -241,6 +252,7 @@ namespace INTERP_KERNEL
           case BarycentricGeo2D:
             intersector=new Geometric2DIntersector<MyMeshType,MatrixType,PlanarIntersectorP0P1Bary>(myMeshT, myMeshS, _dim_caracteristic,
                                                                                                     InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                    InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                                     InterpolationOptions::getMedianPlane(),
                                                                                                     InterpolationOptions::getPrecision(),
                                                                                                     InterpolationOptions::getOrientation());
@@ -257,6 +269,7 @@ namespace INTERP_KERNEL
             intersector=new TriangulationIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P0>(myMeshT,myMeshS,_dim_caracteristic,
                                                                                                   InterpolationOptions::getPrecision(),
                                                                                                   InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                  InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                                   InterpolationOptions::getMedianPlane(),
                                                                                                   InterpolationOptions::getOrientation(),
                                                                                                   InterpolationOptions::getPrintLevel());
@@ -265,6 +278,7 @@ namespace INTERP_KERNEL
             intersector=new ConvexIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P0>(myMeshT,myMeshS,_dim_caracteristic,
                                                                                            InterpolationOptions::getPrecision(),
                                                                                            InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                           InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                            InterpolationOptions::getMedianPlane(),
                                                                                            InterpolationOptions::getDoRotate(),
                                                                                            InterpolationOptions::getOrientation(),
@@ -273,21 +287,24 @@ namespace INTERP_KERNEL
           case Geometric2D:
             intersector=new Geometric2DIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P0>(myMeshT, myMeshS, _dim_caracteristic,
                                                                                                 InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                                 InterpolationOptions::getMedianPlane(),
                                                                                                 InterpolationOptions::getPrecision(),
                                                                                                 InterpolationOptions::getOrientation());
             break;
           case PointLocator:
             intersector=new PlanarIntersectorP1P0PL<MyMeshType,MatrixType>(myMeshT, myMeshS, _dim_caracteristic,
-                                                                       InterpolationOptions::getMaxDistance3DSurfIntersect(),
-                                                                       InterpolationOptions::getMedianPlane(),
-                                                                       InterpolationOptions::getPrecision(),
-                                                                       InterpolationOptions::getOrientation());
+                                                                           InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                           InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
+                                                                           InterpolationOptions::getMedianPlane(),
+                                                                           InterpolationOptions::getPrecision(),
+                                                                           InterpolationOptions::getOrientation());
             break;
           case Barycentric:
              intersector=new TriangulationIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P0Bary>(myMeshT,myMeshS,_dim_caracteristic,
                                                                                                        InterpolationOptions::getPrecision(),
                                                                                                        InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                       InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                                        InterpolationOptions::getMedianPlane(),
                                                                                                        InterpolationOptions::getOrientation(),
                                                                                                        InterpolationOptions::getPrintLevel());
@@ -295,10 +312,13 @@ namespace INTERP_KERNEL
           case BarycentricGeo2D:
             intersector=new Geometric2DIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P0Bary>(myMeshT, myMeshS, _dim_caracteristic,
                                                                                                     InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                    InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                                     InterpolationOptions::getMedianPlane(),
                                                                                                     InterpolationOptions::getPrecision(),
                                                                                                     InterpolationOptions::getOrientation());
             break;
+          default:
+            throw INTERP_KERNEL::Exception("For P1P0 planar interpolation possibities are : Triangulation, Convex, Geometric2D, PointLocator, BarycentricGeo2D or Barycentric!");
           }
       }
     else if(meth=="P1P1")
@@ -309,6 +329,7 @@ namespace INTERP_KERNEL
             intersector=new TriangulationIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P1>(myMeshT,myMeshS,_dim_caracteristic,
                                                                                                   InterpolationOptions::getPrecision(),
                                                                                                   InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                  InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                                   InterpolationOptions::getMedianPlane(),
                                                                                                   InterpolationOptions::getOrientation(),
                                                                                                   InterpolationOptions::getPrintLevel());
@@ -317,6 +338,7 @@ namespace INTERP_KERNEL
             intersector=new ConvexIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P1>(myMeshT,myMeshS,_dim_caracteristic,
                                                                                            InterpolationOptions::getPrecision(),
                                                                                            InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                           InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                            InterpolationOptions::getMedianPlane(),
                                                                                            InterpolationOptions::getDoRotate(),
                                                                                            InterpolationOptions::getOrientation(),
@@ -325,6 +347,7 @@ namespace INTERP_KERNEL
           case Geometric2D:
             intersector=new Geometric2DIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P1>(myMeshT, myMeshS, _dim_caracteristic,
                                                                                                 InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                                                 InterpolationOptions::getMedianPlane(),
                                                                                                 InterpolationOptions::getPrecision(),
                                                                                                 InterpolationOptions::getOrientation());
@@ -332,19 +355,28 @@ namespace INTERP_KERNEL
           case PointLocator:
             intersector=new PlanarIntersectorP1P1PL<MyMeshType,MatrixType>(myMeshT, myMeshS, _dim_caracteristic,
                                                                            InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                           InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                            InterpolationOptions::getMedianPlane(),
                                                                            InterpolationOptions::getPrecision(),
                                                                            InterpolationOptions::getOrientation());
             break;
+          case MappedBarycentric:
+            intersector=new MappedBarycentric2DIntersectorP1P1<MyMeshType,MatrixType>(myMeshT, myMeshS, _dim_caracteristic,
+                                                                                     InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                     InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
+                                                                                     InterpolationOptions::getMedianPlane(),
+                                                                                     InterpolationOptions::getPrecision(),
+                                                                                     InterpolationOptions::getOrientation());
+            break;
           default:
-            throw INTERP_KERNEL::Exception("For P1P1 planar interpolation possibities are : Triangulation, Convex, Geometric2D, PointLocator !");
+            throw INTERP_KERNEL::Exception("For P1P1 planar interpolation possibities are : Triangulation, Convex, Geometric2D, PointLocator, MappedBarycentric !");
           }
       }
     else
       throw INTERP_KERNEL::Exception("Invalid method specified or intersection type ! Must be in : \"P0P0\" \"P0P1\" \"P1P0\" or \"P1P1\"");
     /****************************************************************/
     /* Create a search tree based on the bounding boxes             */
-    /* Instanciate the intersector and initialise the result vector */
+    /* Instantiate the intersector and initialise the result vector */
     /****************************************************************/
  
     long start_filtering=clock();