Salome HOME
Improve swig generation process on Windows platform.
[tools/medcoupling.git] / src / INTERP_KERNEL / InterpolationCurve.txx
index 86ec617440b4e54b9c519f0d1fd85dc579cbc3df..fd25ef29a291497701800e7fe83f89151a5f0858 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,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+// Author : Anthony Geay (CEA/DEN)
 #ifndef __INTERPOLATIONCURVE_TXX__
 #define __INTERPOLATIONCURVE_TXX__
 
@@ -25,6 +26,7 @@
 #include "CurveIntersectorP1P0.txx"
 #include "CurveIntersectorP0P1.txx"
 #include "CurveIntersectorP1P1.txx"
+#include "CurveIntersectorP1P1PL.txx"
 #include "BBTree.txx"
 
 #include <time.h>
@@ -71,10 +73,10 @@ namespace INTERP_KERNEL
       */
   template<class RealCurve>
   template<class MyMeshType, class MatrixType>
-  int InterpolationCurve<RealCurve>::interpolateMeshes (const MyMeshType& myMeshS,
-                                                        const MyMeshType& myMeshT,
-                                                        MatrixType&       result,
-                                                        const char *      method)
+  int InterpolationCurve<RealCurve>::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;
@@ -87,42 +89,80 @@ namespace INTERP_KERNEL
     long nbMailleT = myMeshT.getNumberOfElements();
     
     CurveIntersector<MyMeshType,MatrixType>* intersector=0;
-    std::string meth(method);
-    if(meth=="P0P0")
+    if(method=="P0P0")
       {
-        intersector = new CurveIntersectorP0P0<MyMeshType,MatrixType>
-          (myMeshT, myMeshS,
-           InterpolationOptions::getPrecision(),
-           InterpolationOptions::getBoundingBoxAdjustmentAbs(),
-           InterpolationOptions::getMedianPlane(),
-           InterpolationOptions::getPrintLevel());
+        switch (InterpolationOptions::getIntersectionType())
+          {
+            case Triangulation:
+              {
+                intersector = new CurveIntersectorP0P0<MyMeshType,MatrixType>(myMeshT, myMeshS,
+                                                                              InterpolationOptions::getPrecision(),
+                                                                              InterpolationOptions::getBoundingBoxAdjustmentAbs(),
+                                                                              InterpolationOptions::getMedianPlane(),
+                                                                              InterpolationOptions::getPrintLevel());
+                break;
+              }
+            default:
+              throw INTERP_KERNEL::Exception("For P0P0 in 1D or 2D curve only Triangulation supported for the moment !");
+          }
       }
-    else if(meth=="P0P1")
+    else if(method=="P0P1")
       {
-        intersector = new CurveIntersectorP0P1<MyMeshType,MatrixType>
-          (myMeshT, myMeshS,
-           InterpolationOptions::getPrecision(),
-           InterpolationOptions::getBoundingBoxAdjustmentAbs(),
-           InterpolationOptions::getMedianPlane(),
-           InterpolationOptions::getPrintLevel());
+        switch (InterpolationOptions::getIntersectionType())
+          {
+            case Triangulation:
+              {
+                intersector = new CurveIntersectorP0P1<MyMeshType,MatrixType>(myMeshT, myMeshS,
+                                                                              InterpolationOptions::getPrecision(),
+                                                                              InterpolationOptions::getBoundingBoxAdjustmentAbs(),
+                                                                              InterpolationOptions::getMedianPlane(),
+                                                                              InterpolationOptions::getPrintLevel());
+                break;
+              }
+            default:
+              throw INTERP_KERNEL::Exception("For P0P1 in 1D or 2D curve only Triangulation supported for the moment !");
+          }
       }
-    else if(meth=="P1P0")
+    else if(method=="P1P0")
       {
-        intersector = new CurveIntersectorP1P0<MyMeshType,MatrixType>
-          (myMeshT, myMeshS,
-           InterpolationOptions::getPrecision(),
-           InterpolationOptions::getBoundingBoxAdjustmentAbs(),
-           InterpolationOptions::getMedianPlane(),
-           InterpolationOptions::getPrintLevel());
+        switch (InterpolationOptions::getIntersectionType())
+          {
+            case Triangulation:
+              {
+                intersector = new CurveIntersectorP1P0<MyMeshType,MatrixType>(myMeshT, myMeshS,
+                                                                              InterpolationOptions::getPrecision(),
+                                                                              InterpolationOptions::getBoundingBoxAdjustmentAbs(),
+                                                                              InterpolationOptions::getMedianPlane(),
+                                                                              InterpolationOptions::getPrintLevel());
+                break;
+              }
+            default:
+              throw INTERP_KERNEL::Exception("For P1P0 in 1D or 2D curve only Triangulation supported for the moment !");
+          }
       }
-    else if(meth=="P1P1")
+    else if(method=="P1P1")
       {
-        intersector = new CurveIntersectorP1P1<MyMeshType,MatrixType>
-          (myMeshT, myMeshS,
-           InterpolationOptions::getPrecision(),
-           InterpolationOptions::getBoundingBoxAdjustmentAbs(),
-           InterpolationOptions::getMedianPlane(),
-           InterpolationOptions::getPrintLevel());
+        switch (InterpolationOptions::getIntersectionType())
+          {
+          case Triangulation:
+            intersector = new CurveIntersectorP1P1<MyMeshType,MatrixType>
+              (myMeshT, myMeshS,
+               InterpolationOptions::getPrecision(),
+               InterpolationOptions::getBoundingBoxAdjustmentAbs(),
+               InterpolationOptions::getMedianPlane(),
+               InterpolationOptions::getPrintLevel());
+            break;
+          case PointLocator:
+            intersector = new CurveIntersectorP1P1PL<MyMeshType,MatrixType>
+              (myMeshT, myMeshS,
+               InterpolationOptions::getPrecision(),
+               InterpolationOptions::getBoundingBoxAdjustmentAbs(),
+               InterpolationOptions::getMedianPlane(),
+               InterpolationOptions::getPrintLevel());
+            break;
+          default:
+            throw INTERP_KERNEL::Exception("For P1P1 in 1D or 2D curve only Triangulation and PointLocator supported !");
+          }
       }
     else
       throw INTERP_KERNEL::Exception("Invalid method specified ! Must be in : \"P0P0\" \"P0P1\" \"P1P0\" or \"P1P1\"");