Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
StopHistoryInterval.h
Go to the documentation of this file.
1 
8 #ifndef __STOP_HISTORY_INTERVAL_H
9 #define __STOP_HISTORY_INTERVAL_H
10 
11 #include "../Core/SharedLibraryExportMacros.h"
12 #include "../Core/Error.h"
13 #include <valarray>
14 #include <list>
15 #include <ostream>
16 #include <cassert>
17 #include <iomanip>
18 
19 namespace Evolve {
20 
35  class LIB_LOCAL StopHistoryInterval {
36  private:
37  size_t __num_points,
38  __point_i;
39 
41  std::list<double>::const_iterator __first_age,
42 
44  __last_age,
45 
48  __history_age_end,
49 
51  __discarded_age_begin,
52 
54  __age_i;
55 
57  std::list< std::valarray<double> >::const_iterator __first_stop_cond,
58 
60  __last_stop_cond,
61 
63  __stop_cond_history_end,
64 
66  __stop_cond_discarded_begin,
67 
69  __stop_cond_i,
70 
72  __first_stop_deriv,
73 
75  __last_stop_deriv,
76 
78  __stop_deriv_history_end,
79 
81  __stop_deriv_discarded_begin,
82 
85 
89  void advance_iterator_set(std::list<double>::const_iterator &age_i,
90  std::list< std::valarray<double> >::const_iterator &cond_i,
91  std::list< std::valarray<double> >::const_iterator &deriv_i);
92 
96  void retreat_iterator_set(std::list<double>::const_iterator &age_i,
97  std::list< std::valarray<double> >::const_iterator &cond_i,
98  std::list< std::valarray<double> >::const_iterator &deriv_i);
99 
100  public:
104  size_t num_points=0,
105 
107  std::list<double>::const_iterator
108  first_age=std::list<double>::const_iterator(),
109 
111  std::list<double>::const_iterator
112  history_age_end=std::list<double>::const_iterator(),
113 
115  std::list<double>::const_iterator
116  discarded_age_begin=std::list<double>::const_iterator(),
117 
120  std::list< std::valarray<double> >::const_iterator
121  first_stop_cond
122  =
123  std::list< std::valarray<double> >::const_iterator(),
124 
127  std::list< std::valarray<double> >::const_iterator
128  stop_cond_history_end
129  =
130  std::list< std::valarray<double> >::const_iterator(),
131 
134  std::list< std::valarray<double> >::const_iterator
135  stop_cond_discarded_begin
136  =
137  std::list< std::valarray<double> >::const_iterator(),
138 
141  std::list< std::valarray<double> >::const_iterator
142  first_stop_deriv
143  =
144  std::list< std::valarray<double> >::const_iterator(),
145 
148  std::list< std::valarray<double> >::const_iterator
149  stop_deriv_history_end
150  =
151  std::list< std::valarray<double> >::const_iterator(),
152 
155  std::list< std::valarray<double> >::const_iterator
156  stop_deriv_discarded_begin
157  =
158  std::list< std::valarray<double> >::const_iterator()
159  );
160 
163 
165  void reset();
166 
168  StopHistoryInterval &operator++();
169 
171  StopHistoryInterval operator++(int);
172 
174  StopHistoryInterval &operator--();
175 
177  StopHistoryInterval operator--(int);
178 
186  StopHistoryInterval &operator<<(size_t n);
187 
195  StopHistoryInterval &operator>>(size_t n);
196 
198  StopHistoryInterval &operator=(const StopHistoryInterval &rhs);
199 
201  bool operator==(const StopHistoryInterval &rhs);
202 
204  void grow_left(size_t n=1);
205 
207  void grow_right(size_t n=1);
208 
210  size_t num_points() {return __num_points;}
211 
213  size_t current_point_index() {return __point_i;}
214 
216  size_t number_conditions() {return __first_stop_cond->size();}
217 
220  bool end() {return __point_i==__num_points;}
221 
223  double first_age() const {return *__first_age;}
224 
226  double last_age() const {return *__last_age;}
227 
229  double age() const {return *__age_i;}
230 
233  double first_stop_condition_value(size_t condition_index) const
234  {return (*__first_stop_cond)[condition_index];}
235 
238  double last_stop_condition_value(size_t condition_index) const
239  {return (*__last_stop_cond)[condition_index];}
240 
243  double stop_condition_value(size_t condition_index) const
244  {return (*__stop_cond_i)[condition_index];}
245 
248  double first_stop_condition_deriv(size_t condition_index) const
249  {return (*__first_stop_deriv)[condition_index];}
250 
253  double last_stop_condition_deriv(size_t condition_index) const
254  {return (*__last_stop_deriv)[condition_index];}
255 
258  double stop_condition_deriv(size_t condition_index) const
259  {return (*__stop_deriv_i)[condition_index];}
260  }; //End StopHistoryInternval class.
261 
263  LIB_LOCAL std::ostream &operator<<(std::ostream &os,
264  StopHistoryInterval interval);
265 
266 }//End Evolve namespace.
267 
268 #endif
double stop_condition_deriv(size_t condition_index) const
Returns the derivative of the stop condition with the given index for the current point...
size_t number_conditions()
Returns the number of conditions at the first point.
std::ostream & operator<<(std::ostream &os, const ZoneEvolutionQuantities &evol_var)
More civilized output for EvolVarType variables.
std::list< std::valarray< double > >::const_iterator __stop_deriv_i
The current stop condition derivative.
double first_stop_condition_deriv(size_t condition_index) const
Returns the derivative of the stop condition with the given index for the first point in the interval...
std::list< double >::const_iterator __last_age
The last age in the interval.
Orientations of zones of bodies in a binary system.
size_t __point_i
The index of the current point.
size_t current_point_index()
Returns the index of the current point within the interval.
double first_age() const
Returns the age of the first point in the interval.
double last_stop_condition_value(size_t condition_index) const
Returns the value of the stop condition with the given index for the last point in the interval...
size_t num_points()
Returns the number of points in the interval.
bool end()
Returns true iff this is the invalid point marking the end of the interval.
double stop_condition_value(size_t condition_index) const
Returns the value of the stop condition with the given index for the current point.
double last_age() const
Returns the age of the last point in the interval.
double first_stop_condition_value(size_t condition_index) const
Returns the value of the stop condition with the given index for the first point in the interval...
double age() const
Returns the age of the current point.
A collection of accepted and discarded evolution steps which contain some reason to stop...
double last_stop_condition_deriv(size_t condition_index) const
Returns the derivative of the stop condition with the given index for the last point in the interval...