Salome HOME
Help centos7 C++ compiler
[tools/medcoupling.git] / src / INTERP_KERNEL / InterpolationCurve.hxx
old mode 100644 (file)
new mode 100755 (executable)
index ff66167..34f7bf1
@@ -1,44 +1,72 @@
-// Copyright (C) 2007-2014  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, 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
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// Author : Anthony Geay (CEA/DEN)
-
-#ifndef __INTERPOLATIONCURVE_HXX__
-#define __INTERPOLATIONCURVE_HXX__
-
-#include "Interpolation.hxx"
-#include "InterpolationOptions.hxx"
-
-namespace INTERP_KERNEL
-{
-  template<class RealCurve>
-  class InterpolationCurve : public Interpolation< InterpolationCurve<RealCurve> >
-  {
-  public:
-    InterpolationCurve();
-    InterpolationCurve(const InterpolationOptions & io);
-
-    // Main function to interpolate
-    template<class MyMeshType, class MatrixType>
-    int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT,
-                          MatrixType& result, const std::string& method);
-    
-  };
-}
-
-#endif
+// Copyright (C) 2007-2019  CEA/DEN, EDF R&D\r
+//\r
+// This library is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU Lesser General Public\r
+// License as published by the Free Software Foundation; either\r
+// version 2.1 of the License, or (at your option) any later version.\r
+//\r
+// This library is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+// Lesser General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU Lesser General Public\r
+// License along with this library; if not, write to the Free Software\r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA\r
+//\r
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+//\r
+// Author : Anthony Geay (CEA/DEN)\r
+\r
+#ifndef __INTERPOLATIONCURVE_HXX__\r
+#define __INTERPOLATIONCURVE_HXX__\r
+\r
+#include "Interpolation.hxx"\r
+#include "InterpolationOptions.hxx"\r
+\r
+#include "BBTree.txx"\r
+\r
+#include <functional>\r
+\r
+namespace INTERP_KERNEL\r
+{\r
+  template<class RealCurve>\r
+  class InterpolationCurve : public Interpolation< InterpolationCurve<RealCurve> >\r
+  {\r
+  public:\r
+    InterpolationCurve();\r
+    InterpolationCurve(const InterpolationOptions & io);\r
+\r
+    // Main function to interpolate\r
+    template<class MyMeshType, class MatrixType>\r
+    typename MyMeshType::MyConnType interpolateMeshesInternal(const MyMeshType& meshS, const MyMeshType& meshT,\r
+                                                              MatrixType& result, const std::string& method,\r
+                                                              std::function< void(const BBTree< MyMeshType::MY_SPACEDIM , typename MyMeshType::MyConnType>&, const double*, std::vector<typename MyMeshType::MyConnType>&) > bbtreeMethod);\r
+    template<class MyMeshType, class MatrixType>\r
+    typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT,\r
+                                                      MatrixType& result, const std::string& method)\r
+    {\r
+      std::function< void(const BBTree< MyMeshType::MY_SPACEDIM , typename MyMeshType::MyConnType>&, const double*, std::vector<typename MyMeshType::MyConnType>&) > bbtreeMethod =\r
+        [](const BBTree< MyMeshType::MY_SPACEDIM , typename MyMeshType::MyConnType>& bbtree, const double *bb, std::vector<typename MyMeshType::MyConnType>& intersecting_elems)\r
+        { bbtree.getIntersectingElems(bb, intersecting_elems); };\r
+      return this->interpolateMeshesInternal(meshS,meshT,result,method,bbtreeMethod);\r
+    }\r
+    \r
+    template<class MyMeshType, class MatrixType>\r
+    typename MyMeshType::MyConnType interpolateMeshes0D(const MyMeshType& meshS, const MyMeshType& meshT,\r
+                                                        MatrixType& result, const std::string& method)\r
+    {\r
+      std::function< void(const BBTree< MyMeshType::MY_SPACEDIM , typename MyMeshType::MyConnType>&, const double*, std::vector<typename MyMeshType::MyConnType>&) > bbtreeMethod =\r
+        [](const BBTree< MyMeshType::MY_SPACEDIM , typename MyMeshType::MyConnType>& bbtree, const double *bb, std::vector<typename MyMeshType::MyConnType>& intersecting_elems)\r
+        {\r
+          double TMP[MyMeshType::MY_SPACEDIM];\r
+          for(int i=0;i<MyMeshType::MY_SPACEDIM;++i)\r
+            TMP[i] = bb[2*i];\r
+          bbtree.getElementsAroundPoint(TMP, intersecting_elems);\r
+        };\r
+      return this->interpolateMeshesInternal(meshS,meshT,result,method,bbtreeMethod);\r
+    }\r
+  };\r
+}\r
+\r
+#endif\r