Commit 90e8f721 authored by BRAMAS Berenger's avatar BRAMAS Berenger

Use FSize when it is related to particles

parent e8f3b15a
...@@ -48,7 +48,7 @@ void Scalfmm_dealloc_handle(Scalfmm_Handle handle, Callback_free_cell cellDestro ...@@ -48,7 +48,7 @@ void Scalfmm_dealloc_handle(Scalfmm_Handle handle, Callback_free_cell cellDestro
//< The indexes are the one used on the particles operator //< The indexes are the one used on the particles operator
//< The position of the particles should be composed of one triple per particle: //< The position of the particles should be composed of one triple per particle:
//< xyzxyzxyz... //< xyzxyzxyz...
void Scalfmm_insert_array_of_particles(Scalfmm_Handle handle, int nbParticles, int* particleIndexes, double* particleXYZ); void Scalfmm_insert_array_of_particles(Scalfmm_Handle handle, FSize nbParticles, int* particleIndexes, double* particleXYZ);
//< To insert one particle only //< To insert one particle only
void Scalfmm_one_particle(Scalfmm_Handle handle, int particleIndexe, double x, double y, double z); void Scalfmm_one_particle(Scalfmm_Handle handle, int particleIndexe, double x, double y, double z);
...@@ -62,13 +62,13 @@ void Scalfmm_init_cell(Scalfmm_Handle handle, Callback_init_cell cellInitializer ...@@ -62,13 +62,13 @@ void Scalfmm_init_cell(Scalfmm_Handle handle, Callback_init_cell cellInitializer
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
//< These function are the callbacks of the FMM operators //< These function are the callbacks of the FMM operators
typedef void (*Callback_P2M)(void* leafCell, int nbParticles, const int* particleIndexes, void* userData); typedef void (*Callback_P2M)(void* leafCell, FSize nbParticles, const int* particleIndexes, void* userData);
typedef void (*Callback_M2M)(int level, void* parentCell, int childPosition, void* childCell, void* userData); typedef void (*Callback_M2M)(int level, void* parentCell, int childPosition, void* childCell, void* userData);
typedef void (*Callback_M2L)(int level, void* targetCell, int sourceCellPosition, void* sourceCell, void* userData); typedef void (*Callback_M2L)(int level, void* targetCell, int sourceCellPosition, void* sourceCell, void* userData);
typedef void (*Callback_L2L)(int level, void* parentCell, int childPosition, void* childCell, void* userData); typedef void (*Callback_L2L)(int level, void* parentCell, int childPosition, void* childCell, void* userData);
typedef void (*Callback_L2P)(void* leafCell, int nbParticles, int* particleIndexes, void* userData); typedef void (*Callback_L2P)(void* leafCell, FSize nbParticles, int* particleIndexes, void* userData);
typedef void (*Callback_P2P)(int nbParticles, const int* particleIndexes, int nbSourceParticles, const int* sourceParticleIndexes, void* userData); typedef void (*Callback_P2P)(FSize nbParticles, const int* particleIndexes, int nbSourceParticles, const int* sourceParticleIndexes, void* userData);
typedef void (*Callback_P2PInner)(int nbParticles, int* particleIndexes, void* userData); typedef void (*Callback_P2PInner)(FSize nbParticles, int* particleIndexes, void* userData);
//< This structure should be filled (or filled with null) to call the FMM //< This structure should be filled (or filled with null) to call the FMM
struct Scalfmm_Kernel_Descriptor { struct Scalfmm_Kernel_Descriptor {
......
...@@ -362,7 +362,7 @@ void scalfmm_algorithm_config(scalfmm_handle Handle,scalfmm_algorithm config); ...@@ -362,7 +362,7 @@ void scalfmm_algorithm_config(scalfmm_handle Handle,scalfmm_algorithm config);
* @param particleIndexes indexes of particles currently computed * @param particleIndexes indexes of particles currently computed
* @param userData datas specific to the user's kernel * @param userData datas specific to the user's kernel
*/ */
typedef void (*Callback_P2M)(void* leafCell, int nbParticles, const int* particleIndexes, void* userData); typedef void (*Callback_P2M)(void* leafCell, FSize nbParticles, const int* particleIndexes, void* userData);
/** /**
* @brief Function to be filled by user's M2M * @brief Function to be filled by user's M2M
...@@ -411,7 +411,7 @@ typedef void (*Callback_L2L)(int level, void* parentCell, int childPosition, voi ...@@ -411,7 +411,7 @@ typedef void (*Callback_L2L)(int level, void* parentCell, int childPosition, voi
* @param particleIndexes indexes of particles currently computed * @param particleIndexes indexes of particles currently computed
* @param userData datas specific to the user's kernel * @param userData datas specific to the user's kernel
*/ */
typedef void (*Callback_L2P)(void* leafCell, int nbParticles,const int* particleIndexes, void* userData); typedef void (*Callback_L2P)(void* leafCell, FSize nbParticles,const int* particleIndexes, void* userData);
/** /**
* @brief Function to be filled by user's P2P * @brief Function to be filled by user's P2P
...@@ -421,7 +421,7 @@ typedef void (*Callback_L2P)(void* leafCell, int nbParticles,const int* particle ...@@ -421,7 +421,7 @@ typedef void (*Callback_L2P)(void* leafCell, int nbParticles,const int* particle
* @param sourceParticleIndexes indexes of cource particles currently computed * @param sourceParticleIndexes indexes of cource particles currently computed
* @param userData datas specific to the user's kernel * @param userData datas specific to the user's kernel
*/ */
typedef void (*Callback_P2P)(int nbParticles, const int* particleIndexes, int nbSourceParticles, const int* sourceParticleIndexes, void* userData); typedef void (*Callback_P2P)(FSize nbParticles, const int* particleIndexes, int nbSourceParticles, const int* sourceParticleIndexes, void* userData);
/** /**
* @brief Function to be filled by user's P2P * @brief Function to be filled by user's P2P
...@@ -432,7 +432,7 @@ typedef void (*Callback_P2P)(int nbParticles, const int* particleIndexes, int nb ...@@ -432,7 +432,7 @@ typedef void (*Callback_P2P)(int nbParticles, const int* particleIndexes, int nb
* @param sourceNbPart array containing the number of part in each neighbors * @param sourceNbPart array containing the number of part in each neighbors
* @param userData datas specific to the user's kernel * @param userData datas specific to the user's kernel
*/ */
typedef void (*Callback_P2PFull)(int nbParticles, const int* particleIndexes, typedef void (*Callback_P2PFull)(FSize nbParticles, const int* particleIndexes,
const int * sourceParticleIndexes[27],int sourceNbPart[27], void* userData); const int * sourceParticleIndexes[27],int sourceNbPart[27], void* userData);
...@@ -442,7 +442,7 @@ typedef void (*Callback_P2PFull)(int nbParticles, const int* particleIndexes, ...@@ -442,7 +442,7 @@ typedef void (*Callback_P2PFull)(int nbParticles, const int* particleIndexes,
* @param particleIndexes indexes of particles currently computed * @param particleIndexes indexes of particles currently computed
* @param userData datas specific to the user's kernel * @param userData datas specific to the user's kernel
*/ */
typedef void (*Callback_P2PInner)(int nbParticles, const int* particleIndexes, void* userData); typedef void (*Callback_P2PInner)(FSize nbParticles, const int* particleIndexes, void* userData);
......
This diff is collapsed.
...@@ -126,7 +126,7 @@ extern "C" void ChebKernelStruct_free(void *inKernel){ ...@@ -126,7 +126,7 @@ extern "C" void ChebKernelStruct_free(void *inKernel){
} }
extern "C" void ChebKernel_P2M(void * leafCell, int nbParticles, const int *particleIndexes, void * inKernel){ extern "C" void ChebKernel_P2M(void * leafCell, FSize nbParticles, const int *particleIndexes, void * inKernel){
//make temporary array of parts //make temporary array of parts
FP2PParticleContainerIndexed<FReal>* tempContainer = new FP2PParticleContainerIndexed<FReal>(); FP2PParticleContainerIndexed<FReal>* tempContainer = new FP2PParticleContainerIndexed<FReal>();
tempContainer->reserve(nbParticles); tempContainer->reserve(nbParticles);
...@@ -215,7 +215,7 @@ extern "C" void ChebKernel_L2L(int level, void* parentCell, int childPosition, v ...@@ -215,7 +215,7 @@ extern "C" void ChebKernel_L2L(int level, void* parentCell, int childPosition, v
childChebCell->getLocal(0)); childChebCell->getLocal(0));
} }
extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* particleIndexes, void* inKernel){ extern "C" void ChebKernel_L2P(void* leafCell, FSize nbParticles, const int* particleIndexes, void* inKernel){
//Create temporary FSimpleLeaf //Create temporary FSimpleLeaf
FP2PParticleContainerIndexed<FReal>* tempContainer = new FP2PParticleContainerIndexed<FReal>(); FP2PParticleContainerIndexed<FReal>* tempContainer = new FP2PParticleContainerIndexed<FReal>();
tempContainer->reserve(nbParticles); tempContainer->reserve(nbParticles);
...@@ -242,8 +242,8 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti ...@@ -242,8 +242,8 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti
//Then retrieve the results //Then retrieve the results
double * forcesToFill = reinterpret_cast<UserData *>(inKernel)->forcesComputed[id_thread]; double * forcesToFill = reinterpret_cast<UserData *>(inKernel)->forcesComputed[id_thread];
const FVector<int>& indexes = tempContainer->getIndexes(); const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
for(int idxPart = 0 ; idxPart<nbParticles ; ++idxPart){ for(FSize idxPart = 0 ; idxPart<nbParticles ; ++idxPart){
forcesToFill[indexes[idxPart]*3+0] += tempContainer->getForcesX()[idxPart]; forcesToFill[indexes[idxPart]*3+0] += tempContainer->getForcesX()[idxPart];
forcesToFill[indexes[idxPart]*3+1] += tempContainer->getForcesY()[idxPart]; forcesToFill[indexes[idxPart]*3+1] += tempContainer->getForcesY()[idxPart];
forcesToFill[indexes[idxPart]*3+2] += tempContainer->getForcesZ()[idxPart]; forcesToFill[indexes[idxPart]*3+2] += tempContainer->getForcesZ()[idxPart];
...@@ -254,7 +254,7 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti ...@@ -254,7 +254,7 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti
} }
void ChebKernel_P2P(int nbParticles, const int* particleIndexes, void ChebKernel_P2P(FSize nbParticles, const int* particleIndexes,
const int * sourceParticleIndexes[27],int sourceNbPart[27],void* inKernel){ const int * sourceParticleIndexes[27],int sourceNbPart[27],void* inKernel){
//Create temporary FSimpleLeaf for target //Create temporary FSimpleLeaf for target
...@@ -306,8 +306,8 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti ...@@ -306,8 +306,8 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti
//get back forces //get back forces
double * forcesToFill = reinterpret_cast<UserData *>(inKernel)->forcesComputed[id_thread]; double * forcesToFill = reinterpret_cast<UserData *>(inKernel)->forcesComputed[id_thread];
const FVector<int>& indexes = tempContTarget->getIndexes(); const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
for(int idxPart = 0 ; idxPart<nbParticles ; ++idxPart){ for(FSize idxPart = 0 ; idxPart<nbParticles ; ++idxPart){
forcesToFill[indexes[idxPart]*3+0] += tempContTarget->getForcesX()[idxPart]; forcesToFill[indexes[idxPart]*3+0] += tempContTarget->getForcesX()[idxPart];
forcesToFill[indexes[idxPart]*3+1] += tempContTarget->getForcesY()[idxPart]; forcesToFill[indexes[idxPart]*3+1] += tempContTarget->getForcesY()[idxPart];
forcesToFill[indexes[idxPart]*3+2] += tempContTarget->getForcesZ()[idxPart]; forcesToFill[indexes[idxPart]*3+2] += tempContTarget->getForcesZ()[idxPart];
...@@ -316,7 +316,7 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti ...@@ -316,7 +316,7 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti
//Note that sources are also modified. //Note that sources are also modified.
//get back sources forces //get back sources forces
for(int idSource = 0 ; idSource < 27 ; ++idSource){ for(int idSource = 0 ; idSource < 27 ; ++idSource){
const FVector<int>& indexes = tempContSources[idSource]->getIndexes(); const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
const int nbPartInSource = sourceNbPart[idSource]; const int nbPartInSource = sourceNbPart[idSource];
for(int idxSourcePart = 0; idxSourcePart < nbPartInSource ; ++idxSourcePart){ for(int idxSourcePart = 0; idxSourcePart < nbPartInSource ; ++idxSourcePart){
forcesToFill[indexes[idxSourcePart]*3+0] += tempContSources[idSource]->getForcesX()[idxSourcePart]; forcesToFill[indexes[idxSourcePart]*3+0] += tempContSources[idSource]->getForcesX()[idxSourcePart];
......
...@@ -276,9 +276,9 @@ public: ...@@ -276,9 +276,9 @@ public:
void get_positions_xyz(int NbPositions, double * positionsToFill){ void get_positions_xyz(int NbPositions, double * positionsToFill){
octree->forEachLeaf([&](LeafClass* leaf){ octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc(); ContainerClass * sources = leaf->getSrc();
const FVector<int>& indexes = sources->getIndexes(); const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles(); int nbPartThere = sources->getNbParticles();
for(int idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){ for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
positionsToFill[indexes[idxPart]*3+0] = sources->getPositions()[0][idxPart]; positionsToFill[indexes[idxPart]*3+0] = sources->getPositions()[0][idxPart];
positionsToFill[indexes[idxPart]*3+1] = sources->getPositions()[1][idxPart]; positionsToFill[indexes[idxPart]*3+1] = sources->getPositions()[1][idxPart];
positionsToFill[indexes[idxPart]*3+2] = sources->getPositions()[2][idxPart]; positionsToFill[indexes[idxPart]*3+2] = sources->getPositions()[2][idxPart];
...@@ -289,9 +289,9 @@ public: ...@@ -289,9 +289,9 @@ public:
void get_positions_xyz_npart(int NbPositions, int * idxOfParticles, double * positionsToFill){ void get_positions_xyz_npart(int NbPositions, int * idxOfParticles, double * positionsToFill){
octree->forEachLeaf([&](LeafClass* leaf){ octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc(); ContainerClass * sources = leaf->getSrc();
const FVector<int>& indexes = sources->getIndexes(); const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles(); int nbPartThere = sources->getNbParticles();
for(int idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){ for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
int iterPart = 0; int iterPart = 0;
bool notFoundYet = true; bool notFoundYet = true;
while(iterPart < NbPositions && notFoundYet){ while(iterPart < NbPositions && notFoundYet){
...@@ -312,9 +312,9 @@ public: ...@@ -312,9 +312,9 @@ public:
void get_positions( int NbPositions, double * X, double * Y , double * Z){ void get_positions( int NbPositions, double * X, double * Y , double * Z){
octree->forEachLeaf([&](LeafClass* leaf){ octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc(); ContainerClass * sources = leaf->getSrc();
const FVector<int>& indexes = sources->getIndexes(); const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles(); int nbPartThere = sources->getNbParticles();
for(int idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){ for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
X[indexes[idxPart]] = sources->getPositions()[0][idxPart]; X[indexes[idxPart]] = sources->getPositions()[0][idxPart];
Y[indexes[idxPart]] = sources->getPositions()[1][idxPart]; Y[indexes[idxPart]] = sources->getPositions()[1][idxPart];
Z[indexes[idxPart]] = sources->getPositions()[2][idxPart]; Z[indexes[idxPart]] = sources->getPositions()[2][idxPart];
...@@ -325,9 +325,9 @@ public: ...@@ -325,9 +325,9 @@ public:
void get_positions_npart(int NbPositions, int * idxOfParticles,double * X, double * Y , double * Z){ void get_positions_npart(int NbPositions, int * idxOfParticles,double * X, double * Y , double * Z){
octree->forEachLeaf([&](LeafClass* leaf){ octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc(); ContainerClass * sources = leaf->getSrc();
const FVector<int>& indexes = sources->getIndexes(); const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles(); int nbPartThere = sources->getNbParticles();
for(int idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){ for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
int iterPart = 0; int iterPart = 0;
bool notFoundYet = true; bool notFoundYet = true;
while(iterPart < NbPositions && notFoundYet){ while(iterPart < NbPositions && notFoundYet){
...@@ -352,9 +352,9 @@ public: ...@@ -352,9 +352,9 @@ public:
void add_to_positions_xyz(int NbPositions,double * updatedXYZ){ void add_to_positions_xyz(int NbPositions,double * updatedXYZ){
octree->forEachLeaf([&](LeafClass* leaf){ octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc(); ContainerClass * sources = leaf->getSrc();
const FVector<int>& indexes = sources->getIndexes(); const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles(); int nbPartThere = sources->getNbParticles();
for(int idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){ for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
sources->getWPositions()[0][idxPart] += updatedXYZ[indexes[idxPart]*3+0]; sources->getWPositions()[0][idxPart] += updatedXYZ[indexes[idxPart]*3+0];
sources->getWPositions()[1][idxPart] += updatedXYZ[indexes[idxPart]*3+1]; sources->getWPositions()[1][idxPart] += updatedXYZ[indexes[idxPart]*3+1];
sources->getWPositions()[2][idxPart] += updatedXYZ[indexes[idxPart]*3+2]; sources->getWPositions()[2][idxPart] += updatedXYZ[indexes[idxPart]*3+2];
...@@ -365,9 +365,9 @@ public: ...@@ -365,9 +365,9 @@ public:
void add_to_positions(int NbPositions,double * X, double * Y , double * Z){ void add_to_positions(int NbPositions,double * X, double * Y , double * Z){
octree->forEachLeaf([&](LeafClass* leaf){ octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc(); ContainerClass * sources = leaf->getSrc();
const FVector<int>& indexes = sources->getIndexes(); const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles(); int nbPartThere = sources->getNbParticles();
for(int idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){ for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
sources->getWPositions()[0][idxPart] += X[indexes[idxPart]]; sources->getWPositions()[0][idxPart] += X[indexes[idxPart]];
sources->getWPositions()[1][idxPart] += Y[indexes[idxPart]]; sources->getWPositions()[1][idxPart] += Y[indexes[idxPart]];
sources->getWPositions()[2][idxPart] += Z[indexes[idxPart]]; sources->getWPositions()[2][idxPart] += Z[indexes[idxPart]];
...@@ -379,9 +379,9 @@ public: ...@@ -379,9 +379,9 @@ public:
void set_positions_xyz(int NbPositions, double * updatedXYZ){ void set_positions_xyz(int NbPositions, double * updatedXYZ){
octree->forEachLeaf([&](LeafClass* leaf){ octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc(); ContainerClass * sources = leaf->getSrc();
const FVector<int>& indexes = sources->getIndexes(); const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles(); int nbPartThere = sources->getNbParticles();
for(int idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){ for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
sources->getWPositions()[0][idxPart] = updatedXYZ[indexes[idxPart]*3+0]; sources->getWPositions()[0][idxPart] = updatedXYZ[indexes[idxPart]*3+0];
sources->getWPositions()[1][idxPart] = updatedXYZ[indexes[idxPart]*3+1]; sources->getWPositions()[1][idxPart] = updatedXYZ[indexes[idxPart]*3+1];
sources->getWPositions()[2][idxPart] = updatedXYZ[indexes[idxPart]*3+2]; sources->getWPositions()[2][idxPart] = updatedXYZ[indexes[idxPart]*3+2];
...@@ -392,9 +392,9 @@ public: ...@@ -392,9 +392,9 @@ public:
void set_positions(int NbPositions, double * X, double * Y, double * Z){ void set_positions(int NbPositions, double * X, double * Y, double * Z){
octree->forEachLeaf([&](LeafClass* leaf){ octree->forEachLeaf([&](LeafClass* leaf){
ContainerClass * sources = leaf->getSrc(); ContainerClass * sources = leaf->getSrc();
const FVector<int>& indexes = sources->getIndexes(); const FVector<FSize>& indexes = leaf->getTargets()->getIndexes();
int nbPartThere = sources->getNbParticles(); int nbPartThere = sources->getNbParticles();
for(int idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){ for(FSize idxPart = 0 ; idxPart<nbPartThere ; ++idxPart){
sources->getWPositions()[0][idxPart] = X[indexes[idxPart]]; sources->getWPositions()[0][idxPart] = X[indexes[idxPart]];
sources->getWPositions()[1][idxPart] = Y[indexes[idxPart]]; sources->getWPositions()[1][idxPart] = Y[indexes[idxPart]];
sources->getWPositions()[2][idxPart] = Z[indexes[idxPart]]; sources->getWPositions()[2][idxPart] = Z[indexes[idxPart]];
......
...@@ -226,9 +226,9 @@ extern "C" void Scalfmm_dealloc_handle(Scalfmm_Handle handle, Callback_free_cell ...@@ -226,9 +226,9 @@ extern "C" void Scalfmm_dealloc_handle(Scalfmm_Handle handle, Callback_free_cell
} }
// Insert a full array of particles. Posisions are xyz.xyz.xyz... // Insert a full array of particles. Posisions are xyz.xyz.xyz...
extern "C" void Scalfmm_insert_array_of_particles(Scalfmm_Handle handle, int nbParticles, int* particleIndexes, double* particleXYZ){ extern "C" void Scalfmm_insert_array_of_particles(Scalfmm_Handle handle, FSize nbParticles, int* particleIndexes, double* particleXYZ){
ScalFmmCoreHandle* corehandle = (ScalFmmCoreHandle*)handle; ScalFmmCoreHandle* corehandle = (ScalFmmCoreHandle*)handle;
for(int idxPart = 0 ; idxPart < nbParticles ; ++idxPart){ for(FSize idxPart = 0 ; idxPart < nbParticles ; ++idxPart){
corehandle->octree->insert(FPoint<FReal>(particleXYZ[idxPart*3],particleXYZ[idxPart*3+1],particleXYZ[idxPart*3+2]), corehandle->octree->insert(FPoint<FReal>(particleXYZ[idxPart*3],particleXYZ[idxPart*3+1],particleXYZ[idxPart*3+2]),
particleIndexes[idxPart]); particleIndexes[idxPart]);
} }
......
...@@ -88,13 +88,13 @@ struct MyData { ...@@ -88,13 +88,13 @@ struct MyData {
// Our P2M // Our P2M
void my_Callback_P2M(void* cellData, int nbParticlesInLeaf, const int* particleIndexes, void* userData){ void my_Callback_P2M(void* cellData, FSize nbParticlesInLeaf, const int* particleIndexes, void* userData){
struct MyData* my_data = (struct MyData*)userData; struct MyData* my_data = (struct MyData*)userData;
my_data->countP2M += 1; my_data->countP2M += 1;
struct MyCellDescriptor* my_cell = (struct MyCellDescriptor*) cellData; struct MyCellDescriptor* my_cell = (struct MyCellDescriptor*) cellData;
VerbosePrint("Cell morton %lld is doing P2M with %d particles :\n", my_cell->mortonIndex, nbParticlesInLeaf); VerbosePrint("Cell morton %lld is doing P2M with %d particles :\n", my_cell->mortonIndex, nbParticlesInLeaf);
int idxPart; FSize idxPart;
for(idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){ for(idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
double* position = &my_data->insertedPositions[particleIndexes[idxPart]*3]; double* position = &my_data->insertedPositions[particleIndexes[idxPart]*3];
VerbosePrint("\t particle idx %d position %e/%e%e\n", particleIndexes[idxPart], VerbosePrint("\t particle idx %d position %e/%e%e\n", particleIndexes[idxPart],
...@@ -152,13 +152,13 @@ void my_Callback_L2L(int level, void* cellData, int childPosition, void* childDa ...@@ -152,13 +152,13 @@ void my_Callback_L2L(int level, void* cellData, int childPosition, void* childDa
// JUST-PUT-HERE: Your L2L // JUST-PUT-HERE: Your L2L
} }
void my_Callback_L2P(void* cellData, int nbParticlesInLeaf, int* particleIndexes, void* userData){ void my_Callback_L2P(void* cellData, FSize nbParticlesInLeaf, int* particleIndexes, void* userData){
struct MyData* my_data = (struct MyData*)userData; struct MyData* my_data = (struct MyData*)userData;
my_data->countL2P += 1; my_data->countL2P += 1;
struct MyCellDescriptor* my_cell = (struct MyCellDescriptor*) cellData; struct MyCellDescriptor* my_cell = (struct MyCellDescriptor*) cellData;
VerbosePrint("Cell morton %lld is doing L2P with %d particles :\n", my_cell->mortonIndex, nbParticlesInLeaf); VerbosePrint("Cell morton %lld is doing L2P with %d particles :\n", my_cell->mortonIndex, nbParticlesInLeaf);
int idxPart; FSize idxPart;
for(idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){ for(idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
double* position = &my_data->insertedPositions[particleIndexes[idxPart]*3]; double* position = &my_data->insertedPositions[particleIndexes[idxPart]*3];
VerbosePrint("\t particle idx %d position %e/%e%e\n", particleIndexes[idxPart], VerbosePrint("\t particle idx %d position %e/%e%e\n", particleIndexes[idxPart],
...@@ -167,12 +167,12 @@ void my_Callback_L2P(void* cellData, int nbParticlesInLeaf, int* particleIndexes ...@@ -167,12 +167,12 @@ void my_Callback_L2P(void* cellData, int nbParticlesInLeaf, int* particleIndexes
} }
} }
void my_Callback_P2P(int nbParticlesInLeaf, const int* particleIndexes, int nbParticlesInSrc, const int* particleIndexesSrc, void* userData){ void my_Callback_P2P(FSize nbParticlesInLeaf, const int* particleIndexes, FSize nbParticlesInSrc, const int* particleIndexesSrc, void* userData){
struct MyData* my_data = (struct MyData*)userData; struct MyData* my_data = (struct MyData*)userData;
my_data->countP2P += 1; my_data->countP2P += 1;
VerbosePrint("Doing P2P between two leaves of %d particles and %d particles :\n", nbParticlesInLeaf, nbParticlesInSrc); VerbosePrint("Doing P2P between two leaves of %d particles and %d particles :\n", nbParticlesInLeaf, nbParticlesInSrc);
int idxPart; FSize idxPart;
for(idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){ for(idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
double* position = &my_data->insertedPositions[particleIndexes[idxPart]*3]; double* position = &my_data->insertedPositions[particleIndexes[idxPart]*3];
VerbosePrint("\t Target >> particle idx %d position %e/%e%e\n", particleIndexes[idxPart], VerbosePrint("\t Target >> particle idx %d position %e/%e%e\n", particleIndexes[idxPart],
...@@ -189,12 +189,12 @@ void my_Callback_P2P(int nbParticlesInLeaf, const int* particleIndexes, int nbPa ...@@ -189,12 +189,12 @@ void my_Callback_P2P(int nbParticlesInLeaf, const int* particleIndexes, int nbPa
// interacting with the target particles // interacting with the target particles
} }
void my_Callback_P2PInner(int nbParticlesInLeaf, int* particleIndexes, void* userData){ void my_Callback_P2PInner(FSize nbParticlesInLeaf, int* particleIndexes, void* userData){
struct MyData* my_data = (struct MyData*)userData; struct MyData* my_data = (struct MyData*)userData;
my_data->countP2PInner += 1; my_data->countP2PInner += 1;
VerbosePrint("Doing P2P inside a leaf of %d particles :\n", nbParticlesInLeaf); VerbosePrint("Doing P2P inside a leaf of %d particles :\n", nbParticlesInLeaf);
int idxPart; FSize idxPart;
for(idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){ for(idxPart = 0 ; idxPart < nbParticlesInLeaf ; ++idxPart){
double* position = &my_data->insertedPositions[particleIndexes[idxPart]*3]; double* position = &my_data->insertedPositions[particleIndexes[idxPart]*3];
VerbosePrint("\t particle idx %d position %e/%e%e\n", particleIndexes[idxPart], VerbosePrint("\t particle idx %d position %e/%e%e\n", particleIndexes[idxPart],
...@@ -217,12 +217,12 @@ int main(int argc, char ** argv){ ...@@ -217,12 +217,12 @@ int main(int argc, char ** argv){
boxCenter[0] = boxCenter[1] = boxCenter[2] = 0.0; boxCenter[0] = boxCenter[1] = boxCenter[2] = 0.0;
// Create random particles // Create random particles
int nbParticles = 10; FSize nbParticles = 10;
int particleIndexes[nbParticles]; int particleIndexes[nbParticles];
double particleXYZ[nbParticles*3]; double particleXYZ[nbParticles*3];
{ {
printf("Creating Particles:\n"); printf("Creating Particles:\n");
int idxPart; FSize idxPart;
for(idxPart = 0 ; idxPart < nbParticles ; ++idxPart){ for(idxPart = 0 ; idxPart < nbParticles ; ++idxPart){
particleIndexes[idxPart] = idxPart; particleIndexes[idxPart] = idxPart;
particleXYZ[idxPart*3] = (random()/(double)(RAND_MAX))*boxWidth - boxWidth/2 + boxCenter[0]; particleXYZ[idxPart*3] = (random()/(double)(RAND_MAX))*boxWidth - boxWidth/2 + boxCenter[0];
......
...@@ -34,7 +34,7 @@ void cheb_free_cell(void * inCell){ ...@@ -34,7 +34,7 @@ void cheb_free_cell(void * inCell){
* @brief Wrapper to FMM operators (refer to CScalfmmApi.h to get the * @brief Wrapper to FMM operators (refer to CScalfmmApi.h to get the
* detailed descriptions) * detailed descriptions)
*/ */
void cheb_p2m(void* cellData, int nbParticlesInLeaf, const int* particleIndexes, void* userData){ void cheb_p2m(void* cellData, FSize nbParticlesInLeaf, const int* particleIndexes, void* userData){
ChebKernel_P2M(cellData,nbParticlesInLeaf,particleIndexes,userData); ChebKernel_P2M(cellData,nbParticlesInLeaf,particleIndexes,userData);
} }
void cheb_m2m(int level, void* parentCell, int childPosition, void* childCell, void* userData){ void cheb_m2m(int level, void* parentCell, int childPosition, void* childCell, void* userData){
...@@ -46,10 +46,10 @@ void cheb_m2l_full(int level, void* targetCell, void* sourceCell[343], void* use ...@@ -46,10 +46,10 @@ void cheb_m2l_full(int level, void* targetCell, void* sourceCell[343], void* use
void cheb_l2l(int level, void* parentCell, int childPosition, void* childCell, void* userData){ void cheb_l2l(int level, void* parentCell, int childPosition, void* childCell, void* userData){
ChebKernel_L2L( level, parentCell, childPosition, childCell, userData); ChebKernel_L2L( level, parentCell, childPosition, childCell, userData);
} }
void cheb_l2p(void* leafCell, int nbParticles, const int* particleIndexes, void* userData){ void cheb_l2p(void* leafCell, FSize nbParticles, const int* particleIndexes, void* userData){
ChebKernel_L2P( leafCell, nbParticles, particleIndexes, userData); ChebKernel_L2P( leafCell, nbParticles, particleIndexes, userData);
} }
void cheb_p2pFull(int nbParticles, const int* particleIndexes, void cheb_p2pFull(FSize nbParticles, const int* particleIndexes,
const int * sourceParticleIndexes[27], int sourceNbPart[27],void* userData) { const int * sourceParticleIndexes[27], int sourceNbPart[27],void* userData) {
ChebKernel_P2P(nbParticles, particleIndexes, sourceParticleIndexes, sourceNbPart, userData); ChebKernel_P2P(nbParticles, particleIndexes, sourceParticleIndexes, sourceNbPart, userData);
} }
...@@ -131,7 +131,7 @@ int main(int argc, char ** av){ ...@@ -131,7 +131,7 @@ int main(int argc, char ** av){
{