Contraction_visitor.h
1 /* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2  * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3  * Author(s): David Salinas
4  *
5  * Copyright (C) 2014 Inria
6  *
7  * Modification(s):
8  * - YYYY/MM Author: Description of the modification
9  */
10 
11 #ifndef CONTRACTION_POLICIES_CONTRACTION_VISITOR_H_
12 #define CONTRACTION_POLICIES_CONTRACTION_VISITOR_H_
13 
14 #include <gudhi/Contraction/Edge_profile.h>
15 #include <boost/optional.hpp>
16 
17 namespace Gudhi {
18 
19 namespace contraction {
20 
26 template <typename EdgeProfile>
27 class Contraction_visitor { // : public Dummy_complex_visitor<typename EdgeProfile::Vertex_handle> {
28  public:
29  // typedef typename ComplexType::GeometryTrait GT;
30  typedef EdgeProfile Profile;
31  typedef double FT;
32  typedef typename Profile::Complex Complex;
33  typedef Complex ComplexType;
34  typedef typename ComplexType::Point Point;
35 
36  virtual ~Contraction_visitor() { }
37 
41  virtual void on_started(ComplexType & complex) { }
42 
46  virtual void on_stop_condition_reached() { }
47 
51  virtual void on_collected(const Profile &profile, boost::optional< FT > cost) { }
52 
56  virtual void on_selected(const Profile &profile, boost::optional< FT > cost, int initial_count, int current_count) { }
57 
61  virtual void on_contracting(const Profile &profile, boost::optional< Point > placement) { }
62 
67  virtual void on_contracted(const Profile &profile, boost::optional< Point > placement) { }
68 
72  virtual void on_non_valid(const Profile &profile) { }
73 };
74 
75 } // namespace contraction
76 
77 } // namespace Gudhi
78 
79 #endif // CONTRACTION_POLICIES_CONTRACTION_VISITOR_H_
Interface for a visitor of the edge contraction process.
Definition: Contraction_visitor.h:27
virtual void on_stop_condition_reached()
Called when the algorithm stops.
Definition: Contraction_visitor.h:46
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:67
virtual void on_started(ComplexType &complex)
Called before the edge contraction process starts.
Definition: Contraction_visitor.h:41
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:61
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:72
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:56
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:51
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14