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
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 CONTRACTION_POLICIES_CONTRACTION_VISITOR_H_
24 #define CONTRACTION_POLICIES_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  virtual ~Contraction_visitor() { }
49 
53  virtual void on_started(ComplexType & complex) { }
54 
58  virtual void on_stop_condition_reached() { }
59 
63  virtual void on_collected(const Profile &profile, boost::optional< FT > cost) { }
64 
68  virtual void on_selected(const Profile &profile, boost::optional< FT > cost, int initial_count, int current_count) { }
69 
73  virtual void on_contracting(const Profile &profile, boost::optional< Point > placement) { }
74 
79  virtual void on_contracted(const Profile &profile, boost::optional< Point > placement) { }
80 
84  virtual void on_non_valid(const Profile &profile) { }
85 };
86 
87 } // namespace contraction
88 
89 } // namespace Gudhi
90 
91 #endif // CONTRACTION_POLICIES_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:73
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:63
virtual void on_started(ComplexType &complex)
Called before the edge contraction process starts.
Definition: Contraction_visitor.h:53
Definition: SimplicialComplexForAlpha.h:26
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:84
virtual void on_stop_condition_reached()
Called when the algorithm stops.
Definition: Contraction_visitor.h:58
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:68
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:79
GUDHI  Version 2.2.0  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : GPL v3 Generated on Thu Jun 14 2018 15:00:54 for GUDHI by Doxygen 1.8.13