Top Description Fields Constructors Methods
org.apache.commons.math3.ode.events

public Class FieldEventState<T extends RealFieldElement<T>>

extends Object
Class Inheritance
Type Parameters
<T>
the type of the field elements
Imports
org.apache.commons.math3.RealFieldElement, org.apache.commons.math3.analysis.RealFieldUnivariateFunction, org.apache.commons.math3.analysis.solvers.AllowedSolution, .BracketedRealFieldUnivariateSolver, org.apache.commons.math3.exception.MaxCountExceededException, .NoBracketingException, org.apache.commons.math3.ode.FieldODEState, .FieldODEStateAndDerivative, org.apache.commons.math3.ode.sampling.FieldStepInterpolator, org.apache.commons.math3.util.FastMath

This class handles the state for one event 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.

Since
3.6

Field Summary

Modifier and TypeField and Description
private final T
convergence

Convergence threshold for event localization.

private boolean
forward

Integration direction.

private T
g0

Value of the events handler at the beginning of the step.

private boolean
g0Positive

Simulated sign of g0 (we cheat when crossing events).

private final FieldEventHandler<T>
handler

Event handler.

private boolean
increasing

Variation direction around pending event.

private final double
maxCheckInterval

Maximal time interval between events handler checks.

private final int
maxIterationCount

Upper limit in the iteration count for event localization.

private Action
nextAction

Next action indicator.

private boolean
pendingEvent

Indicator of event expected during the step.

private T
pendingEventTime

Occurrence time of the pending event.

private T
previousEventTime

Occurrence time of the previous event.

private final BracketedRealFieldUnivariateSolver<T>
solver

Root-finding algorithm to use to detect state events.

private T
t0

Time at the beginning of the step.

Constructor Summary

AccessConstructor and Description
public
FieldEventState(final FieldEventHandler<T>
event handler
handler
,
final double
maximal time interval between switching function checks (this interval prevents missing sign changes in case the integration steps becomes very large)
maxCheckInterval
,
final T
convergence threshold in the event time search
convergence
,
final int
upper limit of the iteration count in the event time search
maxIterationCount
,
final BracketedRealFieldUnivariateSolver<T>
Root-finding algorithm to use to detect state events
solver
)

Simple constructor.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the event handler triggers an event before the end of the proposed step
evaluateStep
(final FieldStepInterpolator<T>
step interpolator for the proposed step
interpolator
)

Evaluate the impact of the proposed step on the event handler.

public T

Returns:

convergence threshold for event localization
getConvergence
()

Get the convergence threshold for event localization.

public FieldEventHandler<T>

Returns:

underlying event handler
getEventHandler
()

Get the underlying event handler.

public T

Returns:

occurrence time of the event triggered in the current step or infinity if no events are triggered
getEventTime
()

Get the occurrence time of the event triggered in the current step.

public double

Returns:

maximal time interval between events handler checks
getMaxCheckInterval
()

Get the maximal time interval between events handler checks.

public int

Returns:

upper limit in the iteration count for event localization
getMaxIterationCount
()

Get the upper limit in the iteration count for event localization.

public void
reinitializeBegin(final FieldStepInterpolator<T>
valid for the current step
interpolator
)

Reinitialize the beginning of the step.

public FieldODEState<T>

Returns:

reset state (may by the same as initial state if only derivatives should be reset), or null if nothing is reset
reset
(final FieldODEStateAndDerivative<T>
state at the beginning of the next step
state
)

Let the event handler reset the state if it wants.

public void
stepAccepted(final FieldODEStateAndDerivative<T>
state at the end of the step
state
)

Acknowledge the fact the step has been accepted by the integrator.

public boolean

Returns:

true if the integration should be stopped
stop
()

Check if the integration should be stopped at the end of the current step.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

convergenceback to summary
private final T convergence

Convergence threshold for event localization.

forwardback to summary
private boolean forward

Integration direction.

g0back to summary
private T g0

Value of the events handler at the beginning of the step.

g0Positiveback to summary
private boolean g0Positive

