summaryrefslogtreecommitdiff
path: root/src/Simplex_tree/include/gudhi
diff options
context:
space:
mode:
authorglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-10-16 18:35:37 +0000
committerglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-10-16 18:35:37 +0000
commit01d0289237b3f72ed01f259b15d92eeaa4be1a59 (patch)
treec8b4e88857691221a2c9a99e5a1ff9f5a8725404 /src/Simplex_tree/include/gudhi
parent82424630adfec94295157491a3379bc7888d5f12 (diff)
parentd0938e30da46a8ef0ad2e58ca57ab8df64454831 (diff)
Merge from trunk.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/contiguous_vertices@859 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: ba38ae19afbfbb095dddd6b7203c8ff18d876c70
Diffstat (limited to 'src/Simplex_tree/include/gudhi')
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree.h29
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h6
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h6
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h6
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree/indexing_tag.h6
5 files changed, 29 insertions, 24 deletions
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h
index 30faebc8..74ae1713 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h
@@ -121,7 +121,9 @@ class Simplex_tree {
/* Type of node in the simplex tree. */
typedef Simplex_tree_node_explicit_storage<Simplex_tree> Node;
/* Type of dictionary Vertex_handle -> Node for traversing the simplex tree. */
- // Note: this wastes space when Vertex_handle is 32 bits and Node is aligned on 64 bits. It would be better to use a flat_set (with our own comparator) where we can control the layout of the struct (put Vertex_handle and Simplex_key next to each other).
+ // Note: this wastes space when Vertex_handle is 32 bits and Node is aligned on 64 bits. It would be better to use a
+ // flat_set (with our own comparator) where we can control the layout of the struct (put Vertex_handle and
+ // Simplex_key next to each other).
typedef typename boost::container::flat_map<Vertex_handle, Node> Dictionary;
/* \brief Set of nodes sharing a same parent in the simplex tree. */
@@ -132,7 +134,7 @@ class Simplex_tree {
Key_simplex_base_real() : key_(-1) {}
void assign_key(Simplex_key k) { key_ = k; }
Simplex_key key() const { return key_; }
- private:
+ private:
Simplex_key key_;
};
struct Key_simplex_base_dummy {
@@ -146,7 +148,7 @@ class Simplex_tree {
Filtration_simplex_base_real() : filt_(0) {}
void assign_filtration(Filtration_value f) { filt_ = f; }
Filtration_value filtration() const { return filt_; }
- private:
+ private:
Filtration_value filt_;
};
struct Filtration_simplex_base_dummy {
@@ -154,7 +156,8 @@ class Simplex_tree {
void assign_filtration(Filtration_value f) { assert(f == 0); }
Filtration_value filtration() const { return 0; }
};
- typedef typename std::conditional<Options::store_filtration, Filtration_simplex_base_real, Filtration_simplex_base_dummy>::type Filtration_simplex_base;
+ typedef typename std::conditional<Options::store_filtration, Filtration_simplex_base_real,
+ Filtration_simplex_base_dummy>::type Filtration_simplex_base;
public:
/** \brief Handle type to a simplex contained in the simplicial complex represented
@@ -272,7 +275,7 @@ class Simplex_tree {
* 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. */
- Filtration_simplex_range const& filtration_simplex_range(Indexing_tag=Indexing_tag()) {
+ Filtration_simplex_range const& filtration_simplex_range(Indexing_tag = Indexing_tag()) {
if (filtration_vect_.empty()) {
initialize_filtration();
}
@@ -782,12 +785,6 @@ class Simplex_tree {
* assigned a Simplex_key corresponding to its order in the filtration (from 0 to m-1 for a
* simplicial complex with m simplices).
*
- * The use of a depth-first traversal of the simplex tree, provided by
- * complex_simplex_range(), combined with
- * a stable sort is meant to optimize the order of simplices with same
- * filtration value. The heuristic consists in inserting the cofaces of a
- * simplex as soon as possible.
- *
* Will be automatically called when calling filtration_simplex_range()
* if the filtration has never been initialized yet. */
void initialize_filtration() {
@@ -796,7 +793,15 @@ class Simplex_tree {
for (Simplex_handle sh : complex_simplex_range())
filtration_vect_.push_back(sh);
- // the stable sort ensures the ordering heuristic
+ /* We use stable_sort here because with libstdc++ it is faster than sort.
+ * is_before_in_filtration is now a total order, but we used to call
+ * stable_sort for the following heuristic:
+ * The use of a depth-first traversal of the simplex tree, provided by
+ * complex_simplex_range(), combined with a stable sort is meant to
+ * optimize the order of simplices with same filtration value. The
+ * heuristic consists in inserting the cofaces of a simplex as soon as
+ * possible.
+ */
std::stable_sort(filtration_vect_.begin(), filtration_vect_.end(),
is_before_in_filtration(this));
}
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h
index 856fdbdd..f77bac15 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef SIMPLEX_TREE_ITERATORS_H_
-#define SIMPLEX_TREE_ITERATORS_H_
+#ifndef SIMPLEX_TREE_SIMPLEX_TREE_ITERATORS_H_
+#define SIMPLEX_TREE_SIMPLEX_TREE_ITERATORS_H_
#include <boost/iterator/iterator_facade.hpp>
#include <boost/version.hpp>
@@ -328,4 +328,4 @@ class Simplex_tree_skeleton_simplex_iterator : public boost::iterator_facade<
/* @} */ // end addtogroup simplex_tree
} // namespace Gudhi
-#endif // SIMPLEX_TREE_ITERATORS_H_
+#endif // SIMPLEX_TREE_SIMPLEX_TREE_ITERATORS_H_
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h
index 7f735b7e..25d4888a 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef SIMPLEX_TREE_NODE_EXPLICIT_STORAGE_H_
-#define SIMPLEX_TREE_NODE_EXPLICIT_STORAGE_H_
+#ifndef SIMPLEX_TREE_SIMPLEX_TREE_NODE_EXPLICIT_STORAGE_H_
+#define SIMPLEX_TREE_SIMPLEX_TREE_NODE_EXPLICIT_STORAGE_H_
#include <vector>
@@ -69,4 +69,4 @@ struct Simplex_tree_node_explicit_storage : SimplexTree::Filtration_simplex_base
/* @} */ // end addtogroup simplex_tree
} // namespace Gudhi
-#endif // SIMPLEX_TREE_NODE_EXPLICIT_STORAGE_H_
+#endif // SIMPLEX_TREE_SIMPLEX_TREE_NODE_EXPLICIT_STORAGE_H_
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h
index 9cdda967..158ee1f7 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef SIMPLEX_TREE_SIBLINGS_H_
-#define SIMPLEX_TREE_SIBLINGS_H_
+#ifndef SIMPLEX_TREE_SIMPLEX_TREE_SIBLINGS_H_
+#define SIMPLEX_TREE_SIMPLEX_TREE_SIBLINGS_H_
#include <gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h>
@@ -124,4 +124,4 @@ class Simplex_tree_siblings {
/* @} */ // end addtogroup simplex_tree
} // namespace Gudhi
-#endif // SIMPLEX_TREE_SIBLINGS_H_
+#endif // SIMPLEX_TREE_SIMPLEX_TREE_SIBLINGS_H_
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree/indexing_tag.h b/src/Simplex_tree/include/gudhi/Simplex_tree/indexing_tag.h
index a00dac27..0adeb46d 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree/indexing_tag.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree/indexing_tag.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef INDEXING_TAG_H_
-#define INDEXING_TAG_H_
+#ifndef SIMPLEX_TREE_INDEXING_TAG_H_
+#define SIMPLEX_TREE_INDEXING_TAG_H_
namespace Gudhi {
@@ -36,4 +36,4 @@ struct linear_indexing_tag {
// struct zigzag_indexing_tag {};
} // namespace Gudhi
-#endif // INDEXING_TAG_H_
+#endif // SIMPLEX_TREE_INDEXING_TAG_H_