Commit 4e9ef4c8 authored by PIACIBELLO Cyrille's avatar PIACIBELLO Cyrille

fix on octree arranger

parent 7635caed
...@@ -64,10 +64,11 @@ public: ...@@ -64,10 +64,11 @@ public:
do{ do{
const MortonIndex currentIndex = octreeIterator.getCurrentGlobalIndex(); const MortonIndex currentIndex = octreeIterator.getCurrentGlobalIndex();
ContainerClass* particles = octreeIterator.getCurrentLeaf()->getSrc(); ContainerClass* particles = octreeIterator.getCurrentLeaf()->getSrc();
for(int idxPart = 0 ; idxPart < particles->getNbParticles(); ++idxPart){ //IdxPart is incremented at the end of the loop
for(int idxPart = 0 ; idxPart < particles->getNbParticles(); /*++idxPart*/){
FPoint partPos( particles->getPositions()[0][idxPart], FPoint partPos( particles->getPositions()[0][idxPart],
particles->getPositions()[1][idxPart], particles->getPositions()[1][idxPart],
particles->getPositions()[2][idxPart] ); particles->getPositions()[2][idxPart] );
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
if( TestPeriodicCondition(isPeriodic, DirPlusX) ){ if( TestPeriodicCondition(isPeriodic, DirPlusX) ){
while(partPos.getX() >= max.getX()){ while(partPos.getX() >= max.getX()){
...@@ -133,6 +134,10 @@ public: ...@@ -133,6 +134,10 @@ public:
const MortonIndex particuleIndex = tree->getMortonFromPosition(partPos); const MortonIndex particuleIndex = tree->getMortonFromPosition(partPos);
if(particuleIndex != currentIndex){ if(particuleIndex != currentIndex){
tomove.push(ConverterClass::GetParticleAndRemove(particles,idxPart)); tomove.push(ConverterClass::GetParticleAndRemove(particles,idxPart));
//No need to increment idxPart, since the array has been staggered
}
else{
idxPart++;
} }
} }
} while(octreeIterator.moveRight()); } while(octreeIterator.moveRight());
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
// This software is a computer program whose purpose is to compute the FMM. // This software is a computer program whose purpose is to compute the FMM.
// //
// This software is governed by the CeCILL-C and LGPL licenses and // This software is governed by the CeCILL-C and LGPL licenses and
// abiding by the rules of distribution of free software. // abiding by the rules of distribution of free software.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public and CeCILL-C Licenses for more details. // GNU General Public and CeCILL-C Licenses for more details.
// "http://www.cecill.info". // "http://www.cecill.info".
// "http://www.gnu.org/licenses". // "http://www.gnu.org/licenses".
// =================================================================================== // ===================================================================================
#ifndef FOCTREEARRANGERPROC_HPP #ifndef FOCTREEARRANGERPROC_HPP
...@@ -114,7 +114,8 @@ public: ...@@ -114,7 +114,8 @@ public:
do{ do{
const MortonIndex currentIndex = octreeIterator.getCurrentGlobalIndex(); const MortonIndex currentIndex = octreeIterator.getCurrentGlobalIndex();
ContainerClass* particles = octreeIterator.getCurrentLeaf()->getSrc(); ContainerClass* particles = octreeIterator.getCurrentLeaf()->getSrc();
for(int idxPart = 0 ; idxPart < particles->getNbParticles(); ++idxPart){ //IdxPart is incremented at the end of the loop
for(int idxPart = 0 ; idxPart < particles->getNbParticles(); /*++idxPart*/){
FPoint partPos( particles->getPositions()[0][idxPart], FPoint partPos( particles->getPositions()[0][idxPart],
particles->getPositions()[1][idxPart], particles->getPositions()[1][idxPart],
particles->getPositions()[2][idxPart] ); particles->getPositions()[2][idxPart] );
...@@ -187,6 +188,10 @@ public: ...@@ -187,6 +188,10 @@ public:
const int procConcerned = getInterval( particuleIndex, comm.processCount(), intervals); const int procConcerned = getInterval( particuleIndex, comm.processCount(), intervals);
toMove[procConcerned].push(ConverterClass::GetParticleAndRemove(particles,idxPart)); toMove[procConcerned].push(ConverterClass::GetParticleAndRemove(particles,idxPart));
indexesToExtract.push(idxPart); indexesToExtract.push(idxPart);
//No need to increment idxPart, since the array has been staggered
}
else{
idxPart++;
} }
} }
...@@ -271,7 +276,7 @@ public: ...@@ -271,7 +276,7 @@ public:
} }
hasToRecvFrom -= 1; hasToRecvFrom -= 1;
} }
} }
} }
int counterLeavesAlive = 0; int counterLeavesAlive = 0;
...@@ -290,7 +295,7 @@ public: ...@@ -290,7 +295,7 @@ public:
// Not empty, just continue // Not empty, just continue
else { else {
workOnNext = octreeIterator.moveRight(); workOnNext = octreeIterator.moveRight();
counterLeavesAlive += 1; counterLeavesAlive += 1;
} }
} while( workOnNext ); } while( workOnNext );
} }
......
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