From 3cd1e01f0b0d4fdb46f49ec640c389374ca2fe70 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 22 Feb 2018 23:16:55 +0000 Subject: Fix Cech with radius distance Add a meta generation script for off_file_generator git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cechcomplex_vincent@3256 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: fb13baa124ddc97c0dc61835ab0c72595d666155 --- src/Cech_complex/benchmark/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/Cech_complex/benchmark/CMakeLists.txt (limited to 'src/Cech_complex/benchmark/CMakeLists.txt') diff --git a/src/Cech_complex/benchmark/CMakeLists.txt b/src/Cech_complex/benchmark/CMakeLists.txt new file mode 100644 index 00000000..2a65865b --- /dev/null +++ b/src/Cech_complex/benchmark/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.6) +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}/) + +add_executable(cech_complex_benchmark cech_complex_benchmark.cpp) +target_link_libraries(cech_complex_benchmark ${Boost_FILESYSTEM_LIBRARY}) + +if (TBB_FOUND) + target_link_libraries(cech_complex_benchmark ${TBB_LIBRARIES}) +endif() -- cgit v1.2.3 From 5fd7f8f63704131228a57c6292743295a25db11e Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 28 May 2018 15:31:55 +0000 Subject: Code review: ForwardPointRange instead of InputPointRange Point cloud deep copy git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cechcomplex_vincent@3478 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 29e77a605f85552bc5b31f2907e26b7e5a9da92f --- src/Cech_complex/benchmark/CMakeLists.txt | 4 ++-- src/Cech_complex/include/gudhi/Cech_complex.h | 22 +++++++++------------- 2 files changed, 11 insertions(+), 15 deletions(-) (limited to 'src/Cech_complex/benchmark/CMakeLists.txt') diff --git a/src/Cech_complex/benchmark/CMakeLists.txt b/src/Cech_complex/benchmark/CMakeLists.txt index 2a65865b..b7697764 100644 --- a/src/Cech_complex/benchmark/CMakeLists.txt +++ b/src/Cech_complex/benchmark/CMakeLists.txt @@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 2.6) 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}/) +file(COPY "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) add_executable(cech_complex_benchmark cech_complex_benchmark.cpp) -target_link_libraries(cech_complex_benchmark ${Boost_FILESYSTEM_LIBRARY}) +target_link_libraries(cech_complex_benchmark ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) if (TBB_FOUND) target_link_libraries(cech_complex_benchmark ${TBB_LIBRARIES}) diff --git a/src/Cech_complex/include/gudhi/Cech_complex.h b/src/Cech_complex/include/gudhi/Cech_complex.h index abad0c21..def46c79 100644 --- a/src/Cech_complex/include/gudhi/Cech_complex.h +++ b/src/Cech_complex/include/gudhi/Cech_complex.h @@ -48,10 +48,10 @@ namespace cech_complex { * \tparam SimplicialComplexForProximityGraph furnishes `Vertex_handle` and `Filtration_value` type definition required * by `Gudhi::Proximity_graph`. * - * \tparam InputPointRange must be a range for which `std::begin()` and `std::end()` methods return input + * \tparam ForwardPointRange must be a range for which `std::begin()` and `std::end()` methods return input * iterators on a point. `std::begin()` and `std::end()` methods are also required for a point. */ -template +template class Cech_complex { private: // Required by compute_proximity_graph @@ -59,8 +59,8 @@ class Cech_complex { using Filtration_value = typename SimplicialComplexForProximityGraph::Filtration_value; using Proximity_graph = Gudhi::Proximity_graph; - // Retrieve Coordinate type from InputPointRange - using Point_from_range_iterator = typename boost::range_const_iterator::type; + // Retrieve Coordinate type from ForwardPointRange + using Point_from_range_iterator = typename boost::range_const_iterator::type; using Point_from_range = typename std::iterator_traits::value_type; using Coordinate_iterator = typename boost::range_const_iterator::type; using Coordinate= typename std::iterator_traits::value_type; @@ -76,19 +76,15 @@ class Cech_complex { * @param[in] points Range of points. * @param[in] max_radius Maximal radius value. * - * \tparam InputPointRange must be a range of Point. Point must be a range of copyable Cartesian coordinates. + * \tparam ForwardPointRange must be a range of Point. Point must be a range of copyable Cartesian coordinates. * */ - Cech_complex(const InputPointRange& points, Filtration_value max_radius) + Cech_complex(const ForwardPointRange& points, Filtration_value max_radius) : max_radius_(max_radius) { // Point cloud deep copy - auto points_begin_itr = std::begin(points); - auto points_end_itr = std::end(points); - - point_cloud_.reserve(points_end_itr - points_begin_itr); - for (auto point_itr = points_begin_itr; point_itr < points_end_itr; point_itr++) { - point_cloud_.push_back(Point(std::begin(*point_itr), std::end(*point_itr))); - } + point_cloud_.reserve(boost::size(points)); + for (auto&& point : points) + point_cloud_.emplace_back(std::begin(point), std::end(point)); cech_skeleton_graph_ = Gudhi::compute_proximity_graph(point_cloud_, -- cgit v1.2.3