From 856f23f0687130d405c2c101e902fc605b1af0f1 Mon Sep 17 00:00:00 2001
From: bramas <berenger.bramas@inria.fr>
Date: Tue, 4 Nov 2014 08:42:03 +0100
Subject: [PATCH] Replace list per vector

---
 Src/GroupTree/FGroupSeqAlgorithm.hpp  | 46 +++++++-------
 Src/GroupTree/FGroupTaskAlgorithm.hpp | 88 +++++++++++++--------------
 Src/GroupTree/FGroupTree.hpp          | 46 +++++++-------
 3 files changed, 90 insertions(+), 90 deletions(-)

diff --git a/Src/GroupTree/FGroupSeqAlgorithm.hpp b/Src/GroupTree/FGroupSeqAlgorithm.hpp
index 2c9aa353c..34017df71 100644
--- a/Src/GroupTree/FGroupSeqAlgorithm.hpp
+++ b/Src/GroupTree/FGroupSeqAlgorithm.hpp
@@ -8,7 +8,7 @@
 #include "../Utils/FLog.hpp"
 #include "../Utils/FTic.hpp"
 
-#include <list>
+#include <vector>
 #include <vector>
 
 template <class OctreeClass, class CellContainerClass, class CellClass, class KernelClass, class ParticleGroupClass, class ParticleContainerClass>
