X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParaMEDMEM%2FElementLocator.hxx;h=98e07ec250d3ef92d0dadbb963709be7ffe20bad;hb=3c8fc15dbf44acc69bebbe1a972edead852a1040;hp=eb05f12d95d947833d0cf91824d3944dd7175379;hpb=48782c06022ca2caa36f849cb5a29ea4fe2aaa83;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEM/ElementLocator.hxx b/src/ParaMEDMEM/ElementLocator.hxx index eb05f12d9..98e07ec25 100644 --- a/src/ParaMEDMEM/ElementLocator.hxx +++ b/src/ParaMEDMEM/ElementLocator.hxx @@ -1,67 +1,107 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef __ELEMENTLOCATOR_HXX__ #define __ELEMENTLOCATOR_HXX__ #include "InterpolationOptions.hxx" -#include "MEDCouplingUMesh.hxx" +#include "MEDCouplingNatureOfField.hxx" +#include #include #include namespace ParaMEDMEM { - class ParaMESH; + class ParaFIELD; class ProcessorGroup; class ParaSUPPORT; class InterpolationMatrix; - + class MEDCouplingPointSet; + class DataArrayInt; class ElementLocator : public INTERP_KERNEL::InterpolationOptions { public: - ElementLocator(const ParaMESH& sourceMesh, const ProcessorGroup& distant_group); + ElementLocator(const ParaFIELD& sourceField, const ProcessorGroup& distant_group, const ProcessorGroup& local_group); virtual ~ElementLocator(); void exchangeMesh(int idistantrank, - MEDCouplingUMesh*& target_mesh, + MEDCouplingPointSet*& target_mesh, int*& distant_ids); void exchangeMethod(const std::string& sourceMeth, int idistantrank, std::string& targetMeth); + const std::vector& getDistantProcIds() const { return _distant_proc_ids; } + const MPI_Comm *getCommunicator() const; + NatureOfField getLocalNature() const; + //! This method is used to informed if there is -1D mesh on distant_group side or on local_group side. + bool isM1DCorr() const { return _is_m1d_corr; } + //Working side methods + void recvPolicyFromLazySideW(std::vector& policy); + void sendSumToLazySideW(const std::vector< std::vector >& distantLocEltIds, const std::vector< std::vector >& partialSumRelToDistantIds); + void recvSumFromLazySideW(std::vector< std::vector >& globalSumRelToDistantIds); + void sendCandidatesForAddElementsW(const std::vector& distantGlobIds); + void recvAddElementsFromLazyProcsW(std::vector >& elementsToAdd); + // + void sendLocalIdsToLazyProcsW(const std::vector< std::vector >& distantLocEltIds); + void recvGlobalIdsFromLazyProcsW(const std::vector< std::vector >& distantLocEltIds, std::vector< std::vector >& globalIds); + void recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector >& globalIds); + void sendPartialSumToLazyProcsW(const std::vector& distantGlobIds, const std::vector& sum); + //Lazy side methods + int sendPolicyToWorkingSideL(); + void recvFromWorkingSideL(); + void sendToWorkingSideL(); + // + void recvLocalIdsFromWorkingSideL(); + void sendGlobalIdsToWorkingSideL(); + void sendCandidatesGlobalIdsToWorkingSideL(); + // + void recvSumFromWorkingSideL(); + void recvCandidatesForAddElementsL(); + void sendAddElementsToWorkingSideL(); + private: + void _computeBoundingBoxes(); + bool _intersectsBoundingBox(int irank); + void _exchangeMesh(MEDCouplingPointSet* local_mesh, MEDCouplingPointSet*& distant_mesh, + int iproc_distant, const DataArrayInt* distant_ids_send, + int*& distant_ids_recv); private: - const ParaMESH& _local_para_mesh ; - MEDCouplingUMesh* _local_cell_mesh; - MEDCouplingUMesh* _local_face_mesh; - std::vector _distant_cell_meshes; - std::vector _distant_face_meshes; + const ParaFIELD& _local_para_field ; + MEDCouplingPointSet* _local_cell_mesh; + int _local_cell_mesh_space_dim; + bool _is_m1d_corr; + MEDCouplingPointSet* _local_face_mesh; + std::vector _distant_cell_meshes; + std::vector _distant_face_meshes; double* _domain_bounding_boxes; const ProcessorGroup& _distant_group; const ProcessorGroup& _local_group; ProcessorGroup* _union_group; std::vector _distant_proc_ids; - - void _computeBoundingBoxes(); - bool _intersectsBoundingBox(int irank); - bool _intersectsBoundingBox(double* bb1, double* bb2, int dim); - void _exchangeMesh(MEDCouplingUMesh* local_mesh, MEDCouplingUMesh*& distant_mesh, - int iproc_distant, const int* distant_ids_send, - int*& distant_ids_recv); - MEDCouplingUMesh* _meshFromElems(std::set& elems); + const MPI_Comm *_comm; + //Attributes only used by lazy side + std::vector _values_added; + std::vector< std::vector > _ids_per_working_proc; + std::vector< std::vector > _ids_per_working_proc3; + std::vector< std::vector > _values_per_working_proc; + public: + static const int CUMULATIVE_POLICY=3; + static const int NO_POST_TREATMENT_POLICY=7; }; }