Commit ae904e8e authored by Quentin Khan's avatar Quentin Khan

Polished doc of FFmmAlgorithm, FFmmAlgorithmThread and FCoreCommon

parent b76c01e4
......@@ -38,15 +38,16 @@ enum FFmmOperations {
};
/**
* @brief The FAbstractAlgorithm class
* Is an abstract algorithm to be able to use the FAlgorithmBuilder
* and execute from an abastrct pointer
* \brief Base class of algorithms
*
* This class is an abstract algorithm to be able to use the FAlgorithmBuilder
* and execute from an abstract pointer.
*/
class FAbstractAlgorithm {
protected:
//< Where to start the work
int upperWorkingLevel;
//< Where to end the work (exclusif)
//< Where to end the work (exclusive)
int lowerWorkingLevel;
//< Height of the tree
int nbLevelsInTree;
......@@ -71,7 +72,7 @@ public:
virtual ~FAbstractAlgorithm(){
}
/** Execute all the fmm but for given levels*/
/** Execute the whole fmm for given levels. */
virtual void execute(const int inUpperWorkingLevel, const int inLowerWorkingLevel) final {
upperWorkingLevel = inUpperWorkingLevel;
lowerWorkingLevel = inLowerWorkingLevel;
......@@ -79,7 +80,7 @@ public:
executeCore(FFmmNearAndFarFields);
}
/** Execute all the fmm */
/** Execute the whole fmm. */
virtual void execute() final {
upperWorkingLevel = 2;
lowerWorkingLevel = nbLevelsInTree;
......@@ -87,7 +88,7 @@ public:
executeCore(FFmmNearAndFarFields);
}
/** Execute only some FMM operation for given levels */
/** Execute only some FMM operations for given levels. */
virtual void execute(const unsigned operationsToProceed, const int inUpperWorkingLevel, const int inLowerWorkingLevel) final {
upperWorkingLevel = inUpperWorkingLevel;
lowerWorkingLevel = inLowerWorkingLevel;
......@@ -95,7 +96,7 @@ public:
executeCore(operationsToProceed);
}
/** Execute only some steps */
/** Execute only some steps. */
virtual void execute(const unsigned operationsToProceed) final {
upperWorkingLevel = 2;
lowerWorkingLevel = nbLevelsInTree;
......
......@@ -30,30 +30,32 @@
#include "FCoreCommon.hpp"
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FFmmAlgorithm
* @brief
* Please read the license
* \author Berenger Bramas (berenger.bramas@inria.fr)
* \brief Implements a basic FMM algorithm.
*
* This class is a basic FMM algorithm
* It just iterates on a tree and call the kernels with good arguments.
* Please read the license.
*
* 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>
class FFmmAlgorithm : public FAbstractAlgorithm, public FAlgorithmTimers {
OctreeClass* const tree; //< The octree to work on
KernelClass* const kernels; //< The kernels
OctreeClass* const tree; ///< The octree to work on.
KernelClass* const kernels; ///< The kernels.
const int OctreeHeight;
const int OctreeHeight; ///< The height of the given tree.
public:
/** The constructor need the octree and the kernels used for computation
* @param inTree the octree to work on
* @param inKernels the kernels to call
* An assert is launched if one of the arguments is null
*/
/** Class constructor
*
* The constructor needs the octree and the kernels used for computation.
* @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)
: tree(inTree) , kernels(inKernels), OctreeHeight(tree->getHeight()) {
......@@ -71,8 +73,7 @@ public:
protected:
/**
* To execute the fmm algorithm
* Call this function to run the complete algorithm
* Runs the complete algorithm.
*/
void executeCore(const unsigned operationsToProceed) override {
......@@ -101,7 +102,7 @@ protected:
// P2M
/////////////////////////////////////////////////////////////////////////////
/** P2M */
/** Runs the P2M kernel. */
void bottomPass(){
FLOG( FLog::Controller.write("\tStart Bottom Pass\n").write(FLog::Flush) );
FLOG(FTic counterTime);
......@@ -112,7 +113,7 @@ protected:
// Iterate on leafs
octreeIterator.gotoBottomLeft();
do{
// We need the current cell that represent the leaf
// We need the current cell that represents the leaf
// and the list of particles
FLOG(computationCounter.tic());
kernels->P2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentListSrc());
......@@ -127,7 +128,7 @@ protected:
// Upward
/////////////////////////////////////////////////////////////////////////////
/** M2M */
/** Runs the M2M kernel. */
void upwardPass(){
FLOG( FLog::Controller.write("\tStart Upward Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime);
......@@ -172,7 +173,7 @@ protected:
// Transfer
/////////////////////////////////////////////////////////////////////////////
/** M2L */
/** Runs the M2L kernel. */
void transferPass(){
FLOG( FLog::Controller.write("\tStart Downward Pass (M2L)\n").write(FLog::Flush); );
FLOG(FTic counterTime);
......@@ -218,7 +219,7 @@ protected:
// Downward
/////////////////////////////////////////////////////////////////////////////
/** L2L */
/** Runs the L2L kernel .*/
void downardPass(){
FLOG( FLog::Controller.write("\tStart Downward Pass (L2L)\n").write(FLog::Flush); );
FLOG(FTic counterTime);
......@@ -261,7 +262,11 @@ protected:
// 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){
FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime);
......
......@@ -31,24 +31,24 @@
#include <omp.h>
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FFmmAlgorithmThread
* @brief
* Please read the license
* \author Berenger Bramas (berenger.bramas@inria.fr)
* \brief Implements an FMM algorithm threaded using OpenMP.
*
* This class is a threaded FMM algorithm
* 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
* Please read the license
*
* 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.
*
* This class does not deallocate pointers given to its constructor.
*/
template<class OctreeClass, class CellClass, class ContainerClass, class KernelClass, class LeafClass>
class FFmmAlgorithmThread : public FAbstractAlgorithm, public FAlgorithmTimers{
OctreeClass* const tree; //< The octree to work on
KernelClass** kernels; //< The kernels
OctreeClass* const tree; ///< The octree to work on.
KernelClass** kernels; ///< The kernels.
typename OctreeClass::Iterator* iterArray;
int leafsNumber;
......@@ -56,16 +56,19 @@ class FFmmAlgorithmThread : public FAbstractAlgorithm, public FAlgorithmTimers{
static const int SizeShape = 3*3*3;
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:
/** The constructor need the octree and the kernels used for computation
* @param inTree the octree to work on
* @param inKernels the kernels to call
* An assert is launched if one of the arguments is null
*/
/** Class constructor
*
* The constructor needs the octree and the kernels used for computation.
* \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)
: tree(inTree) , kernels(nullptr), iterArray(nullptr), leafsNumber(0),
MaxThreads(omp_get_max_threads()), OctreeHeight(tree->getHeight()) {
......@@ -96,8 +99,7 @@ public:
protected:
/**
* To execute the fmm algorithm
* Call this function to run the complete algorithm
* Runs the complete algorithm.
*/
void executeCore(const unsigned operationsToProceed) override {
......@@ -146,7 +148,7 @@ protected:
// P2M
/////////////////////////////////////////////////////////////////////////////
/** P2M */
/** Runs the P2M kernel. */
void bottomPass(){
FLOG( FLog::Controller.write("\tStart Bottom Pass\n").write(FLog::Flush) );
FLOG(FTic counterTime);
......@@ -184,7 +186,7 @@ protected:
// Upward
/////////////////////////////////////////////////////////////////////////////
/** M2M */
/** Runs the M2M kernel. */
void upwardPass(){
FLOG( FLog::Controller.write("\tStart Upward Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime);
......@@ -241,7 +243,7 @@ protected:
// Transfer
/////////////////////////////////////////////////////////////////////////////
/** M2L L2L */
/** Runs the M2L kernel. */
void transferPass(){
FLOG( FLog::Controller.write("\tStart Downward Pass (M2L)\n").write(FLog::Flush); );
......@@ -297,7 +299,8 @@ protected:
// Downward
/////////////////////////////////////////////////////////////////////////////
void downardPass(){ // second L2L
/** Runs the L2L kernel. */
void downardPass(){
FLOG( FLog::Controller.write("\tStart Downward Pass (L2L)\n").write(FLog::Flush); );
FLOG(FTic counterTime);
......@@ -349,7 +352,11 @@ protected:
// 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){
FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment