Salome HOME
Doc: indicating how to pass MPI_Comm from mpi4py
[tools/medcoupling.git] / src / INTERP_KERNEL / Interpolation2D3D.hxx
1 // Copyright (C) 2007-2022  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef __INTERPOLATION2D3D_HXX__
21 #define __INTERPOLATION2D3D_HXX__
22
23 #include <set>
24 #include <map>
25
26 #include "INTERPKERNELDefines.hxx"
27 #include "Interpolation.hxx"
28 #include "NormalizedUnstructuredMesh.hxx"
29 #include "InterpolationOptions.hxx"
30 #include "MCIdType.hxx"
31 #include "Intersector3D.hxx"
32 #include <vector>
33
34 namespace INTERP_KERNEL
35 {
36   /*!
37    * Contrary to its name this class deals with 2D mesh in source and 3D mesh in target.
38    * The meshdim of 'MyMeshType' in input is ignored that's why 'meshS' and 'meshT'
39    * have the same type.
40    * '_duplicate_faces' attribute stores duplicated faces in the following format.
41    * The key of '_duplicate_faces' represents the 2D cellId that is shared by
42    * more than one 3D target cell, and the value of '_duplicate_faces'
43    * the 3D target cells. The size of the value of '_duplicate_faces' is more than or equal to 2.
44    */
45   class Interpolation2D3D : public Interpolation<Interpolation2D3D>
46   {
47   public:
48     typedef std::map<mcIdType,std::set<mcIdType> > DuplicateFacesType;
49
50     INTERPKERNEL_EXPORT Interpolation2D3D();
51     INTERPKERNEL_EXPORT Interpolation2D3D(const InterpolationOptions& io);
52     template<class MyMeshType, class MyMatrixType>
53     typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh,
54                           const MyMeshType& targetMesh,
55                           MyMatrixType& matrix,
56                           const std::string& method);
57     INTERPKERNEL_EXPORT DuplicateFacesType retrieveDuplicateFaces() const { return _duplicate_faces; }
58
59   protected:
60     template<class MyMeshType, class MyMatrixType>
61     void performAdjustmentOfBB(Intersector3D<MyMeshType,MyMatrixType>* intersector, double *bbox, std::size_t sz) const
62     {
63       intersector->adjustBoundingBoxes(bbox,sz,InterpolationOptions::getBoundingBoxAdjustment(),InterpolationOptions::getBoundingBoxAdjustmentAbs());
64     }
65
66   private:
67     SplittingPolicy _splitting_policy;
68     DuplicateFacesType _duplicate_faces;
69
70   };
71 }
72
73 #endif