]> SALOME platform Git repositories - modules/med.git/blob - src/ParaMEDMEM/ElementLocator.hxx
Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / src / ParaMEDMEM / ElementLocator.hxx
1 //  Copyright (C) 2007-2008  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.
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 #ifndef __ELEMENTLOCATOR_HXX__
20 #define __ELEMENTLOCATOR_HXX__
21
22 #include "InterpolationOptions.hxx"
23 #include "MEDCouplingUMesh.hxx"
24
25 #include <vector>
26 #include <set>
27
28 namespace ParaMEDMEM
29 {
30   class ParaMESH;
31   class ProcessorGroup;
32   class ParaSUPPORT;
33   class InterpolationMatrix;
34
35
36   class ElementLocator : public INTERP_KERNEL::InterpolationOptions
37   {
38   public:
39     ElementLocator(const ParaMESH& sourceMesh, const ProcessorGroup& distant_group);
40
41     virtual ~ElementLocator();
42     void exchangeMesh(int idistantrank,
43                       MEDCouplingUMesh*& target_mesh,
44                       int*& distant_ids);
45     void exchangeMethod(const std::string& sourceMeth, int idistantrank, std::string& targetMeth);
46   private:
47     const ParaMESH&  _local_para_mesh ;
48     MEDCouplingUMesh* _local_cell_mesh;
49     MEDCouplingUMesh* _local_face_mesh;
50     std::vector<MEDCouplingUMesh*> _distant_cell_meshes;
51     std::vector<MEDCouplingUMesh*> _distant_face_meshes;
52     double* _domain_bounding_boxes;
53     const ProcessorGroup& _distant_group;
54     const ProcessorGroup& _local_group;
55     ProcessorGroup* _union_group;
56     std::vector<int> _distant_proc_ids;
57   
58     void _computeBoundingBoxes();
59     bool _intersectsBoundingBox(int irank);
60     bool _intersectsBoundingBox(double* bb1, double* bb2, int dim);
61     void _exchangeMesh(MEDCouplingUMesh* local_mesh, MEDCouplingUMesh*& distant_mesh,
62                        int iproc_distant, const int* distant_ids_send,
63                        int*& distant_ids_recv);
64     MEDCouplingUMesh* _meshFromElems(std::set<int>& elems);
65   };
66
67 }
68
69 #endif