X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParaMEDMEM%2FCommInterface.cxx;h=f6f33020503f7535c188dcc941c043a2ecbac031;hb=b307fa3ee9c6d9e08082e2ccc832b28a17fd6d2c;hp=948f099d88a77ce5254c3d40825da44f4f66ff8d;hpb=7f3a9dc9613422e5f56bd258d6ef6f1e5865c5e7;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEM/CommInterface.cxx b/src/ParaMEDMEM/CommInterface.cxx index 948f099d8..f6f330205 100644 --- a/src/ParaMEDMEM/CommInterface.cxx +++ b/src/ParaMEDMEM/CommInterface.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D +// Copyright (C) 2007-2021 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 @@ -19,48 +19,55 @@ #include "CommInterface.hxx" -namespace ParaMEDMEM +namespace MEDCoupling { - /*! \anchor CommInterface-det - \class CommInterface + MPI_Datatype ParaTraits::MPIDataType = MPI_DOUBLE; - The class \a CommInterface is the gateway to the MPI library. + MPI_Datatype ParaTraits::MPIDataType = MPI_INT; - It is a helper class that gathers the calls to the MPI - library that are made in the %ParaMEDMEM library. This gathering - allows easier gathering of information about the communication - in the library. + MPI_Datatype ParaTraits::MPIDataType = MPI_LONG; - It is typically called after the MPI_Init() call in a program. It is afterwards passed as a parameter to the constructors of %ParaMEDMEM objects so that they access the MPI library via the CommInterface. - - As an example, the following code excerpt initializes a processor group made of the zero processor. - - \verbatim - #include "CommInterface.hxx" - #include "ProcessorGroup.hxx" + void CommInterface::gatherArrays(MPI_Comm comm, int root, const DataArrayIdType *array, std::vector< MCAuto >& arraysOut) const + { + this->gatherArraysT2(comm,root,array,arraysOut); + } - int main(int argc, char** argv) - { - //initialization - MPI_Init(&argc, &argv); - ParaMEDMEM::CommInterface comm_interface; + /*! + * Generalized AllGather collective communication. + * This method send input \a array to all procs. + */ + void CommInterface::allGatherArrays(MPI_Comm comm, const DataArrayIdType *array, std::vector< MCAuto >& arraysOut) const + { + this->allGatherArraysT2(comm,array,arraysOut); + } - //setting up a processor group with proc 0 - set procs; - procs.insert(0); - ParaMEDMEM::ProcessorGroup group(procs, comm_interface); + /*! + * Generalized AllGather collective communication. + * This method send input \a array to all procs. + */ + int CommInterface::allGatherArrays(MPI_Comm comm, const DataArrayIdType *array, std::unique_ptr& result, std::unique_ptr& resultIndex) const + { + return this->allGatherArraysT(comm,array,result,resultIndex); + } - //cleanup - MPI_Finalize(); - } - \endverbatim - */ + void CommInterface::allToAllArrays(MPI_Comm comm, const std::vector< MCAuto >& arrays, std::vector< MCAuto >& arraysOut) const + { + this->allToAllArraysT(comm,arrays,arraysOut); + } - CommInterface::CommInterface() + void CommInterface::allToAllArrays(MPI_Comm comm, const std::vector< MCAuto >& arrays, MCAuto& arraysOut) const { + std::unique_ptr notUsed1; + mcIdType notUsed2; + this->allToAllArraysT2(comm,arrays,arraysOut,notUsed1,notUsed2); } - CommInterface::~CommInterface() + /*! + * Generalized AllToAll collective communication. + */ + void CommInterface::allToAllArrays(MPI_Comm comm, const std::vector< MCAuto >& arrays, std::vector< MCAuto >& arraysOut) const { + this->allToAllArraysT(comm,arrays,arraysOut); } + }