Class EventState

java.lang.Object
org.apache.commons.math.ode.events.EventState

public class EventState extends Object
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 (and hence the step should be reduced to ensure the event occurs at a bound rather than inside the step).

Since:
1.2
Version:
$Revision: 1073158 $ $Date: 2011-02-21 22:46:52 +0100 (lun. 21 févr. 2011) $
  • Constructor Details

    • EventState

      public EventState(EventHandler handler, double maxCheckInterval, double convergence, int maxIterationCount)
      Simple constructor.
      Parameters:
      handler - event handler
      maxCheckInterval - 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 search
      maxIterationCount - upper limit of the iteration count in the event time search
  • Method Details

    • getEventHandler

      public EventHandler 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 double 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(StepInterpolator interpolator) throws EventException
      Reinitialize the beginning of the step.
      Parameters:
      interpolator - valid for the current step
      Throws:
      EventException - if the event handler value cannot be evaluated at the beginning of the step
    • evaluateStep

      public boolean evaluateStep(StepInterpolator interpolator) throws DerivativeException, EventException, ConvergenceException
      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:
      DerivativeException - if the interpolator fails to compute the switching function somewhere within the step
      EventException - if the switching function cannot be evaluated
      ConvergenceException - if an event cannot be located
    • getEventTime

      public double 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 positive infinity if no events are triggered
    • stepAccepted

      public void stepAccepted(double t, double[] y) throws EventException
      Acknowledge the fact the step has been accepted by the integrator.
      Parameters:
      t - value of the independent time variable at the end of the step
      y - array containing the current value of the state vector at the end of the step
      Throws:
      EventException - if the value of the event handler cannot be evaluated
    • stop

      public boolean stop()
      Check if the integration should be stopped at the end of the current step.
      Returns:
      true if the integration should be stopped
    • reset

      public boolean reset(double t, double[] y) throws EventException
      Let the event handler reset the state if it wants.
      Parameters:
      t - value of the independent time variable at the beginning of the next step
      y - array were to put the desired state vector at the beginning of the next step
      Returns:
      true if the integrator should reset the derivatives too
      Throws:
      EventException - if the state cannot be reseted by the event handler