Update ToS2 benchmarks

This commit is contained in:
Mael Rouxel-Labbé 2021-03-22 16:44:28 +01:00
parent 4973c64e60
commit 618b83b00a
4 changed files with 51 additions and 149 deletions

View File

@ -1,31 +1,17 @@
# 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.")

View File

@ -1,7 +1,4 @@
// @fixme should be in benchmarks really
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_on_sphere_traits_2.h>
#include <CGAL/Delaunay_triangulation_on_sphere_2.h>
@ -12,7 +9,7 @@
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/squared_distance_3.h>
#include <CGAL/Timer.h>
@ -23,7 +20,7 @@
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedron_3<K> Polyhedron_3;
typedef CGAL::Surface_mesh<K> Surface_mesh;
typedef K::Segment_3 Segment_3;
typedef CGAL::Delaunay_triangulation_3<K> 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<Point, Creator> on_sphere(radius);
CGAL::Random random;
std::cout << "Seed is " << random.get_seed() << std::endl;
CGAL::Random_points_on_sphere_3<Point, Creator> on_sphere(radius, random);
std::vector<Point> 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;
}

View File

@ -1,88 +0,0 @@
//#define CGAL_NO_STATIC_FILTERS
#include <CGAL/basic.h>
#include <CGAL/Cartesian.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
#include <CGAL/Gmpq.h>
//robust classes
#include <CGAL/Regular_triangulation_sphere_traits_2.h>
#include <CGAL/Regular_triangulation_on_sphere_2.h>
//#include <CGAL/Triangulation_sphere_traits_2.h>
#include <CGAL/Triangulation_on_sphere_2.h>
//manuel prototypes
//#include <CGAL/Regular_triangulation_sphere_traits_2_manuel_proto.h>
//#include <CGAL/Regular_triangulation_on_sphere_2_manuel_proto.h>
//#include <CGAL/Triangulation_on_sphere_2_manuel_proto.h>
#include <CGAL/Random.h>
#include <CGAL/Timer.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
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<FK>;
typedef CGAL::Regular_triangulation_on_sphere_2<FK> RTOS;
//typedef CGAL::Regular_triangulation_sphere_traits_2_manuel_proto< K > FK2;
//template class CGAL::Regular_triangulation_on_sphere_2_manuel_proto<FK2>;
//typedef CGAL::Regular_triangulation_on_sphere_2_manuel_proto<FK2> RTOSPROTO;
void compute_times()
{
int no_of_pts;
typedef K::Point_3 Point_3;
std::list<Point_3> pts3;
// std::cin >> no_of_pts;
no_of_pts = 1000;
for(int count=0; count<no_of_pts; ++count)
{
Point_3 p;
std::cin >> 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;
}

View File

@ -1,36 +1,38 @@
#include <CGAL/basic.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Random.h>
#include <CGAL/point_generators_3.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
int main(int argc, char* argv[]) {
int main(int argc, char* argv[])
{
int no_of_pts;
double radius;
if (argc > 1) {
if(argc > 1)
{
no_of_pts = pow(10, atoi(argv[1]));
radius = atoi(argv[2]);
} else {
}
else
{
no_of_pts = 1000000;
radius = 1;
}
CGAL::Random random(7);
typedef CGAL::Creator_uniform_3<double, K::Point_3> Creator;
std::cout << no_of_pts << std::endl;
CGAL::Random_points_on_sphere_3<K::Point_3, Creator> on_sphere(radius, random);
for (int count=0; count<no_of_pts; count++) {
K::Point_3 p = *on_sphere; on_sphere ++;
for(int count=0; count<no_of_pts; ++count)
{
K::Point_3 p = *on_sphere;
++on_sphere;
std::cout << p << std::endl;
}
return 0;
return EXIT_SUCCESS;
}