From a1267f46e2bf58c6ed84c9fabd6f5e532c6920dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Schmitt?= Date: Wed, 18 Mar 2015 17:32:07 +0100 Subject: [PATCH] benchmarking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Étienne Schmitt --- include/env_map.h | 27 +++++++++++++-------------- src/env_map.cpp | 21 ++++++++++++++++++++- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/include/env_map.h b/include/env_map.h index ea47efb..b84191f 100644 --- a/include/env_map.h +++ b/include/env_map.h @@ -7,6 +7,8 @@ #include #include +#include +#include #include "Topology/generic/parameters.h" @@ -42,7 +44,7 @@ typedef CGoGN::Algo::Volume::MovingObjects::ParticleCell3DMemo PARTICULEMEM class EnvMap { public: - + std::chrono::duration duration_pop, duration_subdiv, duration_push; EnvMap() ; void init(int argc, char **argv) ; @@ -132,19 +134,16 @@ inline void addElementToVector(std::vector& a, T ag) template inline bool removeElementFromVector(std::vector& a, T ag) { - assert(std::find(a.begin(), a.end(), ag) != a.end()); - - typename std::vector::iterator end = a.template end() ; - for (typename std::vector::iterator it = a.begin(); it != end; ++it) - { - if (*it == ag) - { - *it = a.back() ; - a.pop_back() ; - return true ; - } - } - return false ; + typedef typename std::vector::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 diff --git a/src/env_map.cpp b/src/env_map.cpp index 8b1fc85..fab5d91 100644 --- a/src/env_map.cpp +++ b/src/env_map.cpp @@ -592,7 +592,7 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) } - + const std::chrono::time_point 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 endPop = std::chrono::system_clock::now(); + duration_pop = endPop - startPop; + std::cout << "pop duration : " << duration_pop.count() << "s\n"; + + const std::chrono::time_point startSubdiv = std::chrono::system_clock::now(); + if(!map.isBoundaryMarked(3,dglobal) && map.getDartLevel(dglobal) <= map.getMaxLevel() && !map.volumeIsSubdivided(dglobal) ) { Algo::Volume::IHM::subdivideVolumeClassic(map, dglobal, position,false); res=true; } + const std::chrono::time_point 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 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 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 endPush = std::chrono::system_clock::now(); + duration_push = endPush - startPush; + std::cout << "push triangle duration : " << std::chrono::duration (endPushTriangle - startPush).count() << "s\n"; + std::cout << "push duration : " << duration_push.count() << "s\n"; #endif -- GitLab