Commit d50d163d authored by BRAMAS Berenger's avatar BRAMAS Berenger

had a bug in the periodic (but did not finished to debug)

parent ff7cbb6a
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
*/ */
FFmmAlgorithmPeriodic(OctreeClass* const inTree, const int inUpperLevel = 0, const int inLeafLevelSeperationCriteria = 1) FFmmAlgorithmPeriodic(OctreeClass* const inTree, const int inUpperLevel = 0, const int inLeafLevelSeperationCriteria = 1)
: tree(inTree) , kernels(nullptr), OctreeHeight(tree->getHeight()), : tree(inTree) , kernels(nullptr), OctreeHeight(tree->getHeight()),
nbLevelsAboveRoot(inUpperLevel), offsetRealTree(inUpperLevel + 3), leafLevelSeperationCriteria(inLeafLevelSeperationCriteria) { nbLevelsAboveRoot(inUpperLevel), offsetRealTree(inUpperLevel + 2), leafLevelSeperationCriteria(inLeafLevelSeperationCriteria) {
FAssertLF(tree, "tree cannot be null"); FAssertLF(tree, "tree cannot be null");
FAssertLF(-1 <= inUpperLevel, "inUpperLevel cannot be < -1"); FAssertLF(-1 <= inUpperLevel, "inUpperLevel cannot be < -1");
...@@ -90,10 +90,7 @@ public: ...@@ -90,10 +90,7 @@ public:
// we know it is 3 (-1;+1) // we know it is 3 (-1;+1)
return 3; return 3;
} }
// Else we find the repetition in one dir and double it return 6 * (1 << nbLevelsAboveRoot);
const long long int oneDirectionRepetition = (1<<(nbLevelsAboveRoot+2)); // 2^nbLevelsAboveRoot in each dim
const long long int fullRepetition = 2 * oneDirectionRepetition;
return fullRepetition;
} }
...@@ -115,7 +112,7 @@ public: ...@@ -115,7 +112,7 @@ public:
FReal extendedBoxWidth() const { FReal extendedBoxWidth() const {
// The simulation box is repeated is repeated 4 times if nbLevelsAboveRoot==-1 // The simulation box is repeated is repeated 4 times if nbLevelsAboveRoot==-1
// And then it doubles by two // And then it doubles by two
return tree->getBoxWidth() * FReal(1<<(nbLevelsAboveRoot+3)); return tree->getBoxWidth() * FReal(1<<(nbLevelsAboveRoot+2));
} }
/** This function has to be used to init the kernel with correct args /** This function has to be used to init the kernel with correct args
...@@ -456,9 +453,9 @@ protected: ...@@ -456,9 +453,9 @@ protected:
const CellClass* neighbors[343]; const CellClass* neighbors[343];
memset(neighbors, 0, sizeof(CellClass*) * 343); memset(neighbors, 0, sizeof(CellClass*) * 343);
int counter = 0; int counter = 0;
for(int idxX = -2 ; idxX <= 1 ; ++idxX){ for(int idxX = -3 ; idxX <= 2 ; ++idxX){
for(int idxY = -2 ; idxY <= 1 ; ++idxY){ for(int idxY = -3 ; idxY <= 2 ; ++idxY){
for(int idxZ = -2 ; idxZ <= 1 ; ++idxZ){ for(int idxZ = -3 ; idxZ <= 2 ; ++idxZ){
if( FMath::Abs(idxX) > 1 || FMath::Abs(idxY) > 1 || FMath::Abs(idxZ) > 1){ if( FMath::Abs(idxX) > 1 || FMath::Abs(idxY) > 1 || FMath::Abs(idxZ) > 1){
neighbors[neighIndex(idxX,idxY,idxZ)] = &upperCells[idxUpperLevel-1]; neighbors[neighIndex(idxX,idxY,idxZ)] = &upperCells[idxUpperLevel-1];
++counter; ++counter;
...@@ -492,12 +489,20 @@ protected: ...@@ -492,12 +489,20 @@ protected:
{ {
CellClass* virtualChild[8]; CellClass* virtualChild[8];
memset(virtualChild, 0, sizeof(CellClass*) * 8); memset(virtualChild, 0, sizeof(CellClass*) * 8);
for(int idxLevel = 2 ; idxLevel <= offsetRealTree-1 ; ++idxLevel){ for(int idxLevel = 2 ; idxLevel < offsetRealTree-1 ; ++idxLevel){
virtualChild[0] = &downerCells[idxLevel]; virtualChild[0] = &downerCells[idxLevel];
kernels->L2L( &downerCells[idxLevel-1], virtualChild, idxLevel); kernels->L2L( &downerCells[idxLevel-1], virtualChild, idxLevel);
} }
} }
{
CellClass* virtualChild[8];
memset(virtualChild, 0, sizeof(CellClass*) * 8);
const int idxLevel = offsetRealTree-1;
virtualChild[7] = &downerCells[idxLevel];
kernels->L2L( &downerCells[idxLevel-1], virtualChild, idxLevel);
}
// L2L from 0 to level 1 // L2L from 0 to level 1
{ {
typename OctreeClass::Iterator octreeIterator(tree); typename OctreeClass::Iterator octreeIterator(tree);
......
...@@ -143,7 +143,7 @@ public: ...@@ -143,7 +143,7 @@ public:
*/ */
FFmmAlgorithmThreadProcPeriodic(const FMpi::FComm& inComm, OctreeClass* const inTree, FFmmAlgorithmThreadProcPeriodic(const FMpi::FComm& inComm, OctreeClass* const inTree,
const int inUpperLevel = 2, const int inLeafLevelSeperationCriteria = 1) const int inUpperLevel = 2, const int inLeafLevelSeperationCriteria = 1)
: tree(inTree) , kernels(nullptr), comm(inComm), nbLevelsAboveRoot(inUpperLevel), offsetRealTree(inUpperLevel + 3), : tree(inTree) , kernels(nullptr), comm(inComm), nbLevelsAboveRoot(inUpperLevel), offsetRealTree(inUpperLevel + 2),
numberOfLeafs(0), numberOfLeafs(0),
MaxThreads(omp_get_max_threads()), nbProcess(inComm.processCount()), idProcess(inComm.processId()), MaxThreads(omp_get_max_threads()), nbProcess(inComm.processCount()), idProcess(inComm.processId()),
OctreeHeight(tree->getHeight()), OctreeHeight(tree->getHeight()),
...@@ -181,9 +181,7 @@ public: ...@@ -181,9 +181,7 @@ public:
return 3; return 3;
} }
// Else we find the repetition in one dir and double it // Else we find the repetition in one dir and double it
const long long int oneDirectionRepetition = (1<<(nbLevelsAboveRoot+2)); // 2^nbLevelsAboveRoot in each dim return 6 * (1<<(nbLevelsAboveRoot));
const long long int fullRepetition = 2 * oneDirectionRepetition;
return fullRepetition;
} }
......
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