From 7d3d9e57c7c72b0762db910c2638b08e596199df Mon Sep 17 00:00:00 2001 From: Hind-M Date: Tue, 19 Oct 2021 16:16:21 +0200 Subject: Make Cech benchmark work --- .../benchmark/cech_complex_benchmark.cpp | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/Cech_complex') diff --git a/src/Cech_complex/benchmark/cech_complex_benchmark.cpp b/src/Cech_complex/benchmark/cech_complex_benchmark.cpp index cfeb0725..06d90757 100644 --- a/src/Cech_complex/benchmark/cech_complex_benchmark.cpp +++ b/src/Cech_complex/benchmark/cech_complex_benchmark.cpp @@ -9,7 +9,7 @@ */ #include -#include +#include #include #include #include @@ -33,7 +33,10 @@ using Points_off_reader = Gudhi::Points_off_reader; using Proximity_graph = Gudhi::Proximity_graph; using Rips_complex = Gudhi::rips_complex::Rips_complex; using Kernel = CGAL::Epeck_d; -using Cech_complex = Gudhi::cech_complex::Cech_complex; +using Point_cgal = typename Kernel::Point_d; +using Point_cloud_cgal = std::vector; +using Points_off_reader_cgal = Gudhi::Points_off_reader; +using Cech_complex = Gudhi::cech_complex::Cech_complex; class Minimal_enclosing_ball_radius { public: @@ -65,6 +68,7 @@ int main(int argc, char* argv[]) { // Extract the points from the file filepoints Points_off_reader off_reader(off_file_points); + Points_off_reader_cgal off_reader_cgal(off_file_points); Gudhi::Clock euclidean_clock("Gudhi::Euclidean_distance"); // Compute the proximity graph of the points @@ -79,16 +83,16 @@ int main(int argc, char* argv[]) { off_reader.get_point_cloud(), threshold, Minimal_enclosing_ball_radius()); std::clog << miniball_clock << std::endl; - Gudhi::Clock common_miniball_clock("Gudhi::Minimal_enclosing_ball_radius()"); + Gudhi::Clock cgal_miniball_clock("Gudhi::Minimal_enclosing_ball_radius_cgal()"); // Compute the proximity graph of the points - Proximity_graph common_miniball_prox_graph = Gudhi::compute_proximity_graph( - off_reader.get_point_cloud(), threshold, Gudhi::Minimal_enclosing_ball_radius()); - std::clog << common_miniball_clock << std::endl; + Proximity_graph cgal_miniball_prox_graph = Gudhi::compute_proximity_graph( + off_reader_cgal.get_point_cloud(), threshold, Gudhi::Minimal_enclosing_ball_radius()); + std::clog << cgal_miniball_clock << std::endl; boost::filesystem::path full_path(boost::filesystem::current_path()); std::clog << "Current path is : " << full_path << std::endl; - std::clog << "File name;Radius;Rips time;Cech time; Ratio Rips/Cech time;Rips nb simplices;Cech nb simplices;" + std::clog << "File name; Radius; Rips time; Cech time; Ratio Rips/Cech time; Rips nb simplices; Cech nb simplices;" << std::endl; boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end for (boost::filesystem::directory_iterator itr(boost::filesystem::current_path()); itr != end_itr; ++itr) { @@ -96,13 +100,15 @@ int main(int argc, char* argv[]) { if (itr->path().extension() == ".off") // see below { Points_off_reader off_reader(itr->path().string()); + Points_off_reader_cgal off_reader_cgal(itr->path().string()); + Point p0 = off_reader.get_point_cloud()[0]; for (Filtration_value radius = 0.1; radius < 0.4; radius += 0.1) { std::clog << itr->path().stem() << ";"; std::clog << radius << ";"; Gudhi::Clock rips_clock("Rips computation"); - Rips_complex rips_complex_from_points(off_reader.get_point_cloud(), radius, + Rips_complex rips_complex_from_points(off_reader_cgal.get_point_cloud(), radius, Gudhi::Minimal_enclosing_ball_radius()); Simplex_tree rips_stree; rips_complex_from_points.create_complex(rips_stree, p0.size() - 1); @@ -113,7 +119,7 @@ int main(int argc, char* argv[]) { std::clog << rips_sec << ";"; Gudhi::Clock cech_clock("Cech computation"); - Cech_complex cech_complex_from_points(off_reader.get_point_cloud(), radius); + Cech_complex cech_complex_from_points(off_reader_cgal.get_point_cloud(), radius); Simplex_tree cech_stree; cech_complex_from_points.create_complex(cech_stree, p0.size() - 1); // ------------------------------------------ -- cgit v1.2.3