X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParaMEDMEM%2FCommInterface.hxx;h=d132d09db294a1872da2bea2aa29f582fa74127d;hb=1c9761aeac9192f62f324ad7a04430f2482bc843;hp=05aba50837604ca71928f1ff78606d96eacf7770;hpb=e0c843a1fe827a90af91ada8d2033ffb3a7dd1d8;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEM/CommInterface.hxx b/src/ParaMEDMEM/CommInterface.hxx index 05aba5083..d132d09db 100644 --- a/src/ParaMEDMEM/CommInterface.hxx +++ b/src/ParaMEDMEM/CommInterface.hxx @@ -32,8 +32,8 @@ namespace MEDCoupling class CommInterface { public: - CommInterface(){} - virtual ~CommInterface(){} + CommInterface() { } + virtual ~CommInterface() { } int worldSize() const { int size; MPI_Comm_size(MPI_COMM_WORLD, &size); @@ -81,7 +81,7 @@ namespace MEDCoupling void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) const { return MPI_Allgather(sendbuf,sendcount, sendtype, recvbuf, recvcount, recvtype, comm); } int allGatherV(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, const int recvcounts[], - const int displs[], MPI_Datatype recvtype, MPI_Comm comm) { return MPI_Allgatherv(sendbuf,sendcount,sendtype,recvbuf,recvcounts,displs,recvtype,comm); } + const int displs[], MPI_Datatype recvtype, MPI_Comm comm) const { return MPI_Allgatherv(sendbuf,sendcount,sendtype,recvbuf,recvcounts,displs,recvtype,comm); } int allToAll(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) const { return MPI_Alltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm); } @@ -94,6 +94,9 @@ namespace MEDCoupling MPI_Op op, int root, MPI_Comm comm) const { return MPI_Reduce(sendbuf, recvbuf, count, datatype, op, root, comm); } int allReduce(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) const { return MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm); } public: + void allGatherArrays(MPI_Comm comm, const DataArrayIdType *array, std::unique_ptr& result, std::unique_ptr& resultIndex) const; + void allToAllArrays(MPI_Comm comm, const std::vector< MCAuto >& arrays, std::vector< MCAuto >& arraysOut) const; + public: /*! * \a counts is expected to be an array of array length. This method returns an array of split array. @@ -124,10 +127,11 @@ namespace MEDCoupling /*! * Helper of alltoallv and allgatherv */ - static std::unique_ptr ComputeOffset(const std::unique_ptr& counts, std::size_t sizeOfCounts) + template + static std::unique_ptr ComputeOffset(const std::unique_ptr& counts, std::size_t sizeOfCounts) { - std::unique_ptr ret(new int[sizeOfCounts]); - ret[0] = 0; + std::unique_ptr ret(new T[sizeOfCounts]); + ret[0] = static_cast(0); for(std::size_t i = 1 ; i < sizeOfCounts ; ++i) { ret[i] = ret[i-1] + counts[i-1];