diff --git a/Addons/CKernelApi/Src/CScalfmmApi.h b/Addons/CKernelApi/Src/CScalfmmApi.h index 0050e265e39c4c3940fd0b127dd399b0f55ca7db..5684e0c68d9a409e10d3925c380a15e6c6201837 100644 --- a/Addons/CKernelApi/Src/CScalfmmApi.h +++ b/Addons/CKernelApi/Src/CScalfmmApi.h @@ -91,7 +91,8 @@ typedef enum scalfmm_algorithm_config { sequential = 0, /* Use the sequential version of Scalfmm*/ multi_thread = 1, /* Use the Multi thread version of Scalfmm*/ periodic = 2, /* Use the periodic version of Scalfmm*/ - source_target = 3 /* USe the source/target algorithm */ + source_target = 3, /* USe the source/target algorithm */ + adaptiv = 4 /*Temporary*/ } scalfmm_algorithm; @@ -508,7 +509,7 @@ typedef void (*Callback_P2PInner)(FSize nbParticles, const FSize* particleIndexe * @param spatial_position double[3] center of the cell * @param usercell ptr to user's cell */ -typedef void (*Callback_reset_cell)(int level, long long morton_index, int* tree_position, double* spatial_position, void * userCell); +typedef void (*Callback_reset_cell)(int level, long long morton_index, int* tree_position, double* spatial_position, void * userCell, void * userData); /** * @brief Structure containing callbacks to fill in order to define diff --git a/Addons/CKernelApi/Src/FInterEngine.hpp b/Addons/CKernelApi/Src/FInterEngine.hpp index f0fe11d4dbc7de03dfee9eaf5089170df0209eb7..a53486c7dec303bfac880df23fb2593f5df038d1 100644 --- a/Addons/CKernelApi/Src/FInterEngine.hpp +++ b/Addons/CKernelApi/Src/FInterEngine.hpp @@ -34,6 +34,8 @@ #include "Extensions/FExtendCellType.hpp" #include "Core/FFmmAlgorithmThread.hpp" +#include "Core/FFmmAlgorithmSectionTask.hpp" +#include "Core/FFmmAlgorithmTask.hpp" #include "Core/FFmmAlgorithm.hpp" #include "Core/FFmmAlgorithmPeriodic.hpp" #include "Core/FFmmAlgorithmThreadTsm.hpp" @@ -764,8 +766,6 @@ public: } case 3: { - // class local : public InterCell, public unExtendedCell{ - // }; typedef FFmmAlgorithmThreadTsm AlgoClassTargetSource; AlgoClassTargetSource* algoTS = new AlgoClassTargetSource(octree,kernel); algoTS->execute(); diff --git a/Addons/CKernelApi/Src/FScalfmmApiInit.cpp b/Addons/CKernelApi/Src/FScalfmmApiInit.cpp index 730249449c887b0320ecb024e3cc48544a98fdb4..7edf2e827567ea9efa3f87d90a21808ce07d25db 100644 --- a/Addons/CKernelApi/Src/FScalfmmApiInit.cpp +++ b/Addons/CKernelApi/Src/FScalfmmApiInit.cpp @@ -5,6 +5,7 @@ extern "C" { #include "FInterEngine.hpp" #include "FUserKernelEngine.hpp" +//#include "FAdaptEngine.hpp" extern "C" scalfmm_handle scalfmm_init(/*int TreeHeight,double BoxWidth,double* BoxCenter, */scalfmm_kernel_type KernelType, scalfmm_algorithm algo){ @@ -49,44 +50,48 @@ extern "C" scalfmm_handle scalfmm_init(/*int TreeHeight,double BoxWidth,double* break; } } - else{ //No Source/Targets distinction - switch(KernelType){ - case 0: - typedef FP2PParticleContainerIndexed ContainerClass; - typedef FSimpleLeaf LeafClass; - - handle->engine = new FUserKernelEngine(/*TreeHeight, BoxWidth, BoxCenter, */KernelType); - break; - - case 1: - //TODO typedefs - typedef FP2PParticleContainerIndexed ContainerClass; - //typedef FChebCell ChebCell; - typedef FTypedChebCell ChebCell; - typedef FSimpleLeaf LeafClass; - - typedef FInterpMatrixKernelR MatrixKernelClass; - typedef FChebSymKernel ChebKernel; - - handle->engine = new FInterEngine(/*TreeHeight,BoxWidth,BoxCenter, */KernelType,algo); - break; - // case 2: - // //TODO typedefs - // typedef FP2PParticleContainerIndexed ContainerClass; - // typedef FUnifCell<7> UnifCell; - - // typedef FInterpMatrixKernelR MatrixKernelClass; - // typedef FUnifKernel UnifKernel; - - // handle->engine = new FInterEngine(/*TreeHeight,BoxWidth,BoxCenter, */KernelType); - // break; - - default: - std::cout<< "Kernel type unsupported" << std::endl; - exit(0); - break; - - } + else{ + // if(algo == adaptiv){ + // //Temporary + // handle->engine = new FAdaptEngine(KernelType,algo); + //}else{ + //No Source/Targets distinction + switch(KernelType){ + case 0: + typedef FP2PParticleContainerIndexed ContainerClass; + typedef FSimpleLeaf LeafClass; + + handle->engine = new FUserKernelEngine(/*TreeHeight, BoxWidth, BoxCenter, */KernelType); + break; + + case 1: + //TODO typedefs + typedef FP2PParticleContainerIndexed ContainerClass; + //typedef FChebCell ChebCell; + typedef FTypedChebCell ChebCell; + typedef FSimpleLeaf LeafClass; + + typedef FInterpMatrixKernelR MatrixKernelClass; + typedef FChebSymKernel ChebKernel; + + handle->engine = new FInterEngine(/*TreeHeight,BoxWidth,BoxCenter, */KernelType,algo); + break; + // case 2: + // //TODO typedefs + // typedef FP2PParticleContainerIndexed ContainerClass; + // typedef FUnifCell<7> UnifCell; + + // typedef FInterpMatrixKernelR MatrixKernelClass; + // typedef FUnifKernel UnifKernel; + + // handle->engine = new FInterEngine(/*TreeHeight,BoxWidth,BoxCenter, */KernelType); + // break; + default: + std::cout<< "Kernel type unsupported" << std::endl; + exit(0); + break; + } + // } } return handle; } @@ -391,7 +396,7 @@ void ChebKernel_P2P(FSize nbParticles, const FSize* particleIndexes, delete tempContTarget; } -void ChebCell_reset(int level, long long morton_index, int* tree_position, double* spatial_position, void * userCell){ +void ChebCell_reset(int level, long long morton_index, int* tree_position, double* spatial_position, void * userCell,void * inKernel){ ChebCellStruct * cellStruct = reinterpret_cast(userCell); FChebCell* chebCell = cellStruct->cell; chebCell->resetToInitialState(); diff --git a/Addons/CKernelApi/Src/FUserKernelEngine.hpp b/Addons/CKernelApi/Src/FUserKernelEngine.hpp index db5f2e5e506acfc1a07435b1386ea3ba7bbffcc8..1eaf3fecf43bd69aae8b29591f2b6d31f826b23b 100644 --- a/Addons/CKernelApi/Src/FUserKernelEngine.hpp +++ b/Addons/CKernelApi/Src/FUserKernelEngine.hpp @@ -288,7 +288,7 @@ public: position[0] = boxCorner[0] + currCoord.getX()*boxwidth/double(1<getContainer()); + cellReset(currLevel,currMorton,arrayCoord,position,currCell->getContainer(),kernel->getUserKernelDatas()); } }); } diff --git a/Addons/CKernelApi/Tests/testChebInterface.c b/Addons/CKernelApi/Tests/testChebInterface.c index 6660fb45b96b22c472e3f1c7a85e7e6f487efeb7..29382f0d9b5ec4fdf1c148f395b11aee45893ae0 100644 --- a/Addons/CKernelApi/Tests/testChebInterface.c +++ b/Addons/CKernelApi/Tests/testChebInterface.c @@ -54,8 +54,8 @@ void cheb_p2pFull(FSize nbParticles, const FSize* particleIndexes, ChebKernel_P2P(nbParticles, particleIndexes, sourceParticleIndexes, sourceNbPart, userData); } -void cheb_resetCell(int level, long long morton_index, int* tree_position, double* spatial_position, void * userCell){ - ChebCell_reset(level,morton_index,tree_position,spatial_position,userCell); +void cheb_resetCell(int level, long long morton_index, int* tree_position, double* spatial_position, void * userCell, void * userData){ + ChebCell_reset(level,morton_index,tree_position,spatial_position,userCell,userData); } @@ -247,16 +247,16 @@ int main(int argc, char ** av){ scalfmm_execute_fmm(handle_ref/*, kernel, &my_data*/); tac(&ref_timer); - { //Temporary - int nbTimers = scalfmm_get_nb_timers(handle_ref); - double * timersArray = malloc(sizeof(double)*nbTimers); - scalfmm_get_timers(handle_ref,timersArray); - int i; - for(i=0; inbP2PFull+= 1; } -void displ_resetCell(int level, long long morton_index, int* tree_position, double* spatial_position, void * userCell){ +void displ_resetCell(int level, long long morton_index, int* tree_position, double* spatial_position, void * userCell, void * userData){ printf("Removing %d cell at lvl %d... \n",((Cell*)userCell)->Id,((Cell*)userCell)->lvl); } diff --git a/Src/Kernels/Chebyshev/FChebInterface.h b/Src/Kernels/Chebyshev/FChebInterface.h index 087f4859fa02e6bfbbfaf81f7619adf9ab9db501..83e69a1292f4351db5a59b4f59feff5610b84516 100644 --- a/Src/Kernels/Chebyshev/FChebInterface.h +++ b/Src/Kernels/Chebyshev/FChebInterface.h @@ -56,7 +56,7 @@ void ChebKernel_L2P(void* leafCell, FSize nbParticles, const FSize* particleInde void ChebKernel_P2P(FSize nbParticles, const FSize* particleIndexes, const FSize * sourceParticleIndexes[27], FSize sourceNbPart[27],void* userData); -void ChebCell_reset(int level, long long morton_index, int* tree_position, double* spatial_position, void * userCell); +void ChebCell_reset(int level, long long morton_index, int* tree_position, double* spatial_position, void * userCell, void * kernel); typedef struct myUserDatas{ ChebKernelStruct * kernelStruct; diff --git a/Src/Utils/FAlgorithmTimers.hpp b/Src/Utils/FAlgorithmTimers.hpp index aca3ea956830e188d8956724cf20a21cf483de5b..d73c1e890b6e0db1ab21fb2b0bd99e7843499737 100644 --- a/Src/Utils/FAlgorithmTimers.hpp +++ b/Src/Utils/FAlgorithmTimers.hpp @@ -43,6 +43,9 @@ public: FAlgorithmTimers() : Timers(nullptr) { Timers = new FTic[nbTimers]; + for(int i=0; i