summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex.h5
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree.h79
-rw-r--r--src/common/include/gudhi/Delaunay_triangulation_off_io.h19
3 files changed, 37 insertions, 66 deletions
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h
index 415aa032..2d2d77a5 100644
--- a/src/Alpha_complex/include/gudhi/Alpha_complex.h
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h
@@ -150,8 +150,7 @@ class Alpha_complex : public Simplex_tree<> {
*
* The type InputPointRange must be a range for which std::begin and
* std::end return input iterators on a Kernel::Point_d.
- * \warning In debug mode, the exception std::invalid_argument is thrown if an empty input point range is passed as
- * argument.
+ * \exception std::invalid_argument In debug mode, if an empty input point range is passed as argument.
*/
template<typename InputPointRange >
Alpha_complex(const InputPointRange& points,
@@ -191,7 +190,7 @@ class Alpha_complex : public Simplex_tree<> {
*
* @param[in] vertex Vertex handle of the point to retrieve.
* @return The point found.
- * @warning Exception std::out_of_range is thrown in case vertex is not found.
+ * @exception std::out_of_range In case vertex is not found (cf. std::vector::at).
*/
Point_d get_point(Vertex_handle vertex) const {
return vertex_handle_to_iterator_.at(vertex)->point();
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h
index b7b4b8b2..7b55df11 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h
@@ -47,7 +47,7 @@
#include <stdexcept>
#include <limits> // Inf
#include <initializer_list>
-#include <algorithm> // for std::max
+#include <algorithm> // for std::max
namespace Gudhi {
/** \defgroup simplex_tree Filtered Complexes
@@ -141,7 +141,8 @@ class Simplex_tree {
void assign_key(Simplex_key) { }
Simplex_key key() const { assert(false); return -1; }
};
- typedef typename std::conditional<Options::store_key, Key_simplex_base_real, Key_simplex_base_dummy>::type Key_simplex_base;
+ typedef typename std::conditional<Options::store_key, Key_simplex_base_real, Key_simplex_base_dummy>::type
+ Key_simplex_base;
struct Filtration_simplex_base_real {
Filtration_simplex_base_real() : filt_(0) {}
@@ -450,7 +451,7 @@ class Simplex_tree {
}
/** \brief Sets the filtration value of a simplex.
- * \warning In debug mode, the exception std::invalid_argument is thrown if sh is a null_simplex.
+ * \exception std::invalid_argument In debug mode, if sh is a null_simplex.
*/
void assign_filtration(Simplex_handle sh, Filtration_value fv) {
GUDHI_CHECK(sh == null_simplex(),
@@ -596,7 +597,19 @@ class Simplex_tree {
private:
/** \brief Inserts a simplex represented by a vector of vertex.
- \warning the vector must be sorted by increasing vertex handle order */
+ * @param[in] simplex vector of Vertex_handles, representing the vertices of the new simplex. The vector must be
+ * sorted by increasing vertex handle order.
+ * @param[in] filtration the filtration value assigned to the new simplex.
+ * @return If the new simplex is inserted successfully (i.e. it was not in the
+ * simplicial complex yet) the bool is set to true and the Simplex_handle is the handle assigned
+ * to the new simplex.
+ * If the insertion fails (the simplex is already there), the bool is set to false. If the insertion
+ * fails and the simplex already in the complex has a filtration value strictly bigger than 'filtration',
+ * we assign this simplex with the new value 'filtration', and set the Simplex_handle field of the
+ * output pair to the Simplex_handle of the simplex. Otherwise, we set the Simplex_handle part to
+ * null_simplex.
+ *
+ */
std::pair<Simplex_handle, bool> insert_vertex_vector(const std::vector<Vertex_handle>& simplex,
Filtration_value filtration) {
Siblings * curr_sib = &root_;
@@ -629,7 +642,7 @@ class Simplex_tree {
*
* @param[in] simplex range of Vertex_handles, representing the vertices of the new simplex
* @param[in] filtration the filtration value assigned to the new simplex.
- * The return type is a pair. If the new simplex is inserted successfully (i.e. it was not in the
+ * @return If the new simplex is inserted successfully (i.e. it was not in the
* simplicial complex yet) the bool is set to true and the Simplex_handle is the handle assigned
* to the new simplex.
* If the insertion fails (the simplex is already there), the bool is set to false. If the insertion
@@ -668,7 +681,7 @@ class Simplex_tree {
*
* @param[in] Nsimplex range of Vertex_handles, representing the vertices of the new N-simplex
* @param[in] filtration the filtration value assigned to the new N-simplex.
- * The return type is a pair. If the new simplex is inserted successfully (i.e. it was not in the
+ * @return If the new simplex is inserted successfully (i.e. it was not in the
* simplicial complex yet) the bool is set to true and the Simplex_handle is the handle assigned
* to the new simplex.
* If the insertion fails (the simplex is already there), the bool is set to false. If the insertion
@@ -677,7 +690,7 @@ class Simplex_tree {
* output pair to the Simplex_handle of the simplex. Otherwise, we set the Simplex_handle part to
* null_simplex.
*/
- template<class InputVertexRange=std::initializer_list<Vertex_handle>>
+ template<class InputVertexRange = std::initializer_list<Vertex_handle>>
std::pair<Simplex_handle, bool> insert_simplex_and_subfaces(const InputVertexRange& Nsimplex,
Filtration_value filtration = 0) {
auto first = std::begin(Nsimplex);
@@ -1124,7 +1137,7 @@ class Simplex_tree {
* The simplex tree is browsed starting from the root until the leaf, and the filtration values are set with their
* parent value (increased), in case the values are decreasing.
* @return The filtration modification information.
- * \warning Some simplex tree functions require the filtration to be valid. `make_filtration_non_decreasing()`
+ * \post Some simplex tree functions require the filtration to be valid. `make_filtration_non_decreasing()`
* function is not launching `initialize_filtration()` but returns the filtration modification information. If the
* complex has changed , please call `initialize_filtration()` to recompute it.
*/
@@ -1154,7 +1167,7 @@ class Simplex_tree {
Boundary_simplex_iterator max_border = std::max_element(std::begin(boundary), std::end(boundary),
[](Simplex_handle sh1, Simplex_handle sh2) {
return filtration(sh1) < filtration(sh2);
- } );
+ });
Filtration_value max_filt_border_value = filtration(*max_border);
if (simplex.second.filtration() < max_filt_border_value) {
@@ -1173,7 +1186,7 @@ class Simplex_tree {
public:
/** \brief Prune above filtration value given as parameter.
* @param[in] filtration Maximum threshold value.
- * \warning The filtration must be valid. If the filtration has not been initialized yet, the method initializes it
+ * \post The filtration must be valid. If the filtration has not been initialized yet, the method initializes it
* (i.e. order the simplices). If the complex has changed since the last time the filtration was initialized, please
* call `initialize_filtration()` to recompute it.
*/
@@ -1182,7 +1195,7 @@ class Simplex_tree {
if (filtration_vect_.empty()) {
initialize_filtration();
}
-
+
std::vector<std::vector<Vertex_handle>> simplex_list_to_removed;
// Loop in reverse mode until threshold is reached
// Do not erase while looping, because removing is shifting data in a flat_map
@@ -1234,18 +1247,18 @@ class Simplex_tree {
rec_prune_above_filtration(simplex.second.children(), filt);
}
}*/
-
+
/** \brief Remove a maximal simplex.
* @param[in] sh Simplex handle on the maximal simplex to remove.
* \pre Please check the simplex has no coface before removing it.
- * \warning In debug mode, the exception std::invalid_argument is thrown if sh has children.
- * \warning Be aware that removing is shifting data in a flat_map (initialize_filtration to be done).
+ * \exception std::invalid_argument In debug mode, if sh has children.
+ * \post Be aware that removing is shifting data in a flat_map (initialize_filtration to be done).
*/
void remove_maximal_simplex(Simplex_handle sh) {
// Guarantee the simplex has no children
GUDHI_CHECK(has_children(sh),
std::invalid_argument("Simplex_tree::remove_maximal_simplex - argument has children"));
-
+
// Simplex is a leaf, it means the child is the Siblings owning the leaf
Siblings* child = sh->second.children();
@@ -1259,42 +1272,6 @@ class Simplex_tree {
delete child;
}
}
-/***************************************************************************************************************/
- public:
- /** \brief Prints the simplex_tree hierarchically.
- * Since it prints the vertices recursively, one can watch its tree shape.
- */
- void debug_tree() {
- std::cout << "{" << &root_ << "} -------------------------------------------------------------------" << std::endl;
- for (auto sh = root_.members().begin(); sh != root_.members().end(); ++sh) {
- std::cout << sh->first << " [" << sh->second.filtration() << "] ";
- if (has_children(sh)) {
- rec_debug_tree(sh->second.children());
- } else {
- std::cout << " {- " << sh->second.children() << "} ";
- }
- std::cout << std::endl;
- }
- std::cout << "--------------------------------------------------------------------------------------" << std::endl;
- }
-
-
- /** \brief Recursively prints the simplex_tree, using depth first search. */
- private:
- void rec_debug_tree(Siblings * sib) {
- std::cout << " {" << sib << "} (";
- for (auto sh = sib->members().begin(); sh != sib->members().end(); ++sh) {
- std::cout << " " << sh->first << " [" << sh->second.filtration() << "] ";
- if (has_children(sh)) {
- rec_debug_tree(sh->second.children());
- } else {
- std::cout << " {- " << sh->second.children() << "} ";
- }
- }
- std::cout << ")";
- }
-
-/*****************************************************************************************************************/
private:
Vertex_handle null_vertex_;
diff --git a/src/common/include/gudhi/Delaunay_triangulation_off_io.h b/src/common/include/gudhi/Delaunay_triangulation_off_io.h
index e623cf7b..7bf5569e 100644
--- a/src/common/include/gudhi/Delaunay_triangulation_off_io.h
+++ b/src/common/include/gudhi/Delaunay_triangulation_off_io.h
@@ -98,7 +98,6 @@ class Delaunay_triangulation_off_visitor_reader {
std::cout << std::endl;
#endif // DEBUG_TRACES
// Fill the point cloud
- // VR: complex_->insert(Point(point.size(), point.begin(), point.end()));
point_cloud.push_back(Point(point.size(), point.begin(), point.end()));
}
@@ -116,9 +115,7 @@ class Delaunay_triangulation_off_visitor_reader {
/** \brief Returns the constructed Delaunay triangulation.
*
- * @return A pointer on the Delaunay triangulation.
- *
- * @warning The returned pointer can be nullptr.
+ * @return A pointer on the Delaunay triangulation. Default value is <CODE>nullptr</CODE>.
*/
Complex* get_complex() const {
return complex_;
@@ -157,8 +154,8 @@ class Delaunay_triangulation_off_reader {
* that are in the OFF file.
*
* @param[in] name_file OFF file to read.
- *
- * @warning Check with is_valid() function to see if read operation was successful.
+ *
+ * \post Check with is_valid() function to see if read operation was successful.
*/
Delaunay_triangulation_off_reader(const std::string & name_file)
: valid_(false) {
@@ -191,9 +188,7 @@ class Delaunay_triangulation_off_reader {
/** \brief Returns the constructed Delaunay triangulation.
*
- * @return A pointer on the Delaunay triangulation.
- *
- * @warning The returned pointer can be nullptr.
+ * @return A pointer on the Delaunay triangulation. Default value is <CODE>nullptr</CODE>.
*/
Complex* get_complex() const {
if (valid_)
@@ -242,12 +237,12 @@ class Delaunay_triangulation_off_writer {
public:
typedef typename Complex::Point Point;
- /** \brief Writes the OFF file from the Delaunay triangulation
+ /** \brief Writes the OFF file from the Delaunay triangulation.
*
* @param[in] name_file OFF file to write.
* @param[in] complex_ptr pointer on a Delaunay triangulation.
- *
- * @warning Check with is_valid() function to see if write operation was successful.
+ *
+ * \post Check with is_valid() function to see if write operation was successful.
*/
Delaunay_triangulation_off_writer(const std::string & name_file, Complex* complex_ptr)
: valid_(false) {