public class EventState extends Object implements EventHandlerConfiguration
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.
Modifier and Type | Class and Description |
---|---|
static class |
EventState.EventOccurrence
Class to hold the data related to an event occurrence that is needed to decide how
to modify integration.
|
Constructor and Description |
---|
EventState(ODEEventHandler handler,
double maxCheckInterval,
double convergence,
int maxIterationCount,
BracketedUnivariateSolver<UnivariateFunction> solver)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
EventState.EventOccurrence |
doEvent(ODEStateAndDerivative state)
Notify the user's listener of the event.
|
boolean |
evaluateStep(ODEStateInterpolator interpolator)
Evaluate the impact of the proposed step on the event handler.
|
double |
getConvergence()
Get the convergence threshold for event localization.
|
ODEEventHandler |
getEventHandler()
Get the underlying event handler.
|
double |
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.
|
BracketedUnivariateSolver<UnivariateFunction> |
getSolver()
Get the root-finding algorithm to use to detect state events.
|
void |
reinitializeBegin(ODEStateInterpolator interpolator)
Reinitialize the beginning of the step.
|
boolean |
tryAdvance(ODEStateAndDerivative state,
ODEStateInterpolator interpolator)
Try to accept the current history up to the given time.
|
public EventState(ODEEventHandler handler, double maxCheckInterval, double convergence, int maxIterationCount, BracketedUnivariateSolver<UnivariateFunction> solver)
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 eventspublic ODEEventHandler getEventHandler()
getEventHandler
in interface EventHandlerConfiguration
public double getMaxCheckInterval()
getMaxCheckInterval
in interface EventHandlerConfiguration
public double getConvergence()
getConvergence
in interface EventHandlerConfiguration
public int getMaxIterationCount()
getMaxIterationCount
in interface EventHandlerConfiguration
public BracketedUnivariateSolver<UnivariateFunction> getSolver()
getSolver
in interface EventHandlerConfiguration
public void reinitializeBegin(ODEStateInterpolator interpolator) throws MathIllegalStateException
interpolator
- valid for the current stepMathIllegalStateException
- if the interpolator throws one because
the number of functions evaluations is exceededpublic boolean evaluateStep(ODEStateInterpolator interpolator) throws MathIllegalArgumentException, MathIllegalStateException
interpolator
- step interpolator for the proposed stepMathIllegalStateException
- if the interpolator throws one because the
number of functions evaluations is exceededMathIllegalArgumentException
- if the event cannot be bracketedpublic double getEventTime()
public boolean tryAdvance(ODEStateAndDerivative state, ODEStateInterpolator interpolator)
It is not necessary to call this method before calling doEvent(ODEStateAndDerivative)
with the same state. It is necessary to call this
method before you call doEvent(ODEStateAndDerivative)
on some other event
detector.
state
- to try to accept.interpolator
- to use to find the new root, if any.state
. In other words false
means continue
on while true
means stop and handle my event first.public EventState.EventOccurrence doEvent(ODEStateAndDerivative state)
ODEEventHandler.resetState(ODEStateAndDerivative)
if necessary.state
- the state at the time of the event. This must be at the same time as
the current value of getEventTime()
.Action.RESET_STATE
. Otherwise the new state is state
. The stop time
indicates what time propagation should stop if the action is Action.STOP
.
This guarantees the integration will stop on or after the root, so that integration
may be restarted safely.Copyright © 2016-2021 CS GROUP. All rights reserved.