From 4e9ef4c8ecbfdd5f94c4bc8de7b138e1cebb95d6 Mon Sep 17 00:00:00 2001 From: piacibel <cyrille.piacibello@inria.fr> Date: Wed, 19 Nov 2014 11:23:20 +0100 Subject: [PATCH] fix on octree arranger --- Src/Arranger/FOctreeArranger.hpp | 11 ++++++++--- Src/Arranger/FOctreeArrangerProc.hpp | 17 +++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Src/Arranger/FOctreeArranger.hpp b/Src/Arranger/FOctreeArranger.hpp index f3e3bb3e0..b84833875 100755 --- a/Src/Arranger/FOctreeArranger.hpp +++ b/Src/Arranger/FOctreeArranger.hpp @@ -64,10 +64,11 @@ public: do{ const MortonIndex currentIndex = octreeIterator.getCurrentGlobalIndex(); 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], - particles->getPositions()[1][idxPart], - particles->getPositions()[2][idxPart] ); + particles->getPositions()[1][idxPart], + particles->getPositions()[2][idxPart] ); // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX if( TestPeriodicCondition(isPeriodic, DirPlusX) ){ while(partPos.getX() >= max.getX()){ @@ -133,6 +134,10 @@ public: const MortonIndex particuleIndex = tree->getMortonFromPosition(partPos); if(particuleIndex != currentIndex){ tomove.push(ConverterClass::GetParticleAndRemove(particles,idxPart)); + //No need to increment idxPart, since the array has been staggered + } + else{ + idxPart++; } } } while(octreeIterator.moveRight()); diff --git a/Src/Arranger/FOctreeArrangerProc.hpp b/Src/Arranger/FOctreeArrangerProc.hpp index 224728cae..499bdb3c6 100755 --- a/Src/Arranger/FOctreeArrangerProc.hpp +++ b/Src/Arranger/FOctreeArrangerProc.hpp @@ -4,13 +4,13 @@ // 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 -// 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, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public and CeCILL-C Licenses for more details. -// "http://www.cecill.info". +// "http://www.cecill.info". // "http://www.gnu.org/licenses". // =================================================================================== #ifndef FOCTREEARRANGERPROC_HPP @@ -114,7 +114,8 @@ public: do{ const MortonIndex currentIndex = octreeIterator.getCurrentGlobalIndex(); 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], particles->getPositions()[1][idxPart], particles->getPositions()[2][idxPart] ); @@ -187,6 +188,10 @@ public: const int procConcerned = getInterval( particuleIndex, comm.processCount(), intervals); toMove[procConcerned].push(ConverterClass::GetParticleAndRemove(particles,idxPart)); indexesToExtract.push(idxPart); + //No need to increment idxPart, since the array has been staggered + } + else{ + idxPart++; } } @@ -271,7 +276,7 @@ public: } hasToRecvFrom -= 1; } - } + } } int counterLeavesAlive = 0; @@ -290,7 +295,7 @@ public: // Not empty, just continue else { workOnNext = octreeIterator.moveRight(); - counterLeavesAlive += 1; + counterLeavesAlive += 1; } } while( workOnNext ); } -- GitLab