Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
Common.h
Go to the documentation of this file.
1 
8 #ifndef __UNITTEST_COMMON_H
9 #define __UNITTEST_COMMON_H
10 
11 #include "../Evolve/StopInformation.h"
12 #include "../Core/AstronomicalConstants.h"
13 
14 #include <cpptest.h>
15 #include <valarray>
16 #include <sstream>
17 #include <cstdlib>
18 #include <string>
19 
22 bool check_diff(double x, double y, double frac_tolerance,
23  double abs_tolerance);
24 
28 bool check_diff(std::valarray<double> x, std::valarray<double> y,
29  std::valarray<double> frac_tolerance,
30  std::valarray<double> abs_tolerance);
31 
33 bool isEqual(double a, double b);
34 
36 double getError(double predicted, double actual);
37 
39 bool approxEqual(double predicted, double actual, double thres=0.02);
40 
42 double orbital_angmom_from_freq(double m1, double m2, double freq, double e);
43 
45 const double MIN_STELLAR_MASS = 0.4,
46 
48  MAX_LOW_MASS = 1.075,
49 
52 
54  MIN_AGE = 1e-7,
55 
57  MAX_AGE = 10.0,
58 
61 
64 
67 
70 
74 double uniform_rand(double min, double max);
75 
77 //std::string stop_info_to_str(const Evolve::StopInformation &stop);
78 
81 std::ostream &operator<<(
82  std::ostream &os,
83  const std::valarray< std::valarray<double> > &poly_coef
84 );
85 
87 double rand_value(double min, double max);
88 
90 int rand_value(int min, int max);
91 
93 void rand_poly_coef(std::valarray< std::valarray<double> > &poly_coef,
94  double max_mass=-1);
95 
97 std::valarray< std::valarray<double> > rand_poly_coef(double max_mass=-1);
98 
101 std::valarray< std::valarray<double> > offset_age(
102  const std::valarray< std::valarray<double> > &poly_coef,
103  double age_offset);
104 
107 std::valarray< std::valarray<double> > offset_age(
108  const std::valarray< std::valarray<double> > &poly_coef,
109  double age_offset);
110 
112 unsigned next_binom_coef(unsigned n, unsigned m, unsigned nCm);
113 
114 double lag_from_lgQ(double lgQ);
115 
117 double lag_from_lgQ(
119  double lgQ,
120 
122  double mass_ratio
123 );
124 
125 #endif
const double MIN_AGE
Most tests start at this age in Gyr.
Definition: Common.h:54
bool approxEqual(double predicted, double actual, double thres=0.02)
Definition: Common.cpp:33
const double MAX_LOW_MASS
The boundary between high and low mass stars in .
Definition: Common.h:48
double lag_from_lgQ(double lgQ)
Converts lg(Q) to a tidal phase lag.
Definition: CInterface.cpp:17
double getError(double predicted, double actual)
Definition: Common.cpp:27
const double MAX_PLANET_MASS
The upper limit of the mass of random planets.
Definition: Common.h:63
double rand_value(double min, double max)
A uniform random real value in the given range.
Definition: Common.cpp:61
const double MAX_AGE
Most tests end at this age in Gyr.
Definition: Common.h:57
void rand_poly_coef(std::valarray< std::valarray< double > > &poly_coef, double max_mass=-1)
Fills the given valarray with a random set of polynomial coefficients.
Definition: Common.cpp:90
const double MIN_PLANET_RADIUS
The lower limit of the radius of random planets.
Definition: Common.h:66
double orbital_angmom_from_freq(double m1, double m2, double freq, double e)
The orbital angular momentum corresponding to the given frequency.
Definition: Common.cpp:39
bool check_diff(double x, double y, double frac_tolerance, double abs_tolerance)
Returns true iff .
Definition: Common.cpp:3
double uniform_rand(double min, double max)
Generates a uniformly distributed random number.
Definition: Common.cpp:49
bool isEqual(double a, double b)
Definition: Common.cpp:23
const double MAX_STELLAR_MASS
The highest stellar mass to use in tests in .
Definition: Common.h:51
unsigned next_binom_coef(unsigned n, unsigned m, unsigned nCm)
Given n, m and (n)C(m) returns (n)C(m+1)
Definition: Common.cpp:134
const double MIN_PLANET_MASS
The lower limit of the mass of random planets.
Definition: Common.h:60
std::valarray< std::valarray< double > > offset_age(const std::valarray< std::valarray< double > > &poly_coef, double age_offset)
Returns new polynomial coefficienst such that output polynomial(mass, age+age_offset)=input polynomia...
Definition: Common.cpp:115
const double MAX_PLANET_RADIUS
The upper limit of the radius of random planets.
Definition: Common.h:69
std::ostream & operator<<(std::ostream &os, const std::valarray< std::valarray< double > > &poly_coef)
Create a string with a description of the given stop info.
Definition: Common.cpp:71
const double MIN_STELLAR_MASS
The lowest stellar mass to use in tests in .
Definition: Common.h:45