Salome HOME
Improve swig generation process on Windows platform.
[tools/medcoupling.git] / src / INTERP_KERNEL / InterpolationPlanar.txx
index 2ba5aafe895925c0ada0894dbae513575392c8a1..0dc6e42b886cd5cf98b87a33bc92bca7d3b9037d 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2012  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
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -16,6 +16,8 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+// Author : Anthony Geay (CEA/DEN)
+
 #ifndef __INTERPOLATIONPLANAR_TXX__
 #define __INTERPOLATIONPLANAR_TXX__
 
@@ -38,6 +40,8 @@
 #include "PlanarIntersectorP1P0PL.txx"
 #include "PlanarIntersectorP1P1PL.hxx"
 #include "PlanarIntersectorP1P1PL.txx"
+#include "MappedBarycentric2DIntersectorP1P1.hxx"
+#include "MappedBarycentric2DIntersectorP1P1.txx"
 #include "VectorUtils.hxx"
 #include "BBTree.txx"
 
@@ -110,7 +114,7 @@ namespace INTERP_KERNEL
       */
   template<class RealPlanar>
   template<class MyMeshType, class MatrixType>
-  int InterpolationPlanar<RealPlanar>::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const char *method)
+  int InterpolationPlanar<RealPlanar>::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method)
   {
     static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
     typedef typename MyMeshType::MyConnType ConnType;
@@ -162,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());
@@ -170,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(),
@@ -178,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());
@@ -185,10 +192,13 @@ 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());
             break;
+          default:
+            throw INTERP_KERNEL::Exception("For P0P0 planar interpolation possibities are : Triangulation, Convex, Geometric2D, PointLocator !");
           }
       }
     else if(meth=="P0P1")
@@ -199,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());
@@ -207,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(),
@@ -215,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());
@@ -222,10 +235,30 @@ namespace INTERP_KERNEL
           case PointLocator:
             intersector=new PlanarIntersectorP0P1PL<MyMeshType,MatrixType>(myMeshT, myMeshS, _dim_caracteristic,
                                                                            InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                           InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
                                                                            InterpolationOptions::getMedianPlane(),
                                                                            InterpolationOptions::getPrecision(),
                                                                            InterpolationOptions::getOrientation());
             break;
+          case Barycentric:
+            intersector=new TriangulationIntersector<MyMeshType,MatrixType,PlanarIntersectorP0P1Bary>(myMeshT,myMeshS,_dim_caracteristic,
+                                                                                                      InterpolationOptions::getPrecision(),
+                                                                                                      InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                      InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
+                                                                                                      InterpolationOptions::getMedianPlane(),
+                                                                                                      InterpolationOptions::getOrientation(),
+                                                                                                      InterpolationOptions::getPrintLevel());
+            break;
+          case BarycentricGeo2D:
+            intersector=new Geometric2DIntersector<MyMeshType,MatrixType,PlanarIntersectorP0P1Bary>(myMeshT, myMeshS, _dim_caracteristic,
+                                                                                                    InterpolationOptions::getMaxDistance3DSurfIntersect(),
+                                                                                                    InterpolationOptions::getMinDotBtwPlane3DSurfIntersect(),
+                                                                                                    InterpolationOptions::getMedianPlane(),
+                                                                                                    InterpolationOptions::getPrecision(),
+                                                                                                    InterpolationOptions::getOrientation());
+            break;
+          default:
+            throw INTERP_KERNEL::Exception("For P0P1 planar interpolation possibities are : Triangulation, Convex, Geometric2D, PointLocator, Barycentric, BarycentricGeo2D !");
           }
       }
     else if(meth=="P1P0")
@@ -236,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());
@@ -244,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(),
@@ -252,52 +287,40 @@ 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());
+             break;
+          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=="P1P0Bary")
-    {
-      switch (InterpolationOptions::getIntersectionType())
-      {
-      case Triangulation:
-        intersector=new TriangulationIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P0Bary>(myMeshT,myMeshS,_dim_caracteristic,
-                                                                                                  InterpolationOptions::getPrecision(),
-                                                                                                  InterpolationOptions::getMaxDistance3DSurfIntersect(),
-                                                                                                  InterpolationOptions::getMedianPlane(),
-                                                                                                  InterpolationOptions::getOrientation(),
-                                                                                                  InterpolationOptions::getPrintLevel());
-        break;
-      case Convex:
-        intersector=new ConvexIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P0Bary>(myMeshT,myMeshS,_dim_caracteristic,
-                                                                                           InterpolationOptions::getPrecision(),
-                                                                                           InterpolationOptions::getMaxDistance3DSurfIntersect(),
-                                                                                           InterpolationOptions::getMedianPlane(),
-                                                                                           InterpolationOptions::getDoRotate(),
-                                                                                           InterpolationOptions::getOrientation(),
-                                                                                           InterpolationOptions::getPrintLevel());
-        break;
-      case Geometric2D:
-        intersector=new Geometric2DIntersector<MyMeshType,MatrixType,PlanarIntersectorP1P0Bary>(myMeshT, myMeshS, _dim_caracteristic,
-                                                                                                InterpolationOptions::getMaxDistance3DSurfIntersect(),
-                                                                                                InterpolationOptions::getMedianPlane(),
-                                                                                                InterpolationOptions::getPrecision(),
-                                                                                                InterpolationOptions::getOrientation());
-        break;
-      case PointLocator:
-        throw INTERP_KERNEL::Exception("Invalid intersector (PointLocator) for P1P0Bary !");
-        break;
-      }
-    }
     else if(meth=="P1P1")
       {
         switch (InterpolationOptions::getIntersectionType())
@@ -306,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());
@@ -314,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(),
@@ -322,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());
@@ -329,10 +355,21 @@ 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, MappedBarycentric !");
           }
       }
     else