summaryrefslogtreecommitdiff
path: root/src/Cech_complex
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-05-28 15:31:55 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-05-28 15:31:55 +0000
commit5fd7f8f63704131228a57c6292743295a25db11e (patch)
tree5934cfdef0e23240941ad9d0bd8d915f5aaba550 /src/Cech_complex
parent41029d1e7692cf41e0e4e0eec7cc33b2949e2cf0 (diff)
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
Diffstat (limited to 'src/Cech_complex')
-rw-r--r--src/Cech_complex/benchmark/CMakeLists.txt4
-rw-r--r--src/Cech_complex/include/gudhi/Cech_complex.h22
2 files changed, 11 insertions, 15 deletions
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<typename SimplicialComplexForProximityGraph, typename InputPointRange>
+template<typename SimplicialComplexForProximityGraph, typename ForwardPointRange>
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<SimplicialComplexForProximityGraph>;
- // Retrieve Coordinate type from InputPointRange
- using Point_from_range_iterator = typename boost::range_const_iterator<InputPointRange>::type;
+ // Retrieve Coordinate type from ForwardPointRange
+ using Point_from_range_iterator = typename boost::range_const_iterator<ForwardPointRange>::type;
using Point_from_range = typename std::iterator_traits<Point_from_range_iterator>::value_type;
using Coordinate_iterator = typename boost::range_const_iterator<Point_from_range>::type;
using Coordinate= typename std::iterator_traits<Coordinate_iterator>::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 <b>copyable</b> Cartesian coordinates.
+ * \tparam ForwardPointRange must be a range of Point. Point must be a range of <b>copyable</b> 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<SimplicialComplexForProximityGraph>(point_cloud_,