Simbody
3.5
|
This class uses an Integrator to advance a System through time. More...
Public Member Functions | |
TimeStepper (const System &system) | |
Create a TimeStepper to advance a System. More... | |
TimeStepper (const System &system, Integrator &integrator) | |
Create a TimeStepper to advance a System using an Integrator. More... | |
~TimeStepper () | |
void | setIntegrator (Integrator &integrator) |
Set the Integrator this TimeStepper will use to advance the System. More... | |
const Integrator & | getIntegrator () const |
Get the Integrator being used to advance the System. More... | |
Integrator & | updIntegrator () |
Get a non-const reference to the Integrator being used to advance the System. More... | |
bool | getReportAllSignificantStates () const |
Get whether the TimeStepper should report every significant state returned by the Integrator. More... | |
void | setReportAllSignificantStates (bool b) |
Set whether the TimeStepper should report every significant state returned by the Integrator. More... | |
void | initialize (const State &) |
Supply the time stepper with a starting state. More... | |
const State & | getState () const |
Get the current State of the System being integrated. More... | |
Real | getTime () const |
Get the current time of the System being integrated. More... | |
Integrator::SuccessfulStepStatus | stepTo (Real time) |
Use the Integrator to advance the System up to the specified time. More... | |
Friends | |
class | TimeStepperRep |
This class uses an Integrator to advance a System through time.
For example:
TimeStepper stepper(system, integrator); stepper.initialize(initialState); stepper.stepTo(finalTime);
stepTo() invokes the Integrator to advance time. It detects events which may occur, calls event handlers as appropriate, then invokes the Integrator again to continue advancing time until the target time is reached.
|
explicit |
Create a TimeStepper to advance a System.
This constructor leaves the Integrator unspecified. You therefore must call setIntegrator() before calling initialize().
SimTK::TimeStepper::TimeStepper | ( | const System & | system, |
Integrator & | integrator | ||
) |
Create a TimeStepper to advance a System using an Integrator.
SimTK::TimeStepper::~TimeStepper | ( | ) |
void SimTK::TimeStepper::setIntegrator | ( | Integrator & | integrator | ) |
Set the Integrator this TimeStepper will use to advance the System.
const Integrator& SimTK::TimeStepper::getIntegrator | ( | ) | const |
Get the Integrator being used to advance the System.
Integrator& SimTK::TimeStepper::updIntegrator | ( | ) |
Get a non-const reference to the Integrator being used to advance the System.
bool SimTK::TimeStepper::getReportAllSignificantStates | ( | ) | const |
Get whether the TimeStepper should report every significant state returned by the Integrator.
If this is true, stepTo() will return whenever the Integrator reports a significant state, such as when an event occurs or the start of a new continuous interval. If this is false, stepTo() will only return when the specified time has been reached or when the simulation is terminated.
void SimTK::TimeStepper::setReportAllSignificantStates | ( | bool | b | ) |
Set whether the TimeStepper should report every significant state returned by the Integrator.
If this is true, stepTo() will return whenever the Integrator reports a significant state, such as when an event occurs or the start of a new continuous interval. If this is false, stepTo() will only return when the specified time has been reached or when the simulation is terminated.
void SimTK::TimeStepper::initialize | ( | const State & | ) |
Supply the time stepper with a starting state.
This must be called after the Integrator has been set, and before the first call to stepTo().
The specified state is copied into the Integrator's internally maintained "advanced" state; subsequent changes to the State object passed in here will not affect the simulation.
const State& SimTK::TimeStepper::getState | ( | ) | const |
Get the current State of the System being integrated.
Usually this will correspond to the time specified in the most recent call to stepTo(). It may be an interpolated state which is earlier than the Integrator's "advanced" state.
|
inline |
Get the current time of the System being integrated.
This is identical to calling getState().getTime().
Integrator::SuccessfulStepStatus SimTK::TimeStepper::stepTo | ( | Real | time | ) |
Use the Integrator to advance the System up to the specified time.
This method will repeatedly invoke the Integrator as necessary, handling any events which occur. The TimeStepper must be initialized by calling initialize() before this method may be called.
When this method returns, the System will usually have been advanced all the way to the specified final time. There are situations where it may return sooner, however: if setReportAllSignificantStates() was set to true, and a significant state occurred; if setFinalTime() was invoked on the Integrator, and the final time was reached; or if an event handler requested that the simulation terminate immediately.
|
friend |