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 @@
#include <iostream>
#include <algorithm>
#include <chrono>
#include <ctime>
#include "Topology/generic/parameters.h"
......@@ -42,7 +44,7 @@ typedef CGoGN::Algo::Volume::MovingObjects::ParticleCell3DMemo<PFP> PARTICULEMEM
class EnvMap
{
public:
std::chrono::duration<double> duration_pop, duration_subdiv, duration_push;
EnvMap() ;
void init(int argc, char **argv) ;
......@@ -132,19 +134,16 @@ inline void addElementToVector(std::vector<T>& a, T ag)
template <typename T>
inline bool removeElementFromVector(std::vector<T>& a, T ag)
{
assert(std::find(a.begin(), a.end(), ag) != a.end());
typename std::vector<T>::iterator end = a.template end() ;
for (typename std::vector<T>::iterator it = a.begin(); it != end; ++it)
{
if (*it == ag)
{
*it = a.back() ;
a.pop_back() ;
return true ;
}
}
return false ;
typedef typename std::vector<T>::iterator iterator;
iterator it = std::find(a.begin(), a.end(), ag);
if (it == a.end())
{
return false;
} else {
*it = a.back();
a.pop_back();
}
return true;
}
/////////////////////////////////////////////////////////////////////REGISTRATIONS
......
......@@ -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
// map.check();
map.setCurrentLevel(map.getMaxLevel()) ;
......@@ -625,12 +625,22 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference)
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) )
{
Algo::Volume::IHM::subdivideVolumeClassic<PFP>(map, dglobal, position,false);
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.check();
......@@ -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
for (Triangle * o : oldTrianNeighbor)
{
this->FirstRegistrationTriangle(o) ;
}
//same for triangles // optimiser
for (Triangle * o : oldTrian)
{
......@@ -659,6 +672,8 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference)
this->FirstRegistrationTriangle(o) ;
}
const std::chrono::time_point<std::chrono::system_clock> endPushTriangle = std::chrono::system_clock::now();
//same for adjacent obstacles // optimiser
for (Segment * o : oldNeighborObst)
......@@ -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
......
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