diff options
author | Vincent Rouvreau <vincent.rouvreau@inria.fr> | 2022-01-26 09:49:20 +0100 |
---|---|---|
committer | Vincent Rouvreau <vincent.rouvreau@inria.fr> | 2022-01-26 09:49:20 +0100 |
commit | e88833431fbdd2b58b00fe3d3cf84973700477b3 (patch) | |
tree | c701f2414f640b02dd7f0d47869ec7c2ab029efe /src/python | |
parent | 7cd975bcb4f932372a3abe932d3b22c9ea1ce38a (diff) |
Code review: Remove empty_point_set_ that can be deduced from num_vertices (new method in Alpha_complex -> Abstract_alpha_complex -> In/Exact_alpha_complex_dD -> Alpha_complex_interface
Diffstat (limited to 'src/python')
-rw-r--r-- | src/python/include/Alpha_complex_factory.h | 10 | ||||
-rw-r--r-- | src/python/include/Alpha_complex_interface.h | 6 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/python/include/Alpha_complex_factory.h b/src/python/include/Alpha_complex_factory.h index 14ec1f86..3d20aa8f 100644 --- a/src/python/include/Alpha_complex_factory.h +++ b/src/python/include/Alpha_complex_factory.h @@ -70,6 +70,8 @@ class Abstract_alpha_complex { virtual bool create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square, bool default_filtration_value) = 0; + + virtual std::size_t num_vertices() const = 0; virtual ~Abstract_alpha_complex() = default; }; @@ -104,6 +106,10 @@ class Exact_alpha_complex_dD final : public Abstract_alpha_complex { return alpha_complex_.create_complex(*simplex_tree, max_alpha_square, exact_version_, default_filtration_value); } + virtual std::size_t num_vertices() const { + return alpha_complex_.num_vertices(); + } + private: bool exact_version_; Alpha_complex<Kernel, Weighted> alpha_complex_; @@ -135,6 +141,10 @@ class Inexact_alpha_complex_dD final : public Abstract_alpha_complex { return alpha_complex_.create_complex(*simplex_tree, max_alpha_square, false, default_filtration_value); } + virtual std::size_t num_vertices() const { + return alpha_complex_.num_vertices(); + } + private: Alpha_complex<Kernel, Weighted> alpha_complex_; }; diff --git a/src/python/include/Alpha_complex_interface.h b/src/python/include/Alpha_complex_interface.h index 188036ed..671af4a4 100644 --- a/src/python/include/Alpha_complex_interface.h +++ b/src/python/include/Alpha_complex_interface.h @@ -29,8 +29,7 @@ class Alpha_complex_interface { public: Alpha_complex_interface(const std::vector<std::vector<double>>& points, const std::vector<double>& weights, - bool fast_version, bool exact_version) - : empty_point_set_(points.size() == 0) { + bool fast_version, bool exact_version) { const bool weighted = (weights.size() > 0); if (fast_version) { if (weighted) { @@ -54,13 +53,12 @@ class Alpha_complex_interface { void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square, bool default_filtration_value) { // Nothing to be done in case of an empty point set - if (!empty_point_set_) + if (alpha_ptr_->num_vertices() > 0) alpha_ptr_->create_simplex_tree(simplex_tree, max_alpha_square, default_filtration_value); } private: std::unique_ptr<Abstract_alpha_complex> alpha_ptr_; - bool empty_point_set_; }; } // namespace alpha_complex |