Commit 5a5b4a3f authored by Quentin Khan's avatar Quentin Khan

Merge branch 'corrections'

parents a466119d 92096c15
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
...@@ -717,7 +717,7 @@ public: ...@@ -717,7 +717,7 @@ public:
const MortonIndex fullIndex = inIndex >> (3 * (inLevel + 1 - (workingTree.tree->getSubOctreeHeight() + workingTree.tree->getSubOctreePosition()) ) ); const MortonIndex fullIndex = inIndex >> (3 * (inLevel + 1 - (workingTree.tree->getSubOctreeHeight() + workingTree.tree->getSubOctreePosition()) ) );
// point to next suboctree // point to next suboctree
workingTree.tree = workingTree.middleTree->leafs(treeSubLeafMask & fullIndex); workingTree.tree = workingTree.middleTree->leafs(treeSubLeafMask & fullIndex);
if(!workingTree.tree) return 0; if(!workingTree.tree) return nullptr;
} }
// compute correct index in the array // compute correct index in the array
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
...@@ -38,18 +38,17 @@ enum FFmmOperations { ...@@ -38,18 +38,17 @@ enum FFmmOperations {
}; };
/** /**
* @brief The FAbstractAlgorithm class * \brief Base class of algorithms
* Is an abstract algorithm to be able to use the FAlgorithmBuilder *
* and execute from an abastrct pointer * This class is an abstract algorithm to be able to use the FAlgorithmBuilder
* and execute from an abstract pointer.
*/ */
class FAbstractAlgorithm { class FAbstractAlgorithm {
protected: protected:
//< Where to start the work
int upperWorkingLevel; int upperWorkingLevel; ///< Where to start the work
//< Where to end the work (exclusif) int lowerWorkingLevel; ///< Where to end the work (exclusive)
int lowerWorkingLevel; int nbLevelsInTree; ///< Height of the tree
//< Height of the tree
int nbLevelsInTree;
void setNbLevelsInTree(const int inNbLevelsInTree){ void setNbLevelsInTree(const int inNbLevelsInTree){
nbLevelsInTree = inNbLevelsInTree; nbLevelsInTree = inNbLevelsInTree;
...@@ -71,7 +70,7 @@ public: ...@@ -71,7 +70,7 @@ public:
virtual ~FAbstractAlgorithm(){ virtual ~FAbstractAlgorithm(){
} }
/** Execute all the fmm but for given levels*/ /** \brief Execute the whole fmm for given levels. */
virtual void execute(const int inUpperWorkingLevel, const int inLowerWorkingLevel) final { virtual void execute(const int inUpperWorkingLevel, const int inLowerWorkingLevel) final {
upperWorkingLevel = inUpperWorkingLevel; upperWorkingLevel = inUpperWorkingLevel;
lowerWorkingLevel = inLowerWorkingLevel; lowerWorkingLevel = inLowerWorkingLevel;
...@@ -79,7 +78,7 @@ public: ...@@ -79,7 +78,7 @@ public:
executeCore(FFmmNearAndFarFields); executeCore(FFmmNearAndFarFields);
} }
/** Execute all the fmm */ /** \brief Execute the whole fmm. */
virtual void execute() final { virtual void execute() final {
upperWorkingLevel = 2; upperWorkingLevel = 2;
lowerWorkingLevel = nbLevelsInTree; lowerWorkingLevel = nbLevelsInTree;
...@@ -87,7 +86,7 @@ public: ...@@ -87,7 +86,7 @@ public:
executeCore(FFmmNearAndFarFields); executeCore(FFmmNearAndFarFields);
} }
/** Execute only some FMM operation for given levels */ /** \brief Execute only some FMM operations for given levels. */
virtual void execute(const unsigned operationsToProceed, const int inUpperWorkingLevel, const int inLowerWorkingLevel) final { virtual void execute(const unsigned operationsToProceed, const int inUpperWorkingLevel, const int inLowerWorkingLevel) final {
upperWorkingLevel = inUpperWorkingLevel; upperWorkingLevel = inUpperWorkingLevel;
lowerWorkingLevel = inLowerWorkingLevel; lowerWorkingLevel = inLowerWorkingLevel;
...@@ -95,7 +94,7 @@ public: ...@@ -95,7 +94,7 @@ public:
executeCore(operationsToProceed); executeCore(operationsToProceed);
} }
/** Execute only some steps */ /** \brief Execute only some steps. */
virtual void execute(const unsigned operationsToProceed) final { virtual void execute(const unsigned operationsToProceed) final {
upperWorkingLevel = 2; upperWorkingLevel = 2;
lowerWorkingLevel = nbLevelsInTree; lowerWorkingLevel = nbLevelsInTree;
......
...@@ -30,30 +30,32 @@ ...@@ -30,30 +30,32 @@
#include "FCoreCommon.hpp" #include "FCoreCommon.hpp"
/** /**
* @author Berenger Bramas (berenger.bramas@inria.fr) * \author Berenger Bramas (berenger.bramas@inria.fr)
* @class FFmmAlgorithm * \brief Implements a basic FMM algorithm.
* @brief
* Please read the license
* *
* This class is a basic FMM algorithm * Please read the license.
* It just iterates on a tree and call the kernels with good arguments.
* *
* Of course this class does not deallocate pointer given in arguements. * This class runs the FMM algorithm on a tree using the kernels that it was given.
*
* This class does not deallocate pointers given to it constructor.
*/ */
template<class OctreeClass, class CellClass, class ContainerClass, class KernelClass, class LeafClass> template<class OctreeClass, class CellClass, class ContainerClass, class KernelClass, class LeafClass>
class FFmmAlgorithm : public FAbstractAlgorithm, public FAlgorithmTimers { class FFmmAlgorithm : public FAbstractAlgorithm, public FAlgorithmTimers {
OctreeClass* const tree; //< The octree to work on OctreeClass* const tree; ///< The octree to work on.
KernelClass* const kernels; //< The kernels KernelClass* const kernels; ///< The kernels.
const int OctreeHeight; const int OctreeHeight; ///< The height of the given tree.
public: public:
/** The constructor need the octree and the kernels used for computation /** Class constructor
* @param inTree the octree to work on *
* @param inKernels the kernels to call * The constructor needs the octree and the kernels used for computation.
* An assert is launched if one of the arguments is null * @param inTree the octree to work on.
*/ * @param inKernels the kernels to call.
*
* \except An exception is thrown if one of the arguments is NULL.
*/
FFmmAlgorithm(OctreeClass* const inTree, KernelClass* const inKernels) FFmmAlgorithm(OctreeClass* const inTree, KernelClass* const inKernels)
: tree(inTree) , kernels(inKernels), OctreeHeight(tree->getHeight()) { : tree(inTree) , kernels(inKernels), OctreeHeight(tree->getHeight()) {
...@@ -71,8 +73,7 @@ public: ...@@ -71,8 +73,7 @@ public:
protected: protected:
/** /**
* To execute the fmm algorithm * Runs the complete algorithm.
* Call this function to run the complete algorithm
*/ */
void executeCore(const unsigned operationsToProceed) override { void executeCore(const unsigned operationsToProceed) override {
...@@ -101,7 +102,7 @@ protected: ...@@ -101,7 +102,7 @@ protected:
// P2M // P2M
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** P2M */ /** Runs the P2M kernel. */
void bottomPass(){ void bottomPass(){
FLOG( FLog::Controller.write("\tStart Bottom Pass\n").write(FLog::Flush) ); FLOG( FLog::Controller.write("\tStart Bottom Pass\n").write(FLog::Flush) );
FLOG(FTic counterTime); FLOG(FTic counterTime);
...@@ -112,7 +113,7 @@ protected: ...@@ -112,7 +113,7 @@ protected:
// Iterate on leafs // Iterate on leafs
octreeIterator.gotoBottomLeft(); octreeIterator.gotoBottomLeft();
do{ do{
// We need the current cell that represent the leaf // We need the current cell that represents the leaf
// and the list of particles // and the list of particles
FLOG(computationCounter.tic()); FLOG(computationCounter.tic());
kernels->P2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentListSrc()); kernels->P2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentListSrc());
...@@ -127,7 +128,7 @@ protected: ...@@ -127,7 +128,7 @@ protected:
// Upward // Upward
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** M2M */ /** Runs the M2M kernel. */
void upwardPass(){ void upwardPass(){
FLOG( FLog::Controller.write("\tStart Upward Pass\n").write(FLog::Flush); ); FLOG( FLog::Controller.write("\tStart Upward Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime); FLOG(FTic counterTime);
...@@ -172,7 +173,7 @@ protected: ...@@ -172,7 +173,7 @@ protected:
// Transfer // Transfer
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** M2L */ /** Runs the M2L kernel. */
void transferPass(){ void transferPass(){
FLOG( FLog::Controller.write("\tStart Downward Pass (M2L)\n").write(FLog::Flush); ); FLOG( FLog::Controller.write("\tStart Downward Pass (M2L)\n").write(FLog::Flush); );
FLOG(FTic counterTime); FLOG(FTic counterTime);
...@@ -218,7 +219,7 @@ protected: ...@@ -218,7 +219,7 @@ protected:
// Downward // Downward
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** L2L */ /** Runs the L2L kernel .*/
void downardPass(){ void downardPass(){
FLOG( FLog::Controller.write("\tStart Downward Pass (L2L)\n").write(FLog::Flush); ); FLOG( FLog::Controller.write("\tStart Downward Pass (L2L)\n").write(FLog::Flush); );
FLOG(FTic counterTime); FLOG(FTic counterTime);
...@@ -261,7 +262,11 @@ protected: ...@@ -261,7 +262,11 @@ protected:
// Direct // Direct
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** P2P */ /** Runs the P2P & L2P kernels.
*
* \param p2pEnabled If true, run the P2P kernel.
* \param l2pEnabled If true, run the L2P kernel.
*/
void directPass(const bool p2pEnabled, const bool l2pEnabled){ void directPass(const bool p2pEnabled, const bool l2pEnabled){
FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); ); FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime); FLOG(FTic counterTime);
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
...@@ -31,24 +31,24 @@ ...@@ -31,24 +31,24 @@
#include <omp.h> #include <omp.h>
/** /**
* @author Berenger Bramas (berenger.bramas@inria.fr) * \author Berenger Bramas (berenger.bramas@inria.fr)
* @class FFmmAlgorithmThread * \brief Implements an FMM algorithm threaded using OpenMP.
* @brief
* Please read the license
* *
* This class is a threaded FMM algorithm * Please read the license
* It just iterates on a tree and call the kernels with good arguments.
* It used the inspector-executor model :
* iterates on the tree and builds an array to work in parallel on this array
* *
* Of course this class does not deallocate pointer given in arguments. * This class runs a threaded FMM algorithm. It just iterates on a tree and call
* the kernels with good arguments. The inspector-executor model is used : the
* class iterates on the tree and builds an array and works in parallel on this
* array.
* *
* When using this algorithm the P2P is thread safe. * When using this algorithm the P2P is thread safe.
*
* This class does not deallocate pointers given to its constructor.
*/ */
template<class OctreeClass, class CellClass, class ContainerClass, class KernelClass, class LeafClass> template<class OctreeClass, class CellClass, class ContainerClass, class KernelClass, class LeafClass>
class FFmmAlgorithmThread : public FAbstractAlgorithm, public FAlgorithmTimers{ class FFmmAlgorithmThread : public FAbstractAlgorithm, public FAlgorithmTimers{
OctreeClass* const tree; //< The octree to work on OctreeClass* const tree; ///< The octree to work on.
KernelClass** kernels; //< The kernels KernelClass** kernels; ///< The kernels.
typename OctreeClass::Iterator* iterArray; typename OctreeClass::Iterator* iterArray;
int leafsNumber; int leafsNumber;
...@@ -56,16 +56,19 @@ class FFmmAlgorithmThread : public FAbstractAlgorithm, public FAlgorithmTimers{ ...@@ -56,16 +56,19 @@ class FFmmAlgorithmThread : public FAbstractAlgorithm, public FAlgorithmTimers{
static const int SizeShape = 3*3*3; static const int SizeShape = 3*3*3;
int shapeLeaf[SizeShape]; int shapeLeaf[SizeShape];
const int MaxThreads; const int MaxThreads; ///< The maximum number of threads.
const int OctreeHeight; const int OctreeHeight; ///< The height of the given tree.
public: public:
/** The constructor need the octree and the kernels used for computation /** Class constructor
* @param inTree the octree to work on *
* @param inKernels the kernels to call * The constructor needs the octree and the kernels used for computation.
* An assert is launched if one of the arguments is null * \param inTree the octree to work on.
*/ * \param inKernels the kernels to call.
*
* \except An exception is thrown if one of the arguments is NULL.
*/
FFmmAlgorithmThread(OctreeClass* const inTree, KernelClass* const inKernels) FFmmAlgorithmThread(OctreeClass* const inTree, KernelClass* const inKernels)
: tree(inTree) , kernels(nullptr), iterArray(nullptr), leafsNumber(0), : tree(inTree) , kernels(nullptr), iterArray(nullptr), leafsNumber(0),
MaxThreads(omp_get_max_threads()), OctreeHeight(tree->getHeight()) { MaxThreads(omp_get_max_threads()), OctreeHeight(tree->getHeight()) {
...@@ -96,8 +99,7 @@ public: ...@@ -96,8 +99,7 @@ public:
protected: protected:
/** /**
* To execute the fmm algorithm * Runs the complete algorithm.
* Call this function to run the complete algorithm
*/ */
void executeCore(const unsigned operationsToProceed) override { void executeCore(const unsigned operationsToProceed) override {
...@@ -146,7 +148,7 @@ protected: ...@@ -146,7 +148,7 @@ protected:
// P2M // P2M
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** P2M */ /** Runs the P2M kernel. */
void bottomPass(){ void bottomPass(){
FLOG( FLog::Controller.write("\tStart Bottom Pass\n").write(FLog::Flush) ); FLOG( FLog::Controller.write("\tStart Bottom Pass\n").write(FLog::Flush) );
FLOG(FTic counterTime); FLOG(FTic counterTime);
...@@ -184,7 +186,7 @@ protected: ...@@ -184,7 +186,7 @@ protected:
// Upward // Upward
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** M2M */ /** Runs the M2M kernel. */
void upwardPass(){ void upwardPass(){
FLOG( FLog::Controller.write("\tStart Upward Pass\n").write(FLog::Flush); ); FLOG( FLog::Controller.write("\tStart Upward Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime); FLOG(FTic counterTime);
...@@ -241,7 +243,7 @@ protected: ...@@ -241,7 +243,7 @@ protected:
// Transfer // Transfer
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** M2L L2L */ /** Runs the M2L kernel. */
void transferPass(){ void transferPass(){
FLOG( FLog::Controller.write("\tStart Downward Pass (M2L)\n").write(FLog::Flush); ); FLOG( FLog::Controller.write("\tStart Downward Pass (M2L)\n").write(FLog::Flush); );
...@@ -297,7 +299,8 @@ protected: ...@@ -297,7 +299,8 @@ protected:
// Downward // Downward
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
void downardPass(){ // second L2L /** Runs the L2L kernel. */
void downardPass(){
FLOG( FLog::Controller.write("\tStart Downward Pass (L2L)\n").write(FLog::Flush); ); FLOG( FLog::Controller.write("\tStart Downward Pass (L2L)\n").write(FLog::Flush); );
FLOG(FTic counterTime); FLOG(FTic counterTime);
...@@ -349,7 +352,11 @@ protected: ...@@ -349,7 +352,11 @@ protected:
// Direct // Direct
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/** P2P */ /** Runs the P2P & L2P kernels.
*
* \param p2pEnabled Run the P2P kernel.
* \param l2pEnabled Run the L2P kernel.
*/
void directPass(const bool p2pEnabled, const bool l2pEnabled){ void directPass(const bool p2pEnabled, const bool l2pEnabled){
FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); ); FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime); FLOG(FTic counterTime);
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644