public class EventState
extends java.lang.Object
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 |
---|---|
private static class |
EventState.LocalMaxCountExceededException
Local wrapper to propagate exceptions.
|
Modifier and Type | Field and Description |
---|---|
private double |
convergence
Convergence threshold for event localization.
|
private ExpandableStatefulODE |
expandable
Equation being integrated.
|
private boolean |
forward
Integration direction.
|
private double |
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 EventHandler |
handler
Event handler.
|
private boolean |
increasing
Variation direction around pending event.
|
private double |
maxCheckInterval
Maximal time interval between events handler checks.
|
private int |
maxIterationCount
Upper limit in the iteration count for event localization.
|
private EventHandler.Action |
nextAction
Next action indicator.
|
private boolean |
pendingEvent
Indicator of event expected during the step.
|
private double |
pendingEventTime
Occurrence time of the pending event.
|
private double |
previousEventTime
Occurrence time of the previous event.
|
private UnivariateSolver |
solver
Root-finding algorithm to use to detect state events.
|
private double |
t0
Time at the beginning of the step.
|
Constructor and Description |
---|
EventState(EventHandler handler,
double maxCheckInterval,
double convergence,
int maxIterationCount,
UnivariateSolver solver)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
evaluateStep(StepInterpolator interpolator)
Evaluate the impact of the proposed step on the event handler.
|
private double[] |
getCompleteState(StepInterpolator interpolator)
Get the complete state (primary and secondary).
|
double |
getConvergence()
Get the convergence threshold for event localization.
|
EventHandler |
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.
|
void |
reinitializeBegin(StepInterpolator interpolator)
Reinitialize the beginning of the step.
|
boolean |
reset(double t,
double[] y)
Let the event handler reset the state if it wants.
|
void |
setExpandable(ExpandableStatefulODE expandable)
Set the equation.
|
void |
stepAccepted(double t,
double[] y)
Acknowledge the fact the step has been accepted by the integrator.
|
boolean |
stop()
Check if the integration should be stopped at the end of the
current step.
|
private final EventHandler handler
private final double maxCheckInterval
private final double convergence
private final int maxIterationCount
private ExpandableStatefulODE expandable
private double t0
private double g0
private boolean g0Positive
private boolean pendingEvent
private double pendingEventTime
private double previousEventTime
private boolean forward
private boolean increasing
private EventHandler.Action nextAction
private final UnivariateSolver solver
public EventState(EventHandler handler, double maxCheckInterval, double convergence, int maxIterationCount, UnivariateSolver 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 EventHandler getEventHandler()
public void setExpandable(ExpandableStatefulODE expandable)
expandable
- equation being integratedpublic double getMaxCheckInterval()
public double getConvergence()
public int getMaxIterationCount()
public void reinitializeBegin(StepInterpolator interpolator) throws MaxCountExceededException
interpolator
- valid for the current stepMaxCountExceededException
- if the interpolator throws one because
the number of functions evaluations is exceededprivate double[] getCompleteState(StepInterpolator interpolator)
interpolator
- interpolator to usepublic boolean evaluateStep(StepInterpolator interpolator) throws MaxCountExceededException, NoBracketingException
interpolator
- step interpolator for the proposed stepMaxCountExceededException
- if the interpolator throws one because
the number of functions evaluations is exceededNoBracketingException
- if the event cannot be bracketedpublic double getEventTime()
public void stepAccepted(double t, double[] y)
t
- value of the independent time variable at the
end of the stepy
- array containing the current value of the state vector
at the end of the steppublic boolean stop()
public boolean reset(double t, double[] y)
t
- value of the independent time variable at the
beginning of the next stepy
- array were to put the desired state vector at the beginning
of the next stepCopyright (c) 2003-2014 Apache Software Foundation