11#ifndef PERMUTAHEDRAL_REPRESENTATION_H_
12#define PERMUTAHEDRAL_REPRESENTATION_H_
14#include <gudhi/Permutahedral_representation/Permutahedral_representation_iterators.h>
20namespace coxeter_triangulation {
37template <
class Vertex_,
class Ordered_set_partition_>
65 std::size_t
dimension()
const {
return partition_.size() - 1; }
84 if (vertex_ != other.vertex_)
return false;
85 for (std::size_t k = 0; k < partition_.size(); ++k)
86 if (partition_[k] != other.partition_[k])
return false;
96 typedef boost::iterator_range<Vertex_iterator> Vertex_range;
103 typedef boost::iterator_range<Face_iterator> Face_range;
117 typedef boost::iterator_range<Coface_iterator> Coface_range;
138 using Part =
typename OrderedSetPartition::value_type;
141 if (other.vertex_.size() != vertex_.size())
142 std::cerr <<
"Error: Permutahedral_representation::is_face_of: incompatible ambient dimensions.\n";
144 Vertex v_self = vertex_, v_other = other.vertex_;
145 auto self_partition_it = partition_.begin();
146 auto other_partition_it = other.partition_.begin();
147 while (self_partition_it != partition_.end()) {
148 while (other_partition_it != other.partition_.end() && v_self != v_other) {
149 const Part& other_part = *other_partition_it++;
150 if (other_partition_it == other.partition_.end())
return false;
151 for (
const auto& k : other_part) v_other[k]++;
153 if (other_partition_it == other.partition_.end())
return false;
154 const Part& self_part = *self_partition_it++;
155 if (self_partition_it == partition_.end())
return true;
156 for (
const auto& k : self_part) v_self[k]++;
172template <
class Vertex,
class OrderedSetPartition>
176 if (simplex.
vertex().empty()) {
180 auto v_it = simplex.
vertex().begin();
182 for (; v_it != simplex.
vertex().end(); ++v_it) os <<
", " << *v_it;
186 using Part =
typename OrderedSetPartition::value_type;
187 auto print_part = [&os](
const Part& p) {
192 auto p_it = p.begin();
194 for (; p_it != p.end(); ++p_it) os <<
", " << *p_it;
204 for (; o_it != simplex.
partition().end(); ++o_it) {
Iterator over the k-cofaces of a simplex given by its permutahedral representation.
Definition: Permutahedral_representation_iterators.h:151
Iterator over the k-faces of a simplex given by its permutahedral representation.
Definition: Permutahedral_representation_iterators.h:92
A class that stores the permutahedral representation of a simplex in a Coxeter triangulation or a Fre...
Definition: Permutahedral_representation.h:38
Vertex & vertex()
Lexicographically-minimal vertex.
Definition: Permutahedral_representation.h:68
Vertex_range vertex_range() const
Returns a range of vertices of the simplex. The type of vertices is Vertex.
Definition: Permutahedral_representation.h:100
const Vertex & vertex() const
Lexicographically-minimal vertex.
Definition: Permutahedral_representation.h:71
Coface_range coface_range(std::size_t value_dim) const
Returns a range of permutahedral representations of cofaces of the simplex.
Definition: Permutahedral_representation.h:122
Face_range facet_range() const
Returns a range of permutahedral representations of facets of the simplex. The dimension of the simpl...
Definition: Permutahedral_representation.h:114
Face_range face_range(std::size_t value_dim) const
Returns a range of permutahedral representations of faces of the simplex.
Definition: Permutahedral_representation.h:107
Permutahedral_representation(const Vertex &vertex, const OrderedSetPartition &partition)
Permutahedral_representation constructor from a vertex and an ordered set partition.
Definition: Permutahedral_representation.h:56
bool is_face_of(const Permutahedral_representation &other) const
Returns true, if the simplex is a face of other simplex.
Definition: Permutahedral_representation.h:137
std::size_t dimension() const
Dimension of the simplex.
Definition: Permutahedral_representation.h:65
OrderedSetPartition & partition()
Ordered set partition.
Definition: Permutahedral_representation.h:74
bool operator==(const Permutahedral_representation &other) const
Equality operator. Returns true if an only if both vertex and the ordered set partition coincide.
Definition: Permutahedral_representation.h:82
Ordered_set_partition_ OrderedSetPartition
Type of the ordered partition.
Definition: Permutahedral_representation.h:46
Coface_range cofacet_range() const
Returns a range of permutahedral representations of cofacets of the simplex. The dimension of the sim...
Definition: Permutahedral_representation.h:129
bool operator!=(const Permutahedral_representation &other) const
Inequality operator. Returns true if an only if either vertex or the ordered set partition are differ...
Definition: Permutahedral_representation.h:93
const OrderedSetPartition & partition() const
Identifying vertex.
Definition: Permutahedral_representation.h:77
Vertex_ Vertex
Type of the vertex.
Definition: Permutahedral_representation.h:43
Permutahedral_representation()
Constructor for an empty permutahedral representation that does not correspond to any simplex.
Definition: Permutahedral_representation.h:62
Iterator over the vertices of a simplex represented by its permutahedral representation.
Definition: Permutahedral_representation_iterators.h:41
std::ostream & operator<<(std::ostream &os, const Permutahedral_representation< Vertex, OrderedSetPartition > &simplex)
Print a permutahedral representation to a stream.
Definition: Permutahedral_representation.h:173
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14