diff options
Diffstat (limited to 'concept')
-rw-r--r-- | concept/Persistent_cohomology/CoefficientField.h | 52 | ||||
-rw-r--r-- | concept/Persistent_cohomology/FilteredComplex.h | 144 | ||||
-rw-r--r-- | concept/Persistent_cohomology/PersistentHomology.h | 41 | ||||
-rw-r--r-- | concept/Simplex_tree/FiltrationValue.h | 35 | ||||
-rw-r--r-- | concept/Simplex_tree/IndexingTag.h | 30 | ||||
-rw-r--r-- | concept/Simplex_tree/SimplexKey.h | 28 | ||||
-rw-r--r-- | concept/Simplex_tree/SimplexTreeOptions.h | 43 | ||||
-rw-r--r-- | concept/Simplex_tree/VertexHandle.h | 27 | ||||
-rw-r--r-- | concept/Skeleton_blocker/SkeletonBlockerDS.h | 128 | ||||
-rw-r--r-- | concept/Skeleton_blocker/SkeletonBlockerGeometricDS.h | 77 | ||||
-rw-r--r-- | concept/Witness_complex/Simplicial_complex_for_witness.h | 87 |
11 files changed, 692 insertions, 0 deletions
diff --git a/concept/Persistent_cohomology/CoefficientField.h b/concept/Persistent_cohomology/CoefficientField.h new file mode 100644 index 00000000..953b06c2 --- /dev/null +++ b/concept/Persistent_cohomology/CoefficientField.h @@ -0,0 +1,52 @@ + /* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Clément Maria + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/** \brief Concept describing the requirements for a class to represent + * a field of coefficients to compute persistent homology. + */ +struct CoefficientField { + +/** \brief Type of element of the field. + * + * Must be Assignable. */ + typedef unspecified Element; + +/** Default constructible. */ + CoefficientField(); + + void init(Element charac); + void init(Element charac_min, Element charac_max); + +/** Return the characteristic of the field. */ + Element characteristic(); +/** Return the element 1 of the field. */ + Element multiplicative_identity(); +/** Return the element 0 of the field. */ + Element additive_identity(); + +/** Assign: x <- x + y */ + void plus_equal(Element x, Element y); + +/** */ +//... inverse() + + };
\ No newline at end of file diff --git a/concept/Persistent_cohomology/FilteredComplex.h b/concept/Persistent_cohomology/FilteredComplex.h new file mode 100644 index 00000000..c19698df --- /dev/null +++ b/concept/Persistent_cohomology/FilteredComplex.h @@ -0,0 +1,144 @@ + /* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Clément Maria + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/** \brief The concept FilteredComplex describes the requirements + * for a type to implement a filtered cell complex, from which + * one can compute persistent homology via a model of the concept + * PersistentHomology. + */ +struct FilteredComplex +{ +/** Handle to specify a simplex. */ + typedef unspecified Simplex_handle; +/** \brief Key associated to each simplex. + * + * Must be a signed integer type. */ + typedef unspecified Simplex_key; +/** \brief Type for the value of the filtration function. + * + * Must be comparable with <. */ + typedef unspecified Filtration_value; + +/** \brief Specifies the nature of the indexing scheme. + * + * is model of IndexingTag. */ + typedef unspecified Indexing_tag; + +/** Returns a Simplex_handle that is different from all simplex handles + * of the simplices. */ + Simplex_handle null_simplex(); +/** \brief Returns the number of simplices in the complex. + * + * Does not count the empty simplex. */ + size_t num_simplices(); +/** \brief Returns the dimension of a simplex. */ + int dimension(Simplex_handle sh); +/** \brief Returns the filtration value of a simplex. + * + * If sh is null_simplex(), returns the maximal value of the + * filtration function on the complex. */ + Filtration_value filtration(Simplex_handle sh); + +/** \brief Returns a key that is different from the keys associated + * to the simplices. */ + Simplex_key null_key (); +/** \brief Returns the key associated to a simplex. + * + * This is never called on null_simplex(). */ + Simplex_key key ( Simplex_handle sh ); +/** \brief Returns the simplex that has index idx in the filtration. + * + * This is never called on null_key(). */ + Simplex_handle simplex ( Simplex_key idx ); +/** \brief Assign a key to a simplex. */ + void assign_key(Simplex_handle sh, Simplex_key key); + +/** \brief Iterator on the simplices belonging to the + * boundary of a simplex. + * + * <CODE>value_type</CODE> must be 'Simplex_handle'. + */ +typedef unspecified Boundary_simplex_iterator; +/** \brief Range giving access to the simplices in the boundary of + * a simplex. + * + * .begin() and .end() return type Boundary_simplex_iterator. + */ +typedef unspecified Boundary_simplex_range; + +/** \brief Returns a range giving access to all simplices of the + * boundary of a simplex, i.e. + * the set of codimension 1 subsimplices of the Simplex. + * + * If the simplex is \f$[v_0, \cdots ,v_d]\f$, with canonical orientation + * induced by \f$ v_0 < \cdots < v_d \f$, the iterator enumerates the + * simplices of the boundary in the order: + * \f$[v_0,\cdots,\widehat{v_i},\cdots,v_d]\f$ for \f$i\f$ from 0 to d + * + * We note that the alternate sum of the simplices given by the iterator + * gives the chains corresponding to the boundary of the simplex.*/ +Boundary_simplex_range boundary_simplex_range(Simplex_handle sh); + +/** \brief Iterator over all simplices of the complex + * in the order of the indexing scheme. + * + * 'value_type' must be 'Simplex_handle'. + */ +typedef unspecified Filtration_simplex_iterator; +/** \brief Range over the simplices of the complex + * in the order of the filtration. + * + * .begin() and .end() return type Filtration_simplex_iterator.*/ +typedef unspecified Filtration_simplex_range; +/** \brief Returns a range over the simplices of the complex + * in the order of the filtration. + * + * .begin() and .end() return type Filtration_simplex_iterator.*/ +Filtration_simplex_range filtration_simplex_range(); + + +/* \brief Iterator over the simplices of the complex, + * in an arbitrary order. + * + * 'value_type' must be 'Simplex_handle'.*/ +//typedef unspecified Complex_simplex_iterator; +//typedef unspecified Complex_simplex_range; + +/* +* Returns a range over all the simplices of a +* complex. +*/ +//Complex_simplex_range complex_simplex_range(); + +/*************************************************/ /** +* @details Compares the filtration values of simplices s and t +* +* @return -1 if s comes before t in the filtration, +1 +* if it comes later, and 0 if they come at the same time +* +* @note OPTIONAL +* @todo use an enum? Just a bool? +*/ +//int is_before_in_filtration(Simplex_handle s, Simplex_handle t); +/*************************************************/ + +}; diff --git a/concept/Persistent_cohomology/PersistentHomology.h b/concept/Persistent_cohomology/PersistentHomology.h new file mode 100644 index 00000000..111723a5 --- /dev/null +++ b/concept/Persistent_cohomology/PersistentHomology.h @@ -0,0 +1,41 @@ + /* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Clément Maria + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/** \brief Concept describing the requirements for a class to compute + * persistent homology. */ +struct PersistentHomology { + +/** \brief Type of filtered cell complex on which persistent homology + * is computed. + * + * Must be a model of concept FilteredComplex. + */ + typedef unspecified Filtered_complex; + +/** \brief Type of coefficients to be used for computing persistent + * homology. + * + * Must be a model of concept CoefficientField. + */ + typedef unspecified Coefficient_field; + + }; diff --git a/concept/Simplex_tree/FiltrationValue.h b/concept/Simplex_tree/FiltrationValue.h new file mode 100644 index 00000000..79ca06cc --- /dev/null +++ b/concept/Simplex_tree/FiltrationValue.h @@ -0,0 +1,35 @@ + /* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Clément Maria + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/** \brief Value type for a filtration function on a cell complex. + * + * A <EM>filtration</EM> of a cell complex (see FilteredComplex) is + * a function \f$f:\mathbf{K} \rightarrow \mathbb{R}\f$ satisfying \f$f(\tau)\leq + * f(\sigma)\f$ whenever \f$\tau \subseteq \sigma\f$. Ordering the simplices + * by increasing filtration values (breaking ties so as a simplex appears after + * its subsimplices of same filtration value) provides an indexing scheme + * (see IndexingTag). + */ + struct FiltrationValue { + /** \brief Operator < is a StrictWeakOrdering. */ + bool operator<(FiltrationValue f1, FiltrationValue f2); + }; diff --git a/concept/Simplex_tree/IndexingTag.h b/concept/Simplex_tree/IndexingTag.h new file mode 100644 index 00000000..1dcdd756 --- /dev/null +++ b/concept/Simplex_tree/IndexingTag.h @@ -0,0 +1,30 @@ + /* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Clément Maria + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/** \brief Concept describing an indexing scheme (see FilteredComplex) + * for applying + * continuous maps to a cell complex, and compute its persistent + * homology. + * + * Must be `Gudhi::linear_indexing_tag`. + */ +struct IndexingTag {}; diff --git a/concept/Simplex_tree/SimplexKey.h b/concept/Simplex_tree/SimplexKey.h new file mode 100644 index 00000000..9fbed401 --- /dev/null +++ b/concept/Simplex_tree/SimplexKey.h @@ -0,0 +1,28 @@ + /* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Clément Maria + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + /** \brief Key type used as simplex identifier. + * + * Must be an integer type. + */ + struct SimplexKey {}; + diff --git a/concept/Simplex_tree/SimplexTreeOptions.h b/concept/Simplex_tree/SimplexTreeOptions.h new file mode 100644 index 00000000..89acdc18 --- /dev/null +++ b/concept/Simplex_tree/SimplexTreeOptions.h @@ -0,0 +1,43 @@ + /* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Marc Glisse + * + * Copyright (C) 2015 INRIA Saclay - Ile-de-France (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/** \brief Concept of the template parameter for the class `Gudhi::Simplex_tree<SimplexTreeOptions>`. + * + * One model for this is `Gudhi::Simplex_tree_options_full_featured`. If you want to provide your own, it is recommended that you derive from it and override some parts instead of writing a class from scratch. + */ +struct SimplexTreeOptions { + /// Forced for now. + typedef IndexingTag Indexing_tag; + /// Must be a signed integer type. It admits a total order <. + typedef VertexHandle Vertex_handle; + /// Must be comparable with operator<. + typedef FiltrationValue Filtration_value; + /// Must be an integer type. + typedef SimplexKey Simplex_key; + /// If true, each simplex has extra storage for one `Simplex_key`. Necessary for `Persistent_cohomology`. + static const bool store_key; + /// If true, each simplex has extra storage for one `Filtration_value`, and this value is propagated by operations like `Gudhi::Simplex_tree::expansion`. Without it, `Persistent_cohomology` degenerates to computing usual (non-persistent) cohomology. + static const bool store_filtration; + /// If true, the list of vertices present in the complex must always be 0, ..., num_vertices-1, without any hole. + static constexpr bool contiguous_vertices; +}; + diff --git a/concept/Simplex_tree/VertexHandle.h b/concept/Simplex_tree/VertexHandle.h new file mode 100644 index 00000000..3efbba61 --- /dev/null +++ b/concept/Simplex_tree/VertexHandle.h @@ -0,0 +1,27 @@ + /* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Clément Maria + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/** \brief Handle type for the vertices of a cell complex. + * + * Must be a signed integer type. <code>operator<</code> defines a total order on it. + */ +struct VertexHandle {}; diff --git a/concept/Skeleton_blocker/SkeletonBlockerDS.h b/concept/Skeleton_blocker/SkeletonBlockerDS.h new file mode 100644 index 00000000..3c650f99 --- /dev/null +++ b/concept/Skeleton_blocker/SkeletonBlockerDS.h @@ -0,0 +1,128 @@ +/* + * SkeletonBlockerDS.h + * + * Created on: Feb 20, 2014 + * Author: David Salinas + * Copyright 2013 INRIA. All rights reserved + */ + +#ifndef GUDHI_SKELETONBLOCKERDS_H_ +#define GUDHI_SKELETONBLOCKERDS_H_ + + +namespace Gudhi { + +namespace skeleton_blocker { + + + +/** \brief Concept for the template class passed for Skeleton_blocker_complex. + * Most importantly, it contains the nodes for vertices and edges + * (Graph_vertex and Graph_edge) that are stored in the simplicial + * complex. The user can redefine these classes to attach + * additional information to vertices and edges. + */ +struct SkeletonBlockerDS +{ + /** + * @brief index that allows to find the vertex in the boost graph + */ + typedef int boost_vertex_handle; + + + /** + * @brief Root_vertex_handle and Vertex_handle are similar to global and local vertex descriptor + * used in <a href="http://www.boost.org/doc/libs/1_38_0/libs/graph/doc/subgraph.html">boost subgraphs</a> + * and allow to localize a vertex of a subcomplex on its parent root complex. + * + * In gross, vertices are stored in a vector + * and the Root_vertex_handle and Vertex_handle store indices of a vertex in this vector. + * + * For the root simplicial complex, the Root_vertex_handle and Vertex_handle of a vertex + * are the same. + * + * + * For a subcomplex L of a simplicial complex K, the local descriptor, ie the Vertex_handle, of a + * vertex v (that belongs to L) is its position in the vector of vertices + * of the subcomplex L whereas its Root_vertex_handle (global descriptor) is the position of v in the vector of the + * vertices of the root simplicial complex K. + */ + struct Root_vertex_handle{ + + boost_vertex_handle vertex; + + friend ostream& operator << (ostream& o, const Root_vertex_handle & v); + }; + + /** + * A Vertex_handle must be Default Constructible, Assignable and Equality Comparable. + */ + struct Vertex_handle{ + boost_vertex_handle vertex; + + friend ostream& operator << (ostream& o, const Vertex_handle & v); + }; + + + /** + * \brief The type of vertices that are stored the boost graph. + * A Vertex must be Default Constructible and Equality Comparable. + * + */ + struct Graph_vertex{ + /** \brief Used to deactivate a vertex for example when contracting an edge. + * It allows in some cases to remove the vertex at low cost. + */ + void deactivate(); + + /** \brief Used to activate a vertex. + */ + void activate(); + + /** \brief Tells if the vertex is active. + */ + bool is_active() const; + + void set_id(Root_vertex_handle i); + Root_vertex_handle get_id() const; + virtual string to_string() const ; + friend ostream& operator << (ostream& o, const Graph_vertex & v); + }; + + + /** + * \brief The type of edges that are stored the boost graph. + * An Edge must be Default Constructible and Equality Comparable. + */ + struct Graph_edge{ + /** + * @brief Allows to modify vertices of the edge. + */ + void setId(Root_vertex_handle a,Root_vertex_handle b); + + /** + * @brief Returns the first vertex of the edge. + */ + Root_vertex_handle first() const ; + + /** + * @brief Returns the second vertex of the edge. + */ + Root_vertex_handle second() const ; + + friend ostream& operator << (ostream& o, const Simple_edge & v); + }; + + +}; + + + +} // namespace skeleton_blocker + +namespace skbl = skeleton_blocker; + +} // namespace Gudhi + + +#endif /* GUDHI_SKELETONBLOCKERDS_H_ */ diff --git a/concept/Skeleton_blocker/SkeletonBlockerGeometricDS.h b/concept/Skeleton_blocker/SkeletonBlockerGeometricDS.h new file mode 100644 index 00000000..c5d52800 --- /dev/null +++ b/concept/Skeleton_blocker/SkeletonBlockerGeometricDS.h @@ -0,0 +1,77 @@ +/* + * SkeletonBlockerGeometricDS.h + * + * Created on: Feb 20, 2014 + * Author: David Salinas + * Copyright 2013 INRIA. All rights reserved + */ + +#ifndef GUDHI_SKELETONBLOCKERGEOMETRICDS_H_ +#define GUDHI_SKELETONBLOCKERGEOMETRICDS_H_ + +namespace Gudhi { +namespace skeleton_blocker { + +/** + * \brief Concept for template class of Skeleton_blocker_geometric_complex . + * It must specify a GeometryTrait which contains a Point definition. + * + * Graph_vertex must specify how to access to a point. + * Graph_edge must specify how to access to an index. + * + */ + //todo the index is just for contraction, to remove +template<typename GeometryTrait> +struct SkeletonBlockerGeometricDS : public SkeletonBlockerDS +{ + + /** + * Geometry information. + */ + typedef GeometryTrait GT ; + + /** + * Type of point (should be the same as GT::Point). + */ + typedef typename GeometryTrait::Point Point; + + /** + * @brief Vertex that stores a point. + */ + class Graph_vertex : public SkeletonBlockerDS::Graph_vertex{ + public: + /** + * @brief Access to the point. + */ + Point& point(); + /** + * @brief Access to the point. + */ + const Point& point(); + }; + + /** + * @brief Edge that allows to access to an index. + * The indices of the edges are used to store heap information + * in the edge contraction algorithm. + */ + class Graph_Edge : public SkeletonBlockerDS::Graph_edge{ + public: + /** + * @brief Access to the index. + */ + int& index(); + /** + * @brief Access to the index. + */ + int index(); + }; +}; + +} // namespace skeleton_blocker + +namespace skbl = skeleton_blocker; + +} // namespace Gudhi + +#endif /* GUDHI_SKELETONBLOCKERGEOMETRICDS_H_ */ diff --git a/concept/Witness_complex/Simplicial_complex_for_witness.h b/concept/Witness_complex/Simplicial_complex_for_witness.h new file mode 100644 index 00000000..caaf0db6 --- /dev/null +++ b/concept/Witness_complex/Simplicial_complex_for_witness.h @@ -0,0 +1,87 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Siargey Kachanovich + * + * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef CONCEPT_WITNESS_COMPLEX_SIMPLICIAL_COMPLEX_FOR_WITNESS_H_ +#define CONCEPT_WITNESS_COMPLEX_SIMPLICIAL_COMPLEX_FOR_WITNESS_H_ + +namespace Gudhi { + +namespace witness_complex { + +/** \brief The concept Simplicial_Complex describes the requirements + * for a type to implement a simplicial complex, + * used for example to build a 'Witness_complex'. + */ +struct SimplicialComplexForWitness { + /** Handle to specify a simplex. */ + typedef unspecified Simplex_handle; + /** Handle to specify a vertex. Must be a non-negative integer. */ + typedef unspecified Vertex_handle; + + /** Returns a Simplex_hanlde that is different from all simplex handles + * of the simplices. */ + Simplex_handle null_simplex(); + + /** \brief Iterator over the simplices of the complex, + * in an arbitrary order. + * + * 'value_type' must be 'Simplex_handle'.*/ + typedef unspecified Complex_simplex_range; + + /** + * \brief Returns a range over all the simplices of a + * complex. + */ + Complex_simplex_range complex_simplex_range(); + + /** \brief Iterator over vertices of a simplex. + * + * 'value type' must be 'Vertex_handle'.*/ + typedef unspecified Simplex_vertex_range; + + /** \brief Returns a range over vertices of a given + * simplex. */ + Simplex_vertex_range simplex_vertex_range(Simplex_handle const & simplex); + + /** \brief Return type of an insertion of a simplex + */ + typedef unspecified Insertion_result_type; + + /** \brief Inserts a simplex with vertices from a given range + * 'vertex_range' in the simplicial complex. + * */ + template< typedef Input_vertex_range > + Insertion_result_type insert_simplex(Input_vertex_range const & vertex_range); + + /** \brief Finds a simplex with vertices given by a range + * + * If a simplex exists, its Simplex_handle is returned. + * Otherwise null_simplex() is returned. */ + template< typedef Input_vertex_range > + Simplex_handle find(Input_vertex_range const & vertex_range); +}; + +} // namespace witness_complex + +} // namespace Gudhi + +#endif // CONCEPT_WITNESS_COMPLEX_SIMPLICIAL_COMPLEX_FOR_WITNESS_H_ |