Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
InterpolatedDerivatives.cpp
1 #define BUILDING_LIBRARY
2 #include "InterpolatedDerivatives.h"
3 
4 namespace StellarEvolution {
5 
6  double InterpolatedDerivatives::calc_deriv(unsigned deriv_order) const
7  {
8  if(deriv_order > 2) return 0.0;
9 
10  alglib::real_1d_array interp_values;
11  interp_values.setlength(__interp_deriv->size());
12  for(unsigned i = 0; i < __interp_deriv->size(); ++i)
13  interp_values[i] = (*__interp_deriv)[i]->order(deriv_order);
14 
15  return mass_feh_interp(__interp_masses,
17  interp_values,
20  }
21 
23  double mass,
24  double feh,
25  std::vector<const FunctionDerivatives*> *derivatives,
26  const alglib::real_1d_array &interp_masses,
27  const alglib::real_1d_array &interp_feh,
28  double age,
29  bool log_quantity,
30  bool delete_derivatives
31  ) :
32  LogDerivatives(age, log_quantity),
33  __stellar_mass(mass),
34  __stellar_feh(feh),
35  __interp_deriv(derivatives),
36  __interp_masses(interp_masses),
37  __interp_feh(interp_feh),
38  __delete_derivatives(delete_derivatives)
39  {
40  assert(static_cast<long>(derivatives->size())
41  ==
42  interp_masses.length() * interp_feh.length());
43  }
44 
45 } //End of StellarEvolution namespace.
InterpolatedDerivatives(double mass, double feh, std::vector< const FunctionDerivatives *> *derivatives, const alglib::real_1d_array &interp_masses, const alglib::real_1d_array &interp_feh, double age=NaN, bool log_quantity=false, bool delete_derivatives=false)
Create an object that interpolates derivatives from evolution tracks.
std::vector< const FunctionDerivatives * > * __interp_deriv
The age derivatives for each stellar model.
Calculate dy/dx given dy/dx, dy/dln(x), dln(y)/dx or dln(y)/dln(x).
const alglib::real_1d_array & __interp_masses
The masses of the stelar models in .
double __stellar_feh
The [Fe/H] to interpolate to.
double calc_deriv(unsigned deriv_order) const
Returns the deriv_order-th derivative of the quantity.
bool __delete_derivatives
Whether to delete the derivatives it was created with.
const alglib::real_1d_array & __interp_feh
The [Fe/H] of the stellar models.
double __stellar_mass
The mass to interpolate to in .