1 // Copyright (C) 2007-2015 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, or (at your option) any later version.
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
20 #ifndef __ELEMENTLOCATOR_HXX__
21 #define __ELEMENTLOCATOR_HXX__
23 #include "InterpolationOptions.hxx"
24 #include "MEDCouplingNatureOfField.hxx"
35 class InterpolationMatrix;
36 class MEDCouplingPointSet;
39 class ElementLocator : public INTERP_KERNEL::InterpolationOptions
42 ElementLocator(const ParaFIELD& sourceField, const ProcessorGroup& distant_group, const ProcessorGroup& local_group);
44 virtual ~ElementLocator();
45 void exchangeMesh(int idistantrank,
46 MEDCouplingPointSet*& target_mesh,
48 void exchangeMethod(const std::string& sourceMeth, int idistantrank, std::string& targetMeth);
49 const std::vector<int>& getDistantProcIds() const { return _distant_proc_ids; }
50 const MPI_Comm *getCommunicator() const;
51 NatureOfField getLocalNature() const;
52 //! This method is used to informed if there is -1D mesh on distant_group side or on local_group side.
53 bool isM1DCorr() const { return _is_m1d_corr; }
54 //Working side methods
55 void recvPolicyFromLazySideW(std::vector<int>& policy);
56 void sendSumToLazySideW(const std::vector< std::vector<int> >& distantLocEltIds, const std::vector< std::vector<double> >& partialSumRelToDistantIds);
57 void recvSumFromLazySideW(std::vector< std::vector<double> >& globalSumRelToDistantIds);
58 void sendCandidatesForAddElementsW(const std::vector<int>& distantGlobIds);
59 void recvAddElementsFromLazyProcsW(std::vector<std::vector<int> >& elementsToAdd);
61 void sendLocalIdsToLazyProcsW(const std::vector< std::vector<int> >& distantLocEltIds);
62 void recvGlobalIdsFromLazyProcsW(const std::vector< std::vector<int> >& distantLocEltIds, std::vector< std::vector<int> >& globalIds);
63 void recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector<int> >& globalIds);
64 void sendPartialSumToLazyProcsW(const std::vector<int>& distantGlobIds, const std::vector<double>& sum);
66 int sendPolicyToWorkingSideL();
67 void recvFromWorkingSideL();
68 void sendToWorkingSideL();
70 void recvLocalIdsFromWorkingSideL();
71 void sendGlobalIdsToWorkingSideL();
72 void sendCandidatesGlobalIdsToWorkingSideL();
74 void recvSumFromWorkingSideL();
75 void recvCandidatesForAddElementsL();
76 void sendAddElementsToWorkingSideL();
78 void _computeBoundingBoxes();
79 bool _intersectsBoundingBox(int irank);
80 void _exchangeMesh(MEDCouplingPointSet* local_mesh, MEDCouplingPointSet*& distant_mesh,
81 int iproc_distant, const DataArrayInt* distant_ids_send,
82 int*& distant_ids_recv);
84 const ParaFIELD& _local_para_field ;
85 MEDCouplingPointSet* _local_cell_mesh;
86 int _local_cell_mesh_space_dim;
88 MEDCouplingPointSet* _local_face_mesh;
89 std::vector<MEDCouplingPointSet*> _distant_cell_meshes;
90 std::vector<MEDCouplingPointSet*> _distant_face_meshes;
91 double* _domain_bounding_boxes;
92 const ProcessorGroup& _distant_group;
93 const ProcessorGroup& _local_group;
94 ProcessorGroup* _union_group;
95 std::vector<int> _distant_proc_ids;
96 const MPI_Comm *_comm;
97 //Attributes only used by lazy side
98 std::vector<double> _values_added;
99 std::vector< std::vector<int> > _ids_per_working_proc;
100 std::vector< std::vector<int> > _ids_per_working_proc3;
101 std::vector< std::vector<double> > _values_per_working_proc;
103 static const int CUMULATIVE_POLICY=3;
104 static const int NO_POST_TREATMENT_POLICY=7;