Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __ELEMENTLOCATOR_HXX__
00021 #define __ELEMENTLOCATOR_HXX__
00022
00023 #include "InterpolationOptions.hxx"
00024 #include "MEDCouplingNatureOfField.hxx"
00025
00026 #include <mpi.h>
00027 #include <vector>
00028 #include <set>
00029
00030 namespace ParaMEDMEM
00031 {
00032 class ParaFIELD;
00033 class ProcessorGroup;
00034 class ParaSUPPORT;
00035 class InterpolationMatrix;
00036 class MEDCouplingPointSet;
00037 class DataArrayInt;
00038
00039 class ElementLocator : public INTERP_KERNEL::InterpolationOptions
00040 {
00041 public:
00042 ElementLocator(const ParaFIELD& sourceField, const ProcessorGroup& distant_group, const ProcessorGroup& local_group);
00043
00044 virtual ~ElementLocator();
00045 void exchangeMesh(int idistantrank,
00046 MEDCouplingPointSet*& target_mesh,
00047 int*& distant_ids);
00048 void exchangeMethod(const std::string& sourceMeth, int idistantrank, std::string& targetMeth);
00049 const std::vector<int>& getDistantProcIds() const { return _distant_proc_ids; }
00050 const MPI_Comm *getCommunicator() const;
00051 NatureOfField getLocalNature() const;
00053 bool isM1DCorr() const { return _is_m1d_corr; }
00054
00055 void recvPolicyFromLazySideW(std::vector<int>& policy);
00056 void sendSumToLazySideW(const std::vector< std::vector<int> >& distantLocEltIds, const std::vector< std::vector<double> >& partialSumRelToDistantIds);
00057 void recvSumFromLazySideW(std::vector< std::vector<double> >& globalSumRelToDistantIds);
00058 void sendCandidatesForAddElementsW(const std::vector<int>& distantGlobIds);
00059 void recvAddElementsFromLazyProcsW(std::vector<std::vector<int> >& elementsToAdd);
00060
00061 void sendLocalIdsToLazyProcsW(const std::vector< std::vector<int> >& distantLocEltIds);
00062 void recvGlobalIdsFromLazyProcsW(const std::vector< std::vector<int> >& distantLocEltIds, std::vector< std::vector<int> >& globalIds);
00063 void recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector<int> >& globalIds);
00064 void sendPartialSumToLazyProcsW(const std::vector<int>& distantGlobIds, const std::vector<double>& sum);
00065
00066 int sendPolicyToWorkingSideL();
00067 void recvFromWorkingSideL();
00068 void sendToWorkingSideL();
00069
00070 void recvLocalIdsFromWorkingSideL();
00071 void sendGlobalIdsToWorkingSideL();
00072 void sendCandidatesGlobalIdsToWorkingSideL();
00073
00074 void recvSumFromWorkingSideL();
00075 void recvCandidatesForAddElementsL();
00076 void sendAddElementsToWorkingSideL();
00077 private:
00078 void _computeBoundingBoxes();
00079 bool _intersectsBoundingBox(int irank);
00080 void _exchangeMesh(MEDCouplingPointSet* local_mesh, MEDCouplingPointSet*& distant_mesh,
00081 int iproc_distant, const DataArrayInt* distant_ids_send,
00082 int*& distant_ids_recv);
00083 private:
00084 const ParaFIELD& _local_para_field ;
00085 MEDCouplingPointSet* _local_cell_mesh;
00086 int _local_cell_mesh_space_dim;
00087 bool _is_m1d_corr;
00088 MEDCouplingPointSet* _local_face_mesh;
00089 std::vector<MEDCouplingPointSet*> _distant_cell_meshes;
00090 std::vector<MEDCouplingPointSet*> _distant_face_meshes;
00091 double* _domain_bounding_boxes;
00092 const ProcessorGroup& _distant_group;
00093 const ProcessorGroup& _local_group;
00094 ProcessorGroup* _union_group;
00095 std::vector<int> _distant_proc_ids;
00096 const MPI_Comm *_comm;
00097
00098 std::vector<double> _values_added;
00099 std::vector< std::vector<int> > _ids_per_working_proc;
00100 std::vector< std::vector<int> > _ids_per_working_proc3;
00101 std::vector< std::vector<double> > _values_per_working_proc;
00102 public:
00103 static const int CUMULATIVE_POLICY=3;
00104 static const int NO_POST_TREATMENT_POLICY=7;
00105 };
00106
00107 }
00108
00109 #endif