Commit 0dde3826 authored by PIACIBELLO Cyrille's avatar PIACIBELLO Cyrille

Changes in API, new call back for M2M and L2L where we provide the array of...

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
parent 0f77f48c
......@@ -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;
......
......@@ -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);
}
}
}
}
......
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