summaryrefslogtreecommitdiff
path: root/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h')
-rw-r--r--src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
index e6a78a6d..f8f80ded 100644
--- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
+++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex_base.h
@@ -13,6 +13,8 @@
#include <gudhi/Bitmap_cubical_complex/counter.h>
+#include <boost/config.hpp>
+
#include <iostream>
#include <vector>
#include <string>
@@ -110,6 +112,16 @@ class Bitmap_cubical_complex_base {
virtual inline std::vector<std::size_t> get_coboundary_of_a_cell(std::size_t cell) const;
/**
+ * This function finds a top-dimensional cell that is incident to the input cell and has
+ * the same filtration value. In case several cells are suitable, an arbitrary one is
+ * returned. Note that the input parameter can be a cell of any dimension (vertex, edge, etc).
+ * On the other hand, the output is always indicating the position of
+ * a top-dimensional cube in the data structure.
+ * \pre The filtration values are assigned as per `impose_lower_star_filtration()`.
+ **/
+ inline size_t get_top_dimensional_coface_of_a_cell(size_t splx);
+
+ /**
* This procedure compute incidence numbers between cubes. For a cube \f$A\f$ of
* dimension n and a cube \f$B \subset A\f$ of dimension n-1, an incidence
* between \f$A\f$ and \f$B\f$ is the integer with which \f$B\f$ appears in the boundary of \f$A\f$.
@@ -603,6 +615,19 @@ void Bitmap_cubical_complex_base<T>::setup_bitmap_based_on_top_dimensional_cells
}
template <typename T>
+size_t Bitmap_cubical_complex_base<T>::get_top_dimensional_coface_of_a_cell(size_t splx) {
+ if (this->get_dimension_of_a_cell(splx) == this->dimension()){return splx;}
+ else{
+ for (auto v : this->get_coboundary_of_a_cell(splx)){
+ if(this->get_cell_data(v) == this->get_cell_data(splx)){
+ return this->get_top_dimensional_coface_of_a_cell(v);
+ }
+ }
+ }
+ BOOST_UNREACHABLE_RETURN(-2);
+}
+
+template <typename T>
Bitmap_cubical_complex_base<T>::Bitmap_cubical_complex_base(const std::vector<unsigned>& sizes_in_following_directions,
const std::vector<T>& top_dimensional_cells) {
this->setup_bitmap_based_on_top_dimensional_cells_list(sizes_in_following_directions, top_dimensional_cells);