9 #ifndef __ORBIT_SOLVER_H 10 #define __ORBIT_SOLVER_H 12 #include "../Core/SharedLibraryExportMacros.h" 13 #include "../Core/AstronomicalConstants.h" 14 #include "../Core/Common.h" 15 #include "../Core/OrbitalExpressions.h" 16 #include "../Core/Common.h" 28 #include <gsl/gsl_odeiv2.h> 29 #include <gsl/gsl_errno.h> 30 #include <gsl/gsl_poly.h> 38 typedef int (*GSL_ODE_TYPE)(double,
const double*,
double*,
void*);
39 typedef int (*GSL_JAC_TYPE)(double,
const double*,
double*,
double*,
void*);
40 typedef bool (*STOP_EVOL_TYPE)(double,
const double*,
void*);
50 const double *parameters,
68 const double *parameters,
98 double y=Core::NaN) : __x(x), __y(y) {}
101 double x()
const {
return __x;}
103 double &
x() {
return __x;}
106 double y()
const {
return __y;}
108 double &
y() {
return __y;}
125 __last_order_upgrade_age,
128 __min_extremum_search_step;
148 __discarded_stop_ages;
150 std::list< std::valarray<double> >
152 __orbit_deriv_history,
161 __stop_cond_discarded,
166 __stop_deriv_discarded;
188 void output_history_and_discarded(std::ostream &os);
196 void clear_discarded();
202 void insert_discarded(
double age,
203 const std::valarray<double> ¤t_stop_cond,
204 const std::valarray<double> ¤t_stop_deriv);
207 void add_to_evolution(
222 double go_back(
double max_age,
224 std::valarray<double> &orbit);
228 void clear_history();
240 size_t cond_ind,
size_t max_points)
const;
249 size_t condition_index
259 size_t condition_index,
260 double min_extremum_x
267 double crossing_from_history_no_deriv(
269 size_t condition_index)
const;
275 double crossing_from_history(
277 size_t condition_index)
const;
281 void initialize_skip_history(
283 const std::valarray<double> &stop_cond_values,
289 bool at_exact_condition(
double previous_age,
294 void update_skip_history(
295 const std::valarray<double> ¤t_stop_cond,
300 bool acceptable_step(
double current_age,
315 const std::valarray<double> &orbit,
318 const std::valarray<double> &derivatives,
324 unsigned current_expansion_order,
348 std::valarray<double> &orbit,
386 std::valarray<double> &orbit,
418 const std::list<double> &required_ages);
424 void reached_stopping_condition(
434 void adjust_expansion_order(
439 const std::valarray<double> &orbit,
445 bool must_increase =
false 458 double required_precision,
462 bool print_progress=
false 473 double max_step=Core::Inf,
476 const std::list<double> &required_ages=std::list<double>(),
481 double max_runtime=0,
484 unsigned max_time_steps=0,
490 double min_extremum_search_step=1e-5
495 {
return __tabulated_ages;}
499 {
return __tabulated_evolution_modes;}
503 {
if(__stopping_conditions)
delete __stopping_conditions;}
double __runtime_limit
Max number of seconds current evolution is allowed to run.
double __precision
The precision required of the solution.
const std::list< Core::EvolModeType > & mode_evolution() const
The tabulated evolution modes so far.
LIB_LOCAL int stellar_system_jacobian(double age, const double *parameters, double *param_derivs, double *age_derivs, void *system_mode)
A wrapper tha allows the stellar system jacobian to be passed to the GSL ODE solver.
std::list< Core::EvolModeType > __tabulated_evolution_modes
The evolution mode corresponding to the matching tabulated age.
Declares the StopHistoryInterval class.
Users can define any stopping condition they wish the evolution to search for in this file...
struct LIB_PUBLIC OrbitSolver
Opaque struct to cast to/from Evolve::OrbitSolver.
StoppingConditionType
The reasons for stopping the evolution currently supported.
Orientations of zones of bodies in a binary system.
time_t __evolution_start_time
When did the currently running evolution start.
std::list< std::valarray< double > > __stop_deriv_history
Past values of the stop condition derivatives.
std::vector< StopInformation > __stop_info
unsigned __num_step_limit
Max number of steps allowed to be stored in history and/or discarded.
A base class for all stopping conditions.
Defines the BinarySystem class.
bool __print_progress
See print_progress argument of constructor.
EvolModeType
The various evolution modes.
std::valarray< size_t > __skip_history_zerocrossing
The number of points at the start of the history to skip when lookng for a zero crossing for each con...
Solves the system of ODEs describing the evolution of a single planet around a single star...
Declares a class for a stopping condition that combines other stopping conditions.
A class combining the the outputs of multiple stopping conditions.
std::list< double > __stop_history_ages
The ages at which the stop condition history is kept.
std::valarray< double > __skip_history_extremum
The age after which to look for extrema for each condition.
std::list< double > __tabulated_ages
The ages at which solution is tabulated.
Describes a system of two bodies orbiting each other.
A collection of accepted and discarded evolution steps which contain some reason to stop...
StoppingCondition * __stopping_conditions
The current set of stopping conditions.
const std::list< double > & evolution_ages() const
The ages at which evolution has been tabulated so far.
int stellar_system_diff_eq(double age, const double *parameters, double *derivatives, void *system_mode)
A wrapper tha allows the stellar system differential equation to be passed to the GSL ODE solver...