summaryrefslogtreecommitdiff
path: root/src/Cech_complex/include/gudhi
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/include/gudhi
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/include/gudhi')
-rw-r--r--src/Cech_complex/include/gudhi/Cech_complex.h22
1 files changed, 9 insertions, 13 deletions
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_,