From a9ff53e5295f8f581e02de8f3d7ca4dbc889c01d Mon Sep 17 00:00:00 2001 From: Nico Kruithof Date: Wed, 27 Mar 2013 18:05:50 +0100 Subject: [PATCH] Added test to log the performance of the periodic Delaunay triangulation --- .../test_p2t2_delaunay_performance.cpp | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/test_p2t2_delaunay_performance.cpp diff --git a/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/test_p2t2_delaunay_performance.cpp b/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/test_p2t2_delaunay_performance.cpp new file mode 100644 index 00000000000..0f88729aec5 --- /dev/null +++ b/Periodic_2_triangulation_2/test/Periodic_2_triangulation_2/test_p2t2_delaunay_performance.cpp @@ -0,0 +1,84 @@ +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Periodic_2_triangulation_traits_2 Gt; +typedef Gt::Point_2 Point; +typedef Gt::Vector_2 Vector; + +typedef CGAL::Periodic_2_Delaunay_triangulation_2 P2DT2; +typedef CGAL::Delaunay_triangulation_2 DT2; + +template +class DT2_inserter { + Dt t; +public: + template + void insert(Iterator begin, Iterator end) { + t.insert(begin, end); + } +}; + + +template +class P2DT2_inserter { + PT t; +public: + template + void insert(Iterator begin, Iterator end) { + t.insert(begin, end); + } +}; + +template +class P2DT2_large_point_set_inserter { + PT t; +public: + template + void insert(Iterator begin, Iterator end) { + t.insert(begin, end); + } +}; + +template +void test_performance(const std::string &name) { + // Create point sets + typedef CGAL::Creator_uniform_2 Creator; + CGAL::Random rnd(7); + CGAL::Random_points_in_square_2 in_square(0.5, rnd); + + CGAL::Timer timer; + + for (int n = 1000; n<=1e6; n+=1000) { + std::vector pts; + for (int i=0 ; i >("Euclidean Delaunay"); + test_performance >("Periodic Delaunay"); + test_performance >("Periodic Delaunay, large point set"); + + return 0; +}