Interface FieldODEStepEndHandler<T extends CalculusFieldElement<T>>
- Type Parameters:
T
- the type of the field elements
- Since:
- 3.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
init
(FieldODEStateAndDerivative<T> initialState, T finalTime) Initialize step end handler at the start of an ODE integration.default FieldODEState<T>
resetState
(FieldODEStateAndDerivative<T> state) Reset the state prior to continue the integration.stepEndOccurred
(FieldODEStateAndDerivative<T> state, boolean forward) Handle an event and choose what to do next.
-
Method Details
-
init
Initialize step end handler at the start of an ODE integration.This method is called once at the start of the integration. It may be used by the step end handler to initialize some internal data if needed.
The default implementation does nothing
- Parameters:
initialState
- initial time, state vector and derivativefinalTime
- target time for the integration
-
stepEndOccurred
Handle an event and choose what to do next.This method is called when the integrator has accepted a step ending exactly on step end, just after the step handler itself is called (see below for scheduling). It allows the user to update his internal data to acknowledge the fact the event has been handled (for example setting a flag in the
differential equations
to switch the derivatives computation in case of discontinuity), or to direct the integrator to either stop or continue integration, possibly with a reset state or derivatives.- if
Action.STOP
is returned, the integration will be stopped, - if
Action.RESET_STATE
is returned, theresetState
method will be called once the step handler has finished its task, and the integrator will also recompute the derivatives, - if
Action.RESET_DERIVATIVES
is returned, the integrator will recompute the derivatives, - if
Action.RESET_EVENTS
is returned, the integrator will recheck all event handlers, - if
Action.CONTINUE
is returned, no specific action will be taken (apart from having called this method) and integration will continue.
The scheduling between this method and the
FieldODEStepHandler
methodhandleStep(interpolator)
is to callhandleStep
first and this method afterwards. This scheduling allows user code called by this method and user code called by step handlers to get values of the independent time variable consistent with integration direction.- Parameters:
state
- current value of the independent time variable, state vector and derivative at step endforward
- if true, propagation is forward- Returns:
- indication of what the integrator should do next, this
value must be one of
Action.STOP
,Action.RESET_STATE
,Action.RESET_DERIVATIVES
,Action.RESET_EVENTS
, orAction.CONTINUE
- if
-
resetState
Reset the state prior to continue the integration.This method is called after the step handler has returned and before the next step is started, but only when
FieldODEEventHandler.eventOccurred(FieldODEStateAndDerivative, FieldODEEventDetector, boolean)
has itself returned theAction.RESET_STATE
indicator. It allows the user to reset the state vector for the next step, without perturbing the step handler of the finishing step.The default implementation returns its argument.
- Parameters:
state
- current value of the independent time variable, state vector and derivative at step end- Returns:
- reset state (note that it does not include the derivatives, they will be added automatically by the integrator afterwards)
-