Mentions légales du service

Skip to content
Snippets Groups Projects
Commit e6e5ca8f authored by PIACIBELLO Cyrille's avatar PIACIBELLO Cyrille
Browse files

Add test to avoid computation if no callback is set

parent 426a85df
Branches
Tags
No related merge requests found
...@@ -200,6 +200,10 @@ public: ...@@ -200,6 +200,10 @@ public:
void * getUserKernelDatas(){ void * getUserKernelDatas(){
return userData; return userData;
} }
//Getter
Scalfmm_Kernel_Descriptor getKernelFct() const {
return kernel;
}
void M2L_Extended(CellClass * src, CellClass * tgt, const FTreeCoordinate transfer, const int level){ void M2L_Extended(CellClass * src, CellClass * tgt, const FTreeCoordinate transfer, const int level){
if(kernel.m2l_ext){ if(kernel.m2l_ext){
...@@ -456,74 +460,77 @@ public: ...@@ -456,74 +460,77 @@ public:
* *
*/ */
void internal_M2L(){ void internal_M2L(){
if(upperLimit > 1){ // if upperLimit == 1, then, M2L has been if(this->kernel->getKernelFct().m2l_ext){
// done at level 2, and hence all the far if(upperLimit > 1){ // if upperLimit == 1, then, M2L has been
// field has been calculated. // done at level 2, and hence all the far
//Starting at the lower level where the M2L has not been done. // field has been calculated.
typename OctreeClass::Iterator octreeIterator(octree); //lvl : 1 //Starting at the lower level where the M2L has not been done.
typename OctreeClass::Iterator octreeIterator(octree); //lvl : 1
while(octreeIterator.level() != upperLimit){
octreeIterator.moveDown(); while(octreeIterator.level() != upperLimit){
} octreeIterator.moveDown();
}
//I'm at the upperLimit, so the lowest level where M2L has been done. //I'm at the upperLimit, so the lowest level where M2L has been done.
do{ do{
CoreCell * currentTgt = octreeIterator.getCurrentCell(); // This one is targeted CoreCell * currentTgt = octreeIterator.getCurrentCell(); // This one is targeted
//Then, we get the interaction list at this lvl. This will provide us with lots of source cells. //Then, we get the interaction list at this lvl. This will provide us with lots of source cells.
const CoreCell * currentInteractionList[343]; const CoreCell * currentInteractionList[343];
//Get an iterator for the sources //Get an iterator for the sources
typename OctreeClass::Iterator upAndDownIterator = octreeIterator; typename OctreeClass::Iterator upAndDownIterator = octreeIterator;
{//This is supposed to be done for multiple level. You {//This is supposed to be done for multiple level. You
//need to go up until level 2. And then, to go down //need to go up until level 2. And then, to go down
//until level upperLimit. I think it's possible ... //until level upperLimit. I think it's possible ...
while(upAndDownIterator.level() >= 2){ while(upAndDownIterator.level() >= 2){
upAndDownIterator.moveUp(); upAndDownIterator.moveUp();
//There, we get the interaction list of all parents of tgt cell //There, we get the interaction list of all parents of tgt cell
const int nbInteract = octree->getInteractionNeighbors(currentInteractionList, const int nbInteract = octree->getInteractionNeighbors(currentInteractionList,
upAndDownIterator.getCurrentGlobalCoordinate(), upAndDownIterator.getCurrentGlobalCoordinate(),
upAndDownIterator.level()); upAndDownIterator.level());
int currentLevel = upAndDownIterator.level(); int currentLevel = upAndDownIterator.level();
if(nbInteract){ if(nbInteract){
//Then, we do M2L for each child at level upperLimit of each 343 Interaction cells. //Then, we do M2L for each child at level upperLimit of each 343 Interaction cells.
for(int idxSrc = 0; idxSrc < 343 ; ++idxSrc){ for(int idxSrc = 0; idxSrc < 343 ; ++idxSrc){
if(currentInteractionList[idxSrc]){//Check if it exist if(currentInteractionList[idxSrc]){//Check if it exist
const CoreCell * currentSource = currentInteractionList[idxSrc]; //For clarity, will be otpimised out, anyway const CoreCell * currentSource = currentInteractionList[idxSrc]; //For clarity, will be otpimised out, anyway
MortonIndex idx = currentSource->getMortonIndex(); MortonIndex idx = currentSource->getMortonIndex();
//At this point, we instanciate //At this point, we instanciate
//the number of child needed. //the number of child needed.
//This only depends on diffenrence //This only depends on diffenrence
//between current level and //between current level and
//upperLimit level //upperLimit level
int totalNumberOfChild = FMath::pow(8,upperLimit-currentLevel); int totalNumberOfChild = FMath::pow(8,upperLimit-currentLevel);
for(int idxChildSrc = 0; idxChildSrc < totalNumberOfChild ; ++idxChildSrc){//For all 8^{number of levels to down} children for(int idxChildSrc = 0; idxChildSrc < totalNumberOfChild ; ++idxChildSrc){//For all 8^{number of levels to down} children
MortonIndex indexOfChild = ((idx << 3*(upperLimit-currentLevel))+idxChildSrc); MortonIndex indexOfChild = ((idx << 3*(upperLimit-currentLevel))+idxChildSrc);
CoreCell * src = octree->getCell(indexOfChild,upperLimit); //Get the cell CoreCell * src = octree->getCell(indexOfChild,upperLimit); //Get the cell
if(src){//check if it exists if(src){//check if it exists
FTreeCoordinate srcCoord = src->getCoordinate(); FTreeCoordinate srcCoord = src->getCoordinate();
FTreeCoordinate tgtCoord = currentTgt->getCoordinate(); FTreeCoordinate tgtCoord = currentTgt->getCoordinate();
//Build tree coord translation vector //Build tree coord translation vector
FTreeCoordinate transfer; FTreeCoordinate transfer;
transfer.setPosition(tgtCoord.getX()-srcCoord.getX(), transfer.setPosition(tgtCoord.getX()-srcCoord.getX(),
tgtCoord.getY()-srcCoord.getY(), tgtCoord.getY()-srcCoord.getY(),
tgtCoord.getZ()-srcCoord.getZ()); tgtCoord.getZ()-srcCoord.getZ());
kernel->M2L_Extended(src,currentTgt,transfer,octreeIterator.level()); kernel->M2L_Extended(src,currentTgt,transfer,octreeIterator.level());
}
} }
} }
} }
} }
} }
} }
} }while(octreeIterator.moveRight());
}while(octreeIterator.moveRight()); }
} else{
else{ FAssertLF("No reasons to be there, seriously ...\nExiting anyway...");
FAssertLF("No reasons to be there, seriously ...\nExiting anyway..."); }
} }
} }
void execute_fmm(){ void execute_fmm(){
...@@ -570,7 +577,6 @@ public: ...@@ -570,7 +577,6 @@ public:
} }
if (FScalFMMEngine<FReal>::Algorithm != 2){ if (FScalFMMEngine<FReal>::Algorithm != 2){
if(upperLimit != 2){ if(upperLimit != 2){
printf("At least I'm here\n");
abstrct->execute(FFmmP2M | FFmmM2M | FFmmM2L, upperLimit, treeHeight); abstrct->execute(FFmmP2M | FFmmM2M | FFmmM2L, upperLimit, treeHeight);
printf("\tUpPass finished\n"); printf("\tUpPass finished\n");
internal_M2L(); internal_M2L();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment