Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
EccentricityExpansionCoefficients.h
Go to the documentation of this file.
1 
8 #ifndef __ECCENTRICITY_EXPANSION_COEFFICIENTS_H
9 #define __ECCENTRICITY_EXPANSION_COEFFICIENTS_H
10 
11 #include "../Core/SharedLibraryExportMacros.h"
12 #include "../Core/Error.h"
13 #include "../Core/Common.h"
14 #include <vector>
15 #include <fstream>
16 #include <iomanip>
17 #include <cmath>
18 #include <iostream>
19 #include <sstream>
20 #include <cassert>
21 #include <algorithm>
22 #include <sqlite3.h>
23 //#include <boost/math/special_functions/chebyshev.hpp>
24 
25 namespace Evolve {
26 
30  private:
33  bool __useable;
34 
37 
38  std::vector< std::vector<double> >
44 
45 
49 
52  int __max_s;
53 
56 
59  bool __load_all;
60 
63  std::vector<int> __db_pms_id;
64 
67  std::vector<double> __min_e;
68 
71  std::vector<int> __num_steps;
72 
75  std::vector<double> __max_e;
76 
77 
80  std::vector<double> __interp_precision;
81 
83  std::string __file_name;
84 
89  std::vector<double> __max_ignore_eccentricity;
90 
91  std::vector<double> load_coefficient(sqlite3* db,int m,int s);
92 
95  void set_max_s(sqlite3* db);
96 
99  void load_metadata(sqlite3* db);
100 
102  void load_max_ignore_eccentricity(sqlite3* db, double precision);
103 
104  double load_specific_e(int m,int s,int e_step) const;
107  void get_interp_data(sqlite3* db);
108 
110  double get_specific_e(
112  int m,
113 
115  int s,
116 
118  int e_step
119  ) const;
120 
121  std::vector<double> find_pms_boundary_values(int m,int s,double e) const;
122  double return_known_e(int m, int s, double e) const;
123  bool check_known_e(int m,int s,double e) const;
124  inline int e_to_nearest_step(int m,int s,double e,bool flr) const;
125  inline double step_to_e(int m,int s,int step) const;
126  int current_largest_s(int m);
127  inline int local_index(int m, int s) const;
128  //void change_frequency_order(double new_e); // Has not been implemented yet but is new and is intended to be
129 
130  std::vector<double>* which_list(int m);
131  int* which_order(int m);
132 
133  public:
135  EccentricityExpansionCoefficients() : __useable(false) {}
136 
138  void prepare(
140  const std::string &tabulated_pms_fname,
141 
145  double precision,
146 
150  bool pre_load,
151 
155  bool disable_precision_fail=false
156  );
157 
159  inline double get_expansion_precision() const
160  {return __expansion_precision;}
161 
163  double interp_precision(int m, int s) const;
164 
166  //\f$s'>s\f$ can be ignored from the expansion without violating the
168  int required_expansion_order(double e, int m) const;
169 
172  {return __max_s;}
173 
183  std::pair<double,double> get_expansion_range(int m, int max_s) const;
184 
186  double operator()(
188  int m,
189 
191  int s,
192 
194  double e,
195 
197  bool deriv
198  ) const;
199 
200  }; //End EccentricityExpansionCoefficients class.
201 
202 } //End Evolve namespace.
203 
204 #endif
std::vector< double > __max_e
The maximum eccentricity at which each coefficient can be reliably interpolated. ...
std::vector< double > __max_ignore_eccentricity
The maximum eccentricity at which a given can be ignored.
double get_expansion_precision() const
Return the expansion precision set by the last call to prepare()
int max_expansion_order() const
The largest s for which is known.
std::vector< int > __num_steps
The number of e values at which each coefficient is tabulated.
double __expansion_precision
The currently defined expansion precision (see prepare())
Orientations of zones of bodies in a binary system.
std::vector< std::vector< double > > __pms_interp_data
The expansion coefficients for all .
std::vector< int > __db_pms_id
The identifiers of particular coefficients in the database.
std::string __file_name
The name of the file contanining the interpolatiod sqlite database.
bool __allow_precision_fail
See do_not_fail argument to prepare().
std::vector< double > __interp_precision
The guaranteed interpolation precision for each u coefficient.
bool __load_all
Whether we load the whole database at the start (true) or part of it as needed (false) ...
EccentricityExpansionCoefficients()
Create an uninitialized object.
int __max_s
The largest s (second) index at which all three coefficients are tabulated.
A class which reads-in and provides a convenient interface to the coefficients.