Commit e7ffa655 authored by berenger-bramas's avatar berenger-bramas
Browse files

After this commit the tree height is choose at execution time.

This is a simple parameter given to the tree (FOctree) constructor.
(Instead of a template)

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@103 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 05476fcf
......@@ -12,7 +12,7 @@
*
* If you want to create you own kernels you have to inherit from this class.
*/
template< class ParticleClass, class CellClass, int TreeHeight>
template< class ParticleClass, class CellClass>
class FAbstractKernels{
public:
/** Default destructor */
......
......@@ -15,8 +15,8 @@
* This kernels simply shows the details of the information
* it receives (in debug)
*/
template< class ParticleClass, class CellClass, int TreeHeight>
class FBasicKernels : public FAbstractKernels<ParticleClass,CellClass,TreeHeight> {
template< class ParticleClass, class CellClass>
class FBasicKernels : public FAbstractKernels<ParticleClass,CellClass> {
public:
/** Default destructor */
virtual ~FBasicKernels(){
......
......@@ -20,8 +20,8 @@
* correctly done on particles.
* It used FTestCell and FTestParticle
*/
template< class ParticleClass, class CellClass, int TreeHeight>
class FTestKernels : public FAbstractKernels<ParticleClass,CellClass,TreeHeight> {
template< class ParticleClass, class CellClass>
class FTestKernels : public FAbstractKernels<ParticleClass,CellClass> {
public:
/** Default destructor */
virtual ~FTestKernels(){
......@@ -130,12 +130,13 @@ public:
/** This function test the octree to be sure that the fmm algorithm
* has worked completly.
*/
template< class ParticleClass, class CellClass, template<class ParticleClass> class LeafClass, int TreeHeight, int SizeSubLevels>
void ValidateFMMAlgo(FOctree<ParticleClass, CellClass, LeafClass, TreeHeight , SizeSubLevels>* const tree){
template< class ParticleClass, class CellClass, template<class ParticleClass> class LeafClass>
void ValidateFMMAlgo(FOctree<ParticleClass, CellClass, LeafClass>* const tree){
std::cout << "Check Result\n";
const int TreeHeight = tree->getHeight();
int NbPart = 0;
{ // Check that each particle has been summed with all other
typename FOctree<ParticleClass, CellClass, LeafClass, TreeHeight, SizeSubLevels>::Iterator octreeIterator(tree);
typename FOctree<ParticleClass, CellClass, LeafClass>::Iterator octreeIterator(tree);
octreeIterator.gotoBottomLeft();
do{
if(octreeIterator.getCurrentCell()->getDataUp() != octreeIterator.getCurrentListSrc()->getSize() ){
......@@ -145,7 +146,7 @@ void ValidateFMMAlgo(FOctree<ParticleClass, CellClass, LeafClass, TreeHeight , S
} while(octreeIterator.moveRight());
}
{ // Ceck if there is number of NbPart summed at level 1
typename FOctree<ParticleClass, CellClass, LeafClass, TreeHeight, SizeSubLevels>::Iterator octreeIterator(tree);
typename FOctree<ParticleClass, CellClass, LeafClass>::Iterator octreeIterator(tree);
octreeIterator.moveDown();
long res = 0;
do{
......@@ -156,7 +157,7 @@ void ValidateFMMAlgo(FOctree<ParticleClass, CellClass, LeafClass, TreeHeight , S
}
}
{ // Ceck if there is number of NbPart summed at level 1
typename FOctree<ParticleClass, CellClass, LeafClass, TreeHeight, SizeSubLevels>::Iterator octreeIterator(tree);
typename FOctree<ParticleClass, CellClass, LeafClass>::Iterator octreeIterator(tree);
octreeIterator.gotoBottomLeft();
for(int idxLevel = TreeHeight - 1 ; idxLevel > 1 ; --idxLevel ){
long res = 0;
......@@ -171,7 +172,7 @@ void ValidateFMMAlgo(FOctree<ParticleClass, CellClass, LeafClass, TreeHeight , S
}
}
{ // Check that each particle has been summed with all other
typename FOctree<ParticleClass, CellClass, LeafClass, TreeHeight, SizeSubLevels>::Iterator octreeIterator(tree);
typename FOctree<ParticleClass, CellClass, LeafClass>::Iterator octreeIterator(tree);
octreeIterator.gotoBottomLeft();
do{
typename FList<ParticleClass>::BasicIterator iter(*octreeIterator.getCurrentListTargets());
......
......@@ -21,16 +21,21 @@
* Please refere to testOctree.cpp to see an example.
* <code>
* // can be used as : <br>
* FOctree<TestParticle, TestCell, 10, 3> tree(1.0,F3DPosition(0.5,0.5,0.5));
* FOctree<TestParticle, TestCell> tree(1.0,F3DPosition(0.5,0.5,0.5));
* </code>
*
* Particles and cells has to respect the Abstract class definition.
* Particle must extend {FExtendPosition}
* Cell must extend extend {FExtendPosition,FExtendMortonIndex}
*/
template< class ParticleClass, class CellClass, template <class ParticleClass> class LeafClass, int OctreeHeight, int SubtreeHeight = 3>
template< class ParticleClass, class CellClass, template <class ParticleClass> class LeafClass>
class FOctree {
FReal boxWidthAtLevel[OctreeHeight]; //< to store the width of each boxs at all levels
FReal*const boxWidthAtLevel; //< to store the width of each boxs at all levels
const int height; //< tree height
const int subHeight; //< tree height
const int leafIndex; //< index of leaf int array
FSubOctree< ParticleClass, CellClass , LeafClass> root; //< root suboctree
const F3DPosition boxCenter; //< the space system center
......@@ -38,8 +43,6 @@ class FOctree {
const FReal boxWidth; //< the space system width
const int height; //< tree height
const int leafIndex; //< index of leaf int array
/** Forbiden copy operator */
FOctree& operator=(const FOctree&) {
......@@ -86,9 +89,12 @@ public:
* @param inBoxWidth box width for this simulation
* @param inBoxCenter box center for this simulation
*/
FOctree(const FReal inBoxWidth, const F3DPosition& inBoxCenter)
: root(0, 0, SubtreeHeight, 1), boxCenter(inBoxCenter), boxCorner(inBoxCenter - (inBoxWidth/2)), boxWidth(inBoxWidth),
height(OctreeHeight) , leafIndex(OctreeHeight-1) {
FOctree(const int inHeight, const int inSubHeight,
const FReal inBoxWidth, const F3DPosition& inBoxCenter)
: boxWidthAtLevel(new FReal[this->height]),
height(inHeight) , subHeight(inSubHeight), leafIndex(this->height-1),
root(0, 0, this->subHeight, 1), boxCenter(inBoxCenter), boxCorner(inBoxCenter - (inBoxWidth/2)), boxWidth(inBoxWidth)
{
FReal tempWidth = this->boxWidth;
// pre compute box width for each level
for(int indexLevel = 0; indexLevel < this->height; ++indexLevel ){
......@@ -99,8 +105,14 @@ public:
/** Desctructor */
virtual ~FOctree() {
delete [] boxWidthAtLevel;
}
/** To get the tree height */
int getHeight() const {
return this->height;
}
/**
* Insert a particle on the tree
* algorithm is :
......@@ -474,7 +486,7 @@ public:
* @return true if we are at the bottom of the tree
*/
bool isAtLeafLevel() const {
return level() + 1 == OctreeHeight;
return this->current.tree->isLeafPart() && this->currentLocalLevel + 1 == this->current.tree->getSubOctreeHeight();
}
/**
......
......@@ -49,6 +49,8 @@ protected:
const int subOctreeHeight; //< Height of this suboctree
const int subOctreePosition; //< Level of the current suboctree in the global tree (0 if node)
const bool isLeafSubtree; //< To know if a subtree is leaf or not (we prefere that to a virtual method)
/**
* This function compute the morton index for the last level of this suboctree.
......@@ -116,9 +118,9 @@ public:
* @param inSubOctreePosition Level of the current suboctree in the global tree (1 if upper tree)
*/
FAbstractSubOctree(FAbstractSubOctree* const inParent, const long inIndexInParent,
const int inSubOctreeHeight, const int inSubOctreePosition) :
const int inSubOctreeHeight, const int inSubOctreePosition, const bool inIsLeafSubtree) :
cells(0), parent( inParent ), indexInParent(inIndexInParent), leftLeafIndex(1 << (3 * inSubOctreeHeight)), rightLeafIndex(-1),
subOctreeHeight( inSubOctreeHeight ), subOctreePosition( inSubOctreePosition ) {
subOctreeHeight( inSubOctreeHeight ), subOctreePosition( inSubOctreePosition ), isLeafSubtree(inIsLeafSubtree) {
this->cells = new CellClass**[this->subOctreeHeight];
assert(this->cells, "Allocation failled", __LINE__, __FILE__);
......@@ -229,6 +231,14 @@ public:
long getIndexInParent() const{
return indexInParent;
}
/** To know if this class has been inherited by a leaf subtree or middle subtree
* Of course we can do a virtual method to do that but virtual method are slower
* if we point to parent class to call the method
*/
bool isLeafPart() const{
return this->isLeafSubtree;
}
};
......@@ -269,7 +279,7 @@ public:
*/
FSubOctreeWithLeafs(FAbstractSubOctree<ParticleClass,CellClass,LeafClass>* const inParent, const long inIndexInParent,
const int inSubOctreeHeight, const int inSubOctreePosition) :
FAbstractSubOctree<ParticleClass,CellClass,LeafClass>(inParent, inIndexInParent, inSubOctreeHeight, inSubOctreePosition) {
FAbstractSubOctree<ParticleClass,CellClass,LeafClass>(inParent, inIndexInParent, inSubOctreeHeight, inSubOctreePosition, true) {
const long cellsAtLeafLevel = 1 << (3 * inSubOctreeHeight);
......@@ -381,7 +391,7 @@ public:
*/
FSubOctree(FAbstractSubOctree<ParticleClass,CellClass,LeafClass>* const inParent, const long inIndexInParent,
const int inSubOctreeHeight, const int inSubOctreePosition) :
FAbstractSubOctree<ParticleClass,CellClass,LeafClass>(inParent, inIndexInParent, inSubOctreeHeight, inSubOctreePosition) {
FAbstractSubOctree<ParticleClass,CellClass,LeafClass>(inParent, inIndexInParent, inSubOctreeHeight, inSubOctreePosition, false) {
const long cellsAtLeafLevel = 1 << (3 * inSubOctreeHeight);
this->subleafs = new FAbstractSubOctree<ParticleClass,CellClass,LeafClass>*[cellsAtLeafLevel];
......
......@@ -8,7 +8,7 @@
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FList
* @class FVector
* Please read the license
*
* This class is a vector container.
......@@ -162,7 +162,9 @@ public:
++this->index;
}
/** This class is a basic iterator
*
*/
class BasicIterator{
protected:
FVector* const vector; /**< the vector to work on*/
......@@ -193,7 +195,9 @@ public:
};
friend class BasicIterator;
/** This class is a basic const iterator
* it uses a const vector to work on
*/
class ConstBasicIterator{
protected:
const FVector* const vector; /**< the vector to work on*/
......
......@@ -21,17 +21,18 @@
*
* Of course this class does not deallocate pointer given in arguements.
*/
template<template< class ParticleClass, class CellClass, int OctreeHeight> class KernelClass,
template<template< class ParticleClass, class CellClass> class KernelClass,
class ParticleClass, class CellClass,
template<class ParticleClass> class LeafClass,
int OctreeHeight, int SubtreeHeight>
template<class ParticleClass> class LeafClass>
class FFmmAlgorithm : protected FAssertable{
// To reduce the size of variable type based on foctree in this file
typedef FOctree<ParticleClass, CellClass, LeafClass, OctreeHeight, SubtreeHeight> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass, OctreeHeight, SubtreeHeight>::Iterator FOctreeIterator;
typedef FOctree<ParticleClass, CellClass, LeafClass> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass>::Iterator FOctreeIterator;
Octree* const tree; //< The octree to work on
KernelClass<ParticleClass, CellClass, OctreeHeight>* const kernels; //< The kernels
KernelClass<ParticleClass, CellClass>* const kernels; //< The kernels
const int OctreeHeight;
public:
/** The constructor need the octree and the kernels used for computation
......@@ -39,8 +40,8 @@ public:
* @param inKernels the kernels to call
* An assert is launched if one of the arguments is null
*/
FFmmAlgorithm(Octree* const inTree, KernelClass<ParticleClass,CellClass,OctreeHeight>* const inKernels)
: tree(inTree) , kernels(inKernels) {
FFmmAlgorithm(Octree* const inTree, KernelClass<ParticleClass,CellClass>* const inKernels)
: tree(inTree) , kernels(inKernels), OctreeHeight(tree->getHeight()) {
assert(tree, "tree cannot be null", __LINE__, __FILE__);
assert(kernels, "kernels cannot be null", __LINE__, __FILE__);
......
......@@ -28,15 +28,14 @@
*
* When using this algorithm the P2P is thread safe.
*/
template<template< class ParticleClass, class CellClass, int OctreeHeight> class KernelClass,
template<template< class ParticleClass, class CellClass> class KernelClass,
class ParticleClass, class CellClass,
template<class ParticleClass> class LeafClass,
int OctreeHeight, int SubtreeHeight>
template<class ParticleClass> class LeafClass>
class FFmmAlgorithmThread : protected FAssertable{
// To reduce the size of variable type based on foctree in this file
typedef FOctree<ParticleClass, CellClass, LeafClass, OctreeHeight, SubtreeHeight> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass, OctreeHeight, SubtreeHeight>::Iterator OctreeIterator;
typedef KernelClass<ParticleClass, CellClass, OctreeHeight> Kernel;
typedef FOctree<ParticleClass, CellClass, LeafClass> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass>::Iterator OctreeIterator;
typedef KernelClass<ParticleClass, CellClass> Kernel;
Octree* const tree; //< The octree to work on
Kernel** kernels; //< The kernels
......@@ -49,6 +48,8 @@ class FFmmAlgorithmThread : protected FAssertable{
const int MaxThreads;
const int OctreeHeight;
public:
/** The constructor need the octree and the kernels used for computation
* @param inTree the octree to work on
......@@ -57,13 +58,13 @@ public:
*/
FFmmAlgorithmThread(Octree* const inTree, Kernel* const inKernels)
: tree(inTree) , kernels(0), iterArray(0), leafsNumber(0),
MaxThreads(omp_get_max_threads()) {
MaxThreads(omp_get_max_threads()), OctreeHeight(tree->getHeight()) {
assert(tree, "tree cannot be null", __LINE__, __FILE__);
this->kernels = new Kernel*[MaxThreads];
for(int idxThread = 0 ; idxThread < MaxThreads ; ++idxThread){
this->kernels[idxThread] = new KernelClass<ParticleClass, CellClass, OctreeHeight>(*inKernels);
this->kernels[idxThread] = new KernelClass<ParticleClass, CellClass>(*inKernels);
}
FDEBUG(FDebug::Controller << "FFmmAlgorithmThread (Max Thread " << omp_get_max_threads() << ")\n");
......
......@@ -36,15 +36,14 @@
* --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes
* ./Tests/testFmmAlgorithmProc ../Data/testLoaderSmall.fma.tmp
*/
template<template< class ParticleClass, class CellClass, int OctreeHeight> class KernelClass,
template<template< class ParticleClass, class CellClass> class KernelClass,
class ParticleClass, class CellClass,
template<class ParticleClass> class LeafClass,
int OctreeHeight, int SubtreeHeight>
template<class ParticleClass> class LeafClass>
class FFmmAlgorithmThreadProc : protected FAssertable {
// To reduce the size of variable type based on foctree in this file
typedef FOctree<ParticleClass, CellClass, LeafClass, OctreeHeight, SubtreeHeight> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass, OctreeHeight, SubtreeHeight>::Iterator OctreeIterator;
typedef KernelClass<ParticleClass, CellClass, OctreeHeight> Kernel;
typedef FOctree<ParticleClass, CellClass, LeafClass> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass>::Iterator OctreeIterator;
typedef KernelClass<ParticleClass, CellClass> Kernel;
FMpi& app; //< The app to communicate
......@@ -58,8 +57,8 @@ int OctreeHeight, int SubtreeHeight>
int leafRight; //< To store the right limit at the previous level
int numberOfLeafs; //< To store the size at the previous level
int leftOffsets[OctreeHeight]; //< the right limit at different level
int rightOffsets[OctreeHeight]; //< the left limit at different level
int*const leftOffsets; //< the right limit at different level
int*const rightOffsets; //< the left limit at different level
const int MaxThreads; //< the max number of thread allowed by openmp
......@@ -69,6 +68,8 @@ int OctreeHeight, int SubtreeHeight>
const static int BufferSize = 2000; //< To know max of the buffer we receive
FBufferVector<BufferSize> * sendBuffer; //< To put data to send into a buffer
const int OctreeHeight;
/** To swap between two arrays
* the current and the previous
*/
......@@ -87,14 +88,15 @@ public:
FFmmAlgorithmThreadProc(FMpi& inApp, Octree* const inTree, Kernel* const inKernels)
: app(inApp), tree(inTree) , kernels(0), iterArray(0),
previousIterArray(0), leafLeft(0),leafRight(0), numberOfLeafs(0),
leftOffsets(new int[inTree->getHeight()]),rightOffsets(new int[inTree->getHeight()]),
MaxThreads(omp_get_max_threads()), nbProcess(inApp.processCount()), idPorcess(inApp.processId()),
sendBuffer(0) {
sendBuffer(0), OctreeHeight(tree->getHeight()) {
assert(tree, "tree cannot be null", __LINE__, __FILE__);
this->kernels = new Kernel*[MaxThreads];
for(int idxThread = 0 ; idxThread < MaxThreads ; ++idxThread){
this->kernels[idxThread] = new KernelClass<ParticleClass, CellClass, OctreeHeight>(*inKernels);
this->kernels[idxThread] = new KernelClass<ParticleClass, CellClass>(*inKernels);
}
this->sendBuffer = new FBufferVector<BufferSize>[nbProcess];
......@@ -111,6 +113,9 @@ public:
delete [] this->kernels;
delete [] this->sendBuffer;
delete [] leftOffsets;
delete [] rightOffsets;
}
/**
......
......@@ -29,15 +29,14 @@
* Because this is a Target source model you do not need the P2P to be safe.
* You should not write on sources in the P2P method!
*/
template<template< class ParticleClass, class CellClass, int OctreeHeight> class KernelClass,
template<template< class ParticleClass, class CellClass> class KernelClass,
class ParticleClass, class CellClass,
template<class ParticleClass> class LeafClass,
int OctreeHeight, int SubtreeHeight>
template<class ParticleClass> class LeafClass>
class FFmmAlgorithmThreadTsm : protected FAssertable{
// To reduce the size of variable type based on foctree in this file
typedef FOctree<ParticleClass, CellClass, LeafClass, OctreeHeight, SubtreeHeight> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass, OctreeHeight, SubtreeHeight>::Iterator OctreeIterator;
typedef KernelClass<ParticleClass, CellClass, OctreeHeight> Kernel;
typedef FOctree<ParticleClass, CellClass, LeafClass> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass>::Iterator OctreeIterator;
typedef KernelClass<ParticleClass, CellClass> Kernel;
Octree* const tree; //< The octree to work on
Kernel** kernels; //< The kernels
......@@ -46,6 +45,8 @@ class FFmmAlgorithmThreadTsm : protected FAssertable{
const int MaxThreads;
const int OctreeHeight;
public:
/** The constructor need the octree and the kernels used for computation
* @param inTree the octree to work on
......@@ -53,13 +54,14 @@ public:
* An assert is launched if one of the arguments is null
*/
FFmmAlgorithmThreadTsm(Octree* const inTree, Kernel* const inKernels)
: tree(inTree) , kernels(0), iterArray(0), MaxThreads(omp_get_max_threads()) {
: tree(inTree) , kernels(0), iterArray(0),
MaxThreads(omp_get_max_threads()) , OctreeHeight(tree->getHeight()) {
assert(tree, "tree cannot be null", __LINE__, __FILE__);
this->kernels = new Kernel*[MaxThreads];
for(int idxThread = 0 ; idxThread < MaxThreads ; ++idxThread){
this->kernels[idxThread] = new KernelClass<ParticleClass, CellClass, OctreeHeight>(*inKernels);
this->kernels[idxThread] = new KernelClass<ParticleClass, CellClass>(*inKernels);
}
FDEBUG(FDebug::Controller << "FFmmAlgorithmThreadTsm\n");
......
......@@ -29,15 +29,14 @@
* This algorithms is unsafe for P2P, if you need to write on neigbors
* this can be a problem.
*/
template<template< class ParticleClass, class CellClass, int OctreeHeight> class KernelClass,
template<template< class ParticleClass, class CellClass> class KernelClass,
class ParticleClass, class CellClass,
template<class ParticleClass> class LeafClass,
int OctreeHeight, int SubtreeHeight>
template<class ParticleClass> class LeafClass>
class FFmmAlgorithmThreadUs : protected FAssertable{
// To reduce the size of variable type based on foctree in this file
typedef FOctree<ParticleClass, CellClass, LeafClass, OctreeHeight, SubtreeHeight> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass, OctreeHeight, SubtreeHeight>::Iterator OctreeIterator;
typedef KernelClass<ParticleClass, CellClass, OctreeHeight> Kernel;
typedef FOctree<ParticleClass, CellClass, LeafClass> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass>::Iterator OctreeIterator;
typedef KernelClass<ParticleClass, CellClass> Kernel;
Octree* const tree; //< The octree to work on
Kernel** kernels; //< The kernels
......@@ -46,6 +45,8 @@ class FFmmAlgorithmThreadUs : protected FAssertable{
const int MaxThreads;
const int OctreeHeight;
public:
/** The constructor need the octree and the kernels used for computation
* @param inTree the octree to work on
......@@ -53,13 +54,14 @@ public:
* An assert is launched if one of the arguments is null
*/
FFmmAlgorithmThreadUs(Octree* const inTree, Kernel* const inKernels)
: tree(inTree), kernels(0), iterArray(0), MaxThreads(omp_get_max_threads()) {
: tree(inTree), kernels(0), iterArray(0),
MaxThreads(omp_get_max_threads()), OctreeHeight(tree->getHeight()) {
assert(tree, "tree cannot be null", __LINE__, __FILE__);
this->kernels = new Kernel*[MaxThreads];
for(int idxThread = 0 ; idxThread < MaxThreads ; ++idxThread){
this->kernels[idxThread] = new KernelClass<ParticleClass, CellClass, OctreeHeight>(*inKernels);
this->kernels[idxThread] = new KernelClass<ParticleClass, CellClass>(*inKernels);
}
FDEBUG(FDebug::Controller << "FFmmAlgorithmThreadUs\n");
......
......@@ -23,17 +23,18 @@
*
* The differences with FmmAlgorithm is that it used target source model.
*/
template<template< class ParticleClass, class CellClass, int OctreeHeight> class KernelClass,
template<template< class ParticleClass, class CellClass> class KernelClass,
class ParticleClass, class CellClass,
template<class ParticleClass> class LeafClass,
int OctreeHeight, int SubtreeHeight>
template<class ParticleClass> class LeafClass>
class FFmmAlgorithmTsm : protected FAssertable{
// To reduce the size of variable type based on foctree in this file
typedef FOctree<ParticleClass, CellClass, LeafClass, OctreeHeight, SubtreeHeight> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass, OctreeHeight, SubtreeHeight>::Iterator FOctreeIterator;
typedef FOctree<ParticleClass, CellClass, LeafClass> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass>::Iterator FOctreeIterator;
Octree* const tree; //< The octree to work on
KernelClass<ParticleClass, CellClass, OctreeHeight>* const kernels; //< The kernels
KernelClass<ParticleClass, CellClass>* const kernels; //< The kernels
const int OctreeHeight;
FDEBUG(FTic counterTime); //< In case of debug: to count the elapsed time
FDEBUG(FTic computationCounter); //< In case of debug: to count computation time
......@@ -44,8 +45,8 @@ public:
* @param inKernels the kernels to call
* An assert is launched if one of the arguments is null
*/
FFmmAlgorithmTsm(Octree* const inTree, KernelClass<ParticleClass,CellClass,OctreeHeight>* const inKernels)
: tree(inTree) , kernels(inKernels) {
FFmmAlgorithmTsm(Octree* const inTree, KernelClass<ParticleClass,CellClass>* const inKernels)
: tree(inTree) , kernels(inKernels) , OctreeHeight(tree->getHeight()){
assert(tree, "tree cannot be null", __LINE__, __FILE__);
assert(kernels, "kernels cannot be null", __LINE__, __FILE__);
......
......@@ -25,7 +25,7 @@
* return 1; <br>
* } <br>
* <br>
* FOctree<FBasicParticle, TestCell, FSimpleLeaf, 10, 3> tree(loader.getBoxWidth(),loader.getCenterOfBox()); <br>
* FOctree<FBasicParticle, TestCell, FSimpleLeaf> tree(loader.getBoxWidth(),loader.getCenterOfBox()); <br>
* <br>
* for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){ <br>
* FBasicParticle* const part = new FBasicParticle(); <br>
......
......@@ -25,7 +25,7 @@
* return 1; <br>
* } <br>
* <br>
* FOctree<FBasicParticle, TestCell, FSimpleLeaf, 10, 3> tree(loader.getBoxWidth(),loader.getCenterOfBox()); <br>
* FOctree<FBasicParticle, TestCell, FSimpleLeaf> tree(loader.getBoxWidth(),loader.getCenterOfBox()); <br>
* <br>
* for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){ <br>
* FBasicParticle* const part = new FBasicParticle(); <br>
......
......@@ -25,7 +25,7 @@
* return 1; <br>
* } <br>
* <br>
* FOctree<FBasicParticle, TestCell, FSimpleLeaf, 10, 3> tree(loader.getBoxWidth(),loader.getCenterOfBox()); <br>
* FOctree<FBasicParticle, TestCell, FSimpleLeaf> tree(loader.getBoxWidth(),loader.getCenterOfBox()); <br>
* <br>
* for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){ <br>
* FBasicParticle* const part = new FBasicParticle(); <br>
......
......@@ -25,7 +25,7 @@
* return 1; <br>
* } <br>
* <br>
* FOctree<FBasicParticle, TestCell, FSimpleLeaf, 10, 3> tree(loader.getBoxWidth(),loader.getCenterOfBox()); <br>
* FOctree<FBasicParticle, TestCell, FSimpleLeaf> tree(loader.getBoxWidth(),loader.getCenterOfBox()); <br>
* <br>
* for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){ <br>
* FBasicParticle* const part = new FBasicParticle(); <br>
......
......@@ -25,7 +25,7 @@
* return 1; <br>
* } <br>
* <br>
* FOctree<FBasicParticle, TestCell, FSimpleLeaf, 10, 3> tree(loader.getBoxWidth(),loader.getCenterOfBox()); <br>
* FOctree<FBasicParticle, TestCell, FSimpleLeaf> tree(loader.getBoxWidth(),loader.getCenterOfBox()); <br>
* <br>
* for(int idx = 0 ; idx < loader.getNumberOfParticles() ; ++idx){ <br>
* FBasicParticle* const part = new FBasicParticle(); <br>
......
......@@ -36,8 +36,8 @@ static const int FMB_Info_P = 2;
*
* Needs cell to extend {FExtendFmbCell}
*/
template< class ParticleClass, class CellClass, int TreeHeight>
class FFmbKernels : public FAbstractKernels<ParticleClass,CellClass, TreeHeight> {
template< class ParticleClass, class CellClass>
class FFmbKernels : public FAbstractKernels<ParticleClass,CellClass> {
protected:
// _GRAVITATIONAL_
......@@ -63,16 +63,19 @@ protected:
// NEXP_SIZE(FMB_Info.P)
static const int FMB_Info_nexp_size = (FMB_Info_P + 1) * (FMB_Info_P + 1);
// tree height
const int TreeHeight;
// Width of the box at the root level
FReal treeWidthAtRoot;
// transfer_M2M_container
FComplexe transitionM2M[TreeHeight][8][FMB_Info_nexp_size];
FComplexe transitionM2M[MaxTreeHeight][8][FMB_Info_nexp_size];
// transfer_L2L_container
FComplexe transitionL2L[TreeHeight][8][FMB_Info_nexp_size];
FComplexe transitionL2L[MaxTreeHeight][8][FMB_Info_nexp_size];