Simulated sign of g0 (we cheat when crossing events).

handlerback to summary
private final FieldEventHandler<T> handler

Event handler.

increasingback to summary
private boolean increasing

Variation direction around pending event. (this is considered with respect to the integration direction)

maxCheckIntervalback to summary
private final double maxCheckInterval

Maximal time interval between events handler checks.

maxIterationCountback to summary
private final int maxIterationCount

Upper limit in the iteration count for event localization.

nextActionback to summary
private Action nextAction

Next action indicator.

pendingEventback to summary
private boolean pendingEvent

Indicator of event expected during the step.

pendingEventTimeback to summary
private T pendingEventTime

Occurrence time of the pending event.

previousEventTimeback to summary
private T previousEventTime

Occurrence time of the previous event.

solverback to summary
private final BracketedRealFieldUnivariateSolver<T> solver

Root-finding algorithm to use to detect state events.

t0back to summary
private T t0

Time at the beginning of the step.

Constructor Detail

FieldEventStateback to summary
public FieldEventState(final FieldEventHandler<T> handler, final double maxCheckInterval, final T convergence, final int maxIterationCount, final BracketedRealFieldUnivariateSolver<T> solver)

Simple constructor.

Parameters
handler:FieldEventHandler<T>

event handler

maxCheckInterval:double

maximal time interval between switching function checks (this interval prevents missing sign changes in case the integration steps becomes very large)

convergence:T

convergence threshold in the event time search

maxIterationCount:int

upper limit of the iteration count in the event time search

solver:BracketedRealFieldUnivariateSolver<T>

Root-finding algorithm to use to detect state events

Method Detail

evaluateStepback to summary
public boolean evaluateStep(final FieldStepInterpolator<T> interpolator) throws MaxCountExceededException, NoBracketingException

Evaluate the impact of the proposed step on the event handler.

Parameters
interpolator:FieldStepInterpolator<T>

step interpolator for the proposed step

Returns:boolean

true if the event handler triggers an event before the end of the proposed step

Exceptions
MaxCountExceededException:
if the interpolator throws one because the number of functions evaluations is exceeded
NoBracketingException:
if the event cannot be bracketed
getConvergenceback to summary
public T getConvergence()

Get the convergence threshold for event localization.

Returns:T

convergence threshold for event localization

getEventHandlerback to summary
public FieldEventHandler<T> getEventHandler()

Get the underlying event handler.

Returns:FieldEventHandler<T>

underlying event handler

getEventTimeback to summary
public T getEventTime()

Get the occurrence time of the event triggered in the current step.

Returns:T

occurrence time of the event triggered in the current step or infinity if no events are triggered

getMaxCheckIntervalback to summary
public double getMaxCheckInterval()

Get the maximal time interval between events handler checks.

Returns:double

maximal time interval between events handler checks

getMaxIterationCountback to summary
public int getMaxIterationCount()

Get the upper limit in the iteration count for event localization.

Returns:int

upper limit in the iteration count for event localization

reinitializeBeginback to summary
public void reinitializeBegin(final FieldStepInterpolator<T> interpolator) throws MaxCountExceededException

Reinitialize the beginning of the step.

Parameters
interpolator:FieldStepInterpolator<T>

valid for the current step

Exceptions
MaxCountExceededException:
if the interpolator throws one because the number of functions evaluations is exceeded
resetback to summary
public FieldODEState<T> reset(final FieldODEStateAndDerivative<T> state)

Let the event handler reset the state if it wants.

Parameters
state:FieldODEStateAndDerivative<T>

state at the beginning of the next step

Returns:FieldODEState<T>

reset state (may by the same as initial state if only derivatives should be reset), or null if nothing is reset

stepAcceptedback to summary
public void stepAccepted(final FieldODEStateAndDerivative<T> state)

Acknowledge the fact the step has been accepted by the integrator.

Parameters
state:FieldODEStateAndDerivative<T>

state at the end of the step

stopback to summary
public boolean stop()

Check if the integration should be stopped at the end of the current step.

Returns:boolean

true if the integration should be stopped