Commit 94264c1e authored by BRAMAS Berenger's avatar BRAMAS Berenger

Work in progress to make FReal template - if you pull it will not work

parent 1afca526
...@@ -39,8 +39,8 @@ ...@@ -39,8 +39,8 @@
* templates can be ChebCell/ChebKernel or UnifCell/UnifKernel * templates can be ChebCell/ChebKernel or UnifCell/UnifKernel
*/ */
template<class InterCell,class InterKernel, template<class InterCell,class InterKernel,
class ContainerClass = FP2PParticleContainerIndexed<>, class ContainerClass = FP2PParticleContainerIndexed<FReal>,
class LeafClass = FSimpleLeaf<FP2PParticleContainerIndexed<> >, class LeafClass = FSimpleLeaf<FReal, FP2PParticleContainerIndexed<FReal> >,
class MatrixKernelClass = FInterpMatrixKernelR> class MatrixKernelClass = FInterpMatrixKernelR>
class FInterEngine : public FScalFMMEngine{ class FInterEngine : public FScalFMMEngine{
private: private:
...@@ -76,9 +76,9 @@ public: ...@@ -76,9 +76,9 @@ public:
} }
void build_tree(int TreeHeight, double BoxWidth , double * BoxCenter,User_Scalfmm_Cell_Descriptor notUsedHere){ void build_tree(int TreeHeight, double BoxWidth , double * BoxCenter,User_Scalfmm_Cell_Descriptor notUsedHere){
octree = new OctreeClass(TreeHeight,FMath::Min(3,TreeHeight-1),BoxWidth,FPoint(BoxCenter)); octree = new OctreeClass(TreeHeight,FMath::Min(3,TreeHeight-1),BoxWidth,FPoint<FReal>(BoxCenter));
this->matrix = new MatrixKernelClass(); this->matrix = new MatrixKernelClass();
this->kernel = new InterKernel(TreeHeight,BoxWidth,FPoint(BoxCenter),matrix); this->kernel = new InterKernel(TreeHeight,BoxWidth,FPoint<FReal>(BoxCenter),matrix);
} }
...@@ -95,7 +95,7 @@ public: ...@@ -95,7 +95,7 @@ public:
//Inserting array of position //Inserting array of position
void tree_insert_particles_xyz(int NbPositions, double * XYZ){ void tree_insert_particles_xyz(int NbPositions, double * XYZ){
for(int idPart = 0; idPart<NbPositions ; ++idPart){ for(int idPart = 0; idPart<NbPositions ; ++idPart){
octree->insert(FPoint(&XYZ[3*idPart]),idPart); octree->insert(FPoint<FReal>(&XYZ[3*idPart]),idPart);
} }
nbPart += NbPositions; nbPart += NbPositions;
} }
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
//Inserting arrayS of position //Inserting arrayS of position
void tree_insert_particles(int NbPositions, double * X, double * Y, double * Z){ void tree_insert_particles(int NbPositions, double * X, double * Y, double * Z){
for(int idPart = 0; idPart<NbPositions ; ++idPart){ for(int idPart = 0; idPart<NbPositions ; ++idPart){
octree->insert(FPoint(X[idPart],Y[idPart],Z[idPart]),idPart); octree->insert(FPoint<FReal>(X[idPart],Y[idPart],Z[idPart]),idPart);
} }
nbPart += NbPositions; nbPart += NbPositions;
} }
......
...@@ -223,7 +223,7 @@ struct ScalFmmCoreHandle { ...@@ -223,7 +223,7 @@ struct ScalFmmCoreHandle {
// Read/Write parameter // Read/Write parameter
int treeHeight; // Number of level in the octree int treeHeight; // Number of level in the octree
FReal boxWidth; // Simulation box size (root level) FReal boxWidth; // Simulation box size (root level)
FPoint boxCenter; // Center position of the box simulation(FReal[3]) FPoint<FReal> boxCenter; // Center position of the box simulation(FReal[3])
}; };
ScalFmmCoreConfig config; ScalFmmCoreConfig config;
......
...@@ -16,20 +16,20 @@ extern "C" scalfmm_handle scalfmm_init(/*int TreeHeight,double BoxWidth,double* ...@@ -16,20 +16,20 @@ extern "C" scalfmm_handle scalfmm_init(/*int TreeHeight,double BoxWidth,double*
case 1: case 1:
//TODO typedefs //TODO typedefs
typedef FP2PParticleContainerIndexed<> ContainerClass; typedef FP2PParticleContainerIndexed<FReal> ContainerClass;
typedef FChebCell<7> ChebCell; typedef FChebCell<7> ChebCell;
typedef FInterpMatrixKernelR MatrixKernelClass; typedef FInterpMatrixKernelR<FReal> MatrixKernelClass;
typedef FChebSymKernel<ChebCell,ContainerClass,MatrixKernelClass,7> ChebKernel; typedef FChebSymKernel<ChebCell,ContainerClass,MatrixKernelClass,7> ChebKernel;
handle->engine = new FInterEngine<ChebCell,ChebKernel>(/*TreeHeight,BoxWidth,BoxCenter, */KernelType); handle->engine = new FInterEngine<ChebCell,ChebKernel>(/*TreeHeight,BoxWidth,BoxCenter, */KernelType);
break; break;
// case 2: // case 2:
// //TODO typedefs // //TODO typedefs
// typedef FP2PParticleContainerIndexed<> ContainerClass; // typedef FP2PParticleContainerIndexed<FReal> ContainerClass;
// typedef FUnifCell<7> UnifCell; // typedef FUnifCell<7> UnifCell;
// typedef FInterpMatrixKernelR MatrixKernelClass; // typedef FInterpMatrixKernelR<FReal> MatrixKernelClass;
// typedef FUnifKernel<UnifCell,ContainerClass,MatrixKernelClass,7> UnifKernel; // typedef FUnifKernel<UnifCell,ContainerClass,MatrixKernelClass,7> UnifKernel;
// handle->engine = new FInterEngine<UnifCell,UnifKernel>(/*TreeHeight,BoxWidth,BoxCenter, */KernelType); // handle->engine = new FInterEngine<UnifCell,UnifKernel>(/*TreeHeight,BoxWidth,BoxCenter, */KernelType);
...@@ -90,8 +90,8 @@ extern "C" void ChebCellStruct_free(ChebCellStruct * inCell){ ...@@ -90,8 +90,8 @@ extern "C" void ChebCellStruct_free(ChebCellStruct * inCell){
typedef struct FChebKernel_struct{ typedef struct FChebKernel_struct{
//Be ready full duplication go there !!! //Be ready full duplication go there !!!
FChebSymKernel<FChebCell<7>,FP2PParticleContainerIndexed<>,FInterpMatrixKernelR,7> ** kernel; FChebSymKernel<FChebCell<7>,FP2PParticleContainerIndexed<FReal>,FInterpMatrixKernelR,7> ** kernel;
FInterpMatrixKernelR * matrix; FInterpMatrixKernelR<FReal> * matrix;
} ChebKernelStruct; } ChebKernelStruct;
//Kernel functions //Kernel functions
...@@ -99,14 +99,14 @@ extern "C" ChebKernelStruct * ChebKernelStruct_create(int inTreeHeight, ...@@ -99,14 +99,14 @@ extern "C" ChebKernelStruct * ChebKernelStruct_create(int inTreeHeight,
double inBoxWidth, double inBoxWidth,
double* inBoxCenter){ double* inBoxCenter){
//typedef to lighten the writing //typedef to lighten the writing
typedef FChebSymKernel<FChebCell<7>, FP2PParticleContainerIndexed<>, FInterpMatrixKernelR,7> KernelClass; typedef FChebSymKernel<FChebCell<7>, FP2PParticleContainerIndexed<FReal>, FInterpMatrixKernelR,7> KernelClass;
ChebKernelStruct * newKernel = new ChebKernelStruct(); ChebKernelStruct * newKernel = new ChebKernelStruct();
newKernel->matrix= new FInterpMatrixKernelR(); newKernel->matrix= new FInterpMatrixKernelR();
int nb_threads = omp_get_max_threads(); int nb_threads = omp_get_max_threads();
newKernel->kernel = new KernelClass*[nb_threads]; newKernel->kernel = new KernelClass*[nb_threads];
newKernel->kernel[0]=new KernelClass(inTreeHeight, newKernel->kernel[0]=new KernelClass(inTreeHeight,
inBoxWidth, inBoxWidth,
FPoint(inBoxCenter[0], inBoxCenter[1], inBoxCenter[2]), FPoint<FReal>(inBoxCenter[0], inBoxCenter[1], inBoxCenter[2]),
newKernel->matrix); newKernel->matrix);
for(int idThreads=1 ; idThreads<nb_threads ; ++idThreads){ for(int idThreads=1 ; idThreads<nb_threads ; ++idThreads){
...@@ -128,11 +128,11 @@ extern "C" void ChebKernelStruct_free(void *inKernel){ ...@@ -128,11 +128,11 @@ 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, int nbParticles, const int *particleIndexes, void * inKernel){
//make temporary array of parts //make temporary array of parts
FP2PParticleContainerIndexed<>* tempContainer = new FP2PParticleContainerIndexed<>(); FP2PParticleContainerIndexed<FReal>* tempContainer = new FP2PParticleContainerIndexed<FReal>();
tempContainer->reserve(nbParticles); tempContainer->reserve(nbParticles);
FPoint pos; FPoint<FReal> pos;
for(int i=0 ; i<nbParticles ; ++i){ for(int i=0 ; i<nbParticles ; ++i){
pos = FPoint(reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3 ], pos = FPoint<FReal>(reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3 ],
reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+1], reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+1],
reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+2]); reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+2]);
double Phi = reinterpret_cast<UserData *>(inKernel)->myPhyValues[particleIndexes[i]]; double Phi = reinterpret_cast<UserData *>(inKernel)->myPhyValues[particleIndexes[i]];
...@@ -217,11 +217,11 @@ extern "C" void ChebKernel_L2L(int level, void* parentCell, int childPosition, v ...@@ -217,11 +217,11 @@ extern "C" void ChebKernel_L2L(int level, void* parentCell, int childPosition, v
extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* particleIndexes, void* inKernel){ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* particleIndexes, void* inKernel){
//Create temporary FSimpleLeaf //Create temporary FSimpleLeaf
FP2PParticleContainerIndexed<>* tempContainer = new FP2PParticleContainerIndexed<>(); FP2PParticleContainerIndexed<FReal>* tempContainer = new FP2PParticleContainerIndexed<FReal>();
tempContainer->reserve(nbParticles); tempContainer->reserve(nbParticles);
FPoint pos; FPoint<FReal> pos;
for(int i=0 ; i<nbParticles ; ++i){ for(int i=0 ; i<nbParticles ; ++i){
pos = FPoint(reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3 ], pos = FPoint<FReal>(reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3 ],
reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+1], reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+1],
reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+2]); reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+2]);
double Phi = reinterpret_cast<UserData *>(inKernel)->myPhyValues[particleIndexes[i]]; double Phi = reinterpret_cast<UserData *>(inKernel)->myPhyValues[particleIndexes[i]];
...@@ -258,10 +258,10 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti ...@@ -258,10 +258,10 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti
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
FP2PParticleContainerIndexed<>* tempContTarget = new FP2PParticleContainerIndexed<>(); FP2PParticleContainerIndexed<FReal>* tempContTarget = new FP2PParticleContainerIndexed<FReal>();
tempContTarget->reserve(nbParticles); tempContTarget->reserve(nbParticles);
for(int i=0 ; i<nbParticles ; ++i){ for(int i=0 ; i<nbParticles ; ++i){
FPoint pos = FPoint(reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3 ], FPoint<FReal> pos = FPoint<FReal>(reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3 ],
reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+1], reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+1],
reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+2]); reinterpret_cast<UserData *>(inKernel)->insertedPositions[particleIndexes[i]*3+2]);
double Phi = reinterpret_cast<UserData *>(inKernel)->myPhyValues[particleIndexes[i]]; double Phi = reinterpret_cast<UserData *>(inKernel)->myPhyValues[particleIndexes[i]];
...@@ -269,18 +269,18 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti ...@@ -269,18 +269,18 @@ extern "C" void ChebKernel_L2P(void* leafCell, int nbParticles, const int* parti
} }
//Create 27 FSimpleLeaf for 27 sources //Create 27 FSimpleLeaf for 27 sources
FP2PParticleContainerIndexed<>* tempContSources[27]; FP2PParticleContainerIndexed<FReal>* tempContSources[27];
for(int idSource=0; idSource<27 ; ++idSource){ for(int idSource=0; idSource<27 ; ++idSource){
if(sourceNbPart[idSource] != 0){ if(sourceNbPart[idSource] != 0){
//Create container //Create container
tempContSources[idSource] = new FP2PParticleContainerIndexed<>(); tempContSources[idSource] = new FP2PParticleContainerIndexed<FReal>();
//Allocate memory //Allocate memory
tempContSources[idSource]->reserve(sourceNbPart[idSource]); tempContSources[idSource]->reserve(sourceNbPart[idSource]);
//Store a ptr to the indices of that source leaf //Store a ptr to the indices of that source leaf
const int * indSource = sourceParticleIndexes[idSource]; const int * indSource = sourceParticleIndexes[idSource];
//Then, for each part in this source //Then, for each part in this source
for(int i=0 ; i<sourceNbPart[idSource] ; ++i){ for(int i=0 ; i<sourceNbPart[idSource] ; ++i){
FPoint pos = FPoint(reinterpret_cast<UserData *>(inKernel)->insertedPositions[indSource[i]*3 ], FPoint<FReal> pos = FPoint<FReal>(reinterpret_cast<UserData *>(inKernel)->insertedPositions[indSource[i]*3 ],
reinterpret_cast<UserData *>(inKernel)->insertedPositions[indSource[i]*3+1], reinterpret_cast<UserData *>(inKernel)->insertedPositions[indSource[i]*3+1],
reinterpret_cast<UserData *>(inKernel)->insertedPositions[indSource[i]*3+2]); reinterpret_cast<UserData *>(inKernel)->insertedPositions[indSource[i]*3+2]);
double Phi = reinterpret_cast<UserData *>(inKernel)->myPhyValues[indSource[i]]; double Phi = reinterpret_cast<UserData *>(inKernel)->myPhyValues[indSource[i]];
......
...@@ -203,8 +203,8 @@ class FUserKernelEngine : public FScalFMMEngine{ ...@@ -203,8 +203,8 @@ class FUserKernelEngine : public FScalFMMEngine{
private: private:
//Typedefs : //Typedefs :
typedef FP2PParticleContainerIndexed<> ContainerClass; typedef FP2PParticleContainerIndexed<FReal> ContainerClass;
typedef FSimpleLeaf<ContainerClass> LeafClass; typedef FSimpleLeaf<FReal, ContainerClass> LeafClass;
typedef FOctree<CoreCell,ContainerClass,LeafClass> OctreeClass; typedef FOctree<CoreCell,ContainerClass,LeafClass> OctreeClass;
typedef CoreKernel<CoreCell,ContainerClass> CoreKernelClass; typedef CoreKernel<CoreCell,ContainerClass> CoreKernelClass;
...@@ -223,7 +223,7 @@ private: ...@@ -223,7 +223,7 @@ private:
public: public:
FUserKernelEngine(/*int TreeHeight, double BoxWidth , double * BoxCenter, */scalfmm_kernel_type KernelType) : FUserKernelEngine(/*int TreeHeight, double BoxWidth , double * BoxCenter, */scalfmm_kernel_type KernelType) :
octree(nullptr), kernel(nullptr), arranger(nullptr){ octree(nullptr), kernel(nullptr), arranger(nullptr){
// octree = new OctreeClass(TreeHeight,FMath::Min(3,TreeHeight-1),BoxWidth,FPoint(BoxCenter)); // octree = new OctreeClass(TreeHeight,FMath::Min(3,TreeHeight-1),BoxWidth,FPoint<FReal>(BoxCenter));
kernelType = KernelType; kernelType = KernelType;
//Kernel is not set now because the user must provide a //Kernel is not set now because the user must provide a
//Scalfmm_Kernel_descriptor //Scalfmm_Kernel_descriptor
...@@ -251,12 +251,12 @@ public: ...@@ -251,12 +251,12 @@ public:
void build_tree(int TreeHeight,double BoxWidth,double* BoxCenter,Scalfmm_Cell_Descriptor user_cell_descriptor){ void build_tree(int TreeHeight,double BoxWidth,double* BoxCenter,Scalfmm_Cell_Descriptor user_cell_descriptor){
CoreCell::Init(user_cell_descriptor); CoreCell::Init(user_cell_descriptor);
this->octree = new OctreeClass(TreeHeight,FMath::Min(3,TreeHeight-1),BoxWidth,FPoint(BoxCenter)); this->octree = new OctreeClass(TreeHeight,FMath::Min(3,TreeHeight-1),BoxWidth,FPoint<FReal>(BoxCenter));
} }
void tree_insert_particles( int NbPositions, double * arrayX, double * arrayY, double * arrayZ){ void tree_insert_particles( int NbPositions, double * arrayX, double * arrayY, double * arrayZ){
for(int idPart = 0; idPart<NbPositions ; ++idPart){ for(int idPart = 0; idPart<NbPositions ; ++idPart){
octree->insert(FPoint(arrayX[idPart],arrayY[idPart],arrayZ[idPart]),idPart); octree->insert(FPoint<FReal>(arrayX[idPart],arrayY[idPart],arrayZ[idPart]),idPart);
} }
nbPart += NbPositions; nbPart += NbPositions;
this->init_cell(); this->init_cell();
...@@ -264,7 +264,7 @@ public: ...@@ -264,7 +264,7 @@ public:
void tree_insert_particles_xyz( int NbPositions, double * XYZ){ void tree_insert_particles_xyz( int NbPositions, double * XYZ){
for(int idPart = 0; idPart<NbPositions ; ++idPart){ for(int idPart = 0; idPart<NbPositions ; ++idPart){
octree->insert(FPoint(&XYZ[3*idPart]),idPart); octree->insert(FPoint<FReal>(&XYZ[3*idPart]),idPart);
} }
nbPart += NbPositions; nbPart += NbPositions;
this->init_cell(); this->init_cell();
...@@ -430,7 +430,7 @@ public: ...@@ -430,7 +430,7 @@ public:
void init_cell(){ void init_cell(){
double boxwidth = octree->getBoxWidth(); double boxwidth = octree->getBoxWidth();
FPoint BoxCenter = octree->getBoxCenter(); FPoint<FReal> BoxCenter = octree->getBoxCenter();
double boxCorner[3]; double boxCorner[3];
boxCorner[0] = BoxCenter.getX() - boxwidth/2.0; boxCorner[0] = BoxCenter.getX() - boxwidth/2.0;
boxCorner[1] = BoxCenter.getY() - boxwidth/2.0; boxCorner[1] = BoxCenter.getY() - boxwidth/2.0;
......
...@@ -152,7 +152,7 @@ public: ...@@ -152,7 +152,7 @@ public:
// Here are all the type definition // Here are all the type definition
typedef FBasicParticleContainer<1, int> CoreContainerClass; typedef FBasicParticleContainer<1, int> CoreContainerClass;
typedef FSimpleLeaf<CoreContainerClass > LeafClass; typedef FSimpleLeaf<FReal, CoreContainerClass > LeafClass;
typedef FOctree<CoreCell, CoreContainerClass , LeafClass > OctreeClass; typedef FOctree<CoreCell, CoreContainerClass , LeafClass > OctreeClass;
typedef CoreKernel<CoreCell, CoreContainerClass> CoreKernelClass; typedef CoreKernel<CoreCell, CoreContainerClass> CoreKernelClass;
typedef FFmmAlgorithmThread<OctreeClass, CoreCell, CoreContainerClass, CoreKernelClass, LeafClass > FmmClassThread; typedef FFmmAlgorithmThread<OctreeClass, CoreCell, CoreContainerClass, CoreKernelClass, LeafClass > FmmClassThread;
...@@ -164,7 +164,7 @@ struct ScalFmmCoreHandle { ...@@ -164,7 +164,7 @@ struct ScalFmmCoreHandle {
// Read/Write parameter // Read/Write parameter
int treeHeight; // Number of level in the octree int treeHeight; // Number of level in the octree
FReal boxWidth; // Simulation box size (root level) FReal boxWidth; // Simulation box size (root level)
FPoint boxCenter; // Center position of the box simulation(FReal[3]) FPoint<FReal> boxCenter; // Center position of the box simulation(FReal[3])
}; };
ScalFmmCoreConfig config; ScalFmmCoreConfig config;
...@@ -179,7 +179,7 @@ extern "C" Scalfmm_Handle Scalfmm_init_handle(int treeHeight, double boxWidth, d ...@@ -179,7 +179,7 @@ extern "C" Scalfmm_Handle Scalfmm_init_handle(int treeHeight, double boxWidth, d
corehandle->config.treeHeight = treeHeight; corehandle->config.treeHeight = treeHeight;
corehandle->config.boxWidth = boxWidth; corehandle->config.boxWidth = boxWidth;
corehandle->config.boxCenter = FPoint(boxCenter[0],boxCenter[1],boxCenter[2]); corehandle->config.boxCenter = FPoint<FReal>(boxCenter[0],boxCenter[1],boxCenter[2]);
corehandle->octree = new OctreeClass(corehandle->config.treeHeight, FMath::Min(3,corehandle->config.treeHeight-1), corehandle->octree = new OctreeClass(corehandle->config.treeHeight, FMath::Min(3,corehandle->config.treeHeight-1),
corehandle->config.boxWidth, corehandle->config.boxCenter); corehandle->config.boxWidth, corehandle->config.boxCenter);
...@@ -229,7 +229,7 @@ extern "C" void Scalfmm_dealloc_handle(Scalfmm_Handle handle, Callback_free_cell ...@@ -229,7 +229,7 @@ extern "C" void Scalfmm_dealloc_handle(Scalfmm_Handle handle, Callback_free_cell
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, int nbParticles, int* particleIndexes, double* particleXYZ){
ScalFmmCoreHandle* corehandle = (ScalFmmCoreHandle*)handle; ScalFmmCoreHandle* corehandle = (ScalFmmCoreHandle*)handle;
for(int idxPart = 0 ; idxPart < nbParticles ; ++idxPart){ for(int idxPart = 0 ; idxPart < nbParticles ; ++idxPart){
corehandle->octree->insert(FPoint(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]);
} }
} }
...@@ -237,7 +237,7 @@ extern "C" void Scalfmm_insert_array_of_particles(Scalfmm_Handle handle, int nbP ...@@ -237,7 +237,7 @@ extern "C" void Scalfmm_insert_array_of_particles(Scalfmm_Handle handle, int nbP
// Push one particle in the tree // Push one particle in the tree
extern "C" void Scalfmm_one_particle(Scalfmm_Handle handle, int particleIndex, double x, double y, double z){ extern "C" void Scalfmm_one_particle(Scalfmm_Handle handle, int particleIndex, double x, double y, double z){
ScalFmmCoreHandle* corehandle = (ScalFmmCoreHandle*)handle; ScalFmmCoreHandle* corehandle = (ScalFmmCoreHandle*)handle;
corehandle->octree->insert(FPoint(x,y,z), particleIndex); corehandle->octree->insert(FPoint<FReal>(x,y,z), particleIndex);
} }
// Execute a kernel (by using the user functions callback). // Execute a kernel (by using the user functions callback).
......
...@@ -242,7 +242,7 @@ public: ...@@ -242,7 +242,7 @@ public:
return indexes.getSize(); return indexes.getSize();
} }
void push(const FPoint& partPosition, const int partIndex){ void push(const FPoint<FReal>& partPosition, const int partIndex){
positions.push(partPosition.getX()); positions.push(partPosition.getX());
positions.push(partPosition.getY()); positions.push(partPosition.getY());
positions.push(partPosition.getZ()); positions.push(partPosition.getZ());
...@@ -254,7 +254,7 @@ public: ...@@ -254,7 +254,7 @@ public:
typedef CoreVector CoreContainerClass; typedef CoreVector CoreContainerClass;
typedef CoreCell<CoreContainerClass> CoreCellClass; typedef CoreCell<CoreContainerClass> CoreCellClass;
typedef FSimpleLeaf<CoreContainerClass > LeafClass; typedef FSimpleLeaf<FReal, CoreContainerClass > LeafClass;
typedef FOctree<CoreCellClass, CoreContainerClass , LeafClass > OctreeClass; typedef FOctree<CoreCellClass, CoreContainerClass , LeafClass > OctreeClass;
typedef CoreKernel<CoreCellClass, CoreContainerClass> CoreKernelClass; typedef CoreKernel<CoreCellClass, CoreContainerClass> CoreKernelClass;
...@@ -533,7 +533,7 @@ int FmmCore_setPositions(void *fmmCore, int *nb, FReal *position) { ...@@ -533,7 +533,7 @@ int FmmCore_setPositions(void *fmmCore, int *nb, FReal *position) {
ScalFmmCoreHandle* corehandle = (ScalFmmCoreHandle*)fmmCore; ScalFmmCoreHandle* corehandle = (ScalFmmCoreHandle*)fmmCore;
corehandle->octree = new OctreeClass(corehandle->config.treeHeight, FMath::Min(3,corehandle->config.treeHeight-1), corehandle->octree = new OctreeClass(corehandle->config.treeHeight, FMath::Min(3,corehandle->config.treeHeight-1),
corehandle->config.boxWidth, FPoint(corehandle->config.boxCenter)); corehandle->config.boxWidth, FPoint<FReal>(corehandle->config.boxCenter));
if( corehandle->config.nbThreads != 0){ if( corehandle->config.nbThreads != 0){
omp_set_num_threads(corehandle->config.nbThreads); omp_set_num_threads(corehandle->config.nbThreads);
...@@ -541,7 +541,7 @@ int FmmCore_setPositions(void *fmmCore, int *nb, FReal *position) { ...@@ -541,7 +541,7 @@ int FmmCore_setPositions(void *fmmCore, int *nb, FReal *position) {
for(int idxPart = 0 ; idxPart < (*nb) ; ++idxPart){ for(int idxPart = 0 ; idxPart < (*nb) ; ++idxPart){
const FReal* pos = &position[idxPart * 3]; const FReal* pos = &position[idxPart * 3];
corehandle->octree->insert(FPoint(pos[0], pos[1], pos[2]),idxPart); corehandle->octree->insert(FPoint<FReal>(pos[0], pos[1], pos[2]),idxPart);
} }
return FMMAPI_NO_ERROR; return FMMAPI_NO_ERROR;
...@@ -581,7 +581,7 @@ int FmmCore_doComputation(void *fmmCore) { ...@@ -581,7 +581,7 @@ int FmmCore_doComputation(void *fmmCore) {
ScalFmmCoreHandle* corehandle = (ScalFmmCoreHandle*)fmmCore; ScalFmmCoreHandle* corehandle = (ScalFmmCoreHandle*)fmmCore;
{ // Ceck if there is number of NbPart summed at level 1 { // Ceck if there is number of NbPart summed at level 1
FPoint corner = corehandle->octree->getBoxCenter(); FPoint<FReal> corner = corehandle->octree->getBoxCenter();
corner -= (corehandle->octree->getBoxWidth()/2); corner -= (corehandle->octree->getBoxWidth()/2);
FReal boxWidth = corehandle->octree->getBoxWidth()/( 1<< (corehandle->config.treeHeight-1) ); FReal boxWidth = corehandle->octree->getBoxWidth()/( 1<< (corehandle->config.treeHeight-1) );
...@@ -599,7 +599,7 @@ int FmmCore_doComputation(void *fmmCore) { ...@@ -599,7 +599,7 @@ int FmmCore_doComputation(void *fmmCore) {
octreeIterator.getCurrentCell()->createArrays(multipoleSize, localSize); octreeIterator.getCurrentCell()->createArrays(multipoleSize, localSize);
octreeIterator.getCurrentCell()->setLevel(idxLevel); octreeIterator.getCurrentCell()->setLevel(idxLevel);
const FTreeCoordinate coord = octreeIterator.getCurrentCell()->getCoordinate(); const FTreeCoordinate coord = octreeIterator.getCurrentCell()->getCoordinate();
FPoint position( coord.getX()*boxWidth + boxWidth/2.0 + corner.getX(), FPoint<FReal> position( coord.getX()*boxWidth + boxWidth/2.0 + corner.getX(),
coord.getY()*boxWidth + boxWidth/2.0 + corner.getY(), coord.getY()*boxWidth + boxWidth/2.0 + corner.getY(),
coord.getZ()*boxWidth + boxWidth/2.0 + corner.getZ()); coord.getZ()*boxWidth + boxWidth/2.0 + corner.getZ());
octreeIterator.getCurrentCell()->setPosition(position.getDataValue()); octreeIterator.getCurrentCell()->setPosition(position.getDataValue());
......
...@@ -26,29 +26,29 @@ ...@@ -26,29 +26,29 @@
////////////////////// Opérateurs FMM Kernel : ////////////////////////// ////////////////////// Opérateurs FMM Kernel : //////////////////////////
class KernelCell : public FBasicCell { class KernelCell : public FBasicCell {
FComplex* multipole; FComplex<FReal>* multipole;