11 #ifndef HASSE_DIAGRAM_CELL_H
12 #define HASSE_DIAGRAM_CELL_H
18 #include <type_traits>
22 namespace Hasse_diagram {
24 template <
typename Cell_type>
48 template <
typename Inc
idence_type_,
typename Filtration_type_,
typename Additional_information_ =
void>
51 typedef Incidence_type_ Incidence_type;
52 typedef Filtration_type_ Filtration_type;
53 typedef Additional_information_ Additional_information;
54 using Cell_range = std::vector<std::pair<Hasse_diagram_cell*, Incidence_type> >;
70 : dimension(dim), position(0), deleted_(false), filtration(filt_) {}
76 : dimension(dim), boundary(boundary_), position(0), deleted_(false) {}
82 : dimension(dim), boundary(boundary_), coBoundary(coboundary_), position(0), deleted_(false) {}
88 Hasse_diagram_cell(
const Cell_range& boundary_,
const Cell_range& coboundary_,
const Additional_information& ai,
92 coBoundary(coboundary_),
101 : dimension(dim), additional_info(ai), position(0), deleted_(false) {}
140 return this->filtration;
148 inline bool deleted() {
return this->deleted_; }
150 template <
typename Cell_type>
151 friend class Hasse_diagram;
153 template <
typename Cell_type>
154 friend class is_before_in_filtration;
156 template <
typename Complex_type,
typename Cell_type>
157 friend std::vector<Cell_type*> convert_to_vector_of_Cell_type(Complex_type& cmplx);
164 Cell_range new_boundary;
165 new_boundary.reserve(this->boundary.size());
166 for (std::size_t bd = 0; bd != this->boundary.size(); ++bd) {
167 if (!this->boundary[bd].first->deleted()) {
168 new_boundary.push_back(this->boundary[bd]);
171 this->boundary.swap(new_boundary);
173 Cell_range new_coBoundary;
174 new_coBoundary.reserve(this->coBoundary.size());
175 for (std::size_t cbd = 0; cbd != this->coBoundary.size(); ++cbd) {
176 if (!this->coBoundary[cbd].first->deleted()) {
177 new_coBoundary.push_back(this->coBoundary[cbd]);
180 this->coBoundary.swap(new_coBoundary);
190 out << c.position <<
" " << c.dimension <<
" " << c.filtration << std::endl;
191 for (std::size_t bd = 0; bd != c.boundary.size(); ++bd) {
193 if (c.boundary[bd].first->deleted())
continue;
194 out << c.boundary[bd].first->position <<
" " << c.boundary[bd].second <<
" ";
204 std::vector<Hasse_diagram_cell*> result;
205 std::size_t size_of_boundary = this->boundary.size();
206 result.reserve(size_of_boundary);
207 for (std::size_t bd = 0; bd != size_of_boundary; ++bd) {
208 result.push_back(this->boundary[bd].first);
217 std::vector<unsigned> result;
218 std::size_t size_of_boundary = this->boundary.size();
219 result.reserve(size_of_boundary);
220 for (std::size_t bd = 0; bd != size_of_boundary; ++bd) {
221 result.push_back(this->boundary[bd].first->position);
232 result +=
"dimension: ";
233 result += std::to_string(this->dimension);
234 result +=
" filtration: ";
235 result += std::to_string(this->filtration);
236 result +=
" position: ";
237 result += std::to_string(this->position);
238 result +=
" deleted_: ";
239 result += std::to_string(this->deleted_);
243 if (std::is_same<Additional_information, void>::value) {
244 result +=
" Additional_information: ";
245 result += std::to_string(this->additional_info);
247 result +=
" boundary ";
248 for (std::size_t bd = 0; bd != this->boundary.size(); ++bd) {
249 result +=
"( " + std::to_string(this->boundary[bd].first->position);
250 result +=
" " + std::to_string(this->boundary[bd].second);
254 result +=
" coBoundary ";
255 for (std::size_t cbd = 0; cbd != this->coBoundary.size(); ++cbd) {
256 result +=
"( " + std::to_string(this->coBoundary[cbd].first->position);
257 result +=
" " + std::to_string(this->coBoundary[cbd].second);
266 Cell_range coBoundary;
268 Additional_information additional_info;
271 Filtration_type filtration;
279 void delete_cell() { this->deleted_ =
true; }
Data structure to store a cell in a Hasse diagram.
Definition: Hasse_diagram_cell.h:49
Cell_range & get_coBoundary()
Definition: Hasse_diagram_cell.h:115
bool deleted()
Definition: Hasse_diagram_cell.h:148
Hasse_diagram_cell(int dim)
Definition: Hasse_diagram_cell.h:64
Hasse_diagram_cell(int dim, Filtration_type filt_)
Definition: Hasse_diagram_cell.h:69
int & get_dimension()
Definition: Hasse_diagram_cell.h:120
void remove_deleted_elements_from_boundary_and_coboundary()
Definition: Hasse_diagram_cell.h:163
std::vector< unsigned > get_list_of_positions_of_boundary_elements()
Definition: Hasse_diagram_cell.h:216
Hasse_diagram_cell(Additional_information ai, int dim)
Definition: Hasse_diagram_cell.h:100
Hasse_diagram_cell()
Definition: Hasse_diagram_cell.h:59
Cell_range & get_boundary()
Definition: Hasse_diagram_cell.h:108
std::vector< Hasse_diagram_cell * > get_list_of_boundary_elements()
Definition: Hasse_diagram_cell.h:203
Hasse_diagram_cell(const Cell_range &boundary_, const Cell_range &coboundary_, const Additional_information &ai, int dim)
Definition: Hasse_diagram_cell.h:88
Hasse_diagram_cell(const Cell_range &boundary_, int dim)
Definition: Hasse_diagram_cell.h:75
friend std::ostream & operator<<(std::ostream &out, const Hasse_diagram_cell< Incidence_type, Filtration_type, Additional_information > &c)
Definition: Hasse_diagram_cell.h:186
unsigned & get_position()
Definition: Hasse_diagram_cell.h:133
Filtration_type & get_filtration()
Definition: Hasse_diagram_cell.h:138
Additional_information & get_additional_information()
Definition: Hasse_diagram_cell.h:125
Hasse_diagram_cell(const Cell_range &boundary_, const Cell_range &coboundary_, int dim)
Definition: Hasse_diagram_cell.h:81
std::string full_signature_of_the_structure()
Definition: Hasse_diagram_cell.h:230
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14