Commit 550d3cff authored by BRAMAS Berenger's avatar BRAMAS Berenger

Make it compile for the new FREal

parent 2533757d
......@@ -51,7 +51,7 @@ private:
//Typedef on Octree Arranger, in order to clarify following code
typedef FBasicParticleContainerIndexedMover<OctreeClass, ContainerClass> MoverClass;
typedef FOctreeArranger<OctreeClass, ContainerClass, MoverClass> ArrangerClass;
typedef FOctreeArranger<FReal,OctreeClass, ContainerClass, MoverClass> ArrangerClass;
typedef FArrangerPeriodic<OctreeClass, ContainerClass, MoverClass> ArrangerClassPeriodic;
//Pointer to the kernel to be executed
......@@ -553,7 +553,7 @@ public:
}
case 2:
{
typedef FFmmAlgorithmPeriodic<OctreeClass,InterCell,ContainerClass,InterKernel,LeafClass> AlgoClassPeriodic;
typedef FFmmAlgorithmPeriodic<FReal,OctreeClass,InterCell,ContainerClass,InterKernel,LeafClass> AlgoClassPeriodic;
AlgoClassPeriodic algoPeriod(octree,2);
algoPeriod.setKernel(kernel);
algoPeriod.execute();
......
......@@ -210,7 +210,7 @@ private:
//For arranger classes
typedef FBasicParticleContainerIndexedMover<OctreeClass, ContainerClass> MoverClass;
typedef FOctreeArranger<OctreeClass, ContainerClass, MoverClass> ArrangerClass;
typedef FOctreeArranger<FReal,OctreeClass, ContainerClass, MoverClass> ArrangerClass;
typedef FArrangerPeriodic<OctreeClass, ContainerClass, MoverClass> ArrangerClassPeriodic;
......@@ -479,7 +479,7 @@ public:
}
case 2:
{
typedef FFmmAlgorithmPeriodic<OctreeClass,CoreCell,ContainerClass,CoreKernelClass,LeafClass> AlgoClassPeriodic;
typedef FFmmAlgorithmPeriodic<FReal,OctreeClass,CoreCell,ContainerClass,CoreKernelClass,LeafClass> AlgoClassPeriodic;
AlgoClassPeriodic algoPeriod(octree,2);
algoPeriod.setKernel(kernel);
algoPeriod.execute();
......
......@@ -98,11 +98,11 @@ int main(int argc, char* argv[])
// open particle file
////////////////////////////////////////////////////////////////////
//
typedef double FReal;
FFmaGenericLoader<FReal> loader(filename);
//
////////////////////////////////////////////////////////////////////
// begin Lagrange kernel
typedef double FReal;
// accuracy
const unsigned int ORDER = 7;
// typedefs
......@@ -216,7 +216,7 @@ int main(int argc, char* argv[])
// -----------------------------------------------------
if(FParameters::existParameter(argc, argv, FParameterDefinitions::OutputFile.options)){
std::string name(FParameters::getStr(argc,argv,FParameterDefinitions::OutputFile.options, "output.fma"));
FFmaGenericWriter writer(name) ;
FFmaGenericWriter<FReal> writer(name) ;
//
int NbPoints = loader.getNumberOfParticles();
FReal * particles ;
......
......@@ -169,7 +169,7 @@ void adaptiveTreeBuildLists(OctreeClass & tree) {
}
};
/////////////////////////////////////////////////////////////////////////////////////////
//! \fn setGlobalID(FOctree< FAdaptCell, FBasicParticleContainer<0> , FSimpleLeaf<FReal, FBasicParticleContainer<0>> > & tree) {
//! \fn setGlobalID(FOctree< FAdaptCell, FBasicParticleContainer<FReal,0,FReal> , FSimpleLeaf<FReal, FBasicParticleContainer<FReal,0,FReal>> > & tree) {
/////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -135,10 +135,10 @@ public:
//
// // set child info
// FPoint<FReal> ChildRoots[nnodes], localChildRoots[nnodes];
// FUnifTensor<ORDER>::setRoots(subCellCenter, subCellWidth, ChildRoots);
// FUnifTensor<FReal,ORDER>::setRoots(subCellCenter, subCellWidth, ChildRoots);
//
// // map global position of roots to local position in parent cell
// const map_glob_loc map(poleCellCenter, poleCellWidth);
// const map_glob_loc<FReal> map(poleCellCenter, poleCellWidth);
// for (unsigned int n=0; n<nnodes; ++n)
// map(ChildRoots[n], localChildRoots[n]);
//
......@@ -151,11 +151,11 @@ public:
// Set sub-child coords
FReal globalChildCoords[3][ORDER];
FUnifTensor<order>::setPolynomialsRoots(subCellCenter, subCellWidth, globalChildCoords);
FUnifTensor<FReal,order>::setPolynomialsRoots(subCellCenter, subCellWidth, globalChildCoords);
// Map global position of sub-child nodes to [-1,1]
FReal localChildCoords[3][ORDER];
const map_glob_loc map(poleCellCenter, poleCellWidth);
const map_glob_loc<FReal> map(poleCellCenter, poleCellWidth);
FPoint<FReal> localChildPoints;
for (unsigned int n=0; n<ORDER; ++n) {
map(FPoint<FReal>(globalChildCoords[0][n],globalChildCoords[1][n],globalChildCoords[2][n]), localChildPoints);
......@@ -225,7 +225,7 @@ public:
// std::cout << " call P2L localLevel "<< localLevel << " localCellCenter "<< localCellCenter <<std::endl;
// interpolation points of target (X) cell
FPoint<FReal> X[nnodes];
FUnifTensor<order>::setRoots(localCellCenter, localCellWidth, X);
FUnifTensor<FReal,order>::setRoots(localCellCenter, localCellWidth, X);
// read positions
const FReal*const positionsX = particles->getPositions()[0];
......@@ -265,8 +265,8 @@ public:
// interpolation points of source (Y) and target (X) cell
FPoint<FReal> X[nnodes], Y[nnodes];
FUnifTensor<order>::setRoots(poleCellCenter, poleCellWidth, Y);
FUnifTensor<order>::setRoots(localCellCenter, localCellWidth, X);
FUnifTensor<FReal,order>::setRoots(poleCellCenter, poleCellWidth, Y);
FUnifTensor<FReal,order>::setRoots(localCellCenter, localCellWidth, X);
for(int idxRhs = 0 ; idxRhs < NVALS ; ++idxRhs){
......@@ -290,7 +290,7 @@ public:
// interpolation points of source (Y) cell
FPoint<FReal> Y[nnodes];
FUnifTensor<order>::setRoots(poleCellCenter, poleCellWidth, Y);
FUnifTensor<FReal,order>::setRoots(poleCellCenter, poleCellWidth, Y);
// read positions
const FReal*const positionsX = particles->getPositions()[0];
......@@ -347,10 +347,10 @@ public:
//
// // set child info
// FPoint<FReal> ChildRoots[nnodes], localChildRoots[nnodes];
// FUnifTensor<ORDER>::setRoots(subCellCenter, subCellWidth, ChildRoots);
// FUnifTensor<FReal,ORDER>::setRoots(subCellCenter, subCellWidth, ChildRoots);
//
// // map global position of roots to local position in parent cell
// const map_glob_loc map(localCenter, localWidth);
// const map_glob_loc<FReal> map(localCenter, localWidth);
// for (unsigned int n=0; n<nnodes; ++n)
// map(ChildRoots[n], localChildRoots[n]);
//
......@@ -361,11 +361,11 @@ public:
/// p^4 version
// Set sub-child coords
FReal globalChildCoords[3][ORDER];
FUnifTensor<order>::setPolynomialsRoots(subCellCenter, subCellWidth, globalChildCoords);
FUnifTensor<FReal,order>::setPolynomialsRoots(subCellCenter, subCellWidth, globalChildCoords);
// Map global position of sub-child nodes to [-1,1]
FReal localChildCoords[3][ORDER];
const map_glob_loc map(localCenter, localWidth);
const map_glob_loc<FReal> map(localCenter, localWidth);
FPoint<FReal> localChildPoints;
for (unsigned int n=0; n<ORDER; ++n) {
map(FPoint<FReal>(globalChildCoords[0][n],globalChildCoords[1][n],globalChildCoords[2][n]), localChildPoints);
......@@ -448,7 +448,7 @@ public:
void P2P(ContainerClass* target, const ContainerClass* sources) override {
ContainerClass* sourcesArray[27] = { const_cast<ContainerClass*> (sources) };
DirectInteractionComputer<MatrixKernelClass::NCMP, NVALS>::template P2PRemote(target,sourcesArray,1,MatrixKernel);
DirectInteractionComputer<FReal,MatrixKernelClass::NCMP, NVALS>::template P2PRemote(target,sourcesArray,1,MatrixKernel);
}
bool preferP2M(const ContainerClass* const particles) override {
......
......@@ -16,7 +16,7 @@
#ifndef FABSTRACTLEAFINTERFACE_HPP
#define FABSTRACTLEAFINTERFACE_HPP
template<class OctreeClass,class ParticleClass>
template<class FReal,class OctreeClass,class ParticleClass>
class FAbstractMover{
public:
virtual void getParticlePosition(ParticleClass* lf, const int idxPart, FPoint<FReal>* particlePos) = 0;
......
......@@ -21,7 +21,7 @@
#include "Arranger/FOctreeArranger.hpp"
template <class FReal, class OctreeClass, class ContainerClass, class LeafInterface >
class FArrangerPeriodic : public FOctreeArranger<OctreeClass,ContainerClass,LeafInterface>{
class FArrangerPeriodic : public FOctreeArranger<FReal,OctreeClass,ContainerClass,LeafInterface>{
FReal getPeriodicPos(FReal pos, PeriodicCondition periodicPlus, PeriodicCondition periodicMinus,FReal maxDir,FReal minDir,const int dir){
FReal res = pos;
......@@ -41,7 +41,7 @@ class FArrangerPeriodic : public FOctreeArranger<OctreeClass,ContainerClass,Leaf
public:
FArrangerPeriodic(OctreeClass * octree) : FOctreeArranger<OctreeClass,ContainerClass,LeafInterface>(octree){
FArrangerPeriodic(OctreeClass * octree) : FOctreeArranger<FReal,OctreeClass,ContainerClass,LeafInterface>(octree){
}
// To put in inhereed class
......
......@@ -7,8 +7,8 @@
* This class should be use with the octree arrange to move particles
* that are stored in a FBasicParticleContainer
*/
template<class OctreeClass, class ContainerClass >
class FBasicParticleContainerIndexedMover : public FAbstractMover<OctreeClass, ContainerClass>{
template<class FReal, class OctreeClass, class ContainerClass >
class FBasicParticleContainerIndexedMover : public FAbstractMover<FReal,OctreeClass, ContainerClass>{
private:
ContainerClass toStoreRemovedParts;
......
......@@ -8,8 +8,8 @@
* This class should be use with the octree arrange to move particles
* that are typed (src/tgt) and stored in a FBasicParticleContainer
*/
template<class OctreeClass, class ContainerClass >
class FParticleTypedIndexedMover : public FAbstractMover<OctreeClass, ContainerClass>{
template<class FReal, class OctreeClass, class ContainerClass >
class FParticleTypedIndexedMover : public FAbstractMover<FReal, OctreeClass, ContainerClass>{
private:
ContainerClass toStoreRemovedSourceParts;
ContainerClass toStoreRemovedTargetParts;
......
......@@ -15,7 +15,7 @@ namespace FParForEachOctree {
* @brief forEachLeaf iterate on the leaf and apply the function
* @param function
*/
template< template< class CellClass, class ContainerClass, class LeafClass, class CellAllocatorClass > class FOctree,
template< class FReal, template<class FReal, class CellClass, class ContainerClass, class LeafClass, class CellAllocatorClass > class FOctree,
class CellClass, class ContainerClass, class LeafClass, class CellAllocatorClass,
class FunctionTemplate>
void forEachLeaf(FOctree<FReal, CellClass,ContainerClass,LeafClass,CellAllocatorClass>* tree, FunctionTemplate function){
......@@ -43,7 +43,7 @@ void forEachLeaf(FOctree<FReal, CellClass,ContainerClass,LeafClass,CellAllocator
* @brief forEachLeaf iterate on the cell and apply the function
* @param function
*/
template< template< class CellClass, class ContainerClass, class LeafClass, class CellAllocatorClass > class FOctree,
template< class FReal, template<class FReal, class CellClass, class ContainerClass, class LeafClass, class CellAllocatorClass > class FOctree,
class CellClass, class ContainerClass, class LeafClass, class CellAllocatorClass,
class FunctionTemplate>
void forEachCell(FOctree<FReal, CellClass,ContainerClass,LeafClass,CellAllocatorClass>* tree, FunctionTemplate function){
......@@ -77,7 +77,7 @@ void forEachCell(FOctree<FReal, CellClass,ContainerClass,LeafClass,CellAllocator
* @brief forEachLeaf iterate on the cell and apply the function
* @param function
*/
template< template< class CellClass, class ContainerClass, class LeafClass, class CellAllocatorClass > class FOctree,
template< class FReal, template<class FReal, class CellClass, class ContainerClass, class LeafClass, class CellAllocatorClass > class FOctree,
class CellClass, class ContainerClass, class LeafClass, class CellAllocatorClass,
class FunctionTemplate>
void forEachCellWithLevel(FOctree<FReal, CellClass,ContainerClass,LeafClass,CellAllocatorClass>* tree, FunctionTemplate function){
......@@ -111,7 +111,7 @@ void forEachCellWithLevel(FOctree<FReal, CellClass,ContainerClass,LeafClass,Cell
* @brief forEachLeaf iterate on the cell and apply the function
* @param function
*/
template< template< class CellClass, class ContainerClass, class LeafClass, class CellAllocatorClass > class FOctree,
template< class FReal, template<class FReal, class CellClass, class ContainerClass, class LeafClass, class CellAllocatorClass > class FOctree,
class CellClass, class ContainerClass, class LeafClass, class CellAllocatorClass,
class FunctionTemplate>
void forEachCellLeaf(FOctree<FReal, CellClass,ContainerClass,LeafClass,CellAllocatorClass>* tree, FunctionTemplate function){
......
......@@ -91,7 +91,7 @@ public:
return new FFmmAlgorithmThreadProc<OctreeClass, CellClass, ContainerClass, KernelClass, LeafClass>(FMpi::FComm(mpiComm), tree, kernel);
}
else{
auto algo = new FFmmAlgorithmThreadProcPeriodic<OctreeClass, CellClass, ContainerClass, KernelClass, LeafClass>(FMpi::FComm(mpiComm), tree, periodicUpperlevel);
auto algo = new FFmmAlgorithmThreadProcPeriodic<FReal, OctreeClass, CellClass, ContainerClass, KernelClass, LeafClass>(FMpi::FComm(mpiComm), tree, periodicUpperlevel);
algo->setKernel(kernel);
return algo;
}
......@@ -100,7 +100,7 @@ public:
return new FFmmAlgorithmThread<OctreeClass, CellClass, ContainerClass, KernelClass, LeafClass>(tree, kernel);
}
else{
auto algo = new FFmmAlgorithmPeriodic<OctreeClass, CellClass, ContainerClass, KernelClass, LeafClass>(tree, periodicUpperlevel);
auto algo = new FFmmAlgorithmPeriodic<FReal,OctreeClass, CellClass, ContainerClass, KernelClass, LeafClass>(tree, periodicUpperlevel);
algo->setKernel(kernel);
return algo;
}
......
......@@ -50,7 +50,7 @@
* @endcode
*/
template <class FReal>
class FBasicLoader : public FAbstractLoader {
class FBasicLoader : public FAbstractLoader<FReal> {
protected:
std::ifstream file; //< The file to read
FPoint<FReal> centerOfBox; //< The center of box read from file
......
......@@ -511,7 +511,7 @@ private:
*
* \code
* // Instanciate the writer with a binary fma file (extension .bfma).
* FFmaGenericWriter writer ("data.bfma");
* FFmaGenericWriter<FReal> writer ("data.bfma");
*
* // Write the header of the file.
* writer.writeHeader(loader.getCenterOfBox(), loader.getBoxWidth(), NbPoints, sizeof(FReal), nbData);
......@@ -678,7 +678,7 @@ public:
* FmaRParticle * particles = new FmaRParticle[nbParticles];
* memset(particles, 0, sizeof(FmaRParticle) * nbParticles) ;
* ...
* FFmaGenericWriter writer(filenameOut) ;
* FFmaGenericWriter<FReal> writer(filenameOut) ;
* Fwriter.writeHeader(Centre,BoxWith, nbParticles,*particles) ;
* Fwriter.writeArrayOfParticles(particles, nbParticles);
* \endcode
......@@ -689,7 +689,7 @@ public:
* memset(particles, 0, sizeof(FmaRParticle) * nbParticles) ;
* ...
* FmaBasicParticle *ppart = (FmaBasicParticle*)(&particles[0]);
* FFmaGenericWriter writer(filenameOut) ;
* FFmaGenericWriter<FReal> writer(filenameOut) ;
* writer.writeHeader(Centre,BoxWith, nbParticles,*particles) ;
* writer.writeArrayOfParticles(particles, nbParticles);
* \endcode
......@@ -748,7 +748,7 @@ public:
* FmaRParticle * const particles = new FmaRParticle[nbParticles];
* memset(particles, 0, sizeof(FmaRParticle) * nbParticles) ;
* ...
* FFmaGenericWriter writer(filenameOut) ;
* FFmaGenericWriter<FReal> writer(filenameOut) ;
* Fwriter.writeHeader(Centre,BoxWith, nbParticles,*particles) ;
* Fwriter.writeArrayOfReal(particles, nbParticles);
* \endcode
......
......@@ -83,7 +83,7 @@ public:
/** Should be used to insert a FBasicParticleContainer class */
template < unsigned NbAttributes, class AttributeClass>
static void BuildTreeFromArray(OctreeClass*const tree, const FBasicParticleContainer<NbAttributes, AttributeClass>& particlesContainers,
static void BuildTreeFromArray(OctreeClass*const tree, const FBasicParticleContainer<FReal, NbAttributes, AttributeClass>& particlesContainers,
bool isAlreadySorted=false){
const FSize numberOfParticle = particlesContainers.getNbParticles();
// If the parts are already sorted, no need to sort again
......
......@@ -8,7 +8,7 @@
#include "../../Kernels/Uniform//FUnifTensor.hpp"
#include "../../Utils/FComplex.hpp"
typedef FBasicCellPOD FTestCellPODCore;
typedef FBasicCellPOD FUnifCellPODCore;
template <class FReal, int ORDER, int NRHS = 1, int NLHS = 1, int NVALS = 1>
struct alignas(FStarPUDefaultAlign::StructAlign) FUnifCellPODPole {
......
......@@ -279,11 +279,11 @@ public:
* Handler to deal with all symmetries: Stores permutation indices and vectors
* to reduce 343 different interactions to 16 only.
*/
template < class CellClass,
template <class FReal, class CellClass,
class ContainerClass,
class MatrixKernelClass,
int ORDER>
struct FChebFlopsSymKernel<CellClass, ContainerClass, MatrixKernelClass, ORDER>
struct FChebFlopsSymKernel<FReal, CellClass, ContainerClass, MatrixKernelClass, ORDER>
::SymmetryHandler
{
// M2L operators
......
......@@ -1632,7 +1632,7 @@ inline void FChebInterpolator<FReal, ORDER,MatrixKernelClass,NVALS>::applyL2PTot
//FReal T_of_y[ORDER * (ORDER-1)];
//for (unsigned int o=1; o<ORDER; ++o)
// for (unsigned int j=0; j<ORDER; ++j)
// T_of_y[(o-1)*ORDER + j] = FReal(FChebRoots<ORDER>::T(o, FReal(FChebRoots<ORDER>::roots[j])));
// T_of_y[(o-1)*ORDER + j] = FReal(FChebRoots<FReal,ORDER>::T(o, FReal(FChebRoots<FReal,ORDER>::roots[j])));
//struct SumP2M {
// unsigned int f2[3][nnodes], f4[3][nnodes];
......
......@@ -229,14 +229,14 @@ public:
ContainerClass* const NeighborSourceParticles[27],
const int /* size */)
{
DirectInteractionComputer<MatrixKernelClass::NCMP, NVALS>::P2P(TargetParticles,NeighborSourceParticles,MatrixKernel);
DirectInteractionComputer<FReal, MatrixKernelClass::NCMP, NVALS>::P2P(TargetParticles,NeighborSourceParticles,MatrixKernel);
}
void P2PRemote(const FTreeCoordinate& /*inPosition*/,
ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict /*inSources*/,
ContainerClass* const inNeighbors[27], const int /*inSize*/){
DirectInteractionComputer<MatrixKernelClass::NCMP, NVALS>::P2PRemote(inTargets,inNeighbors,27,MatrixKernel);
DirectInteractionComputer<FReal, MatrixKernelClass::NCMP, NVALS>::P2PRemote(inTargets,inNeighbors,27,MatrixKernel);
}
};
......
......@@ -194,8 +194,8 @@ public:
};
template <int ORDER, class MatrixKernelClass>
class FChebTensorialM2LHandler<ORDER,MatrixKernelClass,NON_HOMOGENEOUS> : FNoCopyable
template <class FReal, int ORDER, class MatrixKernelClass>
class FChebTensorialM2LHandler<FReal,ORDER,MatrixKernelClass,NON_HOMOGENEOUS> : FNoCopyable
{
enum {order = ORDER,
nnodes = TensorTraits<ORDER>::nnodes,
......@@ -264,7 +264,7 @@ public:
rank[0]=rank[1]=0;
for (unsigned int l=2; l<TreeHeight; ++l) {
// compute m2l operator on extended cell
rank[l] = ComputeAndCompress<order>(MatrixKernel, CellWidth, CellWidthExtension, epsilon, U[l], C[l], B[l]);
rank[l] = ComputeAndCompress<FReal, order>(MatrixKernel, CellWidth, CellWidthExtension, epsilon, U[l], C[l], B[l]);
// update cell width
CellWidth /= FReal(2.); // at level l+1
}
......@@ -351,7 +351,7 @@ public:
template <int ORDER, class MatrixKernelClass>
template <class FReal, int ORDER, class MatrixKernelClass>
unsigned int ComputeAndCompress(const MatrixKernelClass *const MatrixKernel,
const FReal CellWidth,
const FReal CellWidthExtension,
......
......@@ -800,7 +800,7 @@ public:
void P2P(const FTreeCoordinate& /*inPosition*/,
ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict /*inSources*/,
ContainerClass* const inNeighbors[27], const int /*inSize*/){
FP2PRT<FReal>::FullMutual<ContainerClass>(inTargets,inNeighbors,14);
FP2PRT<FReal>::template FullMutual<ContainerClass>(inTargets,inNeighbors,14);
}
......@@ -808,7 +808,7 @@ public:
void P2PRemote(const FTreeCoordinate& /*inPosition*/,
ContainerClass* const FRestrict inTargets, const ContainerClass* const FRestrict /*inSources*/,
ContainerClass* const inNeighbors[27], const int /*inSize*/){
FP2PRT<FReal>::FullRemote<ContainerClass>(inTargets,inNeighbors,27);
FP2PRT<FReal>::template FullRemote<ContainerClass>(inTargets,inNeighbors,27);
}
};
......
......@@ -68,7 +68,7 @@ public:
}
/** Constructor */
FSphericalCell(const FSphericalCell& other)
FSphericalCell(const FSphericalCell<FReal>& other)
: multipole_exp(nullptr), local_exp(nullptr){
multipole_exp = new FComplex<FReal>[PoleSize];
local_exp = new FComplex<FReal>[LocalSize];
......@@ -82,7 +82,7 @@ public:
}
/** Copy constructor */
FSphericalCell& operator=(const FSphericalCell& other) {
FSphericalCell<FReal>& operator=(const FSphericalCell<FReal>& other) {
FMemUtils::copyall(multipole_exp, other.multipole_exp, PoleSize);
FMemUtils::copyall(local_exp, other.local_exp, LocalSize);
return *this;
......
......@@ -24,9 +24,9 @@
* This class is the rotation spherical harmonic kernel
*/
template< class FReal, class CellClass, class ContainerClass>
class FSphericalRotationKernel : public FAbstractSphericalKernel<CellClass,ContainerClass> {
class FSphericalRotationKernel : public FAbstractSphericalKernel<FReal, CellClass,ContainerClass> {
protected:
typedef FAbstractSphericalKernel<CellClass,ContainerClass> Parent;
typedef FAbstractSphericalKernel<FReal, CellClass,ContainerClass> Parent;
/** This class define some information to use rotation computation
*/
......
......@@ -23,9 +23,9 @@
#include "../P2P/FP2PR.hpp"
/**
* @author Cyrille Piacibello
* @class FTaylorKernel
*
* @author Cyrille Piacibello
* @class FTaylorKernel
*
* @brief This kernel is an implementation of the different operators
* needed to compute the Fast Multipole Method using Taylor Expansion
* for the Far fields interaction.
......@@ -35,679 +35,679 @@
//TODO spécifier les arguments.
template< class FReal, class CellClass, class ContainerClass, int P, int order>
class FTaylorKernel : public FAbstractKernels<CellClass,ContainerClass> {
private:
//Size of the multipole and local vectors
static const int SizeVector = ((P+1)*(P+2)*(P+3))*order/6;
////////////////////////////////////////////////////
// Object Attributes
////////////////////////////////////////////////////
const FReal boxWidth; //< the box width at leaf level
const int treeHeight; //< The height of the tree
const FReal widthAtLeafLevel; //< width of box at leaf level
const FReal widthAtLeafLevelDiv2; //< width of box at leaf leve div 2
const FPoint<FReal> boxCorner; //< position of the box corner
////////////////////////////////////////////////////
// PreComputed values
////////////////////////////////////////////////////
FReal factorials[2*P+1]; //< This contains the factorial until P
FReal arrayDX[P+2],arrayDY[P+2],arrayDZ[P+2] ; //< Working arrays
static const int sizeDerivative = (2*P+1)*(P+1)*(2*P+3)/3;
FReal _PsiVector[sizeDerivative];
FSmartPointer< FReal[343][sizeDerivative] > M2LpreComputedDerivatives;
FSmartPointer< int[SizeVector] > preComputedIndirections;
FReal _coeffPoly[SizeVector];
////////////////////////////////////////////////////
// Private method
////////////////////////////////////////////////////
///////////////////////////////////////////////////////
// Precomputation
///////////////////////////////////////////////////////
/** Compute the factorial from 0 to P
//Size of the multipole and local vectors
static const int SizeVector = ((P+1)*(P+2)*(P+3))*order/6;
////////////////////////////////////////////////////
// Object Attributes
////////////////////////////////////////////////////
const FReal boxWidth; //< the box width at leaf level
const int treeHeight; //< The height of the tree
const FReal widthAtLeafLevel; //< width of box at leaf level
const FReal widthAtLeafLevelDiv2; //< width of box at leaf leve div 2
const FPoint<FReal> boxCorner; //< position of the box corner
////////////////////////////////////////////////////
// PreComputed values
////////////////////////////////////////////////////
FReal factorials[2*P+1]; //< This contains the factorial until P
FReal arrayDX[P+2],arrayDY[P+2],arrayDZ[P+2] ; //< Working arrays
static const int sizeDerivative = (2*P+1)*(P+1)*(2*P+3)/3;
FReal _PsiVector[sizeDerivative];
FSmartPointer< FReal[343][sizeDerivative] > M2LpreComputedDerivatives;
FSmartPointer< int[SizeVector] > preComputedIndirections;
FReal _coeffPoly[SizeVector];
////////////////////////////////////////////////////
// Private method
////////////////////////////////////////////////////
///////////////////////////////////////////////////////
// Precomputation
///////////////////////////////////////////////////////
/** Compute the factorial from 0 to P
* Then the data is accessible in factorials array:
* factorials[n] = n! with n <= P
*/
void precomputeFactorials(){
factorials[0] = 1.0;
FReal fidx = 1.0;
for(int idx = 1 ; idx <= 2*P ; ++idx, ++fidx){
factorials[idx] = fidx * factorials[idx-1];
void precomputeFactorials(){
factorials[0] = 1.0;
FReal fidx = 1.0;
for(int idx = 1 ; idx <= 2*P ; ++idx, ++fidx){
factorials[idx] = fidx * factorials[idx-1];
}
}
}
/** Return the position of a leaf from its tree coordinate */
FPoint<FReal> getLeafCenter(const FTreeCoordinate coordinate) const {
return FPoint<FReal>(
FReal(coordinate.getX()) * widthAtLeafLevel + widthAtLeafLevelDiv2 + boxCorner.getX(),
FReal(coordinate.getY()) * widthAtLeafLevel + widthAtLeafLevelDiv2 + boxCorner.getY(),
FReal(coordinate.getZ()) * widthAtLeafLevel + widthAtLeafLevelDiv2 + boxCorner.getZ());
}
/** Return the position of a leaf from its tree coordinate */
FPoint<FReal> getLeafCenter(const FTreeCoordinate coordinate) const {
return FPoint<FReal>(
FReal(coordinate.getX()) * widthAtLeafLevel + widthAtLeafLevelDiv2 + boxCorner.getX(),
FReal(coordinate.getY()) * widthAtLeafLevel + widthAtLeafLevelDiv2 + boxCorner.getY(),
FReal(coordinate.getZ()) * widthAtLeafLevel + widthAtLeafLevelDiv2 + boxCorner.getZ());
}