Commit 83829dee authored by PIACIBELLO Cyrille's avatar PIACIBELLO Cyrille
Browse files

Changes to tree builder, should work fine

parent 180ba06e
...@@ -50,7 +50,7 @@ public: ...@@ -50,7 +50,7 @@ public:
MortonIndex index; MortonIndex index;
ParticleClass particle; ParticleClass particle;
operator MortonIndex(){ operator MortonIndex() const {
return this->index; return this->index;
} }
}; };
...@@ -268,11 +268,12 @@ private: ...@@ -268,11 +268,12 @@ private:
} }
memcpy(&(*leavesArray)[idxPart],&workingArray[idxPart].particle,sizeof(ParticleClass)); memcpy(&(*leavesArray)[idxPart],&workingArray[idxPart].particle,sizeof(ParticleClass));
} }
*leavesSize = idxInIndices; *leavesSize = idxInIndices;
*leavesIndices = new FSize[idxInIndices]; *leavesIndices = new FSize[idxInIndices+1];
memcpy(*leavesIndices,tempIndicesArray,(*leavesSize)*sizeof(FSize)); memcpy(*leavesIndices,tempIndicesArray,(*leavesSize)*sizeof(FSize));
(*leavesIndices)[idxInIndices] = *workingSize;
//printf("leaves Indices : %lld : %lld\n",*leavesSize,*workingSize);
} }
delete [] workingArray; delete [] workingArray;
...@@ -338,13 +339,14 @@ private: ...@@ -338,13 +339,14 @@ private:
std::pair<size_t, size_t> myCurrentInter = {diffNumberOfLeavesPerProc[myRank], diffNumberOfLeavesPerProc[myRank+1]}; std::pair<size_t, size_t> myCurrentInter = {diffNumberOfLeavesPerProc[myRank], diffNumberOfLeavesPerProc[myRank+1]};
const std::vector<FEqualize::Package> packsToSend = FEqualize::GetPackToSend(myCurrentInter, allObjectives); const std::vector<FEqualize::Package> packsToSend = FEqualize::GetPackToSend(myCurrentInter, allObjectives);
for(const FEqualize::Package& pack : packsToSend){ for(const FEqualize::Package& pack : packsToSend){
printf("%d] to %d from %llu to %llu\n", myRank, pack.idProc, pack.elementFrom, pack.elementTo); if(pack.idProc != myRank){
idxToSend[pack.idProc] = pack.elementFrom; //printf("%d] to %d from %llu to %llu, will be %lld myNbLeaf : %lu\n", myRank, pack.idProc, pack.elementFrom, pack.elementTo,leavesIndices[pack.elementTo] - leavesIndices[pack.elementFrom],nbLeavesInIntervals);
toSend[pack.idProc] = (pack.elementTo ? leavesIndices[pack.elementTo-1] : 0) idxToSend[pack.idProc] = pack.elementFrom;
- (pack.elementFrom ? leavesIndices[pack.elementFrom-1] : 0); toSend[pack.idProc] = leavesIndices[pack.elementTo] - leavesIndices[pack.elementFrom];
} }
}
//Then, we exchange the datas to send //Then, we exchange the datas to send
FSize * globalSendRecvMap = new FSize[nbProcs*nbProcs]; FSize * globalSendRecvMap = new FSize[nbProcs*nbProcs];
...@@ -366,7 +368,7 @@ private: ...@@ -366,7 +368,7 @@ private:
finalCurrentParts -= toSend[idxProc]; //substract the parts sent finalCurrentParts -= toSend[idxProc]; //substract the parts sent
finalTotParts -= toSend[idxProc]; //substract the parts sent finalTotParts -= toSend[idxProc]; //substract the parts sent
finalTotParts += globalSendRecvMap[idxProc*nbProcs+myRank]; //add the parts received finalTotParts += globalSendRecvMap[idxProc*nbProcs+myRank]; //add the parts received
} }
finalPartBuffer = new ParticleClass[finalTotParts]; finalPartBuffer = new ParticleClass[finalTotParts];
memset(finalPartBuffer,0,sizeof(ParticleClass)*finalTotParts); memset(finalPartBuffer,0,sizeof(ParticleClass)*finalTotParts);
......
Supports Markdown
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