Package org.hipparchus.ode.events
Class FieldEventState<T extends RealFieldElement<T>>
- java.lang.Object
-
- org.hipparchus.ode.events.FieldEventState<T>
-
- Type Parameters:
T
- the type of the field elements
public class FieldEventState<T extends RealFieldElement<T>> extends Object
This class handles the state for oneevent handler
during integration steps.Each time the integrator proposes a step, the event handler switching function should be checked. This class handles the state of one handler during one integration step, with references to the state at the end of the preceding step. This information is used to decide if the handler should trigger an event or not during the proposed step.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FieldEventState.EventOccurrence<T extends RealFieldElement<T>>
Class to hold the data related to an event occurrence that is needed to decide how to modify integration.
-
Constructor Summary
Constructors Constructor Description FieldEventState(FieldODEEventHandler<T> handler, double maxCheckInterval, T convergence, int maxIterationCount, BracketedRealFieldUnivariateSolver<T> solver)
Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FieldEventState.EventOccurrence<T>
doEvent(FieldODEStateAndDerivative<T> state)
Notify the user's listener of the event.boolean
evaluateStep(FieldODEStateInterpolator<T> interpolator)
Evaluate the impact of the proposed step on the event handler.T
getConvergence()
Get the convergence threshold for event localization.FieldODEEventHandler<T>
getEventHandler()
Get the underlying event handler.T
getEventTime()
Get the occurrence time of the event triggered in the current step.double
getMaxCheckInterval()
Get the maximal time interval between events handler checks.int
getMaxIterationCount()
Get the upper limit in the iteration count for event localization.void
reinitializeBegin(FieldODEStateInterpolator<T> interpolator)
Reinitialize the beginning of the step.boolean
tryAdvance(FieldODEStateAndDerivative<T> state, FieldODEStateInterpolator<T> interpolator)
Try to accept the current history up to the given time.
-
-
-
Constructor Detail
-
FieldEventState
public FieldEventState(FieldODEEventHandler<T> handler, double maxCheckInterval, T convergence, int maxIterationCount, BracketedRealFieldUnivariateSolver<T> solver)
Simple constructor.- Parameters:
handler
- event handlermaxCheckInterval
- maximal time interval between switching function checks (this interval prevents missing sign changes in case the integration steps becomes very large)convergence
- convergence threshold in the event time searchmaxIterationCount
- upper limit of the iteration count in the event time searchsolver
- Root-finding algorithm to use to detect state events
-
-
Method Detail
-
getEventHandler
public FieldODEEventHandler<T> getEventHandler()
Get the underlying event handler.- Returns:
- underlying event handler
-
getMaxCheckInterval
public double getMaxCheckInterval()
Get the maximal time interval between events handler checks.- Returns:
- maximal time interval between events handler checks
-
getConvergence
public T getConvergence()
Get the convergence threshold for event localization.- Returns:
- convergence threshold for event localization
-
getMaxIterationCount
public int getMaxIterationCount()
Get the upper limit in the iteration count for event localization.- Returns:
- upper limit in the iteration count for event localization
-
reinitializeBegin
public void reinitializeBegin(FieldODEStateInterpolator<T> interpolator) throws MathIllegalStateException
Reinitialize the beginning of the step.- Parameters:
interpolator
- valid for the current step- Throws:
MathIllegalStateException
- if the interpolator throws one because the number of functions evaluations is exceeded
-
evaluateStep
public boolean evaluateStep(FieldODEStateInterpolator<T> interpolator) throws MathIllegalArgumentException, MathIllegalStateException
Evaluate the impact of the proposed step on the event handler.- Parameters:
interpolator
- step interpolator for the proposed step- Returns:
- true if the event handler triggers an event before the end of the proposed step
- Throws:
MathIllegalStateException
- if the interpolator throws one because the number of functions evaluations is exceededMathIllegalArgumentException
- if the event cannot be bracketed
-
tryAdvance
public boolean tryAdvance(FieldODEStateAndDerivative<T> state, FieldODEStateInterpolator<T> interpolator)
Try to accept the current history up to the given time.It is not necessary to call this method before calling
doEvent(FieldODEStateAndDerivative)
with the same state. It is necessary to call this method before you calldoEvent(FieldODEStateAndDerivative)
on some other event detector.- Parameters:
state
- to try to accept.interpolator
- to use to find the new root, if any.- Returns:
- if the event detector has an event it has not detected before that is on or
before the same time as
state
. In other wordsfalse
means continue on whiletrue
means stop and handle my event first.
-
doEvent
public FieldEventState.EventOccurrence<T> doEvent(FieldODEStateAndDerivative<T> state)
Notify the user's listener of the event. The event occurs wholly within this method call including a call toFieldODEEventHandler.resetState(FieldODEStateAndDerivative)
if necessary.- Parameters:
state
- the state at the time of the event. This must be at the same time as the current value ofgetEventTime()
.- Returns:
- the user's requested action and the new state if the action is
Action.RESET_STATE
. Otherwise the new state isstate
. The stop time indicates what time propagation should stop if the action isAction.STOP
. This guarantees the integration will stop on or after the root, so that integration may be restarted safely.
-
getEventTime
public T getEventTime()
Get the occurrence time of the event triggered in the current step.- Returns:
- occurrence time of the event triggered in the current step or infinity if no events are triggered
-
-