diff --git a/Triangulation_on_sphere_2/benchmark/CMakeLists.txt b/Triangulation_on_sphere_2/benchmark/CMakeLists.txt index 0c97293dcc4..24bd9b0dc91 100644 --- a/Triangulation_on_sphere_2/benchmark/CMakeLists.txt +++ b/Triangulation_on_sphere_2/benchmark/CMakeLists.txt @@ -1,34 +1,20 @@ # Created by the script cgal_create_cmake_script # This is the CMake script for compiling a CGAL application. +project( Triangulation_on_sphere_2_Benchmarks ) -project( Implantation_example ) +cmake_minimum_required(VERSION 3.1...3.15) -CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5) - -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) - -if ( COMMAND cmake_policy ) - cmake_policy( SET CMP0003 NEW ) -endif() - -find_package(CGAL QUIET COMPONENTS Core ) +find_package(CGAL REQUIRED COMPONENTS Core ) if ( CGAL_FOUND ) - include( ${CGAL_USE_FILE} ) - - include( CGAL_CreateSingleSourceCGALProgram ) - - include_directories (../include) - - create_single_source_cgal_program( "bench_regular_triangulation_on_sphere.cpp" ) + create_single_source_cgal_program( "bench_dtos2.cpp" ) create_single_source_cgal_program( "generate_points.cpp" ) - else() - + message(STATUS "This program requires the CGAL library, and will not be compiled.") - + endif() diff --git a/Triangulation_on_sphere_2/benchmark/random_dtos2.cpp b/Triangulation_on_sphere_2/benchmark/bench_dtos2.cpp similarity index 73% rename from Triangulation_on_sphere_2/benchmark/random_dtos2.cpp rename to Triangulation_on_sphere_2/benchmark/bench_dtos2.cpp index 3ec4683e56d..0385b41db3f 100644 --- a/Triangulation_on_sphere_2/benchmark/random_dtos2.cpp +++ b/Triangulation_on_sphere_2/benchmark/bench_dtos2.cpp @@ -1,7 +1,4 @@ -// @fixme should be in benchmarks really - #include -#include #include #include @@ -12,7 +9,7 @@ #include #include #include -#include +#include #include #include @@ -23,7 +20,7 @@ #include typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Polyhedron_3 Polyhedron_3; +typedef CGAL::Surface_mesh Surface_mesh; typedef K::Segment_3 Segment_3; typedef CGAL::Delaunay_triangulation_3 Delaunay; @@ -44,8 +41,10 @@ int main(int, char**) const std::size_t nu_of_pts = 1e7; const double radius = 5184.152; - CGAL::Random random(nu_of_pts); - CGAL::Random_points_on_sphere_3 on_sphere(radius); + CGAL::Random random; + std::cout << "Seed is " << random.get_seed() << std::endl; + + CGAL::Random_points_on_sphere_3 on_sphere(radius, random); std::vector points; points.reserve(nu_of_pts); @@ -63,7 +62,8 @@ int main(int, char**) dtos.insert(points.begin(), points.end()); time.stop(); assert(dtos.number_of_vertices() == nu_of_pts); - std::cout << "Triangulation sphere: " << time.time() << std::endl; + std::cout << "Triangulation sphere: " + << dtos.number_of_vertices() << " vertices in " << time.time() << " sec" << std::endl; //Triangulation with points on the sphere (projection_traits) Gt2 traits(K::Point_3(0, 0, 0), radius); @@ -75,15 +75,16 @@ int main(int, char**) dtos2.insert(boost::make_transform_iterator(points.begin(), cst), boost::make_transform_iterator(points.end(), cst)); time.stop(); - std::cout << "Triangulation sphere projection traits: "<< time.time() << std::endl; + std::cout << "Triangulation w/ sphere projection traits: " + << dtos2.number_of_vertices() << " vertices in " << time.time() << " sec" << std::endl; - Polyhedron_3 poly; +// Surface_mesh sm; - time.reset(); - time.start(); - CGAL::convex_hull_3(points.begin(), points.end(), poly); - time.stop(); - std::cout << "Convex hull: " << time.time() << " " << std::endl; +// time.reset(); +// time.start(); +// CGAL::convex_hull_3(points.begin(), points.end(), sm); +// time.stop(); +// std::cout << "Convex hull 3D: " << time.time() << " " << std::endl; time.reset(); time.start(); @@ -91,7 +92,8 @@ int main(int, char**) T.insert(Point(0, 0, 0)); T.insert(points.begin(), points.end()); time.stop(); - std::cout << "Delaunay on sphere: " << time.time() << std::endl; + std::cout << "Delaunay 3D with origin: " + << T.number_of_vertices() << " vertices in " << time.time() << " sec" << std::endl; time.reset(); time.start(); @@ -99,7 +101,7 @@ int main(int, char**) T_fast_on2.insert(Point(0, 0, 0)); T_fast_on2.insert(points.begin(), points.end()); time.stop(); - std::cout << "Delaunay fast location on sphere: " << time.time() << std::endl; + std::cout << "Delaunay 3D with origin, fast location: " << time.time() << std::endl; return EXIT_SUCCESS; } diff --git a/Triangulation_on_sphere_2/benchmark/bench_regular_triangulation_on_sphere.cpp b/Triangulation_on_sphere_2/benchmark/bench_regular_triangulation_on_sphere.cpp deleted file mode 100644 index 07f6b74b08c..00000000000 --- a/Triangulation_on_sphere_2/benchmark/bench_regular_triangulation_on_sphere.cpp +++ /dev/null @@ -1,88 +0,0 @@ -//#define CGAL_NO_STATIC_FILTERS - -#include - -#include -#include -#include -#include - -//robust classes -#include -#include -//#include -#include - -//manuel prototypes -//#include -//#include -//#include - -#include -#include -#include -#include -#include - -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; - -typedef CGAL::Regular_triangulation_sphere_traits_2< K > FK; -template class CGAL::Regular_triangulation_on_sphere_2; -typedef CGAL::Regular_triangulation_on_sphere_2 RTOS; - -//typedef CGAL::Regular_triangulation_sphere_traits_2_manuel_proto< K > FK2; -//template class CGAL::Regular_triangulation_on_sphere_2_manuel_proto; -//typedef CGAL::Regular_triangulation_on_sphere_2_manuel_proto RTOSPROTO; - -void compute_times() -{ - int no_of_pts; - - typedef K::Point_3 Point_3; - std::list pts3; - - // std::cin >> no_of_pts; - no_of_pts = 1000; - for(int count=0; count> p; - if(p != Point_3(0,0,0)) pts3.push_back(p); - else count--; - } - - std::cout << "REGULAR TRIANGULATION ON SPHERE" << std::endl; - { - RTOS rtos; - //rtos.insert_four_init_vertices(); - { - CGAL::Timer timer_reg; timer_reg.start(); - rtos.insert(pts3.begin(),pts3.end()); - timer_reg.stop(); - std::cout << timer_reg.time() << std::endl; - } - - if(!rtos.is_valid()) - std::cout << "problem!" << std::endl; - } - - std::cout << "REGULAR TRIANGULATION ON SPHERE PROTO" << std::endl; - { - RTOS rtosprot; - { - CGAL::Timer timer_reg; timer_reg.start(); - rtosprot.insert(pts3.begin(),pts3.end()); - timer_reg.stop(); - std::cout << timer_reg.time() << std::endl; - } - if(!rtosprot.is_valid()) { std::cout << "problem!" << std::endl; exit(0); } - } -} - -int main(int /*argc*/, char** /*argv*/) -{ - compute_times(); - - return EXIT_SUCCESS; -} - diff --git a/Triangulation_on_sphere_2/benchmark/generate_points.cpp b/Triangulation_on_sphere_2/benchmark/generate_points.cpp index 560b27d9f21..152145abf16 100644 --- a/Triangulation_on_sphere_2/benchmark/generate_points.cpp +++ b/Triangulation_on_sphere_2/benchmark/generate_points.cpp @@ -1,36 +1,38 @@ -#include - #include + #include #include - typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +int main(int argc, char* argv[]) +{ + int no_of_pts; + double radius; + if(argc > 1) + { + no_of_pts = pow(10, atoi(argv[1])); + radius = atoi(argv[2]); + } + else + { + no_of_pts = 1000000; + radius = 1; + } -int main(int argc, char* argv[]) { - int no_of_pts; - double radius; - if (argc > 1) { - no_of_pts = pow(10,atoi(argv[1])); - radius = atoi(argv[2]); - } else { - no_of_pts = 1000000; - radius=1; - } + CGAL::Random random(7); + typedef CGAL::Creator_uniform_3 Creator; + std::cout << no_of_pts << std::endl; - CGAL::Random random(7); - typedef CGAL::Creator_uniform_3 Creator; + CGAL::Random_points_on_sphere_3 on_sphere(radius, random); + for(int count=0; count on_sphere(radius, random); - for (int count=0; count