@@ -56,11 +56,11 @@ public:
 protected:
     void bottomPass(){
         FLOG( FTic timer; );
-        typename std::list<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
-        const typename std::list<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
+        typename std::vector<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
+        const typename std::vector<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
 
-        typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(tree->getHeight()-1);
-        const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(tree->getHeight()-1);
+        typename std::vector<CellContainerClass*>::iterator iterCells = tree->cellsBegin(tree->getHeight()-1);
+        const typename std::vector<CellContainerClass*>::iterator endCells = tree->cellsEnd(tree->getHeight()-1);
 
         while(iterParticles != endParticles && iterCells != endCells){
             { // Can be a task(in:iterParticles, out:iterCells)
@@ -89,11 +89,11 @@ protected:
     void upwardPass(){
         FLOG( FTic timer; );
         for(int idxLevel = tree->getHeight()-2 ; idxLevel >= 2 ; --idxLevel){
-            typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
-            const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
+            typename std::vector<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
+            const typename std::vector<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
 
-            typename std::list<CellContainerClass*>::iterator iterChildCells = tree->cellsBegin(idxLevel+1);
-            const typename std::list<CellContainerClass*>::iterator endChildCells = tree->cellsEnd(idxLevel+1);
+            typename std::vector<CellContainerClass*>::iterator iterChildCells = tree->cellsBegin(idxLevel+1);
+            const typename std::vector<CellContainerClass*>::iterator endChildCells = tree->cellsEnd(idxLevel+1);
 
             while(iterCells != endCells && iterChildCells != endChildCells){
                 { // Can be a task(in:iterParticles, out:iterChildCells ...)
@@ -135,8 +135,8 @@ protected:
     void transferPass(){
         FLOG( FTic timer; );
         for(int idxLevel = tree->getHeight()-1 ; idxLevel >= 2 ; --idxLevel){
-            typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
-            const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
+            typename std::vector<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
+            const typename std::vector<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
 
             while(iterCells != endCells){
                 std::vector<OutOfBlockInteraction> outsideInteractions;
@@ -186,7 +186,7 @@ protected:
                 // Manage outofblock interaction
                 FQuickSort<OutOfBlockInteraction, int>::QsSequential(outsideInteractions.data(),int(outsideInteractions.size()));
 
-                typename std::list<CellContainerClass*>::iterator iterLeftCells = tree->cellsBegin(idxLevel);
+                typename std::vector<CellContainerClass*>::iterator iterLeftCells = tree->cellsBegin(idxLevel);
                 int currentOutInteraction = 0;
                 while(iterLeftCells != iterCells && currentOutInteraction < int(outsideInteractions.size())){
                     const MortonIndex blockStartIdx = (*iterLeftCells)->getStartingIndex();
@@ -237,11 +237,11 @@ protected:
     void downardPass(){
         FLOG( FTic timer; );
         for(int idxLevel = 2 ; idxLevel <= tree->getHeight()-2 ; ++idxLevel){
-            typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
-            const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
+            typename std::vector<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
+            const typename std::vector<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
 
-            typename std::list<CellContainerClass*>::iterator iterChildCells = tree->cellsBegin(idxLevel+1);
-            const typename std::list<CellContainerClass*>::iterator endChildCells = tree->cellsEnd(idxLevel+1);
+            typename std::vector<CellContainerClass*>::iterator iterChildCells = tree->cellsBegin(idxLevel+1);
+            const typename std::vector<CellContainerClass*>::iterator endChildCells = tree->cellsEnd(idxLevel+1);
 
             while(iterCells != endCells && iterChildCells != endChildCells){
                 { // Can be a task(in:iterParticles, inout:iterChildCells ...)
@@ -281,11 +281,11 @@ protected:
     void directPass(){
         FLOG( FTic timer; );
         {
-            typename std::list<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
-            const typename std::list<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
+            typename std::vector<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
+            const typename std::vector<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
 
-            typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(tree->getHeight()-1);
-            const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(tree->getHeight()-1);
+            typename std::vector<CellContainerClass*>::iterator iterCells = tree->cellsBegin(tree->getHeight()-1);
+            const typename std::vector<CellContainerClass*>::iterator endCells = tree->cellsEnd(tree->getHeight()-1);
 
             while(iterParticles != endParticles && iterCells != endCells){
                 { // Can be a task(in:iterCells, inout:iterParticles)
@@ -309,8 +309,8 @@ protected:
             FAssertLF(iterParticles == endParticles && iterCells == endCells);
         }
         {
-            typename std::list<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
-            const typename std::list<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
+            typename std::vector<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
+            const typename std::vector<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
 
             while(iterParticles != endParticles){
                 typename std::vector<OutOfBlockInteraction> outsideInteractions;
@@ -359,7 +359,7 @@ protected:
                 // Manage outofblock interaction
                 FQuickSort<OutOfBlockInteraction, int>::QsSequential(outsideInteractions.data(),int(outsideInteractions.size()));
 
-                typename std::list<ParticleGroupClass*>::iterator iterLeftParticles = tree->leavesBegin();
+                typename std::vector<ParticleGroupClass*>::iterator iterLeftParticles = tree->leavesBegin();
                 int currentOutInteraction = 0;
                 while(iterLeftParticles != iterParticles && currentOutInteraction < int(outsideInteractions.size())){
                     const MortonIndex blockStartIdx = (*iterLeftParticles)->getStartingIndex();
diff --git a/Src/GroupTree/FGroupTaskAlgorithm.hpp b/Src/GroupTree/FGroupTaskAlgorithm.hpp
index 7d88f1a3f..0e6dfe35d 100644
--- a/Src/GroupTree/FGroupTaskAlgorithm.hpp
+++ b/Src/GroupTree/FGroupTaskAlgorithm.hpp
@@ -8,7 +8,7 @@
 #include "../Utils/FLog.hpp"
 #include "../Utils/FTic.hpp"
 
-#include <list>
+#include <vector>
 #include <vector>
 
 #include <omp.h>
@@ -32,8 +32,8 @@ protected:
         std::vector<OutOfBlockInteraction> interactions;
     };
 
-    std::vector< std::list< std::list<BlockInteractions<CellContainerClass>>>> externalInteractionsAllLevel;
-    std::list< std::list<BlockInteractions<ParticleGroupClass>>> externalInteractionsLeafLevel;
+    std::vector< std::vector< std::vector<BlockInteractions<CellContainerClass>>>> externalInteractionsAllLevel;
+    std::vector< std::vector<BlockInteractions<ParticleGroupClass>>> externalInteractionsLeafLevel;
 
     const int MaxThreads;         //< The number of threads
     OctreeClass*const tree;       //< The Tree
@@ -96,7 +96,7 @@ public:
 
 protected:
     /**
-     * This function is creating the interactions list between blocks.
+     * This function is creating the interactions vector between blocks.
      * It fills externalInteractionsAllLevel and externalInteractionsLeafLevel.
      * Warning, the omp task for now are using the class attributes!
      *
@@ -112,11 +112,11 @@ protected:
         // First leaf level
         {
             // We create one big vector per block
-            typename std::list< std::vector<OutOfBlockInteraction> > allOutsideInteractions;
+            typename std::vector< std::vector<OutOfBlockInteraction> > allOutsideInteractions;
 
             {
-                typename std::list<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
-                const typename std::list<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
+                typename std::vector<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
+                const typename std::vector<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
 
                 // We iterate on blocks
                 while(iterParticles != endParticles){
@@ -126,7 +126,7 @@ protected:
                     ParticleGroupClass* containers = (*iterParticles);
 
                     externalInteractionsLeafLevel.emplace_back();
-                    std::list<BlockInteractions<ParticleGroupClass>>* externalInteractions = &externalInteractionsLeafLevel.back();
+                    std::vector<BlockInteractions<ParticleGroupClass>>* externalInteractions = &externalInteractionsLeafLevel.back();
 
                     #pragma omp task default(none) firstprivate(containers, outsideInteractions, externalInteractions)
                     { // Can be a task(inout:iterCells, out:outsideInteractions)
@@ -159,7 +159,7 @@ protected:
                         // Sort to match external order
                         FQuickSort<OutOfBlockInteraction, int>::QsSequential((*outsideInteractions).data(),int((*outsideInteractions).size()));
 
-                        typename std::list<ParticleGroupClass*>::iterator iterLeftParticles = tree->leavesBegin();
+                        typename std::vector<ParticleGroupClass*>::iterator iterLeftParticles = tree->leavesBegin();
                         int currentOutInteraction = 0;
                         while((*iterLeftParticles) != containers && currentOutInteraction < int((*outsideInteractions).size())){
                             ParticleGroupClass* leftContainers = (*iterLeftParticles);
@@ -199,10 +199,10 @@ protected:
         FLOG( cellTimer.tic(); );
         {
             for(int idxLevel = tree->getHeight()-1 ; idxLevel >= 2 ; --idxLevel){
-                std::list<std::vector<OutOfBlockInteraction> > allOutsideInteractions;
+                std::vector<std::vector<OutOfBlockInteraction> > allOutsideInteractions;
 
-                typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
-                const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
+                typename std::vector<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
+                const typename std::vector<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
 
                 while(iterCells != endCells){
                     allOutsideInteractions.push_back(std::vector<OutOfBlockInteraction>());
@@ -211,7 +211,7 @@ protected:
                     CellContainerClass* currentCells = (*iterCells);
 
                     externalInteractionsAllLevel[idxLevel].emplace_back();
-                    std::list<BlockInteractions<CellContainerClass>>* externalInteractions = &externalInteractionsAllLevel[idxLevel].back();
+                    std::vector<BlockInteractions<CellContainerClass>>* externalInteractions = &externalInteractionsAllLevel[idxLevel].back();
 
                     #pragma omp task default(none) firstprivate(currentCells, outsideInteractions, idxLevel, externalInteractions)
                     {
@@ -245,7 +245,7 @@ protected:
                         // Manage outofblock interaction
                         FQuickSort<OutOfBlockInteraction, int>::QsSequential((*outsideInteractions).data(),int((*outsideInteractions).size()));
 
-                        typename std::list<CellContainerClass*>::iterator iterLeftCells = tree->cellsBegin(idxLevel);
+                        typename std::vector<CellContainerClass*>::iterator iterLeftCells = tree->cellsBegin(idxLevel);
                         int currentOutInteraction = 0;
                         while((*iterLeftCells) != currentCells && currentOutInteraction < int((*outsideInteractions).size())){
                             const MortonIndex blockStartIdx = (*iterLeftCells)->getStartingIndex();
@@ -291,11 +291,11 @@ protected:
 
     void bottomPass(){
         FLOG( FTic timer; );
-        typename std::list<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
-        const typename std::list<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
+        typename std::vector<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
+        const typename std::vector<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
 
-        typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(tree->getHeight()-1);
-        const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(tree->getHeight()-1);
+        typename std::vector<CellContainerClass*>::iterator iterCells = tree->cellsBegin(tree->getHeight()-1);
+        const typename std::vector<CellContainerClass*>::iterator endCells = tree->cellsEnd(tree->getHeight()-1);
 
         while(iterParticles != endParticles && iterCells != endCells){
             CellContainerClass* leafCells = (*iterCells);
@@ -330,11 +330,11 @@ protected:
     void upwardPass(){
         FLOG( FTic timer; );
         for(int idxLevel = tree->getHeight()-2 ; idxLevel >= 2 ; --idxLevel){
-            typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
-            const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
+            typename std::vector<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
+            const typename std::vector<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
 
-            typename std::list<CellContainerClass*>::iterator iterChildCells = tree->cellsBegin(idxLevel+1);
-            const typename std::list<CellContainerClass*>::iterator endChildCells = tree->cellsEnd(idxLevel+1);
+            typename std::vector<CellContainerClass*>::iterator iterChildCells = tree->cellsBegin(idxLevel+1);
+            const typename std::vector<CellContainerClass*>::iterator endChildCells = tree->cellsEnd(idxLevel+1);
 
             while(iterCells != endCells && iterChildCells != endChildCells){
                 CellContainerClass* currentCells = (*iterCells);
@@ -407,8 +407,8 @@ protected:
         for(int idxLevel = tree->getHeight()-1 ; idxLevel >= 2 ; --idxLevel){
             FLOG( timerInBlock.tic() );
             {
-                typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
-                const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
+                typename std::vector<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
+                const typename std::vector<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
 
                 while(iterCells != endCells){
                     CellContainerClass* currentCells = (*iterCells);
@@ -455,16 +455,16 @@ protected:
             FLOG( timerInBlock.tac() );
             FLOG( timerOutBlock.tic() );
             {
-                typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
-                const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
+                typename std::vector<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
+                const typename std::vector<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
 
-                typename std::list<std::list<BlockInteractions<CellContainerClass>>>::iterator externalInteractionsIter = externalInteractionsAllLevel[idxLevel].begin();
+                typename std::vector<std::vector<BlockInteractions<CellContainerClass>>>::iterator externalInteractionsIter = externalInteractionsAllLevel[idxLevel].begin();
 
                 while(iterCells != endCells){
                     CellContainerClass* currentCells = (*iterCells);
 
-                    typename std::list<BlockInteractions<CellContainerClass>>::iterator currentInteractions = (*externalInteractionsIter).begin();
-                    const typename std::list<BlockInteractions<CellContainerClass>>::iterator currentInteractionsEnd = (*externalInteractionsIter).end();
+                    typename std::vector<BlockInteractions<CellContainerClass>>::iterator currentInteractions = (*externalInteractionsIter).begin();
+                    const typename std::vector<BlockInteractions<CellContainerClass>>::iterator currentInteractionsEnd = (*externalInteractionsIter).end();
 
                     while(currentInteractions != currentInteractionsEnd){
                         CellContainerClass* cellsOther = (*currentInteractions).otherBlock;
@@ -514,11 +514,11 @@ protected:
     void downardPass(){
         FLOG( FTic timer; );
         for(int idxLevel = 2 ; idxLevel <= tree->getHeight()-2 ; ++idxLevel){
-            typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
-            const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
+            typename std::vector<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
+            const typename std::vector<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
 
-            typename std::list<CellContainerClass*>::iterator iterChildCells = tree->cellsBegin(idxLevel+1);
-            const typename std::list<CellContainerClass*>::iterator endChildCells = tree->cellsEnd(idxLevel+1);
+            typename std::vector<CellContainerClass*>::iterator iterChildCells = tree->cellsBegin(idxLevel+1);
+            const typename std::vector<CellContainerClass*>::iterator endChildCells = tree->cellsEnd(idxLevel+1);
 
             while(iterCells != endCells && iterChildCells != endChildCells){
                 CellContainerClass* currentCells = (*iterCells);
@@ -589,8 +589,8 @@ protected:
 
         FLOG( timerInBlock.tic() );
         {
-            typename std::list<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
-            const typename std::list<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
+            typename std::vector<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
+            const typename std::vector<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
 
             while(iterParticles != endParticles){
                 ParticleGroupClass* containers = (*iterParticles);
@@ -636,14 +636,14 @@ protected:
         FLOG( timerInBlock.tac() );
         FLOG( timerOutBlock.tic() );
         {
-            typename std::list<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
-            const typename std::list<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
+            typename std::vector<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
+            const typename std::vector<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
 
-            typename std::list<std::list<BlockInteractions<ParticleGroupClass>>>::iterator externalInteractionsIter = externalInteractionsLeafLevel.begin();
+            typename std::vector<std::vector<BlockInteractions<ParticleGroupClass>>>::iterator externalInteractionsIter = externalInteractionsLeafLevel.begin();
 
             while(iterParticles != endParticles){
-                typename std::list<BlockInteractions<ParticleGroupClass>>::iterator currentInteractions = (*externalInteractionsIter).begin();
-                const typename std::list<BlockInteractions<ParticleGroupClass>>::iterator currentInteractionsEnd = (*externalInteractionsIter).end();
+                typename std::vector<BlockInteractions<ParticleGroupClass>>::iterator currentInteractions = (*externalInteractionsIter).begin();
+                const typename std::vector<BlockInteractions<ParticleGroupClass>>::iterator currentInteractionsEnd = (*externalInteractionsIter).end();
 
                 ParticleGroupClass* containers = (*iterParticles);
 
@@ -691,11 +691,11 @@ protected:
     void mergePass(){
         FLOG( FTic timer; );
         {
-            typename std::list<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
-            const typename std::list<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
+            typename std::vector<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
+            const typename std::vector<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
 
-            typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(tree->getHeight()-1);
-            const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(tree->getHeight()-1);
+            typename std::vector<CellContainerClass*>::iterator iterCells = tree->cellsBegin(tree->getHeight()-1);
+            const typename std::vector<CellContainerClass*>::iterator endCells = tree->cellsEnd(tree->getHeight()-1);
 
             while(iterParticles != endParticles && iterCells != endCells){
                 CellContainerClass* leafCells = (*iterCells);
diff --git a/Src/GroupTree/FGroupTree.hpp b/Src/GroupTree/FGroupTree.hpp
index c47919dac..ffc699de3 100644
--- a/Src/GroupTree/FGroupTree.hpp
+++ b/Src/GroupTree/FGroupTree.hpp
@@ -1,6 +1,6 @@
 #ifndef FGROUPTREE_HPP
 #define FGROUPTREE_HPP
-#include <list>
+#include <vector>
 #include <functional>
 
 #include "../Utils/FAssert.hpp"
@@ -30,9 +30,9 @@ protected:
     //< max number of cells in a block
     const int nbElementsPerBlock;
     //< all the blocks of the tree
-    std::list<CellGroupClass*>* cellBlocksPerLevel;
+    std::vector<CellGroupClass*>* cellBlocksPerLevel;
     //< all the blocks of leaves
-    std::list<ParticleGroupClass*> particleBlocks;
+    std::vector<ParticleGroupClass*> particleBlocks;
 
     //< the space system center
     const FPoint boxCenter;
@@ -75,7 +75,7 @@ public:
         : treeHeight(inTreeHeight), nbElementsPerBlock(inNbElementsPerBlock), cellBlocksPerLevel(nullptr),
           boxCenter(inOctreeSrc->getBoxCenter()), boxCorner(inOctreeSrc->getBoxCenter(),-(inOctreeSrc->getBoxWidth()/2)),
           boxWidth(inOctreeSrc->getBoxWidth()), boxWidthAtLeafLevel(inOctreeSrc->getBoxWidth()/FReal(1<<(inTreeHeight-1))){
-        cellBlocksPerLevel = new std::list<CellGroupClass*>[treeHeight];
+        cellBlocksPerLevel = new std::vector<CellGroupClass*>[treeHeight];
 
         // Iterate on the tree and build
         typename OctreeClass::Iterator octreeIterator(inOctreeSrc);
@@ -194,7 +194,7 @@ public:
             boxCenter(inBoxCenter), boxCorner(inBoxCenter,-(inBoxWidth/2)), boxWidth(inBoxWidth),
             boxWidthAtLeafLevel(inBoxWidth/FReal(1<<(inTreeHeight-1))){
 
-        cellBlocksPerLevel = new std::list<CellGroupClass*>[treeHeight];
+        cellBlocksPerLevel = new std::vector<CellGroupClass*>[treeHeight];
 
         MortonIndex* currentBlockIndexes = new MortonIndex[nbElementsPerBlock];
         // First we work at leaf level
@@ -297,8 +297,8 @@ public:
 
         // For each level from heigth - 2 to 1
         for(int idxLevel = treeHeight-2; idxLevel > 0 ; --idxLevel){
-            typename std::list<CellGroupClass*>::const_iterator iterChildCells = cellBlocksPerLevel[idxLevel+1].begin();
-            const typename std::list<CellGroupClass*>::const_iterator iterChildEndCells = cellBlocksPerLevel[idxLevel+1].end();
+            typename std::vector<CellGroupClass*>::const_iterator iterChildCells = cellBlocksPerLevel[idxLevel+1].begin();
+            const typename std::vector<CellGroupClass*>::const_iterator iterChildEndCells = cellBlocksPerLevel[idxLevel+1].end();
 
             MortonIndex currentCellIndex = (*iterChildCells)->getStartingIndex();
             int sizeOfBlock = 0;
@@ -357,7 +357,7 @@ public:
     /** This function dealloc the tree by deleting each block */
     ~FGroupTree(){
         for(int idxLevel = 0 ; idxLevel < treeHeight ; ++idxLevel){
-            std::list<CellGroupClass*>& levelBlocks = cellBlocksPerLevel[idxLevel];
+            std::vector<CellGroupClass*>& levelBlocks = cellBlocksPerLevel[idxLevel];
             for (CellGroupClass* block: levelBlocks){
                 delete block;
             }
@@ -391,7 +391,7 @@ public:
    */
     void forEachCell(std::function<void(CellClass*)> function){
         for(int idxLevel = 0 ; idxLevel < treeHeight ; ++idxLevel){
-            std::list<CellGroupClass*>& levelBlocks = cellBlocksPerLevel[idxLevel];
+            std::vector<CellGroupClass*>& levelBlocks = cellBlocksPerLevel[idxLevel];
             for (CellGroupClass* block: levelBlocks){
                 block->forEachCell(function);
             }
@@ -404,7 +404,7 @@ public:
    */
     void forEachCellWithLevel(std::function<void(CellClass*,const int)> function){
         for(int idxLevel = 0 ; idxLevel < treeHeight ; ++idxLevel){
-            std::list<CellGroupClass*>& levelBlocks = cellBlocksPerLevel[idxLevel];
+            std::vector<CellGroupClass*>& levelBlocks = cellBlocksPerLevel[idxLevel];
             for (CellGroupClass* block: levelBlocks){
                 block->forEachCell(function, idxLevel);
             }
@@ -417,11 +417,11 @@ public:
    */
     template<class ParticlesAttachedClass>
     void forEachCellLeaf(std::function<void(CellClass*,ParticlesAttachedClass*)> function){
-        typename std::list<CellGroupClass*>::iterator iterCells = cellBlocksPerLevel[treeHeight-1].begin();
-        const typename std::list<CellGroupClass*>::iterator iterEndCells = cellBlocksPerLevel[treeHeight-1].end();
+        typename std::vector<CellGroupClass*>::iterator iterCells = cellBlocksPerLevel[treeHeight-1].begin();
+        const typename std::vector<CellGroupClass*>::iterator iterEndCells = cellBlocksPerLevel[treeHeight-1].end();
 
-        typename std::list<ParticleGroupClass*>::iterator iterLeaves = particleBlocks.begin();
-        const typename std::list<ParticleGroupClass*>::iterator iterEndLeaves = particleBlocks.end();
+        typename std::vector<ParticleGroupClass*>::iterator iterLeaves = particleBlocks.begin();
+        const typename std::vector<ParticleGroupClass*>::iterator iterEndLeaves = particleBlocks.end();
 
         while(iterCells != iterEndCells && iterLeaves != iterEndLeaves){
             (*iterCells)->forEachCell([&](CellClass* aCell){
@@ -447,7 +447,7 @@ public:
         std::cout << "\t Group Size = " << nbElementsPerBlock << "\n";
         std::cout << "\t Tree height = " << treeHeight << "\n";
         for(int idxLevel = 1 ; idxLevel < treeHeight ; ++idxLevel){
-            std::list<CellGroupClass*>& levelBlocks = cellBlocksPerLevel[idxLevel];
+            std::vector<CellGroupClass*>& levelBlocks = cellBlocksPerLevel[idxLevel];
             std::cout << "Level " << idxLevel << ", there are " << levelBlocks.size() << " groups.\n";
             int idxGroup = 0;
             for (const CellGroupClass* block: levelBlocks){
@@ -482,40 +482,40 @@ public:
         return treeHeight;
     }
 
-    typename std::list<CellGroupClass*>::iterator cellsBegin(const int atHeight){
+    typename std::vector<CellGroupClass*>::iterator cellsBegin(const int atHeight){
         FAssertLF(atHeight < treeHeight);
         return cellBlocksPerLevel[atHeight].begin();
     }
 
-    typename std::list<CellGroupClass*>::const_iterator cellsBegin(const int atHeight) const {
+    typename std::vector<CellGroupClass*>::const_iterator cellsBegin(const int atHeight) const {
         FAssertLF(atHeight < treeHeight);
         return cellBlocksPerLevel[atHeight].begin();
     }
 
-    typename std::list<CellGroupClass*>::iterator cellsEnd(const int atHeight){
+    typename std::vector<CellGroupClass*>::iterator cellsEnd(const int atHeight){
         FAssertLF(atHeight < treeHeight);
         return cellBlocksPerLevel[atHeight].end();
     }
 
-    typename std::list<CellGroupClass*>::const_iterator cellsEnd(const int atHeight) const {
+    typename std::vector<CellGroupClass*>::const_iterator cellsEnd(const int atHeight) const {
         FAssertLF(atHeight < treeHeight);
         return cellBlocksPerLevel[atHeight].end();
     }
 
 
-    typename std::list<ParticleGroupClass*>::iterator leavesBegin(){
+    typename std::vector<ParticleGroupClass*>::iterator leavesBegin(){
         return particleBlocks.begin();
     }
 
-    typename std::list<ParticleGroupClass*>::const_iterator leavesBegin() const {
+    typename std::vector<ParticleGroupClass*>::const_iterator leavesBegin() const {
         return particleBlocks.begin();
     }
 
-    typename std::list<ParticleGroupClass*>::iterator leavesEnd(){
+    typename std::vector<ParticleGroupClass*>::iterator leavesEnd(){
         return particleBlocks.end();
     }
 
-    typename std::list<ParticleGroupClass*>::const_iterator leavesEnd() const {
+    typename std::vector<ParticleGroupClass*>::const_iterator leavesEnd() const {
         return particleBlocks.end();
     }
 };
-- 
GitLab