Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 4ff2da85 authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

debug blocked tree and seq algorithm

parent 9debea45
No related branches found
No related tags found
No related merge requests found
...@@ -52,7 +52,7 @@ protected: ...@@ -52,7 +52,7 @@ protected:
size_t attributeOffset; size_t attributeOffset;
//< This value is for not used leaves //< This value is for not used leaves
static const MortonIndex LeafIsEmptyFlag = -1; static const int LeafIsEmptyFlag = -1;
public: public:
/** /**
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "../Core/FCoreCommon.hpp" #include "../Core/FCoreCommon.hpp"
#include "../Utils/FQuickSort.hpp" #include "../Utils/FQuickSort.hpp"
#include "../Containers/FTreeCoordinate.hpp" #include "../Containers/FTreeCoordinate.hpp"
#include "../Utils/FLog.hpp"
#include "../Utils/FTic.hpp"
#include <list> #include <list>
#include <vector> #include <vector>
...@@ -38,6 +40,8 @@ public: ...@@ -38,6 +40,8 @@ public:
} }
void execute(const unsigned operationsToProceed = FFmmNearAndFarFields){ void execute(const unsigned operationsToProceed = FFmmNearAndFarFields){
FLOG( FLog::Controller << "\tStart FGroupSeqAlgorithm\n" );
if(operationsToProceed & FFmmP2M) bottomPass(); if(operationsToProceed & FFmmP2M) bottomPass();
if(operationsToProceed & FFmmM2M) upwardPass(); if(operationsToProceed & FFmmM2M) upwardPass();
...@@ -51,6 +55,7 @@ public: ...@@ -51,6 +55,7 @@ public:
protected: protected:
void bottomPass(){ void bottomPass(){
FLOG( FTic timer; );
typename std::list<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin(); typename std::list<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
const typename std::list<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd(); const typename std::list<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
...@@ -77,9 +82,11 @@ protected: ...@@ -77,9 +82,11 @@ protected:
} }
FAssertLF(iterParticles == endParticles && iterCells == endCells); FAssertLF(iterParticles == endParticles && iterCells == endCells);
FLOG( FLog::Controller << "\t\t bottomPass in " << timer.tacAndElapsed() << "s\n" );
} }
void upwardPass(){ void upwardPass(){
FLOG( FTic timer; );
for(int idxLevel = tree->getHeight()-2 ; idxLevel >= 2 ; --idxLevel){ for(int idxLevel = tree->getHeight()-2 ; idxLevel >= 2 ; --idxLevel){
typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel); typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel); const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
...@@ -117,9 +124,11 @@ protected: ...@@ -117,9 +124,11 @@ protected:
FAssertLF(iterCells == endCells && (iterChildCells == endChildCells || (++iterChildCells) == endChildCells)); FAssertLF(iterCells == endCells && (iterChildCells == endChildCells || (++iterChildCells) == endChildCells));
} }
FLOG( FLog::Controller << "\t\t upwardPass in " << timer.tacAndElapsed() << "s\n" );
} }
void transferPass(){ void transferPass(){
FLOG( FTic timer; );
for(int idxLevel = tree->getHeight()-1 ; idxLevel >= 2 ; --idxLevel){ for(int idxLevel = tree->getHeight()-1 ; idxLevel >= 2 ; --idxLevel){
typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel); typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel); const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
...@@ -151,7 +160,7 @@ protected: ...@@ -151,7 +160,7 @@ protected:
counterExistingCell += 1; counterExistingCell += 1;
} }
} }
else if(interactionsPosition[idxInter] < 343/2){ else if(interactionsIndexes[idxInter] < mindex){
OutOfBlockInteraction property; OutOfBlockInteraction property;
property.insideIndex = mindex; property.insideIndex = mindex;
property.outIndex = interactionsIndexes[idxInter]; property.outIndex = interactionsIndexes[idxInter];
...@@ -179,7 +188,7 @@ protected: ...@@ -179,7 +188,7 @@ protected:
currentOutInteraction += 1; currentOutInteraction += 1;
} }
int lastOutInteraction = currentOutInteraction + 1; int lastOutInteraction = currentOutInteraction;
while(lastOutInteraction < int(outsideInteractions.size()) && outsideInteractions[lastOutInteraction].outIndex < blockEndIdx){ while(lastOutInteraction < int(outsideInteractions.size()) && outsideInteractions[lastOutInteraction].outIndex < blockEndIdx){
lastOutInteraction += 1; lastOutInteraction += 1;
} }
...@@ -211,9 +220,11 @@ protected: ...@@ -211,9 +220,11 @@ protected:
} }
} }
FLOG( FLog::Controller << "\t\t transferPass in " << timer.tacAndElapsed() << "s\n" );
} }
void downardPass(){ void downardPass(){
FLOG( FTic timer; );
for(int idxLevel = 2 ; idxLevel <= tree->getHeight()-2 ; ++idxLevel){ for(int idxLevel = 2 ; idxLevel <= tree->getHeight()-2 ; ++idxLevel){
typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel); typename std::list<CellContainerClass*>::iterator iterCells = tree->cellsBegin(idxLevel);
const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel); const typename std::list<CellContainerClass*>::iterator endCells = tree->cellsEnd(idxLevel);
...@@ -251,9 +262,11 @@ protected: ...@@ -251,9 +262,11 @@ protected:
FAssertLF(iterCells == endCells && (iterChildCells == endChildCells || (++iterChildCells) == endChildCells)); FAssertLF(iterCells == endCells && (iterChildCells == endChildCells || (++iterChildCells) == endChildCells));
} }
FLOG( FLog::Controller << "\t\t downardPass in " << timer.tacAndElapsed() << "s\n" );
} }
void directPass(){ void directPass(){
FLOG( FTic timer; );
{ {
typename std::list<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin(); typename std::list<ParticleGroupClass*>::iterator iterParticles = tree->leavesBegin();
const typename std::list<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd(); const typename std::list<ParticleGroupClass*>::iterator endParticles = tree->leavesEnd();
...@@ -303,7 +316,7 @@ protected: ...@@ -303,7 +316,7 @@ protected:
ParticleContainerClass interactionsObjects[27]; ParticleContainerClass interactionsObjects[27];
ParticleContainerClass* interactions[27]; ParticleContainerClass* interactions[27];
memset(interactions, 0, 27*sizeof(CellClass*)); memset(interactions, 0, 27*sizeof(ParticleContainerClass*));
int counterExistingCell = 0; int counterExistingCell = 0;
for(int idxInter = 0 ; idxInter < counter ; ++idxInter){ for(int idxInter = 0 ; idxInter < counter ; ++idxInter){
...@@ -314,7 +327,7 @@ protected: ...@@ -314,7 +327,7 @@ protected:
counterExistingCell += 1; counterExistingCell += 1;
} }
} }
else if(interactionsPosition[idxInter] < 27/2){ else if(interactionsIndexes[idxInter] < mindex){
OutOfBlockInteraction property; OutOfBlockInteraction property;
property.insideIndex = mindex; property.insideIndex = mindex;
property.outIndex = interactionsIndexes[idxInter]; property.outIndex = interactionsIndexes[idxInter];
...@@ -342,7 +355,7 @@ protected: ...@@ -342,7 +355,7 @@ protected:
currentOutInteraction += 1; currentOutInteraction += 1;
} }
int lastOutInteraction = currentOutInteraction + 1; int lastOutInteraction = currentOutInteraction;
while(lastOutInteraction < int(outsideInteractions.size()) && outsideInteractions[lastOutInteraction].outIndex < blockEndIdx){ while(lastOutInteraction < int(outsideInteractions.size()) && outsideInteractions[lastOutInteraction].outIndex < blockEndIdx){
lastOutInteraction += 1; lastOutInteraction += 1;
} }
...@@ -354,7 +367,7 @@ protected: ...@@ -354,7 +367,7 @@ protected:
ParticleContainerClass particles = (*iterParticles)->template getLeaf<ParticleContainerClass>(outsideInteractions[outInterIdx].insideIndex); ParticleContainerClass particles = (*iterParticles)->template getLeaf<ParticleContainerClass>(outsideInteractions[outInterIdx].insideIndex);
FAssertLF(particles.isAttachedToSomething()); FAssertLF(particles.isAttachedToSomething());
ParticleContainerClass* interactions[27]; ParticleContainerClass* interactions[27];
memset(interactions, 0, 27*sizeof(CellClass*)); memset(interactions, 0, 27*sizeof(ParticleContainerClass*));
interactions[outsideInteractions[outInterIdx].outPosition] = &interParticles; interactions[outsideInteractions[outInterIdx].outPosition] = &interParticles;
const int counter = 1; const int counter = 1;
kernels->P2PRemote( FTreeCoordinate(outsideInteractions[outInterIdx].insideIndex, tree->getHeight()-1), &particles, &particles , interactions, counter); kernels->P2PRemote( FTreeCoordinate(outsideInteractions[outInterIdx].insideIndex, tree->getHeight()-1), &particles, &particles , interactions, counter);
...@@ -373,6 +386,7 @@ protected: ...@@ -373,6 +386,7 @@ protected:
++iterParticles; ++iterParticles;
} }
} }
FLOG( FLog::Controller << "\t\t directPass in " << timer.tacAndElapsed() << "s\n" );
} }
int getOppositeNeighIndex(const int index) const { int getOppositeNeighIndex(const int index) const {
......
...@@ -27,13 +27,13 @@ ...@@ -27,13 +27,13 @@
#include "../../Src/GroupTree/FP2PGroupParticleContainer.hpp" #include "../../Src/GroupTree/FP2PGroupParticleContainer.hpp"
int main(int argc, char* argv[]){ int main(int argc, char* argv[]){
static const int P = 9; static const int P = 3;
typedef FRotationCell<P> CellClass; typedef FRotationCell<P> CellClass;
typedef FP2PParticleContainer<> ContainerClass; typedef FP2PParticleContainer<> ContainerClass;
typedef FSimpleLeaf< ContainerClass > LeafClass; typedef FSimpleLeaf< ContainerClass > LeafClass;
typedef FOctree< CellClass, ContainerClass , LeafClass > OctreeClass; typedef FOctree< CellClass, ContainerClass , LeafClass > OctreeClass;
typedef FGroupTree< CellClass, FP2PGroupParticleContainer<>, 4, FReal> GroupOctreeClass; typedef FGroupTree< CellClass, FP2PGroupParticleContainer<>, 5, FReal> GroupOctreeClass;
FTic counter; FTic counter;
const int NbLevels = FParameters::getValue(argc,argv,"-h", 5); const int NbLevels = FParameters::getValue(argc,argv,"-h", 5);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment