#include "BlockTopology.hxx"
#include "MEDCouplingMemArray.hxx"
+#include "mpi.h"
+
#include <fstream>
+#include <numeric>
+#include <memory>
#include <vector>
using namespace std;
DACheckNbOfTuplesAndComp(globalNodeIds,_mesh->getNumberOfNodes(),1,"ParaUMesh::getCellIdsLyingOnNodes");
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);
+ MPI_Comm_size(comm,&size);
+ std::unique_ptr<long[]> nbOfElems(new long[size]);
+ long nbOfNodeIdsLoc(FromIdType<long>(globalNodeIds->getNumberOfTuples()));
+ MPI_Allgather(&nbOfNodeIdsLoc,1,MPI_LONG,nbOfElems.get(),size,MPI_LONG,comm);
+ long nbOfNodeIdsSum(std::accumulate(nbOfElems.get(),nbOfElems.get()+size,0L));
+ std::unique_ptr<int []> allGlobalNodeIds(new int[nbOfNodeIdsSum]);
+ MPI_Allgather(globalNodeIds->begin(),1,MPI_INT,allGlobalNodeIds.get(),size,MPI_INT,comm);
+ // compute for each proc the cell contribution among _mesh cells
+ mcIdType offset(0);
+ for(int curRk = 0 ; curRk < size ; ++curRk)
+ {
+ MCAuto<DataArrayIdType> globalNodeIdsOfCurProc(DataArrayIdType::New());
+ globalNodeIdsOfCurProc->useArray(allGlobalNodeIds.get()+offset,false,DeallocType::CPP_DEALLOC,nbOfElems[curRk],1);
+ offset += nbOfElems[curRk];
+ MCAuto<DataArrayIdType> globalNodeIdsCaptured(_node_global->buildIntersection(globalNodeIdsOfCurProc));
+ MCAuto<DataArrayIdType> localNodeIdsToLocate(_node_global->findIdForEach(globalNodeIdsCaptured->begin(),globalNodeIdsCaptured->end()));
+ MCAuto<DataArrayIdType> localCellCaptured(_mesh->getCellIdsLyingOnNodes(localNodeIdsToLocate->begin(),localNodeIdsToLocate->end(),false));
+ MCAuto<DataArrayIdType> localCellCapturedGlob(_cell_global->selectByTupleIdSafe(localCellCaptured->begin(),localCellCaptured->end()));
+
+ }
+ //
MCAuto<DataArrayIdType> local;
}