Commit a1267f46 authored by Etienne Schmitt's avatar Etienne Schmitt

benchmarking

Signed-off-by: Etienne Schmitt's avatarÉtienne Schmitt <etienne.schmitt@inria.fr>
parent 21772991
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
#include <chrono>
#include <ctime>
#include "Topology/generic/parameters.h" #include "Topology/generic/parameters.h"
...@@ -42,7 +44,7 @@ typedef CGoGN::Algo::Volume::MovingObjects::ParticleCell3DMemo<PFP> PARTICULEMEM ...@@ -42,7 +44,7 @@ typedef CGoGN::Algo::Volume::MovingObjects::ParticleCell3DMemo<PFP> PARTICULEMEM
class EnvMap class EnvMap
{ {
public: public:
std::chrono::duration<double> duration_pop, duration_subdiv, duration_push;
EnvMap() ; EnvMap() ;
void init(int argc, char **argv) ; void init(int argc, char **argv) ;
...@@ -132,19 +134,16 @@ inline void addElementToVector(std::vector<T>& a, T ag) ...@@ -132,19 +134,16 @@ inline void addElementToVector(std::vector<T>& a, T ag)
template <typename T> template <typename T>
inline bool removeElementFromVector(std::vector<T>& a, T ag) inline bool removeElementFromVector(std::vector<T>& a, T ag)
{ {
assert(std::find(a.begin(), a.end(), ag) != a.end()); typedef typename std::vector<T>::iterator iterator;
iterator it = std::find(a.begin(), a.end(), ag);
typename std::vector<T>::iterator end = a.template end() ; if (it == a.end())
for (typename std::vector<T>::iterator it = a.begin(); it != end; ++it) {
{ return false;
if (*it == ag) } else {
{ *it = a.back();
*it = a.back() ; a.pop_back();
a.pop_back() ; }
return true ; return true;
}
}
return false ;
} }
/////////////////////////////////////////////////////////////////////REGISTRATIONS /////////////////////////////////////////////////////////////////////REGISTRATIONS
......
...@@ -592,7 +592,7 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) ...@@ -592,7 +592,7 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference)
} }
const std::chrono::time_point<std::chrono::system_clock> startPop = std::chrono::system_clock::now();
// on commence ensuite a subdiviser // on commence ensuite a subdiviser
// map.check(); // map.check();
map.setCurrentLevel(map.getMaxLevel()) ; map.setCurrentLevel(map.getMaxLevel()) ;
...@@ -625,12 +625,22 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) ...@@ -625,12 +625,22 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference)
this->popTriangle(o) ; this->popTriangle(o) ;
} }
const std::chrono::time_point<std::chrono::system_clock> endPop = std::chrono::system_clock::now();
duration_pop = endPop - startPop;
std::cout << "pop duration : " << duration_pop.count() << "s\n";
const std::chrono::time_point<std::chrono::system_clock> startSubdiv = std::chrono::system_clock::now();
if(!map.isBoundaryMarked(3,dglobal) && map.getDartLevel(dglobal) <= map.getMaxLevel() && !map.volumeIsSubdivided(dglobal) ) if(!map.isBoundaryMarked(3,dglobal) && map.getDartLevel(dglobal) <= map.getMaxLevel() && !map.volumeIsSubdivided(dglobal) )
{ {
Algo::Volume::IHM::subdivideVolumeClassic<PFP>(map, dglobal, position,false); Algo::Volume::IHM::subdivideVolumeClassic<PFP>(map, dglobal, position,false);
res=true; res=true;
} }
const std::chrono::time_point<std::chrono::system_clock> endSubdiv = std::chrono::system_clock::now();
duration_subdiv = endSubdiv - startSubdiv;
std::cout << "subdiv duration : " << duration_subdiv.count() << "s\n";
map.setCurrentLevel(map.getMaxLevel()) ; map.setCurrentLevel(map.getMaxLevel()) ;
// map.check(); // map.check();
...@@ -646,12 +656,15 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) ...@@ -646,12 +656,15 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference)
} }
const std::chrono::time_point<std::chrono::system_clock> startPush = std::chrono::system_clock::now();
//same for adjacent triangles // optimiser //same for adjacent triangles // optimiser
for (Triangle * o : oldTrianNeighbor) for (Triangle * o : oldTrianNeighbor)
{ {
this->FirstRegistrationTriangle(o) ; this->FirstRegistrationTriangle(o) ;
} }
//same for triangles // optimiser //same for triangles // optimiser
for (Triangle * o : oldTrian) for (Triangle * o : oldTrian)
{ {
...@@ -659,6 +672,8 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) ...@@ -659,6 +672,8 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference)
this->FirstRegistrationTriangle(o) ; this->FirstRegistrationTriangle(o) ;
} }
const std::chrono::time_point<std::chrono::system_clock> endPushTriangle = std::chrono::system_clock::now();
//same for adjacent obstacles // optimiser //same for adjacent obstacles // optimiser
for (Segment * o : oldNeighborObst) for (Segment * o : oldNeighborObst)
...@@ -673,6 +688,10 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) ...@@ -673,6 +688,10 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference)
} }
const std::chrono::time_point<std::chrono::system_clock> endPush = std::chrono::system_clock::now();
duration_push = endPush - startPush;
std::cout << "push triangle duration : " << std::chrono::duration<double> (endPushTriangle - startPush).count() << "s\n";
std::cout << "push duration : " << duration_push.count() << "s\n";
#endif #endif
......
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