summaryrefslogtreecommitdiff
path: root/src/Cech_complex/include/gudhi
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-02-20 16:03:52 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-02-20 16:03:52 +0000
commit0586a149b5bb3a4b65b63b2ab7d3ecdd9682ee1b (patch)
treed982ba2389a24fbccc92d6a6d147c5e323bd4f5d /src/Cech_complex/include/gudhi
parent4a91726c9500e4b7ffe469192aa1140650c3d094 (diff)
tests and utils fix
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cechcomplex_vincent@3253 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 5786a8a7e4b16750f29fac99ca61926158542cfd
Diffstat (limited to 'src/Cech_complex/include/gudhi')
-rw-r--r--src/Cech_complex/include/gudhi/Cech_complex.h18
-rw-r--r--src/Cech_complex/include/gudhi/Cech_complex_blocker.h23
2 files changed, 29 insertions, 12 deletions
diff --git a/src/Cech_complex/include/gudhi/Cech_complex.h b/src/Cech_complex/include/gudhi/Cech_complex.h
index 94939105..e847c97f 100644
--- a/src/Cech_complex/include/gudhi/Cech_complex.h
+++ b/src/Cech_complex/include/gudhi/Cech_complex.h
@@ -28,7 +28,6 @@
#include <gudhi/Cech_complex_blocker.h> // for Gudhi::cech_complex::Cech_blocker
#include <iostream>
-#include <vector>
#include <cstddef> // for std::size_t
#include <stdexcept> // for exception management
@@ -40,7 +39,7 @@ namespace cech_complex {
* \class Cech_complex
* \brief Cech complex data structure.
*
- * \ingroup Cech_complex
+ * \ingroup cech_complex
*
* \details
* The data structure is a proximity graph, containing edges when the edge length is less or equal
@@ -65,10 +64,9 @@ class Cech_complex {
* @param[in] points Range of points.
* @param[in] threshold Rips value.
* @param[in] distance distance function that returns a `Filtration_value` from 2 given points.
- * @exception std::invalid_argument In debug mode, if `points.size()` returns a value &le; 0.
*
* \tparam ForwardPointRange must be a range for which `.size()`, `.begin()` and `.end()` methods return input
- * iterators on a point. A point must have a `.size()` method available.
+ * iterators on a point. `.begin()` and `.end()` methods are required for a point.
*
* \tparam Distance furnishes `operator()(const Point& p1, const Point& p2)`, where
* `Point` is a point from the `ForwardPointRange`, and that returns a `Filtration_value`.
@@ -77,12 +75,10 @@ class Cech_complex {
Cech_complex(const ForwardPointRange& points, Filtration_value threshold, Distance distance)
: threshold_(threshold),
point_cloud_(points) {
- GUDHI_CHECK(points.size() > 0,
- std::invalid_argument("Cech_complex::create_complex - point cloud is empty"));
- dimension_ = points.begin()->size();
+ dimension_ = points.begin()->end() - points.begin()->begin();
cech_skeleton_graph_ = Gudhi::compute_proximity_graph<SimplicialComplexForProximityGraph>(point_cloud_,
- threshold_,
- distance);
+ threshold_,
+ distance);
}
/** \brief Initializes the simplicial complex from the proximity graph and expands it until a given maximal
@@ -116,10 +112,10 @@ class Cech_complex {
}
/** @param[in] vertex Point position in the range.
- * @return Threshold value given at construction.
+ * @return A const iterator on the point.
* @exception std::out_of_range In debug mode, if point position in the range is out.
*/
- typename ForwardPointRange::const_iterator point(std::size_t vertex) const {
+ typename ForwardPointRange::const_iterator point_iterator(std::size_t vertex) const {
GUDHI_CHECK((point_cloud_.begin() + vertex) < point_cloud_.end(),
std::out_of_range("Cech_complex::point - simplicial complex is not empty"));
return (point_cloud_.begin() + vertex);
diff --git a/src/Cech_complex/include/gudhi/Cech_complex_blocker.h b/src/Cech_complex/include/gudhi/Cech_complex_blocker.h
index 25fab909..f8738be0 100644
--- a/src/Cech_complex/include/gudhi/Cech_complex_blocker.h
+++ b/src/Cech_complex/include/gudhi/Cech_complex_blocker.h
@@ -39,6 +39,20 @@ namespace cech_complex {
template<typename SimplicialComplexForCechComplex, typename ForwardPointRange>
class Cech_complex;
+/** \internal
+ * \class Cech_blocker
+ * \brief Cech complex blocker.
+ *
+ * \ingroup cech_complex
+ *
+ * \details
+ * Cech blocker is an oracle constructed from a Cech_complex and a simplicial complex.
+ *
+ * \tparam SimplicialComplexForProximityGraph furnishes `Simplex_handle` and `Filtration_value` type definition,
+ * `simplex_vertex_range(Simplex_handle sh)`and `assign_filtration(Simplex_handle sh, Filtration_value filt)` methods.
+ *
+ * \tparam ForwardPointRange is required by the pointer on Chech_complex for type definition.
+ */
template <typename SimplicialComplexForCech, typename ForwardPointRange>
class Cech_blocker {
private:
@@ -52,10 +66,15 @@ class Cech_blocker {
using Cech_complex = Gudhi::cech_complex::Cech_complex<SimplicialComplexForCech, ForwardPointRange>;
public:
+ /** \internal \brief Cech complex blocker operator() - the oracle - assigns the filtration value from the simplex
+ * radius and returns if the simplex expansion must be blocked.
+ * \param[in] sh The Simplex_handle.
+ * \return true if the simplex radius is greater than the Cech_complex threshold*/
bool operator()(Simplex_handle sh) {
Point_cloud points;
for (auto vertex : simplicial_complex_.simplex_vertex_range(sh)) {
- points.push_back(*(cc_ptr_->point(vertex)));
+ points.push_back(Point(cc_ptr_->point_iterator(vertex)->begin(),
+ cc_ptr_->point_iterator(vertex)->end()));
#ifdef DEBUG_TRACES
std::cout << "#(" << vertex << ")#";
#endif // DEBUG_TRACES
@@ -68,6 +87,8 @@ class Cech_blocker {
simplicial_complex_.assign_filtration(sh, radius);
return (radius > cc_ptr_->threshold());
}
+
+ /** \internal \brief Cech complex blocker constructor. */
Cech_blocker(SimplicialComplexForCech& simplicial_complex, Cech_complex* cc_ptr)
: simplicial_complex_(simplicial_complex),
cc_ptr_(cc_ptr) {