From 0dde3826e22fb7783b0451f9dc96b3e94e187c4d Mon Sep 17 00:00:00 2001 From: piacibel <cyrille.piacibello@inria.fr> Date: Mon, 21 Mar 2016 14:54:35 +0100 Subject: [PATCH] Changes in API, new call back for M2M and L2L where we provide the array of cells instead of calling the M2M over each child --- Addons/CKernelApi/Src/CScalfmmApi.h | 20 ++++++++++++ Addons/CKernelApi/Src/FUserKernelEngine.hpp | 35 +++++++++++++++------ 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/Addons/CKernelApi/Src/CScalfmmApi.h b/Addons/CKernelApi/Src/CScalfmmApi.h index 3eac6ca2d..0559961cf 100644 --- a/Addons/CKernelApi/Src/CScalfmmApi.h +++ b/Addons/CKernelApi/Src/CScalfmmApi.h @@ -488,6 +488,15 @@ typedef void (*Callback_P2M)(void* cellData, void * leafData, FSize nbParticles, */ typedef void (*Callback_M2M)(int level, void* parentCell, int childPosition, void* childCell, void* userData); +/** + * @brief Function to be filled by user's M2M + * @param level current level in the tree + * @prama parentCell cell to be filled + * @param userData datas specific to the user's kernel + * @param childCell array of cells to be read + */ +typedef void (*Callback_M2M_Full)(int level, void* parentCell, void* childCell[8], void* userData); + /** * @brief Function to be filled by user's M2L * @param level current level in the tree @@ -529,6 +538,15 @@ typedef void (*Callback_M2LFull)(int level, void* targetCell, const int * neighb */ typedef void (*Callback_L2L)(int level, void* parentCell, int childPosition, void* childCell, void* userData); +/** + * @brief Function to be filled by user's L2L + * @param level current level in the tree + * @prama parentCell cell to be filled + * @param userData datas specific to the user's kernel + * @param childCell array of cells to be read + */ +typedef void (*Callback_L2L_Full)(int level, void* parentCell, void* childCell[8], void* userData); + /** * @brief Function to be filled by user's L2P * @param cellData cell to be read @@ -618,10 +636,12 @@ typedef void (*Callback_apply_on_cell)(int level, long long morton_index, int* t typedef struct User_Scalfmm_Kernel_Descriptor { Callback_P2M p2m; Callback_M2M m2m; + Callback_M2M_Full m2m_full; Callback_M2L m2l; Callback_M2L_Ext m2l_ext; Callback_M2LFull m2l_full; Callback_L2L l2l; + Callback_L2L_Full l2l_full; Callback_L2P l2p; Callback_P2P p2p; Callback_P2PFull p2p_full; diff --git a/Addons/CKernelApi/Src/FUserKernelEngine.hpp b/Addons/CKernelApi/Src/FUserKernelEngine.hpp index 300bceb95..f07661c66 100644 --- a/Addons/CKernelApi/Src/FUserKernelEngine.hpp +++ b/Addons/CKernelApi/Src/FUserKernelEngine.hpp @@ -123,10 +123,18 @@ public: /** Do nothing */ virtual void M2M(CellClass* const FRestrict cell, const CellClass*const FRestrict *const FRestrict children, const int level) { - if(kernel.m2m){ - for(int idx = 0 ; idx < 8 ; ++idx){ - if( children[idx] ){ - kernel.m2m(level, cell->getContainer(), idx, children[idx]->getContainer(), userData); + if(kernel.m2m_full){ + std::vector<void *> userCellArray; + for(int i=0 ;i<8 ; ++i){ + userCellArray.push_back(children[i]->getContainer()); + kernel.m2m_full(level, cell->getContainer(), userCellArray.data(), userData); + } + }else{ + if(kernel.m2m){ + for(int idx = 0 ; idx < 8 ; ++idx){ + if( children[idx] ){ + kernel.m2m(level, cell->getContainer(), idx, children[idx]->getContainer(), userData); + } } } } @@ -144,8 +152,7 @@ public: } kernel.m2l_full(level,cell->getContainer(),neighborPositions,size,userCellArray.data(),userData); FAssertLF("m2l_full temporary disabled ...\n"); - } - else{ + }else{ if(kernel.m2l){ for(int idx = 0 ; idx < size ; ++idx){ const int idxNeigh = neighborPositions[idx]; @@ -157,10 +164,18 @@ public: /** Do nothing */ virtual void L2L(const CellClass* const FRestrict cell, CellClass* FRestrict *const FRestrict children, const int level) { - if(kernel.l2l){ - for(int idx = 0 ; idx < 8 ; ++idx){ - if( children[idx] ){ - kernel.l2l(level, cell->getContainer(), idx, children[idx]->getContainer(), userData); + if(kernel.l2l_full){ + std::vector<void *> userCellArray; + for(int i=0 ;i<8 ; ++i){ + userCellArray.push_back(children[i]->getContainer()); + kernel.l2l_full(level, cell->getContainer(), userCellArray.data(), userData); + } + }else{ + if(kernel.l2l){ + for(int idx = 0 ; idx < 8 ; ++idx){ + if( children[idx] ){ + kernel.l2l(level, cell->getContainer(), idx, children[idx]->getContainer(), userData); + } } } } -- GitLab