Bertini 2 - C++ Core
Software for Numerical Algebraic Geometry
Loading...
Searching...
No Matches
trackers/events.hpp
Go to the documentation of this file.
1//This file is part of Bertini 2.
2//
3//events.hpp is free software: you can redistribute it and/or modify
4//it under the terms of the GNU General Public License as published by
5//the Free Software Foundation, either version 3 of the License, or
6//(at your option) any later version.
7//
8//events.hpp is distributed in the hope that it will be useful,
9//but WITHOUT ANY WARRANTY; without even the implied warranty of
10//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11//GNU General Public License for more details.
12//
13//You should have received a copy of the GNU General Public License
14//along with events.hpp. If not, see <http://www.gnu.org/licenses/>.
15//
16// Copyright(C) 2015 - 2021 by Bertini2 Development Team
17//
18// See <http://www.gnu.org/licenses/> for a copy of the license,
19// as well as COPYING. Bertini2 is provided with permitted
20// additional terms in the b2/licenses/ directory.
21
22// individual authors of this file include:
23// silviana amethyst, university of wisconsin eau claire
24
25
33
34#pragma once
37
38namespace bertini {
39
40 namespace tracking{
41
42
43
47 ADD_BERTINI_EVENT_TYPE(TrackingEvent,ConstEvent);
48
52 ADD_BERTINI_EVENT_TYPE(SuccessfulStep,TrackingEvent);
53
57 ADD_BERTINI_EVENT_TYPE(FailedStep,TrackingEvent);
58
62 ADD_BERTINI_EVENT_TYPE(NewStep,TrackingEvent);
63
69 ADD_BERTINI_EVENT_TYPE(SingularStartPoint,TrackingEvent);
70
74 template<class ObservedT, typename NumT>
75 class SuccessfulPredict : public TrackingEvent<ObservedT>
76 { BOOST_TYPE_INDEX_REGISTER_CLASS
77 public:
84 SuccessfulPredict(const ObservedT & obs,
85 Vec<NumT> const& resulting_point) : TrackingEvent<ObservedT>(obs),
86 resulting_point_(resulting_point)
87 {}
88
89
90 virtual ~SuccessfulPredict() = default;
91 SuccessfulPredict() = delete;
92
96 const Vec<NumT>& ResultingPoint() const {return resulting_point_;}
97 private:
98 const Vec<NumT>& resulting_point_;
99 };
100
104 template<class ObservedT, typename NumT>
105 class SuccessfulCorrect : public TrackingEvent<ObservedT>
106 { BOOST_TYPE_INDEX_REGISTER_CLASS
107 public:
114 SuccessfulCorrect(const ObservedT & obs,
115 Vec<NumT> const& resulting_point) : TrackingEvent<ObservedT>(obs),
116 resulting_point_(resulting_point)
117 {}
118
119
120 virtual ~SuccessfulCorrect() = default;
121 SuccessfulCorrect() = delete;
122
126 const Vec<NumT>& ResultingPoint() const {return resulting_point_;}
127 private:
128 const Vec<NumT>& resulting_point_;
129 };
130
132 //
133 // Precision events
134
138 ADD_BERTINI_EVENT_TYPE(PrecisionEvent,TrackingEvent);
139
140 template<class ObservedT>
141 class PrecisionChanged : public PrecisionEvent<ObservedT>
142 { BOOST_TYPE_INDEX_REGISTER_CLASS
143 public:
151 PrecisionChanged(const ObservedT & obs,
152 unsigned previous, unsigned next) : PrecisionEvent<ObservedT>(obs),
153 prev_(previous),
154 next_(next)
155 {}
156
157
158 virtual ~PrecisionChanged() = default;
159 PrecisionChanged() = delete;
160
164 auto Previous() const {return prev_;}
165
169 auto Next() const {return next_;}
170 private:
171 const unsigned prev_, next_;
172 };
173
177 template<class ObservedT>
178 class PrecisionIncreased : public PrecisionChanged<ObservedT>
179 { BOOST_TYPE_INDEX_REGISTER_CLASS
180 public:
188 PrecisionIncreased(const ObservedT & obs,
189 unsigned previous, unsigned next) : PrecisionChanged<ObservedT>(obs, previous, next)
190 {}
191 virtual ~PrecisionIncreased() = default;
192 PrecisionIncreased() = delete;
193 };
194
198 template<class ObservedT>
199 class PrecisionDecreased : public PrecisionChanged<ObservedT>
200 { BOOST_TYPE_INDEX_REGISTER_CLASS
201 public:
209 PrecisionDecreased(const ObservedT & obs,
210 unsigned previous, unsigned next) : PrecisionChanged<ObservedT>(obs, previous, next)
211 {}
212 virtual ~PrecisionDecreased() = default;
213 PrecisionDecreased() = delete;
214 };
215
219 ADD_BERTINI_EVENT_TYPE(HigherPrecisionNecessary,PrecisionEvent);
220
224 ADD_BERTINI_EVENT_TYPE(PredictorHigherPrecisionNecessary,HigherPrecisionNecessary);
225
229 ADD_BERTINI_EVENT_TYPE(CorrectorHigherPrecisionNecessary,HigherPrecisionNecessary);
230
234 ADD_BERTINI_EVENT_TYPE(MatrixSolveFailure,PrecisionEvent);
235
239 ADD_BERTINI_EVENT_TYPE(PredictorMatrixSolveFailure,MatrixSolveFailure);
240
244 ADD_BERTINI_EVENT_TYPE(FirstStepPredictorMatrixSolveFailure,MatrixSolveFailure);
245
249 ADD_BERTINI_EVENT_TYPE(CorrectorMatrixSolveFailure,MatrixSolveFailure);
251 //
252 // Stepsize events
253
257 ADD_BERTINI_EVENT_TYPE(StepsizeEvent,TrackingEvent);
258
264 ADD_BERTINI_EVENT_TYPE(StepsizeDecreased,StepsizeEvent);
265
271 ADD_BERTINI_EVENT_TYPE(StepsizeIncreased,StepsizeEvent);
272
273
275 //
276 // beginning and end events
277
281 ADD_BERTINI_EVENT_TYPE(TrackingStarted,TrackingEvent);
282
286 ADD_BERTINI_EVENT_TYPE(TrackingEnded, TrackingEvent);
287
291 ADD_BERTINI_EVENT_TYPE(InfinitePathTruncation, TrackingEvent);
292
296 template<class ObservedT, typename NumT>
297 class Initializing : public TrackingEvent<ObservedT>
298 { BOOST_TYPE_INDEX_REGISTER_CLASS
299 public:
300
309 Initializing(const ObservedT & obs,
310 NumT const& start_time,
311 NumT const& endtime,
312 Vec<NumT> const& start_point) : TrackingEvent<ObservedT>(obs),
313 start_time_(start_time),
314 end_time_(endtime),
315 start_point_(start_point)
316 {}
317
318
319 virtual ~Initializing() = default;
320 Initializing() = delete;
321
325 const NumT& StartTime() const {return start_time_;}
326
330 const NumT& EndTime() const {return end_time_;}
331
335 const Vec<NumT>& StartPoint() const {return start_point_;}
336 private:
337 const NumT& start_time_;
338 const NumT& end_time_;
339 const Vec<NumT>& start_point_;
340 };
341}// re: namespace tracking
342}// re: namespace bertini
343
TrackPath is initializing the tracker.
Definition trackers/events.hpp:298
Initializing(const ObservedT &obs, NumT const &start_time, NumT const &endtime, Vec< NumT > const &start_point)
Constructor for an Initializing Event.
Definition trackers/events.hpp:309
const NumT & EndTime() const
Get the target time for tracking.
Definition trackers/events.hpp:330
const NumT & StartTime() const
Get the time (tracking wise, not clock wise) at which tracking is starting/.
Definition trackers/events.hpp:325
const Vec< NumT > & StartPoint() const
Get the start point, the input point for TrackPath.
Definition trackers/events.hpp:335
Precision decreased during tracking.
Definition trackers/events.hpp:200
PrecisionDecreased(const ObservedT &obs, unsigned previous, unsigned next)
The constructor for a PrecisionDecreased Event.
Definition trackers/events.hpp:209
Precision increased during tracking.
Definition trackers/events.hpp:179
PrecisionIncreased(const ObservedT &obs, unsigned previous, unsigned next)
The constructor for a PrecisionIncreased Event.
Definition trackers/events.hpp:188
The correct part of a time step was successful.
Definition trackers/events.hpp:106
SuccessfulCorrect(const ObservedT &obs, Vec< NumT > const &resulting_point)
The constructor for a SuccessfulCorrect Event.
Definition trackers/events.hpp:114
const Vec< NumT > & ResultingPoint() const
Get the resulting point of the correction.
Definition trackers/events.hpp:126
The predict part of tracking step was successful.
Definition trackers/events.hpp:76
SuccessfulPredict(const ObservedT &obs, Vec< NumT > const &resulting_point)
The constructor for a SuccessfulPredict Event.
Definition trackers/events.hpp:84
const Vec< NumT > & ResultingPoint() const
Get the resulting point of the prediction.
Definition trackers/events.hpp:96
Contains the detail/events base types.
#define ADD_BERTINI_EVENT_TYPE(event_name, event_parenttype)
Defines a new event type in a hierarchy.
Definition detail/events.hpp:154
Bertini extensions of the Eigen linear algebra library.