Commit 7bd01fec authored by ESTERIE Pierre's avatar ESTERIE Pierre

Cleaning GroupTaskAlgo and adding generic function to GroupTree, needed for...

Cleaning GroupTaskAlgo and adding generic function to GroupTree, needed for test driver compatibility.
parent effca65f
......@@ -138,7 +138,7 @@ int main(int argc, char* argv[]){
#else
typedef FTestKernels< GroupCellClass, GroupContainerClass > GroupKernelClass;
//typedef FGroupSeqAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm;
typedef FGroupTaskAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm;
typedef FGroupTaskAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm;
#endif
typedef FTestCell CellClass;
......
......@@ -645,7 +645,7 @@ struct RunContainer{
{
typedef FRotationKernel<FReal,GroupCellClass,GroupContainerClass,ORDER> GroupKernelClass;
//typedef FGroupSeqAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm;
typedef FGroupTaskAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupCellClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm;
typedef FGroupTaskAlgorithm<GroupOctreeClass, typename GroupOctreeClass::CellGroupClass, GroupKernelClass, typename GroupOctreeClass::ParticleGroupClass, GroupContainerClass > GroupAlgorithm;
std::cout << "Using FGroupTaskAlgorithm" << std::endl;
GroupKernelClass groupkernel(NbLevels, loader.getBoxWidth(), loader.getCenterOfBox());
GroupAlgorithm groupalgo(&groupedTree,&groupkernel);
......
......@@ -358,6 +358,15 @@ public:
blockHeader->attributeLeadingDim);
}
template<class F>
void forEachLeaf(F&& function){
using F_ = std::remove_reference_t<F>;
for(int idxLeafPtr = 0 ; idxLeafPtr < blockHeader->numberOfLeavesInBlock ; ++idxLeafPtr){
auto leaf = getLeaf<typename F_::leaf_type>(idxLeafPtr);
function(&leaf);
}
}
/** Extract methods */
......
......@@ -17,7 +17,7 @@
#include <omp.h>
template <class OctreeClass, class CellContainerClass, class CellClass, class KernelClass, class ParticleGroupClass, class ParticleContainerClass>
template <class OctreeClass, class CellContainerClass, class KernelClass, class ParticleGroupClass, class ParticleContainerClass>
class FGroupTaskAlgorithm : public FAbstractAlgorithm {
protected:
template <class OtherBlockClass>
......
......@@ -962,6 +962,18 @@ public:
block->forEachLeaf(function);
}
}
/**
* @brief forEachLeaf iterate on the leaf and apply the generic function
* @param function
*/
template<class F>
void forEachLeaf(F&& function){
for (ParticleGroupClass* block: _particleBlocks){
block->forEachLeaf(function);
}
}
/**
* @brief forEachMyLeaf iterate on the leaf and apply the function
* @param function
......
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