From 54c6bc50795f53ff1a1227c098f0d4fe84a8d885 Mon Sep 17 00:00:00 2001 From: salinasd Date: Tue, 16 Dec 2014 14:18:30 +0000 Subject: doc + problem test git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@356 636b058d-ea47-450e-bf9e-a15bfbe3eedb --- .../include/gudhi/Skeleton_blocker.h | 13 ++++--- .../Skeleton_blocker/Skeleton_blocker_off_io.h | 6 +++ .../Skeleton_blocker_simple_geometric_traits.h | 5 +++ .../Skeleton_blocker_simple_traits.h | 7 +++- .../Skeleton_blocker_sub_complex.h | 2 +- .../include/gudhi/Skeleton_blocker_complex.h | 44 ++++++++++++++++++---- .../gudhi/Skeleton_blocker_simplifiable_complex.h | 1 + 7 files changed, 63 insertions(+), 15 deletions(-) (limited to 'src/Skeleton_blocker/include/gudhi') diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h index d05bdc19..eff37a18 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h @@ -41,7 +41,7 @@ \section Introduction The Skeleton-Blocker data-structure had been introduced in the two papers -\cite socg_blockers_2011,\cite blockers2012\cite blockers2012. +\cite socg_blockers_2011,\cite blockers2012. It proposes a light encoding for simplicial complexes by storing only an *implicit* representation of its simplices. Intuitively, it just stores the 1-skeleton of a simplicial complex with a graph and the set of its "missing faces" that @@ -53,7 +53,8 @@ This data-structure handles all simplicial complexes operations such as \section Definitions -We recall briefly classical definitions of simplicial complexes \cite Munkres-elementsalgtop1984. +We recall briefly classical definitions of simplicial complexes + \cite Munkres-elementsalgtop1984. An abstract simplex is a finite non-empty set and its dimension is its number of elements minus 1. Whenever \f$\tau \subset \sigma\f$ and \f$\tau \neq \emptyset \f$, \f$ \tau \f$ is called a face of \f$ \sigma\f$ and \f$ \sigma\f$ is called a coface of \f$ \tau \f$ . Furthermore, @@ -91,22 +92,24 @@ in figure X. \subsection Overview -Four classes define a simplicial complex namely : +Four classes are implemented for simplicial complex in this representation namely : \li Skeleton_blocker_complex : a simplicial complex with basic operations such as vertex/edge/simplex enumeration and construction \li Skeleton_blocker_link_complex : the link of a simplex in a parent complex. It is represented as a sub complex of the parent complex \li Skeleton_blocker_simplifiable_complex : a simplicial complex with simplification operations such as edge contraction or simplex collapse -\li Skeleton_blocker_geometric_complex : a simplicial complex who has access to geometric points in \f$R^d\f$ +\li Skeleton_blocker_geometric_complex : a simplifiable simplicial complex who has access to geometric points in \f$R^d\f$ The two last classes are derived classes from the Skeleton_blocker_complex class. The class Skeleton_blocker_link_complex inheritates from a template passed parameter that may be either Skeleton_blocker_complex or Skeleton_blocker_geometric_complex (a link may store points coordinates or not). +Most user will just need to use Skeleton_blocker_geometric_complex. \subsection Visitor The class Skeleton_blocker_complex has a visitor that is called when usual operations such as adding an edge or remove a vertex are called. You may want to use this visitor to compute statistics or to update another data-structure (for instance this visitor is heavily used in the -Contraction package). +Contraction package). + diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h index a02dfe29..fd44fba5 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h @@ -28,6 +28,9 @@ namespace Gudhi { namespace skbl { +/** + *@brief Off reader visitor that can be passed to Off_reader to read a Skeleton_blocker_complex. + */ template class Skeleton_blocker_off_visitor_reader{ Complex& complex_; @@ -65,6 +68,9 @@ public: } }; +/** +*@brief Class that allows to load a Skeleton_blocker_complex from an off file. +*/ template class Skeleton_blocker_off_reader{ public: diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_geometric_traits.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_geometric_traits.h index bb48cd8e..a24bea25 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_geometric_traits.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_geometric_traits.h @@ -30,8 +30,12 @@ namespace Gudhi{ namespace skbl{ + /** * @extends SkeletonBlockerGeometricDS + * @ingroup skbl + * @brief Simple traits that is a model of SkeletonBlockerGeometricDS and + * can be passed as a template argument to Skeleton_blocker_geometric_complex */ template struct Skeleton_blocker_simple_geometric_traits : public skbl::Skeleton_blocker_simple_traits { @@ -49,6 +53,7 @@ public: template friend class Skeleton_blocker_geometric_complex; private: Point point_; + Point& point(){ return point_; } const Point& point() const { return point_; } }; diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_traits.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_traits.h index 9d945d46..e17ea9b5 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_traits.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simple_traits.h @@ -32,11 +32,14 @@ namespace skbl { /** * @extends SkeletonBlockerDS + * @ingroup skbl + * @brief Simple traits that is a model of SkeletonBlockerDS and + * can be passed as a template argument to Skeleton_blocker_complex */ struct Skeleton_blocker_simple_traits{ /** - * @brief global and local handle similar to boost subgraphs. - * In gross, vertices are stored in a vector. + * @brief Global and local handle similar to boost subgraphs. + * Vertices are stored in a vector. * For the root simplicial complex, the local and global descriptors are the same. * For a subcomplex L and one of its vertices 'v', the local descriptor of 'v' is its position in * the vertex vector of the subcomplex L whereas its global descriptor is the position of 'v' diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h index 97cadfc9..9b4253d1 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h @@ -33,7 +33,7 @@ namespace skbl { /** * @brief Simplicial subcomplex of a complex represented by a skeleton/blockers pair. - * + * @extends Skeleton_blocker_complex * @details Stores a subcomplex of a simplicial complex. * To simplify explanations below, we will suppose that : * - K is the root simplicial complex diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h index c0a0a2eb..81ff0231 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h @@ -74,19 +74,35 @@ class Skeleton_blocker_complex public: - + /** + * @brief The type of stored vertex node, specified by the template SkeletonBlockerDS + */ typedef typename SkeletonBlockerDS::Graph_vertex Graph_vertex; + + /** + * @brief The type of stored edge node, specified by the template SkeletonBlockerDS + */ typedef typename SkeletonBlockerDS::Graph_edge Graph_edge; typedef typename SkeletonBlockerDS::Root_vertex_handle Root_vertex_handle; + + /** + * @brief The type of an handle to a vertex of the complex. + */ typedef typename SkeletonBlockerDS::Vertex_handle Vertex_handle; typedef typename Root_vertex_handle::boost_vertex_handle boost_vertex_handle; + /** + * @brief A ordered set of integers that represents a simplex. + */ typedef Skeleton_blocker_simplex Simplex_handle; typedef Skeleton_blocker_simplex Root_simplex_handle; + /** + * @brief Handle to a blocker of the complex. + */ typedef Simplex_handle* Blocker_handle; @@ -118,12 +134,12 @@ protected: public: /** - * Handle to an edge of the complex. + * @brief Handle to an edge of the complex. */ typedef typename boost::graph_traits::edge_descriptor Edge_handle; - +protected: typedef std::multimap BlockerMap; typedef typename std::multimap::value_type BlockerPair; typedef typename std::multimap::iterator BlockerMapIterator; @@ -166,6 +182,9 @@ public: /** @name Constructors, Destructors */ //@{ + /** + *@brief constructs a simplicial complex with a given number of vertices and a visitor. + */ Skeleton_blocker_complex(int num_vertices_ = 0,Visitor* visitor_=NULL):visitor(visitor_){ clear(); for (int i=0; i& simplices,Visitor* visitor_=NULL): num_vertices_(0),num_blockers_(0), @@ -330,6 +348,8 @@ public: } } +/** +*/ Skeleton_blocker_complex& operator=(const Skeleton_blocker_complex& copy){ clear(); visitor = NULL; @@ -370,6 +390,9 @@ public: skeleton.clear(); } +/** +*@brief allows to change the visitor. +*/ void set_visitor(Visitor* other_visitor){ visitor = other_visitor; } @@ -445,11 +468,15 @@ public: if (visitor) visitor->on_remove_vertex(address); } +/** +*/ bool contains_vertex(Vertex_handle u) const{ if (u.vertex<0 || u.vertex>=boost::num_vertices(skeleton)) return false; return (*this)[u].is_active(); } +/** +*/ bool contains_vertex(Root_vertex_handle u) const{ boost::optional address = get_address(u); return address && (*this)[*address].is_active(); @@ -923,8 +950,9 @@ public: * @brief Compute the local vertices of 's' in the current complex * If one of them is not present in the complex then the return value is uninitialized. * - * xxx rename get_address et place un using dans sub_complex + * */ + //xxx rename get_address et place un using dans sub_complex boost::optional get_simplex_address(const Root_simplex_handle& s) const { boost::optional res; @@ -1126,6 +1154,7 @@ private: public: typedef Triangle_around_vertex_iterator Superior_triangle_around_vertex_iterator; + typedef boost::iterator_range < Triangle_around_vertex_iterator > Complex_triangle_around_vertex_range; /** @@ -1320,6 +1349,7 @@ public: */ //@{ public: + std::string to_string() const{ std::ostringstream stream; stream< class Skeleton_blocker_simplifiable_complex : public Skeleton_blocker_complex -- cgit v1.2.3