Commit 7a737b27 authored by berenger-bramas's avatar berenger-bramas
Browse files

FMB update

(comments, end)

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@14 2616d619-271b-44dc-8df4-d4a8f33a7222
parent dfc8b42d
......@@ -11,6 +11,12 @@
*
* This class define the method that every cell class
* has to implement.
*
* In fact FOctree & FFMMAlgorithm need this function to be implemented.
* But you cannot use this interface with the extension (as an example :
* because the compiler will faill to know if getMortonIndex is coming
* from this interface or from the extension)
*
* @warning Inherite from this class when implement a specific cell type
*/
class FAbstractCell{
......
......@@ -13,6 +13,13 @@ class F3DPosition;
*
* This class define the method that every particule class
* has to implement.
*
* In fact FOctree & FFMMAlgorithm need this function to be implemented.
* But you cannot use this interface with the extension (as an example :
* because the compiler will faill to know if getPosition is coming
* from this interface or from the extension)
*
*
* @warning Inherite from this class when implement a specific particule type
*/
class FAbstractParticule{
......
......@@ -2,59 +2,25 @@
#define FBASICCELL_HPP
// /!\ Please, you must read the license at the bottom of this page
#include "FAbstractCell.hpp"
#include "../Containers/FTreeCoordinate.hpp"
#include "FExtendPosition.hpp"
#include "FExtendMortonIndex.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FBasicCell
* Please read the license
*
* This class defines a basic cell used for examples.
* This class defines a basic cell used for examples. It extends
* the mininum, only what is needed by FOctree and FFMMAlgorithm
* to make the things working.
* By using this extension it will implement the FAbstractCell without
* inheriting from it.
*/
class FBasicCell : public FAbstractCell {
protected:
MortonIndex index; //< Cell's position in the tree
F3DPosition position; //< Cell's spacial position
class FBasicCell : public FExtendPosition, public FExtendMortonIndex {
public:
/** Default constructor */
FBasicCell() : index(0), position(0,0,0){
}
/** Default destructor */
virtual ~FBasicCell(){
}
/**
* From the FAbstractParticule definition
* @return the position of the current cell
*/
MortonIndex getMortonIndex() const {
return this->index;
}
/**
* This function is needed by the basic loader to fill the current particule
* @param inPos the position given by the basic loader
*/
void setMortonIndex(const MortonIndex inIndex) {
this->index = inIndex;
}
/**
* @return the position of the current cell
*/
F3DPosition getPosition() const{
return this->position;
}
/**
* @param inPosition the position of the current cell
*/
void setPosition(const F3DPosition& inPosition){
this->position = inPosition;
}
};
......
#ifndef FBASICKERNELS_HPP
#define FBASICKERNELS_HPP
// /!\ Please, you must read the license at the bottom of this page
#include "FAbstractKernels.hpp"
#include "../Utils/FDebug.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class AbstractKernels
* @brief
* Please read the license
*
* This kernels simply shows the details of the information
* it receives (in debug)
*/
template< class ParticuleClass, class CellClass>
class FBasicKernels : public FAbstractKernels<ParticuleClass,CellClass> {
public:
/** Default destructor */
virtual ~FBasicKernels(){
}
/** When init the kernel */
virtual void init(){}
/** Print the number of particules */
virtual void P2M(CellClass* const pole, FList<ParticuleClass*>* const particules) {
FDEBUG( FDebug::Controller << "P2M : " << particules->getSize() << "\n" );
}
/** Print the morton index */
virtual void M2M(CellClass* const pole, CellClass** const child, const int inLevel) {
FDEBUG( FDebug::Controller << "M2M : " << pole->getMortonIndex() << "\n" );
}
/** Print the morton index */
virtual void M2L(CellClass* const pole, CellClass** const distantNeighbors, const int size, const int inLevel) {
FDEBUG( FDebug::Controller << "M2L : " << pole->getMortonIndex() << " (" << size << ")\n" );
}
/** Print the morton index */
virtual void L2L(CellClass* const pole, CellClass** const child, const int inLevel) {
FDEBUG( FDebug::Controller << "L2L : " << pole->getMortonIndex() << "\n" );
}
/** Print the number of particules */
virtual void L2P(CellClass* const pole, FList<ParticuleClass*>* const particules){
FDEBUG( FDebug::Controller << "L2P : " << particules->getSize() << "\n" );
}
/** Print the number of particules */
virtual void P2P(FList<ParticuleClass*>* const currentBox, FList<ParticuleClass*>** directNeighbors, const int size) {
FDEBUG( FDebug::Controller << "P2P : " << currentBox->getSize() << " (" << size << ")\n" );
}
};
#endif //FBASICKERNELS_HPP
// [--LICENSE--]
......@@ -2,60 +2,24 @@
#define FBASICPARTICULE_HPP
// /!\ Please, you must read the license at the bottom of this page
#include "FAbstractParticule.hpp"
#include "../Utils/F3DPosition.hpp"
#include "FExtendPosition.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FBasicParticule
* Please read the license
*
* This class defines a basic particule used for examples.
* This class defines a basic particule used for examples. It extends
* the mininum, only what is needed by FOctree and FFMMAlgorithm
* to make the things working.
* By using this extension it will implement the FAbstractParticule without
* inheriting from it.
*/
class FBasicParticule : public FAbstractParticule{
protected:
F3DPosition pos; //< Particule's position
class FBasicParticule : public FExtendPosition{
public:
/**
* Constructor with a position
* @param inX x position
* @param inY y position
* @param inZ z position
*/
FBasicParticule(const double inX, const double inY, const double inZ) : pos(inX,inY,inZ) {
}
/**
* Constructor with a position object
* @param inPos particule position
*/
FBasicParticule(const F3DPosition& inPos) : pos(inPos) {
}
/** Default constructor */
FBasicParticule(){
}
/** Default destructor */
virtual ~FBasicParticule(){
}
/**
* From the FAbstractParticule definition
* @return the position of the current cell
*/
F3DPosition getPosition() const {
return pos;
}
/**
* This function is needed by the basic loader to fill the current particule
* @param inPos the position given by the basic loader
*/
void setPosition(const F3DPosition& inPos) {
pos = inPos;
}
};
......
#ifndef FEXTENDFORCES_HPP
#define FEXTENDFORCES_HPP
// /!\ Please, you must read the license at the bottom of this page
#include "../Utils/F3DPosition.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FExtendForces
* Please read the license
*
* This class is an extenssion.
* It proposes a 3d array as a forces vector.
*/
class FExtendForces {
protected:
F3DPosition forces; //< 3D vector stored in a position object
public:
/** Default constructor */
FExtendForces() {
}
/** Copy constructor */
FExtendForces(const FExtendForces& other) : forces(other.forces) {
}
/** Destructor */
virtual ~FExtendForces(){
}
/** Copy operator */
FExtendForces& operator=(const FExtendForces& other) {
this->forces = other.forces;
return *this;
}
/** Return the forces */
F3DPosition getForces() const {
return this->forces;
}
/** Set Forces */
void setForces(const F3DPosition& inForces) {
this->forces = inForces;
}
/** Set Forces with 3 doubles */
void setForces(const double inFx, const double inFy, const double inFz) {
this->forces.setX(inFx);
this->forces.setY(inFy);
this->forces.setZ(inFz);
}
};
#endif //FEXTENDFORCES_HPP
// [--LICENSE--]
#ifndef FEXTENDMORTONINDEX_HPP
#define FEXTENDMORTONINDEX_HPP
// /!\ Please, you must read the license at the bottom of this page
#include "../Containers/FTreeCoordinate.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FExtendMortonIndex
* Please read the license
* This class is an extenssion.
* It proposes a mortonIndex.
*/
class FExtendMortonIndex {
protected:
MortonIndex mortonIndex; //< Morton index (need by most elements)
public:
/** Default constructor */
FExtendMortonIndex() : mortonIndex(0) {
}
/** Copy constructor */
FExtendMortonIndex(const FExtendMortonIndex& other) : mortonIndex(other.mortonIndex) {
}
/** Destructor */
virtual ~FExtendMortonIndex(){
}
/** Copy operator */
FExtendMortonIndex& operator=(const FExtendMortonIndex& other) {
this->mortonIndex = other.mortonIndex;
return *this;
}
/** To get the morton index */
MortonIndex getMortonIndex() const {
return this->mortonIndex;
}
/** To set the morton index */
void setMortonIndex(const MortonIndex inMortonIndex) {
this->mortonIndex = inMortonIndex;
}
};
#endif //FEXTENDMORTONINDEX_HPP
// [--LICENSE--]
#ifndef FEXTENDPOSITION_HPP
#define FEXTENDPOSITION_HPP
// /!\ Please, you must read the license at the bottom of this page
#include "../Utils/F3DPosition.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FExtendPosition
* Please read the license
* This class is an extenssion.
* It proposes a mortonIndex.
*/
class FExtendPosition {
protected:
F3DPosition position; //< The position
public:
/** Default constructor */
FExtendPosition() {
}
/** Copy constructor */
FExtendPosition(const FExtendPosition& other) : position(other.position) {
}
/** Destructor */
virtual ~FExtendPosition(){
}
/** Copy operator */
FExtendPosition& operator=(const FExtendPosition& other) {
this->position = other.position;
return *this;
}
/** To get the position */
F3DPosition getPosition() const {
return this->position;
}
/** To set the position */
void setPosition(const F3DPosition& inPosition) {
this->position = inPosition;
}
/** To set the position from 3 doubles */
void setPosition(const double inX, const double inY, const double inZ) {
this->position.setX(inX);
this->position.setY(inY);
this->position.setZ(inZ);
}
};
#endif //FEXTENDPOSITION_HPP
// [--LICENSE--]
#ifndef FEXTENDPOTENTIAL_HPP
#define FEXTENDPOTENTIAL_HPP
// /!\ Please, you must read the license at the bottom of this page
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FExtendPotential
* Please read the license
* This class is an extenssion.
* It proposes a Potential (double).
*/
class FExtendPotential {
protected:
double potential; //< The potential extended
public:
/** Default constructor */
FExtendPotential() : potential(0) {
}
/** Copy constructor */
FExtendPotential(const FExtendPotential& other) : potential(other.potential) {
}
/** Destructor */
virtual ~FExtendPotential(){
}
/** Copy operator */
FExtendPotential& operator=(const FExtendPotential& other) {
this->potential = other.potential;
return *this;
}
/** To get the potential */
double getPotential() const {
return this->potential;
}
/** To set the potential */
void setPotential(const double inPotential) {
this->potential = inPotential;
}
};
#endif //FEXTENDPOTENTIAL_HPP
// [--LICENSE--]
#ifndef FEXTENDVALUE_HPP
#define FEXTENDVALUE_HPP
// /!\ Please, you must read the license at the bottom of this page
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FExtendValue
* Please read the license
* This class is an extenssion.
* It proposes a value (double).
*/
class FExtendValue {
protected:
double value; //< A simple value
public:
/** Default constructor */
FExtendValue() : value(0) {
}
/** Copy constructor */
FExtendValue(const FExtendValue& other) : value(other.value) {
}
/** Destructor */
virtual ~FExtendValue(){
}
/** Copy Constructor */
FExtendValue& operator=(const FExtendValue& other) {
this->value = other.value;
return *this;
}
/** To get the value */
double getValue() const {
return this->value;
}
/** To set the value */
void setValue(const double invalue) {
this->value = invalue;
}
};
#endif //FEXTENDVALUE_HPP
// [--LICENSE--]
......@@ -25,7 +25,7 @@ class FFMMAlgorithm : public FAssertable{
FOctree<ParticuleClass, CellClass, OctreeHeight, SubtreeHeight>* const tree; //< The octree to work on
FAbstractKernels<ParticuleClass, CellClass>* const kernels; //< The kernels
FDEBUG(FTic counter);
FDEBUG_TIME(FTic counter); //< In case of debug count the time
public:
/** The constructor need the octree and the kernels used for computation
......@@ -60,8 +60,8 @@ public:
/** P2M */
void bottomPass(){
FDEBUG( FDebug::Controller.write("\tStart Bottom Pass\n").write(FDebug::Flush) );
FDEBUG(counter.tic(););
FDEBUG_TRACE( FDebug::Controller.write("\tStart Bottom Pass\n").write(FDebug::Flush) );
FDEBUG_TIME(counter.tic(););
typename FOctree<ParticuleClass, CellClass, OctreeHeight, SubtreeHeight>::Iterator octreeIterator(tree);
// Iterate on leafs
......@@ -72,14 +72,14 @@ public:
kernels->P2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentList());
} while(octreeIterator.moveRight());
FDEBUG(counter.tac(););
FDEBUG( FDebug::Controller << "\tFinished (" << counter.elapsed() << "s)\n"; )
FDEBUG_TIME(counter.tac(););
FDEBUG_TRACE( FDebug::Controller << "\tFinished (") FDEBUG_TIME(<< counter.elapsed() <<) FDEBUG_TRACE("s)\n"; )
}
/** M2M */
void upwardPass(){
FDEBUG( FDebug::Controller.write("\tStart Upward Pass\n").write(FDebug::Flush); );
FDEBUG(counter.tic(););
FDEBUG_TRACE( FDebug::Controller.write("\tStart Upward Pass\n").write(FDebug::Flush); );
FDEBUG_TIME(counter.tic(););
typename FOctree<ParticuleClass, CellClass, OctreeHeight, SubtreeHeight>::Iterator octreeIterator(tree);
octreeIterator.gotoBottomLeft();
......@@ -96,14 +96,14 @@ public:
octreeIterator.gotoLeft();
}
FDEBUG(counter.tac(););
FDEBUG( FDebug::Controller << "\tFinished (" << counter.elapsed() << "s)\n"; )
FDEBUG_TIME(counter.tac(););
FDEBUG_TRACE( FDebug::Controller << "\tFinished (") FDEBUG_TIME(<< counter.elapsed() <<) FDEBUG_TRACE("s)\n"; )
}
/** M2L L2L */
void downardPass(){
FDEBUG( FDebug::Controller.write("\tStart Downward Pass (M2L)\n").write(FDebug::Flush); );
FDEBUG(counter.tic(););
FDEBUG_TRACE( FDebug::Controller.write("\tStart Downward Pass (M2L)\n").write(FDebug::Flush); );
FDEBUG_TIME(counter.tic(););
{ // first M2L
typename FOctree<ParticuleClass, CellClass, OctreeHeight, SubtreeHeight>::Iterator octreeIterator(tree);
......@@ -120,11 +120,11 @@ public:
octreeIterator.moveDown();
}
}
FDEBUG(counter.tac(););
FDEBUG( FDebug::Controller << "\tFinished (" << counter.elapsed() << "s)\n"; )
FDEBUG_TIME(counter.tac(););
FDEBUG_TRACE( FDebug::Controller << "\tFinished (") FDEBUG_TIME(<< counter.elapsed() <<) FDEBUG_TRACE("s)\n"; )
FDEBUG( FDebug::Controller.write("\tStart Downward Pass (L2L)\n").write(FDebug::Flush); );
FDEBUG(counter.tic(););
FDEBUG_TRACE( FDebug::Controller.write("\tStart Downward Pass (L2L)\n").write(FDebug::Flush); );
FDEBUG_TIME(counter.tic(););
{ // second L2L
typename FOctree<ParticuleClass, CellClass, OctreeHeight, SubtreeHeight>::Iterator octreeIterator(tree);
octreeIterator.moveDown();
......@@ -140,15 +140,15 @@ public:
}
}
FDEBUG(counter.tac(););
FDEBUG( FDebug::Controller << "\tFinished (" << counter.elapsed() << "s)\n"; )
FDEBUG_TIME(counter.tac(););
FDEBUG_TRACE( FDebug::Controller << "\tFinished (") FDEBUG_TIME(<< counter.elapsed() <<) FDEBUG_TRACE("s)\n"; )
}
/** P2P */
void directPass(){
FDEBUG( FDebug::Controller.write("\tStart Direct Pass\n").write(FDebug::Flush); );
FDEBUG(counter.tic(););
FDEBUG_TRACE( FDebug::Controller.write("\tStart Direct Pass\n").write(FDebug::Flush); );
FDEBUG_TIME(counter.tic(););
typename FOctree<ParticuleClass, CellClass, OctreeHeight, SubtreeHeight>::Iterator octreeIterator(tree);
octreeIterator.gotoBottomLeft();
......@@ -162,8 +162,8 @@ public:
kernels->P2P( octreeIterator.getCurrentList() , neighbors, counter);
} while(octreeIterator.moveRight());
FDEBUG(counter.tac(););
FDEBUG( FDebug::Controller << "\tFinished (" << counter.elapsed() << "s)\n"; )
FDEBUG_TIME(counter.tac(););
FDEBUG_TRACE( FDebug::Controller << "\tFinished (") FDEBUG_TIME(<< counter.elapsed() <<) FDEBUG_TRACE("s)\n"; )
}
......
......@@ -3,60 +3,21 @@
// /!\ Please, you must read the license at the bottom of this page
#include "FBasicParticule.hpp"
#include "FExtendValue.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FFmaParticule
* Please read the license
*