Commit e5f1f699 authored by PIACIBELLO Cyrille's avatar PIACIBELLO Cyrille

Api Tests cleared

parent 9919134d
......@@ -1016,6 +1016,27 @@ extern "C" int scalfmm_get_nb_timers(scalfmm_handle Handle){
// ((ScalFmmCoreHandle<double> * ) Handle)->engine->tree_abstract_insert(NbPartToInsert,nbAttributeToInsert,strideForEachAtt,rawDatas);
// }
/**
* These functions are just translating functions.
*/
//< This function fill the childFullPosition[3] with [-1;1] to know the position of a child relatively to
//< its position from its parent
extern "C" void scalfmm_utils_parentChildPosition(int childPosition, int* childFullPosition){
childFullPosition[2] = (childPosition%2 ? 1 : -1);
childFullPosition[1] = ((childPosition/2)%2 ? 1 : -1);
childFullPosition[0] = ((childPosition/4)%2 ? 1 : -1);
}
//< This function fill the childFullPosition[3] with [-3;3] to know the position of a interaction
//< cell relatively to its position from the target
extern "C" void scalfmm_utils_interactionPosition(int interactionPosition, int* srcPosition){
srcPosition[2] = interactionPosition%7 - 3;
srcPosition[1] = (interactionPosition/7)%7 - 3;
srcPosition[0] = (interactionPosition/49)%7 - 3;
}
extern "C" void scalfmm_reset_tree(scalfmm_handle Handle, Callback_reset_cell cellReseter){
((ScalFmmCoreHandle<double> * ) Handle)->engine->reset_tree(cellReseter);
}
......
......@@ -28,7 +28,7 @@ int main(int argc, char ** av){
double boxCenter[3] = {0.0,0.0,0.0};
//Init our lib
scalfmm_handle handle = scalfmm_init(/* TreeHeight,boxWidth,boxCenter, */myChoice); //The tree is built
scalfmm_handle handle = scalfmm_init(/* TreeHeight,boxWidth,boxCenter, */myChoice,multi_thread); //The tree is built
struct User_Scalfmm_Cell_Descriptor user_descr;
user_descr.user_init_cell = NULL;
user_descr.user_free_cell = NULL;
......@@ -54,10 +54,10 @@ int main(int argc, char ** av){
}
//Inserting the array in the tree
scalfmm_tree_insert_particles_xyz(handle,nb_of_parts,positionsXYZ);
scalfmm_tree_insert_particles_xyz(handle,nb_of_parts,positionsXYZ,BOTH);
//Set the charge
scalfmm_set_physical_values(handle,nb_of_parts,array_of_charge);
scalfmm_set_physical_values(handle,nb_of_parts,array_of_charge,BOTH);
//Computation Part
......@@ -80,9 +80,9 @@ int main(int argc, char ** av){
scalfmm_execute_fmm(handle);
//Get the resulting forces
scalfmm_get_forces_xyz(handle,nb_of_parts,array_of_forces);
scalfmm_get_forces_xyz(handle,nb_of_parts,array_of_forces,BOTH);
//Get the resulting potential
scalfmm_get_potentials(handle,nb_of_parts,array_of_pot);
scalfmm_get_potentials(handle,nb_of_parts,array_of_pot,BOTH);
......@@ -90,7 +90,7 @@ int main(int argc, char ** av){
compute_displacement_from_forces(array_of_forces,array_of_charge,array_of_displacement,nb_of_parts);
//get position in order to display
scalfmm_get_positions_xyz(handle,nb_of_parts,positionsXYZ);
scalfmm_get_positions_xyz(handle,nb_of_parts,positionsXYZ,BOTH);
//Display forces :
{
......@@ -109,7 +109,7 @@ int main(int argc, char ** av){
}
}
//Apply displacement computed
scalfmm_add_to_positions_xyz(handle,nb_of_parts,array_of_displacement);
scalfmm_add_to_positions_xyz(handle,nb_of_parts,array_of_displacement,BOTH);
//Update Consequently the tree
scalfmm_update_tree(handle);
......
......@@ -47,7 +47,7 @@ struct MyCellDescriptor{
};
// This is our function that init a cell (struct MyCellDescriptor)
void* my_Callback_init_cell(int level, long long mortonIndex, int* coord, double* position){
void* my_Callback_init_cell(int level, long long mortonIndex, int* coord, double* position, void * kernel){
VerbosePrint("\tAllocating cell for level %d, morton index %lld, coord %d/%d/%d\n", level, mortonIndex, coord[0], coord[1], coord[2]);
struct MyCellDescriptor* cellData = (struct MyCellDescriptor*)malloc(sizeof(struct MyCellDescriptor));
memset(cellData, 0, sizeof(struct MyCellDescriptor));
......@@ -88,7 +88,7 @@ struct MyData {
// Our P2M
void my_Callback_P2M(void* cellData, FSize nbParticlesInLeaf, const int* particleIndexes, void* userData){
void my_Callback_P2M(void* cellData, FSize nbParticlesInLeaf, const FSize* particleIndexes, void* userData){
struct MyData* my_data = (struct MyData*)userData;
my_data->countP2M += 1;
......@@ -152,7 +152,7 @@ void my_Callback_L2L(int level, void* cellData, int childPosition, void* childDa
// JUST-PUT-HERE: Your L2L
}
void my_Callback_L2P(void* cellData, FSize nbParticlesInLeaf, const int* particleIndexes, void* userData){
void my_Callback_L2P(void* cellData, FSize nbParticlesInLeaf, const FSize* particleIndexes, void* userData){
struct MyData* my_data = (struct MyData*)userData;
my_data->countL2P += 1;
......@@ -167,7 +167,7 @@ void my_Callback_L2P(void* cellData, FSize nbParticlesInLeaf, const int* particl
}
}
void my_Callback_P2P(FSize nbParticlesInLeaf, const int* particleIndexes, FSize nbParticlesInSrc, const int* particleIndexesSrc, void* userData){
void my_Callback_P2P(FSize nbParticlesInLeaf, const FSize* particleIndexes, FSize nbParticlesInSrc, const FSize* particleIndexesSrc, void* userData){
struct MyData* my_data = (struct MyData*)userData;
my_data->countP2P += 1;
......@@ -189,7 +189,7 @@ void my_Callback_P2P(FSize nbParticlesInLeaf, const int* particleIndexes, FSize
// interacting with the target particles
}
void my_Callback_P2PInner(FSize nbParticlesInLeaf, const int* particleIndexes, void* userData){
void my_Callback_P2PInner(FSize nbParticlesInLeaf, const FSize* particleIndexes, void* userData){
struct MyData* my_data = (struct MyData*)userData;
my_data->countP2PInner += 1;
......@@ -233,7 +233,7 @@ int main(int argc, char ** argv){
}
// Init the handle
scalfmm_handle handle = scalfmm_init(user_defined_kernel);
scalfmm_handle handle = scalfmm_init(user_defined_kernel,multi_thread);
//Build our own call backs
struct User_Scalfmm_Cell_Descriptor cellDescriptor;
......@@ -245,7 +245,7 @@ int main(int argc, char ** argv){
scalfmm_build_tree(handle,treeHeight, boxWidth, boxCenter, cellDescriptor);
// Insert particles
printf("Inserting particles...\n");
scalfmm_tree_insert_particles_xyz(handle, nbParticles, particleXYZ);
scalfmm_tree_insert_particles_xyz(handle, nbParticles, particleXYZ,BOTH);
printf("Particles Inserted ...\n");
// Init our callback struct
......@@ -253,10 +253,12 @@ int main(int argc, char ** argv){
kernel.p2m = my_Callback_P2M;
kernel.m2m = my_Callback_M2M;
kernel.m2l = my_Callback_M2L;
kernel.m2l_full = NULL;
kernel.l2l = my_Callback_L2L;
kernel.l2p = my_Callback_L2P;
kernel.p2pinner = my_Callback_P2PInner;
kernel.p2p = my_Callback_P2P;
kernel.p2p_full = NULL;
// Init the data to pass to all our callbacks
struct MyData my_data;
......@@ -277,7 +279,7 @@ int main(int argc, char ** argv){
// Execute the FMM
scalfmm_execute_fmm(handle/*, kernel, &my_data*/);
printf("FMM finished ... \n");
scalfmm_get_positions_xyz(handle,nbParticles,new_positions);
scalfmm_get_positions_xyz(handle,nbParticles,new_positions,BOTH);
//Computation on those positions
//Here it's a random
int id;
......@@ -288,7 +290,7 @@ int main(int argc, char ** argv){
}
printf("Positions changed \n");
scalfmm_set_positions_xyz(handle,nbParticles,new_positions);
scalfmm_set_positions_xyz(handle,nbParticles,new_positions,BOTH);
scalfmm_update_tree(handle);
curr_ite++;
}
......
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