Commit c5cc6b92 authored by PIACIBELLO Cyrille's avatar PIACIBELLO Cyrille
Browse files

FMpiTreeBuilder has been modified in order to work with a call from >>mpirun -np 1 ...

parent 3edeb822
......@@ -149,7 +149,10 @@ private:
FTRACE( FTrace::FFunction functionTrace(__FUNCTION__, "Loader to Tree" , __FILE__ , __LINE__) );
const int rank = communicator.processId();
const int nbProcs = communicator.processCount();
if(nbProcs == 1){
//Nothing to do there : there is no need to verify if leaves are split, if there is one process...
}
else{
// be sure there is no splited leaves
// to do that we exchange the first index with the left proc
{
......@@ -235,7 +238,7 @@ private:
sendBuffer = 0;
}
}
}
{
FTRACE( FTrace::FRegion regionTrace("Remove Splited leaves", __FUNCTION__ , __FILE__ , __LINE__) );
// We now copy the data from a sorted type into real particles array + counter
......@@ -275,6 +278,7 @@ private:
}
}
//////////////////////////////////////////////////////////////////////////
// To equalize (same number of leaves among the procs)
//////////////////////////////////////////////////////////////////////////
......@@ -289,6 +293,24 @@ private:
const int myRank = communicator.processId();
const int nbProcs = communicator.processCount();
const FSize myNumberOfLeaves = nbLeavesInIntervals;
//Test if -np 1
if(nbProcs == 1){
//there is no need to equalize tree between if there is one process
//Saving directly the particles
int counter = 0;
FSize idxInLeafArray = 0;
for(FSize idxLeaf = 0 ; idxLeaf < nbLeavesInIntervals ; idxLeaf++){
counter++;
int nbPartInLeaf = *(reinterpret_cast<int*>(&leavesArray[idxInLeafArray]));
idxInLeafArray += sizeof(int);
for(FSize idxPartInLeaf = 0 ; idxPartInLeaf<nbPartInLeaf ; idxPartInLeaf++){
particlesSaver->push(*(reinterpret_cast<ParticleClass*>(&leavesArray[idxInLeafArray+idxPartInLeaf*sizeof(ParticleClass)])));
}
idxInLeafArray += sizeof(ParticleClass)*nbPartInLeaf;
}
printf("nbLeavesInIntervals %d \n",nbLeavesInIntervals);
}
else{
// We have to know the number of leaves each procs holds
int*const numberOfLeavesPerProc = new int[nbProcs];
......@@ -516,6 +538,7 @@ private:
delete[] requests;
delete[] recvBlockInfo;
}
}
public:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment