Gudhi  1.1.0
 All Classes Functions Typedefs Friends Groups Pages
Contraction_visitor.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_CONTRACTION_VISITOR_H_
24 #define GUDHI_CONTRACTION_VISITOR_H_
25 
26 #include "gudhi/Contraction/Edge_profile.h"
27 #include "boost/optional.hpp"
28 
29 namespace Gudhi{
30 
31 namespace contraction {
32 
38 template <typename EdgeProfile>
39 class Contraction_visitor {//: public Dummy_complex_visitor<typename EdgeProfile::Vertex_handle> {
40 public:
41  //typedef typename ComplexType::GeometryTrait GT;
42  typedef EdgeProfile Profile;
43  typedef double FT;
44  typedef typename Profile::Complex Complex;
45  typedef Complex ComplexType;
46  typedef typename ComplexType::Point Point;
47 
48 
49  virtual ~Contraction_visitor(){};
50 
54  virtual void on_started (ComplexType & complex){}
55 
59  virtual void on_stop_condition_reached (){}
60 
61 
65  virtual void on_collected (const Profile &profile, boost::optional< FT > cost){}
66 
70  virtual void on_selected (const Profile &profile, boost::optional< FT > cost, int initial_count, int current_count){}
71 
72 
76  virtual void on_contracting(const Profile &profile, boost::optional< Point > placement){
77  }
78 
79 
80 
85  virtual void on_contracted(const Profile &profile, boost::optional< Point > placement){
86 
87  }
88 
89 
93  virtual void on_non_valid(const Profile &profile){}
94 
95 };
96 
97 } // namespace contraction
98 
99 } // namespace GUDHI
100 
101 #endif /* GUDHI_CONTRACTION_VISITOR_H_ */
virtual void on_contracting(const Profile &profile, boost::optional< Point > placement)
Called when an edge is about to be contracted and replaced by a vertex whose position is *placement...
Definition: Contraction_visitor.h:76
virtual void on_collected(const Profile &profile, boost::optional< FT > cost)
Called during the collecting phase (when a cost is assigned to the edges), for each edge collected...
Definition: Contraction_visitor.h:65
virtual void on_started(ComplexType &complex)
Called before the edge contraction process starts.
Definition: Contraction_visitor.h:54
Interface for a visitor of the edge contraction process.
Definition: Contraction_visitor.h:39
virtual void on_non_valid(const Profile &profile)
Called for each selected edge which cannot be contracted because the ValidContractionPredicate is fal...
Definition: Contraction_visitor.h:93
virtual void on_stop_condition_reached()
Called when the algorithm stops.
Definition: Contraction_visitor.h:59
virtual void on_selected(const Profile &profile, boost::optional< FT > cost, int initial_count, int current_count)
Called during the processing phase (when edges are contracted), for each edge that is selected...
Definition: Contraction_visitor.h:70
virtual void on_contracted(const Profile &profile, boost::optional< Point > placement)
Called when after an edge has been contracted onto a new point placement. A possibility would to remo...
Definition: Contraction_visitor.h:85