Loading...
Searching...
No Matches
Skeleton_blocker_geometric_complex.h
/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
* See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
* Author(s): David Salinas
*
* Copyright (C) 2014 Inria
*
* Modification(s):
* - YYYY/MM Author: Description of the modification
*/
#ifndef SKELETON_BLOCKER_GEOMETRIC_COMPLEX_H_
#define SKELETON_BLOCKER_GEOMETRIC_COMPLEX_H_
#include <gudhi/Skeleton_blocker_complex.h>
#include <gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h>
#include <gudhi/Debug_utils.h>
namespace Gudhi {
namespace skeleton_blocker {
template<typename SkeletonBlockerGeometricDS>
class Skeleton_blocker_geometric_complex :
public Skeleton_blocker_complex<SkeletonBlockerGeometricDS> {
public:
typedef typename SkeletonBlockerGeometricDS::GT GT;
typedef Skeleton_blocker_complex<SkeletonBlockerGeometricDS> SimplifiableSkeletonblocker;
typedef typename SimplifiableSkeletonblocker::Vertex_handle Vertex_handle;
typedef typename SimplifiableSkeletonblocker::Root_vertex_handle Root_vertex_handle;
typedef typename SimplifiableSkeletonblocker::Edge_handle Edge_handle;
typedef typename SimplifiableSkeletonblocker::Simplex Simplex;
typedef typename SimplifiableSkeletonblocker::Graph_vertex Graph_vertex;
typedef typename SkeletonBlockerGeometricDS::Point Point;
Skeleton_blocker_geometric_complex() { }
template<typename PointIterator>
explicit Skeleton_blocker_geometric_complex(int num_vertices, PointIterator begin, PointIterator end) {
for (auto point = begin; point != end; ++point)
add_vertex(*point);
}
template<typename SimpleHandleOutputIterator, typename PointIterator>
Skeleton_blocker_geometric_complex(
SimpleHandleOutputIterator simplex_begin, SimpleHandleOutputIterator simplex_end,
PointIterator points_begin, PointIterator points_end,
bool is_flag_complex = false)
: Skeleton_blocker_complex<SkeletonBlockerGeometricDS>(simplex_begin, simplex_end, is_flag_complex) {
unsigned current = 0;
for (auto point = points_begin; point != points_end; ++point)
(*this)[Vertex_handle(current++)].point() = Point(point->begin(), point->end());
}
template<typename SimpleHandleOutputIterator>
Skeleton_blocker_geometric_complex(
SimpleHandleOutputIterator simplex_begin, SimpleHandleOutputIterator simplex_end,
bool is_flag_complex = false)
: Skeleton_blocker_complex<SkeletonBlockerGeometricDS>(simplex_begin, simplex_end, is_flag_complex) { }
Vertex_handle add_vertex() {
return SimplifiableSkeletonblocker::add_vertex();
}
Vertex_handle add_vertex(const Point& point) {
Vertex_handle ad = SimplifiableSkeletonblocker::add_vertex();
(*this)[ad].point() = point;
return ad;
}
const Point& point(Vertex_handle v) const {
assert(this->contains_vertex(v));
return (*this)[v].point();
}
Point& point(Vertex_handle v) {
assert(this->contains_vertex(v));
return (*this)[v].point();
}
const Point& point(Root_vertex_handle global_v) const {
Vertex_handle local_v((*this)[global_v]);
assert(this->contains_vertex(local_v));
return (*this)[local_v].point();
}
Point& point(Root_vertex_handle global_v) {
Vertex_handle local_v((*this)[global_v]);
assert(this->contains_vertex(local_v));
return (*this)[local_v].point();
}
typedef Skeleton_blocker_link_complex<Skeleton_blocker_geometric_complex> Geometric_link;
Geometric_link link(Vertex_handle v) const {
Geometric_link link(*this, Simplex(v));
// we now add the point info
add_points_to_link(link);
return link;
}
Geometric_link link(const Simplex& simplex) const {
Geometric_link link(*this, simplex);
// we now add the point info
add_points_to_link(link);
return link;
}
Geometric_link link(Edge_handle edge) const {
Geometric_link link(*this, edge);
// we now add the point info
add_points_to_link(link);
return link;
}
typedef Skeleton_blocker_link_complex<Skeleton_blocker_complex<SkeletonBlockerGeometricDS>> Abstract_link;
Abstract_link abstract_link(Vertex_handle v) const {
return Abstract_link(*this, Simplex(v));
}
Abstract_link abstract_link(const Simplex& simplex) const {
return Abstract_link(*this, simplex);
}
Abstract_link abstract_link(Edge_handle edge) const {
return Abstract_link(*this, edge);
}
private:
void add_points_to_link(Geometric_link& link) const {
for (Vertex_handle v : link.vertex_range()) {
Root_vertex_handle v_root(link.get_id(v));
link.point(v) = (*this).point(v_root);
}
}
};
template<typename SkeletonBlockerGeometricComplex, typename SimpleHandleOutputIterator, typename PointIterator>
SkeletonBlockerGeometricComplex make_complex_from_top_faces(
SimpleHandleOutputIterator simplex_begin,
SimpleHandleOutputIterator simplex_end,
PointIterator points_begin,
PointIterator points_end,
bool is_flag_complex = false) {
typedef SkeletonBlockerGeometricComplex SBGC;
SkeletonBlockerGeometricComplex complex;
unsigned current = 0;
complex =
make_complex_from_top_faces<SBGC>(simplex_begin, simplex_end, is_flag_complex);
for (auto point = points_begin; point != points_end; ++point)
// complex.point(Vertex_handle(current++)) = Point(point->begin(),point->end());
complex.point(typename SBGC::Vertex_handle(current++)) = typename SBGC::Point(*point);
return complex;
}
} // namespace skeleton_blocker
namespace skbl = skeleton_blocker;
} // namespace Gudhi
#endif // SKELETON_BLOCKER_GEOMETRIC_COMPLEX_H_
Gudhi::skeleton_blocker::Skeleton_blocker_complex< SkeletonBlockerGeometricDS >::Simplex
Skeleton_blocker_simplex< Vertex_handle > Simplex
Definition Skeleton_blocker_complex.h:83
Gudhi::skeleton_blocker::Skeleton_blocker_complex< SkeletonBlockerGeometricDS >::Graph_vertex
SkeletonBlockerGeometricDS::Graph_vertex Graph_vertex
Definition Skeleton_blocker_complex.h:65
Gudhi::skeleton_blocker::Skeleton_blocker_complex< SkeletonBlockerGeometricDS >::add_vertex
Vertex_handle add_vertex()
Definition Skeleton_blocker_complex.h:372
Gudhi::skeleton_blocker::Skeleton_blocker_complex< SkeletonBlockerGeometricDS >::Skeleton_blocker_complex
Skeleton_blocker_complex(size_t num_vertices_=0, Visitor *visitor_=NULL)
Definition Skeleton_blocker_complex.h:153
Gudhi::skeleton_blocker::Skeleton_blocker_complex::vertex_range
Complex_vertex_range vertex_range() const
Returns a Complex_vertex_range over all vertices of the complex.
Definition Skeleton_blocker_complex.h:1282
Gudhi::skeleton_blocker::Skeleton_blocker_complex< SkeletonBlockerGeometricDS >::Vertex_handle
SkeletonBlockerGeometricDS::Vertex_handle Vertex_handle
Definition Skeleton_blocker_complex.h:77
Gudhi::skeleton_blocker::Skeleton_blocker_complex::get_id
Root_vertex_handle get_id(Vertex_handle local) const
Definition Skeleton_blocker_complex.h:443
Gudhi::skeleton_blocker::Skeleton_blocker_complex< SkeletonBlockerGeometricDS >::Edge_handle
boost::graph_traits< Graph >::edge_descriptor Edge_handle
Definition Skeleton_blocker_complex.h:114
Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex::add_vertex
Vertex_handle add_vertex()
Add a vertex to the complex with a default constructed associated point.
Definition Skeleton_blocker_geometric_complex.h:85
Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex::abstract_link
Abstract_link abstract_link(Edge_handle edge) const
Definition Skeleton_blocker_geometric_complex.h:177
Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex::point
Point & point(Vertex_handle v)
Returns the Point associated to the vertex v.
Definition Skeleton_blocker_geometric_complex.h:109
Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex::abstract_link
Abstract_link abstract_link(Vertex_handle v) const
Definition Skeleton_blocker_geometric_complex.h:163
Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex::Skeleton_blocker_geometric_complex
Skeleton_blocker_geometric_complex(SimpleHandleOutputIterator simplex_begin, SimpleHandleOutputIterator simplex_end, bool is_flag_complex=false)
Constructor with a list of simplices. Points of every vertex are the point constructed with default c...
Definition Skeleton_blocker_geometric_complex.h:77
Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex::add_vertex
Vertex_handle add_vertex(const Point &point)
Add a vertex to the complex with its associated point.
Definition Skeleton_blocker_geometric_complex.h:92
Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex::Skeleton_blocker_geometric_complex
Skeleton_blocker_geometric_complex(SimpleHandleOutputIterator simplex_begin, SimpleHandleOutputIterator simplex_end, PointIterator points_begin, PointIterator points_end, bool is_flag_complex=false)
Constructor with a list of simplices.
Definition Skeleton_blocker_geometric_complex.h:61
Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex::link
Geometric_link link(const Simplex &simplex) const
Definition Skeleton_blocker_geometric_complex.h:141
Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex< Garland_heckbert_traits >::point
const Point & point(Vertex_handle v) const
Definition Skeleton_blocker_geometric_complex.h:101
Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex::Skeleton_blocker_geometric_complex
Skeleton_blocker_geometric_complex(int num_vertices, PointIterator begin, PointIterator end)
Definition Skeleton_blocker_geometric_complex.h:50
Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex::abstract_link
Abstract_link abstract_link(const Simplex &simplex) const
Definition Skeleton_blocker_geometric_complex.h:170
Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex::link
Geometric_link link(Vertex_handle v) const
Definition Skeleton_blocker_geometric_complex.h:131
Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex::link
Geometric_link link(Edge_handle edge) const
Definition Skeleton_blocker_geometric_complex.h:151
Gudhi::skeleton_blocker::Skeleton_blocker_link_complex
Class representing the link of a simplicial complex encoded by a skeleton/blockers pair....
Definition Skeleton_blocker_link_complex.h:31
Gudhi
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14
Gudhi::skeleton_blocker::SkeletonBlockerGeometricDS
Concept for template class of Skeleton_blocker_geometric_complex . It must specify a GeometryTrait wh...
Definition SkeletonBlockerGeometricDS.h:28
Gudhi::skeleton_blocker::SkeletonBlockerGeometricDS::GT
GeometryTrait GT
Definition SkeletonBlockerGeometricDS.h:32
Gudhi::skeleton_blocker::SkeletonBlockerGeometricDS::Point
GeometryTrait::Point Point
Definition SkeletonBlockerGeometricDS.h:37