From fbdb713ed3f321e7a983eb4c50a8b26a37f3c193 Mon Sep 17 00:00:00 2001 From: glisse Date: Fri, 19 Jun 2015 12:52:35 +0000 Subject: Trivial clean-ups - add static/const to some member functions - remove an unused variable - don't pass int by const& git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/constify-ST@632 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: d8742bf06caf10115ba4b5157e81bfd7bf8d6e15 --- src/Alpha_shapes/include/gudhi/Alpha_shapes.h | 2 +- .../include/gudhi/Persistent_cohomology/Field_Zp.h | 2 +- src/Simplex_tree/include/gudhi/Simplex_tree.h | 32 +++++++++++----------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Alpha_shapes/include/gudhi/Alpha_shapes.h b/src/Alpha_shapes/include/gudhi/Alpha_shapes.h index b8efdb4d..e988f683 100644 --- a/src/Alpha_shapes/include/gudhi/Alpha_shapes.h +++ b/src/Alpha_shapes/include/gudhi/Alpha_shapes.h @@ -171,7 +171,7 @@ class Alpha_shapes { /** \brief Returns the number of simplices in the complex. * * Does not count the empty simplex. */ - const unsigned int& num_simplices() const { + unsigned int num_simplices() const { return _st.num_simplices(); } diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h index 2349cdac..2a4c8692 100644 --- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h +++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h @@ -85,7 +85,7 @@ class Field_Zp { return add_id_all; } /** \brief Returns the multiplicative identity \f$1_{\Bbbk}\f$ of the field.*/ - const Element& multiplicative_identity(Element P = 0) const { + const Element& multiplicative_identity(Element = 0) const { return mult_id_all; } /** Returns the inverse in the field. Modifies P.*/ diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index b79e3c8f..9d0cf755 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -325,7 +325,7 @@ class Simplex_tree { /** \brief Returns the filtration value of a simplex. * * Called on the null_simplex, returns INFINITY. */ - Filtration_value filtration(Simplex_handle sh) { + Filtration_value filtration(Simplex_handle sh) const { if (sh != null_simplex()) { return sh->second.filtration(); } else { @@ -333,34 +333,34 @@ class Simplex_tree { } // filtration(); } } /** \brief Returns an upper bound of the filtration values of the simplices. */ - Filtration_value filtration() { + Filtration_value filtration() const { return threshold_; } /** \brief Returns a Simplex_handle different from all Simplex_handles * associated to the simplices in the simplicial complex. * * One can call filtration(null_simplex()). */ - Simplex_handle null_simplex() { + Simplex_handle null_simplex() const { return Dictionary_it(NULL); } /** \brief Returns a key different for all keys associated to the * simplices of the simplicial complex. */ - Simplex_key null_key() { + Simplex_key null_key() const { return -1; } /** \brief Returns a Vertex_handle different from all Vertex_handles associated * to the vertices of the simplicial complex. */ - Vertex_handle null_vertex() { + Vertex_handle null_vertex() const { return null_vertex_; } /** \brief Returns the number of vertices in the complex. */ - size_t num_vertices() { + size_t num_vertices() const { return root_.members_.size(); } /** \brief Returns the number of simplices in the complex. * * Does not count the empty simplex. */ - const unsigned int& num_simplices() const { + unsigned int num_simplices() const { return num_simplices_; } @@ -377,13 +377,13 @@ class Simplex_tree { return dim - 1; } /** \brief Returns an upper bound on the dimension of the simplicial complex. */ - int dimension() { + int dimension() const { return dimension_; } /** \brief Returns true iff the node in the simplex tree pointed by * sh has children.*/ - bool has_children(Simplex_handle sh) { + bool has_children(Simplex_handle sh) const { return (sh->second.children()->parent() == sh->first); } @@ -563,7 +563,7 @@ class Simplex_tree { threshold_ = fil; } /** Set a number of simplices for the simplicial complex. */ - void set_num_simplices(const unsigned int& num_simplices) { + void set_num_simplices(unsigned int num_simplices) { num_simplices_ = num_simplices; } /** Set a dimension for the simplicial complex. */ @@ -771,10 +771,10 @@ class Simplex_tree { } /** \brief Intersects Dictionary 1 [begin1;end1) with Dictionary 2 [begin2,end2) * and assigns the maximal possible Filtration_value to the Nodes. */ - void intersection(std::vector >& intersection, - Dictionary_it begin1, Dictionary_it end1, - Dictionary_it begin2, Dictionary_it end2, - Filtration_value filtration) { + static void intersection(std::vector >& intersection, + Dictionary_it begin1, Dictionary_it end1, + Dictionary_it begin2, Dictionary_it end2, + Filtration_value filtration) { if (begin1 == end1 || begin2 == end2) return; // ----->> while (true) { @@ -801,8 +801,8 @@ class Simplex_tree { } } /** Maximum over 3 values.*/ - Filtration_value maximum(Filtration_value a, Filtration_value b, - Filtration_value c) { + static Filtration_value maximum(Filtration_value a, Filtration_value b, + Filtration_value c) { Filtration_value max = (a < b) ? b : a; return ((max < c) ? c : max); } -- cgit v1.2.3