Gudhi  1.1.0
 All Classes Functions Typedefs Friends Groups Pages
Edge_profile.h
1  /* This file is part of the Gudhi Library. The Gudhi library
2  * (Geometric Understanding in Higher Dimensions) is a generic C++
3  * library for computational topology.
4  *
5  * Author(s): David Salinas
6  *
7  * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France)
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef GUDHI_EDGE_PROFILE_H_
24 #define GUDHI_EDGE_PROFILE_H_
25 //#include "combinatorics/Skeleton_blocker/Simplex.h"
26 
27 
28 namespace Gudhi{
29 
30 namespace contraction {
31 template<typename GeometricSimplifiableComplex> class Edge_profile{
32 
33 public:
34  typedef GeometricSimplifiableComplex Complex;
35  typedef typename Complex::GT GT;
36 
37  typedef typename GeometricSimplifiableComplex::Vertex_handle Vertex_handle;
38  typedef typename GeometricSimplifiableComplex::Root_vertex_handle Root_vertex_handle;
39 
40 
41  typedef typename GeometricSimplifiableComplex::Edge_handle Edge_handle;
42  typedef typename GeometricSimplifiableComplex::Graph_vertex Graph_vertex;
43  typedef typename GeometricSimplifiableComplex::Graph_edge Graph_edge;
44  typedef typename GeometricSimplifiableComplex::Point Point;
45 
46 
47 
48 
49  Edge_profile( GeometricSimplifiableComplex& complex,Edge_handle edge):complex_(complex),edge_handle_(edge),
50  v0_(complex_.first_vertex(edge_handle_)),v1_(complex_.second_vertex(edge_handle_))
51 {
52  assert(complex_.get_address(complex_[edge_handle_].first()));
53  assert(complex_.get_address(complex_[edge_handle_].second()));
54  assert(complex_.contains_edge(v0_handle(),v1_handle()));
55  assert(v0_handle() != v1_handle());
56 }
57 
58  virtual ~Edge_profile(){ }
59 
60 
61  GeometricSimplifiableComplex& complex() const {
62  return complex_;
63  }
64 
65  Edge_handle edge_handle() const{
66  return edge_handle_;
67  }
68 
69  Graph_edge& edge() const{
70  return complex_[edge_handle_];
71  }
72 
73 
74  Graph_vertex& v0() const{return complex_[v0_handle()];}
75  Graph_vertex& v1() const{return complex_[v1_handle()];}
76 
77 
78  Vertex_handle v0_handle() const{
79  return v0_;
80 // Root_vertex_handle root = complex_[edge_handle_].first();
81 // assert(complex_.get_address(root));
82 // return *complex_.get_address(root);
83  }
84 
85  Vertex_handle v1_handle() const{
86  return v1_;
87 // Root_vertex_handle root = complex_[edge_handle_].second();
88 // assert(complex_.get_address(root));
89 // return *complex_.get_address(root);
90  }
91 
92  const Point& p0() const {return complex_.point(v0_handle());}
93 
94  const Point& p1() const {return complex_.point(v1_handle());}
95 
96  friend std::ostream& operator << (std::ostream& o, const Edge_profile & v){
97  o << "v0:"<<v.v0_handle() << " v1:"<<v.v1_handle();
98  return o;
99  }
100 private:
101 
102  GeometricSimplifiableComplex& complex_;
103 
104  Edge_handle edge_handle_;
105 
106  Vertex_handle v0_;
107 
108  Vertex_handle v1_;
109 
110 };
111 
112 template<typename EdgeProfile> class Edge_profile_factory{
113 public:
114  typedef typename EdgeProfile::Edge_handle Edge_handle_;
115  typedef typename EdgeProfile::Complex Complex_;
116  virtual EdgeProfile make_profile(
117  Complex_& complex,
118  Edge_handle_ edge) const{
119  return EdgeProfile(complex,edge);
120  }
121 
122  virtual ~Edge_profile_factory(){};
123 };
124 
125 
126 } // namespace contraction
127 
128 } // namespace GUDHI
129 
130 #endif /* GUDHI_EDGE_PROFILE_H_ */
Root_vertex_handle and Vertex_handle are similar to global and local vertex descriptor used in boost ...
Definition: SkeletonBlockerDS.h:50