Commit 8c8d1eba authored by Quentin Khan's avatar Quentin Khan
Browse files

FFmmAlgorithmSectionTask: added inheritance from FAlgorithmTimers

FAlgorithmTimers: added copy constructor, move constructor, operator+ and operator=
parent c1dc7289
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
* Of course this class does not deallocate pointer given in arguements. * Of course this class does not deallocate pointer given in arguements.
*/ */
template<class OctreeClass, class CellClass, class ContainerClass, class KernelClass, class LeafClass> template<class OctreeClass, class CellClass, class ContainerClass, class KernelClass, class LeafClass>
class FFmmAlgorithmSectionTask : public FAbstractAlgorithm{ class FFmmAlgorithmSectionTask : 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
...@@ -99,24 +99,38 @@ protected: ...@@ -99,24 +99,38 @@ protected:
{ {
#pragma omp section #pragma omp section
{ {
Timers[P2MTimer].tic();
if(operationsToProceed & FFmmP2M) bottomPass(); if(operationsToProceed & FFmmP2M) bottomPass();
Timers[P2MTimer].tac();
Timers[M2MTimer].tic();
if(operationsToProceed & FFmmM2M) upwardPass(); if(operationsToProceed & FFmmM2M) upwardPass();
Timers[M2MTimer].tac();
Timers[M2LTimer].tic();
if(operationsToProceed & FFmmM2L) transferPass(); if(operationsToProceed & FFmmM2L) transferPass();
Timers[M2LTimer].tac();
Timers[L2LTimer].tic();
if(operationsToProceed & FFmmL2L) downardPass(); if(operationsToProceed & FFmmL2L) downardPass();
Timers[L2LTimer].tac();
} }
#pragma omp section #pragma omp section
{ {
if(operationsToProceed & FFmmP2P) directPass(); Timers[P2PTimer].tic();
if( operationsToProceed & FFmmP2P ) directPass();
Timers[P2PTimer].tac();
} }
} }
#pragma omp single #pragma omp single
{ {
Timers[L2PTimer].tic();
if(operationsToProceed & FFmmL2P) L2PPass(); if(operationsToProceed & FFmmL2P) L2PPass();
Timers[L2PTimer].tac();
} }
} }
Timers[NearTimer] = Timers[L2PTimer] + Timers[P2PTimer];
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
...@@ -321,7 +335,7 @@ protected: ...@@ -321,7 +335,7 @@ protected:
FLOG( computationCounter.tic() ); FLOG( computationCounter.tic() );
for( int idxShape = 0 ; idxShape < SizeShape ; ++idxShape){ for( int idxShape = 0 ; idxShape < SizeShape ; ++idxShape){
const int nbLeaf = shapes[idxShape].getSize(); const FSize nbLeaf = shapes[idxShape].getSize();
for(int iterLeaf = 0 ; iterLeaf < nbLeaf ; ++iterLeaf ){ for(int iterLeaf = 0 ; iterLeaf < nbLeaf ; ++iterLeaf ){
typename OctreeClass::Iterator toWork = shapes[idxShape][iterLeaf]; typename OctreeClass::Iterator toWork = shapes[idxShape][iterLeaf];
#pragma omp task firstprivate(neighbors, toWork) #pragma omp task firstprivate(neighbors, toWork)
......
...@@ -60,6 +60,26 @@ public: ...@@ -60,6 +60,26 @@ public:
tic(); tic();
} }
FTic(const FTic& other) : start(other.start), end(other.end), cumulate(other.cumulate) {}
FTic(FTic&& other) : start(other.start), end(other.end), cumulate(other.cumulate) {}
FTic& operator=(const FTic& other) {
start = other.start;
end = other.end;
cumulate = other.cumulate;
return *this;
}
const FTic operator+(const FTic& other) {
start = start < other.start ? start : other.start;
end = end > other.end ? end : other.end;
cumulate += other.cumulate;
return FTic(*this);
}
/** Tic : start <= current time */ /** Tic : start <= current time */
void tic(){ void tic(){
this->start = FTic::GetTime(); this->start = FTic::GetTime();
......
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