dsim_model member functions that handle timestep updates. More...
Functions | |
virtual void | dsim_model::initialize_timestep () |
Overridden by subclasses to prepare for the timestep. | |
virtual void | dsim_model::pre_calculate () |
Overridden by subclasses to do any single-time calculations necessary before integration. | |
virtual void | dsim_model::post_calculate () |
Overridden by subclasses to do any single-time calculations necessary after integration. | |
virtual void | dsim_model::complete_timestep () |
Overridden by subclasses to do any necessary post-timestep cleanup. | |
virtual void | dsim_model::rhs (double t, double jd) |
Overridden by subclasses to set the derivatives of integrated states. | |
void | dsim_model::configure_timestep (bool call_pre, bool call_rhs, bool call_post) |
Called to set which functions are called during a timestep. |
dsim_model member functions that handle timestep updates.
These methods handle the updating of the object at each timestep. Timesteps are managed by the simulation in a strict order. Within each step, the order in which the associated function is called on each object is determined by the dependencies between objects that are provided in the simulation setup file. The order of calls is:
void dsim_model::complete_timestep | ( | ) | [virtual, inherited] |
Overridden by subclasses to do any necessary post-timestep cleanup.
Called on all objects, in an order determined by dependencies specified in the simulation setup file, at the end of each timestep. Models that override this function must take care to call their superclass's implementation as well.
Reimplemented in dsim_rigid_body, and dsim_second_order.
void dsim_model::configure_timestep | ( | bool | call_pre, |
bool | call_rhs, | ||
bool | call_post | ||
) | [protected, inherited] |
Called to set which functions are called during a timestep.
Specify which timestep functions should be called on the object. By default, neither pre_calculate() nor post_calculate() will be called on the object, and rhs() will be called only if the object has at least one integrated state variable. Models can call configure_timestep() to turn on or off calls to these three functions.
call_pre | Whether or not pre_calculate() should be called on this object. |
call_rhs | Whether or not rhs() should be called on this object. |
call_post | Whether or not post_calculate() should be called on this object. |
void dsim_model::initialize_timestep | ( | ) | [virtual, inherited] |
Overridden by subclasses to prepare for the timestep.
Called on all objects, in an order determined by dependencies specified in the simulation setup file, at the beginning of each timestep. Models that override this function must take care to call their superclass's implementation as well.
Reimplemented in dsim_rigid_body, and dsim_second_order.
void dsim_model::post_calculate | ( | ) | [virtual, inherited] |
Overridden by subclasses to do any single-time calculations necessary after integration.
Optionally called on objects, in order determined by dependencies specified in the simulation file, after the intra-timestep integration loop ends. Models may opt-in to having post_calculate() called on them by passing true as the third parameter to a call to configure_timestep(), usually in their initialize_data() or initialization_complete() methods. Models that override this function must take care to call their superclass's implementation as well.
void dsim_model::pre_calculate | ( | ) | [virtual, inherited] |
Overridden by subclasses to do any single-time calculations necessary before integration.
Optionally called on objects, in order determined by dependencies specified in the simulation file, prior to the intra-timestep integration loop beginning. Models may opt-in to having pre_calculate() called on them by passing true as the first parameter to a call to configure_timestep(), usually in their initialize_data() or initialization_complete() methods. Models that override this function must take care to call their superclass's implementation as well.
void dsim_model::rhs | ( | double | t, |
double | jd | ||
) | [virtual, inherited] |
Overridden by subclasses to set the derivatives of integrated states.
The rhs() function is where all integration occurs. Model implementations of rhs() should calculate and store the derivatives for any integrated states by calling dsim_variable::set_derivative() on the appropriate variables. Models may also implement rhs() to perform co-integration message passing- for instance, sending messages to apply forces and torques that other objects need to integrate.
Objects have rhs() called on them in an order determined by dependencies specified in the simulation, and will generally have it called on them multiple times per timestep. How many times is determined by the object's assigned integrator.
All objects that have integrated states will have rhs() called on them. In addition, models may opt-in to having rhs() called on them by passing true as the second parameter to a call to configure_timestep().
t | The simulation time that should be used for any time-dependent calculations for derivatives. |
jd | The Julian Date matching the simulation time. |
Reimplemented in dsim_ideal_gravity, dsim_ideal_spring, dsim_rigid_body, and dsim_second_order.