32 template<
typename T>
friend class Skeleton_blocker_link_superior;
33 typedef typename ComplexType::Edge_handle Edge_handle;
35 typedef typename ComplexType::boost_vertex_handle boost_vertex_handle;
38 bool only_superior_vertices_;
41 typedef typename ComplexType::Vertex_handle Vertex_handle;
42 typedef typename ComplexType::Root_vertex_handle Root_vertex_handle;
44 typedef typename ComplexType::Simplex Simplex;
45 typedef typename ComplexType::Root_simplex_handle Root_simplex_handle;
47 typedef typename ComplexType::Blocker_handle Blocker_handle;
49 typedef typename ComplexType::Root_simplex_handle::Simplex_vertex_const_iterator Root_simplex_handle_iterator;
51 explicit Skeleton_blocker_link_complex(
bool only_superior_vertices =
false)
52 : only_superior_vertices_(only_superior_vertices) { }
60 const Simplex& alpha_parent_address,
61 bool only_superior_vertices =
false,
62 bool only_vertices =
false)
63 : only_superior_vertices_(only_superior_vertices) {
64 if (!alpha_parent_address.empty())
65 build_link(parent_complex, alpha_parent_address, only_vertices);
73 Vertex_handle a_parent_address,
74 bool only_superior_vertices =
false)
75 : only_superior_vertices_(only_superior_vertices) {
76 Simplex alpha_simplex(a_parent_address);
85 Edge_handle edge,
bool only_superior_vertices =
87 : only_superior_vertices_(only_superior_vertices) {
88 Simplex alpha_simplex(parent_complex.first_vertex(edge),
89 parent_complex.second_vertex(edge));
99 void compute_link_vertices(
const ComplexType & parent_complex,
100 const Simplex& alpha_parent_address,
101 bool only_superior_vertices,
102 bool is_alpha_blocker =
false) {
103 if (alpha_parent_address.
dimension() == 0) {
106 this->compute_link_vertices(parent_complex,
108 only_superior_vertices_);
111 Simplex link_vertices_parent;
112 parent_complex.add_neighbours(alpha_parent_address, link_vertices_parent,
113 only_superior_vertices);
116 for (
auto v_parent : link_vertices_parent) {
117 bool new_vertex =
true;
118 for (
auto beta : parent_complex.const_blocker_range(v_parent)) {
119 if (!is_alpha_blocker || *beta != alpha_parent_address) {
127 this->
add_vertex(parent_complex.get_id(v_parent));
137 void compute_link_vertices(
const ComplexType & parent_complex,
138 Vertex_handle alpha_parent_address,
139 bool only_superior_vertices) {
141 this->skeleton.m_vertices.reserve(
142 parent_complex.degree(alpha_parent_address));
146 for (
auto v_parent : parent_complex.vertex_range(alpha_parent_address)) {
147 if (!only_superior_vertices
148 || v_parent.vertex > alpha_parent_address.vertex)
149 this->
add_vertex(parent_complex.get_id(v_parent));
153 void compute_link_edges(
const ComplexType & parent_complex,
154 const Simplex& alpha_parent_address,
155 bool is_alpha_blocker =
false) {
156 if (this->num_vertices() <= 1)
161 for (
auto y_link = x_link; ++y_link != this->
vertex_range().end();) {
162 Vertex_handle x_parent = *parent_complex.get_address(
164 Vertex_handle y_parent = *parent_complex.get_address(
166 if (parent_complex.contains_edge(x_parent, y_parent)) {
168 bool new_edge =
true;
169 for (
auto blocker_parent : parent_complex.const_blocker_range(
171 if (!is_alpha_blocker || *blocker_parent != alpha_parent_address) {
172 if (blocker_parent->contains(y_parent)) {
174 *blocker_parent, x_parent, y_parent));
192 boost::optional<Vertex_handle> give_equivalent_vertex(
const ComplexType & other_complex,
193 Vertex_handle address)
const {
194 Root_vertex_handle id((*
this)[address].
get_id());
195 return other_complex.get_address(
id);
203 void compute_link_blockers(
const ComplexType & parent_complex,
204 const Simplex& alpha_parent,
205 bool is_alpha_blocker =
false) {
207 Vertex_handle x_parent = *this->give_equivalent_vertex(parent_complex,
210 for (
auto blocker_parent : parent_complex.const_blocker_range(x_parent)) {
211 if (!is_alpha_blocker || *blocker_parent != alpha_parent) {
212 Simplex sigma_parent(*blocker_parent);
214 sigma_parent.difference(alpha_parent);
216 if (sigma_parent.dimension() >= 2
217 && sigma_parent.first_vertex() == x_parent) {
218 Root_simplex_handle sigma_id(parent_complex.get_id(sigma_parent));
222 bool is_new_blocker =
true;
223 for (
auto a : alpha_parent) {
224 for (
auto eta_parent : parent_complex.const_blocker_range(a)) {
225 if (!is_alpha_blocker || *eta_parent != alpha_parent) {
226 Simplex eta_minus_alpha(*eta_parent);
227 eta_minus_alpha.difference(alpha_parent);
228 if (eta_minus_alpha != sigma_parent
229 && sigma_parent.contains_difference(*eta_parent,
231 is_new_blocker =
false;
255 const Simplex& alpha_parent_address,
256 bool is_alpha_blocker =
false,
257 bool only_vertices =
false) {
258 assert(is_alpha_blocker || parent_complex.contains(alpha_parent_address));
259 compute_link_vertices(parent_complex, alpha_parent_address, only_superior_vertices_);
260 if (!only_vertices) {
261 compute_link_edges(parent_complex, alpha_parent_address, is_alpha_blocker);
262 compute_link_blockers(parent_complex, alpha_parent_address, is_alpha_blocker);
273 Skeleton_blocker_link_complex & result) {
275 assert(parent_complex.contains_blocker(blocker));
277 result.
build_link(parent_complex, blocker,
true);