1 // Copyright (C) 2007-2019 CEA/DEN, EDF R&D
\r
3 // This library is free software; you can redistribute it and/or
\r
4 // modify it under the terms of the GNU Lesser General Public
\r
5 // License as published by the Free Software Foundation; either
\r
6 // version 2.1 of the License, or (at your option) any later version.
\r
8 // This library is distributed in the hope that it will be useful,
\r
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
11 // Lesser General Public License for more details.
\r
13 // You should have received a copy of the GNU Lesser General Public
\r
14 // License along with this library; if not, write to the Free Software
\r
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
\r
19 // Author : Anthony Geay (CEA/DEN)
\r
21 #ifndef __INTERPOLATIONCURVE_HXX__
\r
22 #define __INTERPOLATIONCURVE_HXX__
\r
24 #include "Interpolation.hxx"
\r
25 #include "InterpolationOptions.hxx"
\r
27 #include "BBTree.txx"
\r
29 #include <functional>
\r
31 namespace INTERP_KERNEL
\r
33 template<class RealCurve>
\r
34 class InterpolationCurve : public Interpolation< InterpolationCurve<RealCurve> >
\r
37 InterpolationCurve();
\r
38 InterpolationCurve(const InterpolationOptions & io);
\r
40 // Main function to interpolate
\r
41 template<class MyMeshType, class MatrixType>
\r
42 typename MyMeshType::MyConnType interpolateMeshesInternal(const MyMeshType& meshS, const MyMeshType& meshT,
\r
43 MatrixType& result, const std::string& method,
\r
44 std::function< void(const BBTree< MyMeshType::MY_SPACEDIM , typename MyMeshType::MyConnType>&, const double*, std::vector<typename MyMeshType::MyConnType>&) > bbtreeMethod);
\r
45 template<class MyMeshType, class MatrixType>
\r
46 typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT,
\r
47 MatrixType& result, const std::string& method) { return this->interpolateMeshesInternal(meshS,meshT,result,method,[](const BBTree< MyMeshType::MY_SPACEDIM ,
\r
48 typename MyMeshType::MyConnType>& bbtree, const double *bb,
\r
49 std::vector<typename MyMeshType::MyConnType>& intersecting_elems)
\r
50 { bbtree.getIntersectingElems(bb, intersecting_elems); }); }
\r
51 template<class MyMeshType, class MatrixType>
\r
52 typename MyMeshType::MyConnType interpolateMeshes0D(const MyMeshType& meshS, const MyMeshType& meshT,
\r
53 MatrixType& result, const std::string& method) { return this->interpolateMeshesInternal(meshS,meshT,result,method,[](const BBTree< MyMeshType::MY_SPACEDIM ,
\r
54 typename MyMeshType::MyConnType>& bbtree, const double *bb,
\r
55 std::vector<typename MyMeshType::MyConnType>& intersecting_elems)
\r
57 double TMP[MyMeshType::MY_SPACEDIM];
\r
58 for(int i=0;i<MyMeshType::MY_SPACEDIM;++i)
\r
60 bbtree.getElementsAroundPoint(TMP, intersecting_elems);
\r