X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParaMEDMEM%2FOverlapElementLocator.hxx;h=780f9333e66bdf9321b60fad184d1d481c786bc7;hb=1b5fb5650409b0ad3a61da3215496f2adf2dae02;hp=566395f9a291697739c376c6cb216c80b8c173a6;hpb=6f841c1f16f8b9d0b7ba50cf000ade240b2484b2;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEM/OverlapElementLocator.hxx b/src/ParaMEDMEM/OverlapElementLocator.hxx index 566395f9a..780f9333e 100644 --- a/src/ParaMEDMEM/OverlapElementLocator.hxx +++ b/src/ParaMEDMEM/OverlapElementLocator.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D +// Copyright (C) 2007-2023 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -25,14 +25,16 @@ #include "MEDCouplingNatureOfField.hxx" #include "MEDCouplingPointSet.hxx" #include "MEDCouplingMemArray.hxx" -#include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MCAuto.hxx" #include #include #include #include -namespace ParaMEDMEM +//#define DEC_DEBUG + +namespace MEDCoupling { class ParaFIELD; class ProcessorGroup; @@ -43,28 +45,34 @@ namespace ParaMEDMEM class OverlapElementLocator : public INTERP_KERNEL::InterpolationOptions { public: - OverlapElementLocator(const ParaFIELD *sourceField, const ParaFIELD *targetField, const ProcessorGroup& group,double epsAbs); + OverlapElementLocator(const ParaFIELD *sourceField, const ParaFIELD *targetField, const ProcessorGroup& group, + double epsAbs, int workSharingAlgo); virtual ~OverlapElementLocator(); const MPI_Comm *getCommunicator() const; void exchangeMeshes(OverlapInterpolationMatrix& matrix); std::vector< std::pair > getToDoList() const { return _to_do_list; } - std::vector< int > getProcsToSendFieldData() const { return _procs_to_send_field; } + std::vector< int > getProcsToSendFieldData() const { return _procs_to_send_field; } // same set as the set of procs we sent mesh data to std::string getSourceMethod() const; std::string getTargetMethod() const; const MEDCouplingPointSet *getSourceMesh(int procId) const; - const DataArrayInt *getSourceIds(int procId) const; + const DataArrayIdType *getSourceIds(int procId) const; const MEDCouplingPointSet *getTargetMesh(int procId) const; - const DataArrayInt *getTargetIds(int procId) const; + const DataArrayIdType *getTargetIds(int procId) const; + bool isInMyTodoList(int i, int j) const; + void debugPrintWorkSharing(std::ostream & ostr) const; private: - void computeBoundingBoxesAndTodoList(); + void computeBoundingBoxesAndInteractionList(); + void computeTodoList_original(); + void computeTodoList_new(bool revertIter); + void fillProcToSend(); bool intersectsBoundingBox(int i, int j) const; void sendLocalMeshTo(int procId, bool sourceOrTarget, OverlapInterpolationMatrix& matrix) const; void receiveRemoteMeshFrom(int procId, bool sourceOrTarget); - void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayInt *idsToSend) const; - void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayInt *&ids) const; + void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayIdType *idsToSend) const; + void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayIdType *&ids) const; private: - typedef MEDCouplingAutoRefCountObjectPtr< MEDCouplingPointSet > AutoMCPointSet; - typedef MEDCouplingAutoRefCountObjectPtr< DataArrayInt > AutoDAInt; + typedef MCAuto< MEDCouplingPointSet > AutoMCPointSet; + typedef MCAuto< DataArrayIdType > AutoDAInt; typedef std::pair Proc_SrcOrTgt; // a key indicating a proc ID and whether the data is for source mesh/field or target mesh/field static const int START_TAG_MESH_XCH; @@ -77,15 +85,17 @@ namespace ParaMEDMEM MEDCouplingPointSet *_local_target_mesh; /*! 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. */ + This vector is common for all procs in _group. This is the full list of jobs to do the interp. */ std::vector< std::vector< int > > _proc_pairs; - //! list of interpolation couples to be done by this proc only. This is a simple extraction of the member _pairsToBeDonePerProc + //! todo lists per proc + std::vector< std::vector< ProcCouple > > _all_todo_lists; + //! list of interpolation couples to be done by this proc only. This is a simple extraction of the member above _all_todo_lists std::vector< ProcCouple > _to_do_list; //! list of procs the local proc will have to send mesh data to: std::vector< Proc_SrcOrTgt > _procs_to_send_mesh; - /*! list of procs the local proc will have to send field data to for the final matrix-vector computation: - * This can be different from _procs_to_send_mesh because interpolation matrix bits are computed on a potentially - * different proc than the target one. */ +// /*! list of procs the local proc will have to send field data to for the final matrix-vector computation: +// * This can be different from _procs_to_send_mesh (restricted to Source) because interpolation matrix bits are computed on a potentially +// * different proc than the target one. */ std::vector< int > _procs_to_send_field; //! Set of distant meshes std::map< Proc_SrcOrTgt, AutoMCPointSet > _remote_meshes;