diff --git a/.gitattributes b/.gitattributes index 3e27d285f2b..e487f1ba9f6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4171,6 +4171,7 @@ Testsuite/test/Testsuite/cgal_test_with_cmake eol=lf Testsuite/test/collect_cgal_testresults_from_cmake -text Testsuite/test/makefile2 -text Testsuite/test/run_testsuite_with_cmake -text +Triangulation_2/benchmark/Triangulation_2/Delaunay_remove.cpp -text Triangulation_2/demo/Triangulation_2/qt3/help/cindex.html svneol=native#text/html Triangulation_2/demo/Triangulation_2/qt3/help/cinput_point_layer.gif -text svneol=unset#image/gif Triangulation_2/demo/Triangulation_2/qt3/help/conflict_zone.gif -text svneol=unset#image/gif diff --git a/Triangulation_2/benchmark/Triangulation_2/CMakeLists.txt b/Triangulation_2/benchmark/Triangulation_2/CMakeLists.txt index c4015ebf1f4..16c110d8f82 100644 --- a/Triangulation_2/benchmark/Triangulation_2/CMakeLists.txt +++ b/Triangulation_2/benchmark/Triangulation_2/CMakeLists.txt @@ -26,6 +26,7 @@ if ( CGAL_FOUND ) include_directories (BEFORE ../../../../experimental-packages/Triangulation_2-unrecursive/include) create_single_source_cgal_program( "Triangulation_benchmark_2.cpp" ) + create_single_source_cgal_program( "Delaunay_remove.cpp" ) else() diff --git a/Triangulation_2/benchmark/Triangulation_2/Delaunay_remove.cpp b/Triangulation_2/benchmark/Triangulation_2/Delaunay_remove.cpp new file mode 100644 index 00000000000..0d95e4893ac --- /dev/null +++ b/Triangulation_2/benchmark/Triangulation_2/Delaunay_remove.cpp @@ -0,0 +1,52 @@ +#include +#include +#include +#include + + +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Delaunay_triangulation_2 Delaunay; +typedef K::Point_2 Point; +typedef CGAL::Creator_uniform_2 Creator; + + + +int main(int argc, char **argv) +{ + int n=1000000; + int rep=100; + if (argc>=2) + n=atoi(argv[1]); + if (argc>=3) + rep=atoi(argv[2]); + std::vector points; + points.reserve(n); + CGAL::Random_points_in_disc_2 g(1); + CGAL::copy_n( g, n, std::back_inserter(points)); + Delaunay original; + original.insert(points.begin(),points.end()); + + double res=0; + for (int r=0;r maxd_ptr; + static boost::thread_specific_ptr< std::vector > f_ptr; + static boost::thread_specific_ptr< std::vector > i_ptr; + static boost::thread_specific_ptr< std::vector > w_ptr; + if (maxd_ptr.get() == NULL) { + maxd_ptr.reset(new int(30)); + f_ptr.reset(new std::vector(*maxd_ptr)); + i_ptr.reset(new std::vector(*maxd_ptr)); + w_ptr.reset(new std::vector(*maxd_ptr)); + } + int& maxd=*maxd_ptr; + std::vector& f=*f_ptr; + std::vector& i=*i_ptr; + std::vector& w=*w_ptr; + #else static int maxd=30; static std::vector f(maxd); static std::vector i(maxd); static std::vector w(maxd); + #endif int d; remove_degree_init(v,f,w,i,d,maxd); remove_degree_triangulate(v,f,w,i,d); @@ -944,10 +961,27 @@ remove(Vertex_handle v) if ( this->dimension() <= 1) { Triangulation::remove(v); return; } + #ifdef CGAL_HAS_THREADS + static boost::thread_specific_ptr< int > maxd_ptr; + static boost::thread_specific_ptr< std::vector > f_ptr; + static boost::thread_specific_ptr< std::vector > i_ptr; + static boost::thread_specific_ptr< std::vector > w_ptr; + if (maxd_ptr.get() == NULL) { + maxd_ptr.reset(new int(30)); + f_ptr.reset(new std::vector(*maxd_ptr)); + i_ptr.reset(new std::vector(*maxd_ptr)); + w_ptr.reset(new std::vector(*maxd_ptr)); + } + int& maxd=*maxd_ptr; + std::vector& f=*f_ptr; + std::vector& i=*i_ptr; + std::vector& w=*w_ptr; + #else static int maxd=30; static std::vector f(maxd); static std::vector i(maxd); static std::vector w(maxd); + #endif remove_degree_init(v,f,w,i,d,maxd); if (d == 0) return; // dim is going down remove_degree_triangulate(v,f,w,i,d); @@ -2090,10 +2124,27 @@ move_if_no_collision(Vertex_handle v, const Point &p) { { int d; + #ifdef CGAL_HAS_THREADS + static boost::thread_specific_ptr< int > maxd_ptr; + static boost::thread_specific_ptr< std::vector > f_ptr; + static boost::thread_specific_ptr< std::vector > i_ptr; + static boost::thread_specific_ptr< std::vector > w_ptr; + if (maxd_ptr.get() == NULL) { + maxd_ptr.reset(new int(30)); + f_ptr.reset(new std::vector(*maxd_ptr)); + i_ptr.reset(new std::vector(*maxd_ptr)); + w_ptr.reset(new std::vector(*maxd_ptr)); + } + int& maxd=*maxd_ptr; + std::vector& f=*f_ptr; + std::vector& i=*i_ptr; + std::vector& w=*w_ptr; + #else static int maxd=30; static std::vector f(maxd); static std::vector i(maxd); static std::vector w(maxd); + #endif remove_degree_init(v,f,w,i,d,maxd); remove_degree_triangulate(v,f,w,i,d); } @@ -2308,10 +2359,27 @@ move_if_no_collision_and_give_new_faces(Vertex_handle v, { + #ifdef CGAL_HAS_THREADS + static boost::thread_specific_ptr< int > maxd_ptr; + static boost::thread_specific_ptr< std::vector > f_ptr; + static boost::thread_specific_ptr< std::vector > i_ptr; + static boost::thread_specific_ptr< std::vector > w_ptr; + if (maxd_ptr.get() == NULL) { + maxd_ptr.reset(new int(30)); + f_ptr.reset(new std::vector(*maxd_ptr)); + i_ptr.reset(new std::vector(*maxd_ptr)); + w_ptr.reset(new std::vector(*maxd_ptr)); + } + int& maxd=*maxd_ptr; + std::vector& f=*f_ptr; + std::vector& i=*i_ptr; + std::vector& w=*w_ptr; + #else static int maxd=30; static std::vector f(maxd); static std::vector i(maxd); static std::vector w(maxd); + #endif int d; remove_degree_init(v,f,w,i,d,maxd); remove_degree_triangulate(v,f,w,i,d);