summaryrefslogtreecommitdiff
path: root/src/Cech_complex/benchmark
diff options
context:
space:
mode:
Diffstat (limited to 'src/Cech_complex/benchmark')
-rw-r--r--src/Cech_complex/benchmark/CMakeLists.txt18
-rw-r--r--src/Cech_complex/benchmark/cech_complex_benchmark.cpp27
2 files changed, 28 insertions, 17 deletions
diff --git a/src/Cech_complex/benchmark/CMakeLists.txt b/src/Cech_complex/benchmark/CMakeLists.txt
index bc54c0f3..a6b3d70b 100644
--- a/src/Cech_complex/benchmark/CMakeLists.txt
+++ b/src/Cech_complex/benchmark/CMakeLists.txt
@@ -1,13 +1,15 @@
project(Cech_complex_benchmark)
-# Do not forget to copy test files in current binary dir
-file(COPY "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
+if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 5.0.1)
+ # Do not forget to copy test files in current binary dir
+ file(COPY "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-if(TARGET Boost::filesystem)
- add_executable(cech_complex_benchmark cech_complex_benchmark.cpp)
- target_link_libraries(cech_complex_benchmark Boost::filesystem)
+ if(TARGET Boost::filesystem)
+ add_executable(cech_complex_benchmark cech_complex_benchmark.cpp)
+ target_link_libraries(cech_complex_benchmark Boost::filesystem)
- if (TBB_FOUND)
- target_link_libraries(cech_complex_benchmark ${TBB_LIBRARIES})
+ if (TBB_FOUND)
+ target_link_libraries(cech_complex_benchmark ${TBB_LIBRARIES})
+ endif()
endif()
-endif() \ No newline at end of file
+endif()
diff --git a/src/Cech_complex/benchmark/cech_complex_benchmark.cpp b/src/Cech_complex/benchmark/cech_complex_benchmark.cpp
index 2e4adce4..94c5fa4f 100644
--- a/src/Cech_complex/benchmark/cech_complex_benchmark.cpp
+++ b/src/Cech_complex/benchmark/cech_complex_benchmark.cpp
@@ -17,6 +17,8 @@
#include <gudhi/Simplex_tree.h>
#include <gudhi/Miniball.hpp>
+#include <CGAL/Epick_d.h>
+
#include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations
#include <string>
@@ -30,7 +32,11 @@ using Point_cloud = std::vector<Point>;
using Points_off_reader = Gudhi::Points_off_reader<Point>;
using Proximity_graph = Gudhi::Proximity_graph<Simplex_tree>;
using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
-using Cech_complex = Gudhi::cech_complex::Cech_complex<Simplex_tree, Point_cloud>;
+using Kernel = CGAL::Epick_d<CGAL::Dimension_tag<3>>;
+using Point_cgal = typename Kernel::Point_d;
+using Point_cloud_cgal = std::vector<Point_cgal>;
+using Points_off_reader_cgal = Gudhi::Points_off_reader<Point_cgal>;
+using Cech_complex = Gudhi::cech_complex::Cech_complex<Simplex_tree, Point_cloud_cgal, Kernel, Simplex_tree>;
class Minimal_enclosing_ball_radius {
public:
@@ -62,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
@@ -76,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<Simplex_tree>(
- 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<Simplex_tree>(
+ off_reader_cgal.get_point_cloud(), threshold, Gudhi::Minimal_enclosing_ball_radius<Kernel>());
+ 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) {
@@ -93,14 +100,16 @@ 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,
- Gudhi::Minimal_enclosing_ball_radius());
+ Rips_complex rips_complex_from_points(off_reader_cgal.get_point_cloud(), radius,
+ Gudhi::Minimal_enclosing_ball_radius<Kernel>());
Simplex_tree rips_stree;
rips_complex_from_points.create_complex(rips_stree, p0.size() - 1);
// ------------------------------------------
@@ -110,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);
// ------------------------------------------