1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
21 #ifndef __OVERLAPELEMENTLOCATOR_HXX__
22 #define __OVERLAPELEMENTLOCATOR_HXX__
24 #include "InterpolationOptions.hxx"
25 #include "MEDCouplingNatureOfField.hxx"
26 #include "MEDCouplingPointSet.hxx"
27 #include "MEDCouplingMemArray.hxx"
28 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
40 class OverlapInterpolationMatrix;
42 class OverlapElementLocator : public INTERP_KERNEL::InterpolationOptions
45 OverlapElementLocator(const ParaFIELD *sourceField, const ParaFIELD *targetField, const ProcessorGroup& group);
46 virtual ~OverlapElementLocator();
47 const MPI_Comm *getCommunicator() const;
48 void exchangeMeshes(OverlapInterpolationMatrix& matrix);
49 std::vector< std::pair<int,int> > getToDoList() const { return _to_do_list; }
50 std::vector< std::vector< int > > getProcsInInteraction() const { return _proc_pairs; }
51 std::string getSourceMethod() const;
52 std::string getTargetMethod() const;
53 const MEDCouplingPointSet *getSourceMesh(int procId) const;
54 const DataArrayInt *getSourceIds(int procId) const;
55 const MEDCouplingPointSet *getTargetMesh(int procId) const;
56 const DataArrayInt *getTargetIds(int procId) const;
58 void computeBoundingBoxes();
59 bool intersectsBoundingBox(int i, int j) const;
60 void sendLocalMeshTo(int procId, bool sourceOrTarget, OverlapInterpolationMatrix& matrix) const;
61 void receiveRemoteMesh(int procId, bool sourceOrTarget);
62 void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayInt *idsToSend) const;
63 void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayInt *&ids) const;
65 const ParaFIELD *_local_source_field;
66 const ParaFIELD *_local_target_field;
68 MEDCouplingPointSet *_local_source_mesh;
69 MEDCouplingPointSet *_local_target_mesh;
70 std::vector<MEDCouplingPointSet*> _distant_cell_meshes;
71 std::vector<MEDCouplingPointSet*> _distant_face_meshes;
72 //! of size _group.size(). Contains for each source proc i, the ids of proc j the targets interact with. This vector is common for all procs in _group.
73 std::vector< std::vector< int > > _proc_pairs;
74 //! list of interpolations couple to be done
75 std::vector< std::pair<int,int> > _to_do_list;
76 std::vector< std::pair<int,bool> > _procs_to_send;
77 std::map<std::pair<int,bool>, MEDCouplingAutoRefCountObjectPtr< MEDCouplingPointSet > > _remote_meshes;
78 std::map<std::pair<int,bool>, MEDCouplingAutoRefCountObjectPtr< DataArrayInt > > _remote_elems;
79 double* _domain_bounding_boxes;
80 const ProcessorGroup& _group;
81 std::vector<int> _distant_proc_ids;
82 const MPI_Comm *_comm;
83 //Attributes only used by lazy side
84 //std::vector<double> _values_added;
85 //std::vector< std::vector<int> > _ids_per_working_proc;
86 //std::vector< std::vector<int> > _ids_per_working_proc3;
87 //std::vector< std::vector<double> > _values_per_working_proc;