X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FMEDPartitioner%2FMEDPARTITIONER_UtilsPara.cxx;h=851d3e6ab65a35d6286eb19dd9399e8592c88e13;hb=95dc805fa1b8b94ef0c8509b0a597ae7aee13903;hp=942397376a3f76c3e0f7c2e326a2cc83843caa0a;hpb=1e36a6710aab710674e20fbd89f6a9a8f238c023;p=tools%2Fmedcoupling.git diff --git a/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx b/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx index 942397376..851d3e6ab 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D +// Copyright (C) 2007-2020 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 @@ -27,6 +27,7 @@ #include "MEDCouplingFieldDouble.hxx" #include "InterpKernelException.hxx" #include "MCAuto.hxx" +#include "MEDCouplingMemArray.txx" #include "InterpKernelAutoPtr.hxx" #include @@ -36,7 +37,15 @@ #include #ifdef HAVE_MPI + #include + +#ifndef MEDCOUPLING_USE_64BIT_IDS +#define MPI_ID_TYPE MPI_INT +#else +#define MPI_ID_TYPE MPI_LONG +#endif + #endif using namespace MEDPARTITIONER; @@ -54,9 +63,9 @@ std::vector MEDPARTITIONER::SendAndReceiveVectorOfString(const std: if (rank == source) { std::string str=SerializeFromVectorOfString(vec); - int size=str.length(); + int size=(int)str.length(); MPI_Send( &size, 1, MPI_INT, target, tag, MPI_COMM_WORLD ); - MPI_Send( (void*)str.data(), str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD ); + MPI_Send( (void*)str.data(), (int)str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD ); } int recSize=0; @@ -83,7 +92,7 @@ std::vector MEDPARTITIONER::AllgathervVectorOfString(const std::vec std::string str=SerializeFromVectorOfString(vec); std::vector indexes(world_size); - int size=str.length(); + int size=(int)str.length(); MPI_Allgather(&size, 1, MPI_INT, &indexes[0], 1, MPI_INT, MPI_COMM_WORLD); @@ -92,7 +101,7 @@ std::vector MEDPARTITIONER::AllgathervVectorOfString(const std::vec for (int i=0; i MEDPARTITIONER::AllgathervVectorOfString(const std::vec void MEDPARTITIONER::SendDoubleVec(const std::vector& vec, const int target) { int tag = 111002; - int size=vec.size(); + int size=(int)vec.size(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendDoubleVec " << size << std::endl; #ifdef HAVE_MPI @@ -164,15 +173,15 @@ void MEDPARTITIONER::RecvDoubleVec(std::vector& vec, const int source) \param vec vector to be sent \param target processor id of the target */ -void MEDPARTITIONER::SendIntVec(const std::vector& vec, const int target) +void MEDPARTITIONER::SendIntVec(const std::vector& vec, const int target) { int tag = 111003; - int size=vec.size(); + int size=(int)vec.size(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendIntVec " << size << std::endl; #ifdef HAVE_MPI - MPI_Send(&size, 1, MPI_INT, target, tag, MPI_COMM_WORLD); - MPI_Send(const_cast(&vec[0]), size,MPI_INT, target, tag+100, MPI_COMM_WORLD); + MPI_Send(&size, 1, MPI_ID_TYPE, target, tag, MPI_COMM_WORLD); + MPI_Send(const_cast(&vec[0]), size,MPI_ID_TYPE, target, tag+100, MPI_COMM_WORLD); #endif } @@ -197,7 +206,7 @@ std::vector *MEDPARTITIONER::RecvIntVec(const int source) return vec; } -void MEDPARTITIONER::RecvIntVec(std::vector& vec, const int source) +void MEDPARTITIONER::RecvIntVec(std::vector& vec, const int source) { int tag = 111003; int size; @@ -207,7 +216,7 @@ void MEDPARTITIONER::RecvIntVec(std::vector& vec, const int source) if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : <-- RecvIntVec " << size << std::endl; vec.resize(size); - MPI_Recv(&vec[0], size, MPI_INT, source, tag+100, MPI_COMM_WORLD,&status); + MPI_Recv(&vec[0], size, MPI_ID_TYPE, source, tag+100, MPI_COMM_WORLD,&status); #endif } @@ -223,9 +232,9 @@ void MEDPARTITIONER::SendDataArrayInt(const MEDCoupling::DataArrayInt *da, const throw INTERP_KERNEL::Exception("Problem send DataArrayInt* NULL"); int tag = 111004; int size[3]; - size[0]=da->getNbOfElems(); - size[1]=da->getNumberOfTuples(); - size[2]=da->getNumberOfComponents(); + size[0]=(int)da->getNbOfElems(); + size[1]=(int)da->getNumberOfTuples(); + size[2]=(int)da->getNumberOfComponents(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayInt " << size[0] << std::endl; #ifdef HAVE_MPI @@ -271,9 +280,9 @@ void MEDPARTITIONER::SendDataArrayDouble(const MEDCoupling::DataArrayDouble *da, throw INTERP_KERNEL::Exception("Problem send DataArrayDouble* NULL"); int tag = 111005; int size[3]; - size[0]=da->getNbOfElems(); - size[1]=da->getNumberOfTuples(); - size[2]=da->getNumberOfComponents(); + size[0]=(int)da->getNbOfElems(); + size[1]=(int)da->getNumberOfTuples(); + size[2]=(int)da->getNumberOfComponents(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayDouble " << size[0] << std::endl; #ifdef HAVE_MPI @@ -380,7 +389,7 @@ void MEDPARTITIONER::TestVectorOfStringMpi() void MEDPARTITIONER::TestMapOfStringIntMpi() { int rank=MyGlobals::_Rank; - std::map myMap; + std::map myMap; myMap["one"]=1; myMap["two"]=22; //a bug myMap["three"]=3; @@ -389,7 +398,7 @@ void MEDPARTITIONER::TestMapOfStringIntMpi() if (rank==0) { std::vector v2=VectorizeFromMapOfStringInt(myMap); - std::map m3=DevectorizeToMapOfStringInt(v2); + std::map m3=DevectorizeToMapOfStringInt(v2); if (ReprMapOfStringInt(m3)!=ReprMapOfStringInt(myMap)) throw INTERP_KERNEL::Exception("Problem in (de)vectorize MapOfStringInt"); } @@ -399,7 +408,7 @@ void MEDPARTITIONER::TestMapOfStringIntMpi() { std::cout << "v2 is : a vector of size " << v2.size() << std::endl; std::cout << ReprVectorOfString(v2) << std::endl; - std::map m2=DevectorizeToMapOfStringInt(v2); + std::map m2=DevectorizeToMapOfStringInt(v2); std::cout << "m2 is : a map of size " << m2.size() << std::endl; std::cout << ReprMapOfStringInt(m2) << std::endl; }