#include "mpi.h"
#include <fstream>
+#include <sstream>
#include <numeric>
#include <memory>
#include <vector>
_cell_global.checkNotNull();
_node_global.checkNotNull();
_mesh->checkConsistencyLight();
+ if(_mesh->getNumberOfNodes() != _node_global->getNumberOfTuples())
+ throw INTERP_KERNEL::Exception("ParaUMesh constructor : mismatch between # nodes and len of global # nodes.");
+ if(_mesh->getNumberOfCells() != _cell_global->getNumberOfTuples())
+ throw INTERP_KERNEL::Exception("ParaUMesh constructor : mismatch between # cells and len of global # cells.");
}
MCAuto<DataArrayIdType> ParaUMesh::getCellIdsLyingOnNodes(DataArrayIdType *globalNodeIds, bool fullyIn) const
if(fullyIn)
throw INTERP_KERNEL::Exception("ParaUMesh::getCellIdsLyingOnNodes : not implemented yet for fullyIn == True !");
MPI_Comm comm(MPI_COMM_WORLD);
- int rk,size;
- MPI_Comm_rank(comm,&rk);
+ int size;
MPI_Comm_size(comm,&size);
std::unique_ptr<long[]> nbOfElems(new long[size]),nbOfElems2(new long[size]);
long nbOfNodeIdsLoc(FromIdType<long>(globalNodeIds->getNumberOfTuples()));
std::vector< MCAuto<DataArrayIdType> > tabs(size);
{
std::unique_ptr<int []> allGlobalNodeIds(new int[nbOfNodeIdsSum]);
- MPI_Allgather(globalNodeIds->begin(),1,MPI_INT,allGlobalNodeIds.get(),1,MPI_INT,comm);
- // compute for each proc the cell contribution among _mesh cells
+ std::unique_ptr<int[]> nbOfElemsInt( CommInterface::ToIntArray(nbOfElems,size) );
+ std::unique_ptr<int[]> offsetsIn( CommInterface::ComputeOffset(nbOfElemsInt,size) );
+ MPI_Allgatherv(globalNodeIds->begin(),globalNodeIds->getNumberOfTuples(),MPI_INT,allGlobalNodeIds.get(),nbOfElemsInt.get(),offsetsIn.get(),MPI_INT,comm);
long offset(0);
for(int curRk = 0 ; curRk < size ; ++curRk)
{