Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Modules Pages
EvolvingStellarZone.cpp
Go to the documentation of this file.
1 
8 #define BUILDING_LIBRARY
9 #include "EvolvingStellarZone.h"
10 
11 namespace Star {
12 
14  {
15  for(size_t i=0; i<__current_age_quantities.size(); ++i)
17  delete __current_age_quantities[i];
19  }
20  }
21 
23  unsigned deriv_order) const
24  {
25  assert(quantity < __evolving_quantities.size());
26 
27  if(__current_age_quantities[quantity]==NULL) {
28  __current_age_quantities[quantity] =
29  __evolving_quantities[quantity]->deriv(__current_age);
30  }
31  return __current_age_quantities[quantity]->order(deriv_order);
32  }
33 
34  double EvolvingStellarZone::any_age_quantity(size_t quantity,
35  double age,
36  unsigned deriv_order) const
37  {
38  if(deriv_order == 0)
39  return (*(__evolving_quantities[quantity]))(age);
40  else {
42  *deriv = __evolving_quantities[quantity]->deriv(age);
43  double result = deriv->order(deriv_order);
44  delete deriv;
45  return result;
46  }
47  }
48 
49  void EvolvingStellarZone::configure(bool initialize,
50  double age,
51  double orbital_frequency,
52  double eccentricity,
53  double orbital_angmom,
54  double spin,
55  double inclination,
56  double periapsis,
57  bool spin_is_frequency)
58  {
59  if(__current_age != age) {
60  __current_age = age;
62  }
63  BrokenPowerlawPhaseLagZone::configure(initialize,
64  age,
65  orbital_frequency,
66  eccentricity,
67  orbital_angmom,
68  spin,
69  inclination,
70  periapsis,
71  spin_is_frequency);
72  }
73 
75  {
77 
78  for(size_t i = 0; i < __evolving_quantities.size(); ++i)
80  }
81 
83  {
84  for(size_t i = 0; i < __evolving_quantities.size(); ++i)
85  while(__evolving_quantities[i]->next_discontinuity() <= age)
86  __evolving_quantities[i]->enable_next_interpolation_region();
87  }
88 
90  {
91  double result = Core::Inf;
92  for(size_t i = 0; i < __evolving_quantities.size(); ++i)
93  result = std::min(
94  result,
95  __evolving_quantities[i]->next_discontinuity()
96  );
97  return result;
98  }
99 
101  {
102  double result = -Core::Inf;
103  for(
104  std::vector<
106  >::const_iterator quantity_iter = __evolving_quantities.begin();
107  quantity_iter != __evolving_quantities.end();
108  ++quantity_iter
109  )
110  result = std::max(result, (*quantity_iter)->range_low());
111  return result;
112  }
113 
115  {
116  for(
117  std::vector<
119  >::const_iterator quantity_iter = __evolving_quantities.begin();
120  quantity_iter != __evolving_quantities.end();
121  ++quantity_iter
122  )
123  (*quantity_iter)->select_interpolation_region(age);
124  }
125 
126 }//End Star namespace.
std::vector< const Core::FunctionDerivatives *> __current_age_quantities
Pre-computed values and derivatives for quantities which only depend on age at the current age...
double periapsis(bool evolution_rate=false) const
The argument of periapsis of this zone minus the reference zone&#39;s.
double __current_age
The age for the last configure() call.
A class for stellar properties that depend on age.
virtual double order(unsigned deriv_order=1) const =0
Derivative of the given order of the function with respect to its argument.
Declares a base class for all stellar zones.
virtual void select_interpolation_region(double age) const
Prepare the zone quantities for interpolation around the given age.
double current_age_quantity(size_t quantity, unsigned deriv_order=0) const
The current age value of the given quantity (or its derivative).
double next_stop_age() const
The next age when the evolution needs to be stopped for a change in one of the bodies.
const std::vector< const StellarEvolution::EvolvingStellarQuantity *> __evolving_quantities
The quantities describing the stellar zone.
void reached_critical_age(double age)
Change the body as necessary at the given age.
~EvolvingStellarZone()
Delete any dynamically allocated memory.
A class representing arbitrary order derivatives of a function.
Definition: Functions.h:66
double any_age_quantity(size_t quantity, double age, unsigned deriv_order=0) const
The value of the given quantity (or its derivative) at an arbitrary age.
double inclination(bool evolution_rate=false) const
The angle between the angular momenta of the zone and the orbit.
void reset_current_quantities()
Forgets any previously calculated quantities for the current age.
virtual void configure(bool initialize, double age, double orbital_frequency, double eccentricity, double orbital_angmom, double spin, double inclination, double periapsis, bool spin_is_frequency)
Defines the current orbit, triggering re-calculation of all quantities.
double min_interp_age() const
The minimum age at wich zone quantities can be querried.