diff --git a/Addons/CKernelApi/Src/FUserKernelDistrEngine.hpp b/Addons/CKernelApi/Src/FUserKernelDistrEngine.hpp index dba12ace23184eb84ebf61a35dea3d788b5049a0..13fe832311988c58922e18c5a665b77d279ff9df 100644 --- a/Addons/CKernelApi/Src/FUserKernelDistrEngine.hpp +++ b/Addons/CKernelApi/Src/FUserKernelDistrEngine.hpp @@ -637,6 +637,24 @@ public: }); } + void apply_on_cell(Callback_apply_on_cell function){ + double boxwidth = octreeDist->getBoxWidth(); + //apply user function reset on each user's cell + octreeDist->forEachCellWithLevel([&](CoreCell * currCell,const int currLevel){ + if(currCell->getContainer()){ + FTreeCoordinate currCoord = currCell->getCoordinate(); + int arrayCoord[3] = {currCoord.getX(),currCoord.getY(),currCoord.getZ()}; + MortonIndex currMorton = currCoord.getMortonIndex(currLevel); + double position[3]; + FPoint<FReal> boxC = this->getBoxCorner(); + position[0] = boxC.getX() + currCoord.getX()*boxwidth/double(1<<currLevel); + position[1] = boxC.getY() + currCoord.getY()*boxwidth/double(1<<currLevel); + position[2] = boxC.getZ() + currCoord.getZ()*boxwidth/double(1<<currLevel); + function(currLevel,currMorton,arrayCoord,position,currCell->getContainer(),kernel->getUserKernelDatas()); + } + }); + } + void apply_on_each_leaf(Callback_apply_on_leaf function){ if(octreeDist){ FUserKernelEngine<FReal,LeafClass>::template generic_apply_on_each_leaf<ContainerClass,CoreCellDist>(octreeDist,kernel->getUserKernelDatas(),function); diff --git a/Addons/CKernelApi/Src/FUserKernelEngine.hpp b/Addons/CKernelApi/Src/FUserKernelEngine.hpp index a4fb90b9164d67205c035fede02f1c4868edf28b..c3ad5b7bc65769e3f875a4288eb30592860e0e55 100644 --- a/Addons/CKernelApi/Src/FUserKernelEngine.hpp +++ b/Addons/CKernelApi/Src/FUserKernelEngine.hpp @@ -361,7 +361,7 @@ public: this->octree = new OctreeClass(TreeHeight,FMath::Min(3,TreeHeight-1),BoxWidth,FPoint<FReal>(BoxCenter)); } - void apply_on_cell(Callback_apply_on_cell function){ + virtual void apply_on_cell(Callback_apply_on_cell function){ double boxwidth = octree->getBoxWidth(); //apply user function reset on each user's cell octree->forEachCellWithLevel([&](CoreCell * currCell,const int currLevel){