Commit 65375456 authored by PIACIBELLO Cyrille's avatar PIACIBELLO Cyrille

Changes in API : reset_cell and Timers

parent 8c0cf920
......@@ -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
......
......@@ -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<OctreeClass,InterCell,ContainerClass,InterKernel,LeafClass> AlgoClassTargetSource;
AlgoClassTargetSource* algoTS = new AlgoClassTargetSource(octree,kernel);
algoTS->execute();
......
......@@ -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<FReal> ContainerClass;
typedef FSimpleLeaf<FReal,ContainerClass> LeafClass;
handle->engine = new FUserKernelEngine<FReal,LeafClass>(/*TreeHeight, BoxWidth, BoxCenter, */KernelType);
break;
case 1:
//TODO typedefs
typedef FP2PParticleContainerIndexed<FReal> ContainerClass;
//typedef FChebCell<FReal,7> ChebCell;
typedef FTypedChebCell<FReal,7> ChebCell;
typedef FSimpleLeaf<FReal,ContainerClass> LeafClass;
typedef FInterpMatrixKernelR<FReal> MatrixKernelClass;
typedef FChebSymKernel<FReal,ChebCell,ContainerClass,MatrixKernelClass,7> ChebKernel;
handle->engine = new FInterEngine<FReal,ChebCell,ChebKernel,LeafClass>(/*TreeHeight,BoxWidth,BoxCenter, */KernelType,algo);
break;
// case 2:
// //TODO typedefs
// typedef FP2PParticleContainerIndexed<FReal> ContainerClass;
// typedef FUnifCell<7> UnifCell;
// typedef FInterpMatrixKernelR<FReal> MatrixKernelClass;
// typedef FUnifKernel<UnifCell,ContainerClass,MatrixKernelClass,7> UnifKernel;
// handle->engine = new FInterEngine<UnifCell,UnifKernel>(/*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<FReal,4>(KernelType,algo);
//}else{
//No Source/Targets distinction
switch(KernelType){
case 0:
typedef FP2PParticleContainerIndexed<FReal> ContainerClass;
typedef FSimpleLeaf<FReal,ContainerClass> LeafClass;
handle->engine = new FUserKernelEngine<FReal,LeafClass>(/*TreeHeight, BoxWidth, BoxCenter, */KernelType);
break;
case 1:
//TODO typedefs
typedef FP2PParticleContainerIndexed<FReal> ContainerClass;
//typedef FChebCell<FReal,7> ChebCell;
typedef FTypedChebCell<FReal,7> ChebCell;
typedef FSimpleLeaf<FReal,ContainerClass> LeafClass;
typedef FInterpMatrixKernelR<FReal> MatrixKernelClass;
typedef FChebSymKernel<FReal,ChebCell,ContainerClass,MatrixKernelClass,7> ChebKernel;
handle->engine = new FInterEngine<FReal,ChebCell,ChebKernel,LeafClass>(/*TreeHeight,BoxWidth,BoxCenter, */KernelType,algo);
break;
// case 2:
// //TODO typedefs
// typedef FP2PParticleContainerIndexed<FReal> ContainerClass;
// typedef FUnifCell<7> UnifCell;
// typedef FInterpMatrixKernelR<FReal> MatrixKernelClass;
// typedef FUnifKernel<UnifCell,ContainerClass,MatrixKernelClass,7> UnifKernel;
// handle->engine = new FInterEngine<UnifCell,UnifKernel>(/*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<ChebCellStruct *>(userCell);
FChebCell<double,7>* chebCell = cellStruct->cell;
chebCell->resetToInitialState();
......
......@@ -288,7 +288,7 @@ public:
position[0] = boxCorner[0] + currCoord.getX()*boxwidth/double(1<<currLevel);
position[1] = boxCorner[1] + currCoord.getY()*boxwidth/double(1<<currLevel);
position[2] = boxCorner[2] + currCoord.getZ()*boxwidth/double(1<<currLevel);
cellReset(currLevel,currMorton,arrayCoord,position,currCell->getContainer());
cellReset(currLevel,currMorton,arrayCoord,position,currCell->getContainer(),kernel->getUserKernelDatas());
}
});
}
......
......@@ -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; i<nbTimers ; ++i){
printf("ScalFMM Operands : %d : \t %e\n",i,timersArray[i]);
}
free(timersArray);
}
/* { //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; i<nbTimers ; ++i){ */
/* printf("ScalFMM Operands : %d : \t %e\n",i,timersArray[i]); */
/* } */
/* free(timersArray); */
/* } */
printf("Intern Chebyshev done\n");
......@@ -292,10 +292,10 @@ int main(int argc, char ** av){
nbPartOkay++;
}
else{
printf("id : %lld : %e, %e, %e, %e, ChebInterf Pot : %e Cheb Pot : %e \n",
idxPart,diffX,diffY,diffZ,diffPot,
potentialToStore[0][idxPart],
potentialsRef[idxPart]);
/* printf("id : %lld : %e, %e, %e, %e, ChebInterf Pot : %e Cheb Pot : %e \n", */
/* idxPart,diffX,diffY,diffZ,diffPot, */
/* potentialToStore[0][idxPart], */
/* potentialsRef[idxPart]); */
}
//That part is to verify with our usual exec' if everything is alright
if(idxPart == 0 || idxPart == nbPart/2 || idxPart == nbPart-1){
......
......@@ -139,7 +139,7 @@ void displ_p2pFull(FSize nbParticles, const FSize* particleIndexes,
user_data->nbP2PFull+= 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);
}
......
......@@ -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;
......
......@@ -43,6 +43,9 @@ public:
FAlgorithmTimers() : Timers(nullptr)
{
Timers = new FTic[nbTimers];
for(int i=0; i<nbTimers ; ++i){
Timers[i].reset();
}
}
virtual ~FAlgorithmTimers(){
......
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