Commit aa4c4d19 authored by PIACIBELLO Cyrille's avatar PIACIBELLO Cyrille

API can now call chebyshev/lagrange kernel succesfully (only cheb has been...

API can now call chebyshev/lagrange kernel succesfully (only cheb has been tested), remaining to do : updates positions of particles
parent db0c2164
......@@ -68,6 +68,29 @@ typedef enum kernel_type {
} scalfmm_kernel_type;
/**
* Enum over the different way scalfmm can handle a particule moving
* out of the simulation box
*/
typedef enum out_of_the_box_config {
exiting = 0, /*If a particule move outside the simulation box,
the simulation stop*/
periodic = 1, /*If a particule move outside the simulation box,
the particules is inserted back at the other side
of the simulation box*/
erasing = 2 /*If a particule move outside the simulation box, it
simply disappears from the simulation */
} scalfmm_out_of_box_behavior;
/**
* Enum over the different algorithm that scalfmm can use
*/
typedef enum scalfmm_algorithm_config {
sequential = 0, /* Use the sequential version of Scalfmm*/
multi_thread = 1 /* Use the Multi thread version of Scalfmm*/
} scalfmm_algorithm;
/**
* Handle for the user
*/
......@@ -135,6 +158,11 @@ void scalfmm_tree_insert_particles_xyz(scalfmm_handle Handle, int NbPositions, d
* the array. First particle inserted will take value physicalValues[0].
*/
void scalfmm_set_physical_values(scalfmm_handle Handle, int nbPhysicalValues, double * physicalValues);
/**
* @brief get the physical values.
*
* WARNING : the user must allocate (and initialize) the array given
*/
void scalfmm_get_physical_values(scalfmm_handle Handle, int nbPhysicalValues, double * physicalValues);
/**
......@@ -206,7 +234,7 @@ void scalfmm_set_forces_npart(scalfmm_handle Handle, int nbParts, int* idxOfPart
* array.
*/
void scalfmm_get_potentials(scalfmm_handle Handle, int nbParts, double * potentialsToFill);
void scalfmm_set_potentials(scalfmm_handle Handle, int nbParts, double * potentialsToFill);
void scalfmm_set_potentials(scalfmm_handle Handle, int nbParts, double * potentialsToRead);
void scalfmm_get_potentials_npart(scalfmm_handle Handle, int nbParts, int* idxOfParticles, double * potentialsToFill);
void scalfmm_set_potentials_npart(scalfmm_handle Handle, int nbParts, int* idxOfParticles, double * potentialsToFill);
......@@ -251,7 +279,24 @@ void scalfmm_get_positions(scalfmm_handle Handle, int NbPositions, double * X, d
void scalfmm_get_positions_xyz_npart(scalfmm_handle Handle, int NbPositions, int* idxOfParticles, double * updatedXYZ);
void scalfmm_get_positions_npart(scalfmm_handle Handle, int NbPositions, int* idxOfParticles, double * X, double * Y , double * Z);
/**
* @brief This function provides a way for the user to define scalfmm
* behavior in case a particule get out of the box after a
* displacement
* @param Handle scalfmm_handle provided by scalfmm_init
* @param Member of enum scalfmm_out_of_box_behavior
*/
void scalfmm_out_of_the_box_config(scalfmm_handle Handle,scalfmm_out_of_box_behavior config);
/**
* @brief This function provides a way for choosing the algorithm to
* be used
* @param Handle scalfmm_handle provided by scalfmm_init
* @param Member of enum scalfmm_algorithm
*/
void scalfmm_algorithm_config(scalfmm_handle Handle,scalfmm_algorithm config);
/////////////////////////////////////////////////////////////////////
......
This diff is collapsed.
......@@ -47,17 +47,39 @@
* @class FScalFMMEngine
*/
class FScalFMMEngine{
private:
scalfmm_kernel_type kernel;
protected:
scalfmm_kernel_type kernelType;
scalfmm_out_of_box_behavior OutOfBoxBehavior;
scalfmm_algorithm Algorithm;
FVector<bool> progress;
int nbPart;
public:
FScalFMMEngine() : OutOfBoxBehavior(exiting), Algorithm(multi_thread), progress(), nbPart(0){
//Default behavior in case of out of the box particles is exiting
}
//First function displayed there are common function for every
//kernel
scalfmm_kernel_type getKernelType(){
return this->kernel;
return this->kernelType;
}
//To deal with particles moving outside the box
void out_of_the_box_config(scalfmm_out_of_box_behavior config){
this->OutOfBoxBehavior = config;
}
//Function about the tree (to be redefined)
//To change default algorithm
void algorithm_config(scalfmm_algorithm config){
this->Algorithm = config;
}
//Functions displayed there are function that are to be redefined
//by specific Engine
//Function about the tree
virtual void tree_insert_particles( int NbPositions, double * arrayX, double * arrayY, double * arrayZ){
FAssertLF(0,"No tree instancied, exiting ...\n");
}
......@@ -96,6 +118,7 @@ public:
virtual void get_forces_npart( int nbParts, int* idxOfParticles, double * fX, double* fY, double* fZ){
FAssertLF(0,"No tree instancied, exiting ...\n");
}
//To set initial condition
virtual void set_forces_xyz( int nbParts, double * forcesToFill){
FAssertLF(0,"No tree instancied, exiting ...\n");
......@@ -113,17 +136,17 @@ public:
virtual void get_potentials( int nbParts, double * potentialsToFill){
FAssertLF(0,"No tree instancied, exiting ...\n");
}
virtual void set_potentials( int nbParts, double * potentialsToFill){
virtual void set_potentials( int nbParts, double * potentialsToRead){
FAssertLF(0,"No tree instancied, exiting ...\n");
}
virtual void get_potentials_npart( int nbParts, int* idxOfParticles, double * potentialsToFill){
FAssertLF(0,"No tree instancied, exiting ...\n");
}
virtual void set_potentials_npart( int nbParts, int* idxOfParticles, double * potentialsToFill){
virtual void set_potentials_npart( int nbParts, int* idxOfParticles, double * potentialsToRead){
FAssertLF(0,"No tree instancied, exiting ...\n");
}
//To deal with positions
//Function to move particles
virtual void add_to_positions_xyz( int NbPositions, double * updatedXYZ){
FAssertLF(0,"No tree instancied, exiting ...\n");
}
......@@ -134,7 +157,7 @@ public:
FAssertLF(0,"No tree instancied, exiting ...\n");
}
virtual void add_to_positions_npart( int NbPositions, int* idxOfParticles,
double * X, double * Y , double * Z){
double * X, double * Y , double * Z){
FAssertLF(0,"No tree instancied, exiting ...\n");
}
virtual void set_positions_xyz( int NbPositions, double * updatedXYZ){
......@@ -147,7 +170,7 @@ public:
FAssertLF(0,"No tree instancied, exiting ...\n");
}
virtual void set_positions_npart( int NbPositions, int* idxOfParticles,
double * X, double * Y , double * Z){
double * X, double * Y , double * Z){
FAssertLF(0,"No tree instancied, exiting ...\n");
}
virtual void get_positions_xyz( int NbPositions, double * updatedXYZ){
......@@ -160,7 +183,7 @@ public:
FAssertLF(0,"No tree instancied, exiting ...\n");
}
virtual void get_positions_npart( int NbPositions, int* idxOfParticles,
double * X, double * Y , double * Z){
double * X, double * Y , double * Z){
FAssertLF(0,"No tree instancied, exiting ...\n");
}
......@@ -170,8 +193,8 @@ public:
FAssertLF(0,"No user kernel defined, exiting ...\n");
}
virtual void scalfmm_execute_fmm(){
FAssertLF(0,"No kernel set, exiting ...\n");
virtual void execute_fmm(){
FAssertLF(0,"No kernel set, cannot execute anything, exiting ...\n");
}
};
......@@ -272,6 +295,11 @@ extern "C" void scalfmm_set_potentials_npart(scalfmm_handle Handle, int nbParts,
//To deal with positions
//Out of the box behavior
extern "C" void scalfmm_out_of_the_box_config(scalfmm_handle Handle,scalfmm_out_of_box_behavior config){
((ScalFmmCoreHandle * ) Handle)->engine->out_of_the_box_config(config);
}
//Update
extern "C" void scalfmm_add_to_positions_xyz(scalfmm_handle Handle, int NbPositions, double * updatedXYZ){
((ScalFmmCoreHandle * ) Handle)->engine->add_to_positions_xyz(NbPositions, updatedXYZ);
......@@ -286,7 +314,7 @@ extern "C" void scalfmm_add_to_positions_xyz_npart(scalfmm_handle Handle, int Nb
}
extern "C" void scalfmm_add_to_positions_npart(scalfmm_handle Handle, int NbPositions, int* idxOfParticles,
double * X, double * Y , double * Z){
double * X, double * Y , double * Z){
((ScalFmmCoreHandle * ) Handle)->engine->add_to_positions_npart(NbPositions, idxOfParticles, X, Y, Z);
}
//Set new positions
......@@ -320,14 +348,20 @@ extern "C" void scalfmm_get_positions_xyz_npart(scalfmm_handle Handle, int NbPos
}
extern "C" void scalfmm_get_positions_npart(scalfmm_handle Handle, int NbPositions, int* idxOfParticles,
double * X, double * Y , double * Z){
double * X, double * Y , double * Z){
((ScalFmmCoreHandle * ) Handle)->engine->get_positions_npart(NbPositions, idxOfParticles, X, Y, Z);
}
//To choose algorithm
extern "C" void scalfmm_algorithm_config(scalfmm_handle Handle, scalfmm_algorithm config){
((ScalFmmCoreHandle * ) Handle)->engine->algorithm_config(config);
}
//Executing FMM
extern "C" void scalfmm_execute_fmm(scalfmm_handle Handle){
((ScalFmmCoreHandle * ) Handle)->engine->scalfmm_execute_fmm();
((ScalFmmCoreHandle * ) Handle)->engine->execute_fmm();
}
#endif
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