Class StepsizeHelper

java.lang.Object
org.hipparchus.ode.nonstiff.StepsizeHelper

public class StepsizeHelper extends Object
Helper for adaptive stepsize control.
Since:
2.0
  • Constructor Details

    • StepsizeHelper

      public StepsizeHelper(double minStep, double maxStep, double scalAbsoluteTolerance, double scalRelativeTolerance)
      Simple constructor.
      Parameters:
      minStep - minimal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than this
      maxStep - maximal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than this
      scalAbsoluteTolerance - allowed absolute error
      scalRelativeTolerance - allowed relative error
    • StepsizeHelper

      public StepsizeHelper(double minStep, double maxStep, double[] vecAbsoluteTolerance, double[] vecRelativeTolerance)
      Simple constructor..
      Parameters:
      minStep - minimal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than this
      maxStep - maximal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than this
      vecAbsoluteTolerance - allowed absolute error
      vecRelativeTolerance - allowed relative error
  • Method Details

    • setMainSetDimension

      protected void setMainSetDimension(int mainSetDimension) throws MathIllegalArgumentException
      Set main set dimension.
      Parameters:
      mainSetDimension - dimension of the main set
      Throws:
      MathIllegalArgumentException - if adaptive step size integrators tolerance arrays dimensions are not compatible with equations settings
    • getMainSetDimension

      public int getMainSetDimension()
      Get the main set dimension.
      Returns:
      main set dimension
    • getRelativeTolerance

      public double getRelativeTolerance(int i)
      Get the relative tolerance for one component.
      Parameters:
      i - component to select
      Returns:
      relative tolerance for selected component
    • getTolerance

      public double getTolerance(int i, double scale)
      Get the tolerance for one component.
      Parameters:
      i - component to select
      scale - scale factor for relative tolerance (i.e. y[i])
      Returns:
      tolerance for selected component
    • getTolerance

      public <T extends CalculusFieldElement<T>> T getTolerance(int i, T scale)
      Get the tolerance for one component.
      Type Parameters:
      T - type of the field elements
      Parameters:
      i - component to select
      scale - scale factor for relative tolerance (i.e. y[i])
      Returns:
      tolerance for selected component
    • filterStep

      public double filterStep(double h, boolean forward, boolean acceptSmall) throws MathIllegalArgumentException
      Filter the integration step.
      Parameters:
      h - signed step
      forward - forward integration indicator
      acceptSmall - if true, steps smaller than the minimal value are silently increased up to this value, if false such small steps generate an exception
      Returns:
      a bounded integration step (h if no bound is reach, or a bounded value)
      Throws:
      MathIllegalArgumentException - if the step is too small and acceptSmall is false
    • filterStep

      public <T extends CalculusFieldElement<T>> T filterStep(T h, boolean forward, boolean acceptSmall) throws MathIllegalArgumentException
      Filter the integration step.
      Type Parameters:
      T - type of the field elements
      Parameters:
      h - signed step
      forward - forward integration indicator
      acceptSmall - if true, steps smaller than the minimal value are silently increased up to this value, if false such small steps generate an exception
      Returns:
      a bounded integration step (h if no bound is reach, or a bounded value)
      Throws:
      MathIllegalArgumentException - if the step is too small and acceptSmall is false
    • setInitialStepSize

      public void setInitialStepSize(double initialStepSize)
      Set the initial step size.

      This method allows the user to specify an initial positive step size instead of letting the integrator guess it by itself. If this method is not called before integration is started, the initial step size will be estimated by the integrator.

      Parameters:
      initialStepSize - initial step size to use (must be positive even for backward integration ; providing a negative value or a value outside of the min/max step interval will lead the integrator to ignore the value and compute the initial step size by itself)
    • getInitialStep

      public double getInitialStep()
      Get the initial step.
      Returns:
      initial step
    • getMinStep

      public double getMinStep()
      Get the minimal step.
      Returns:
      minimal step
    • getMaxStep

      public double getMaxStep()
      Get the maximal step.
      Returns:
      maximal step
    • getDummyStepsize

      public double getDummyStepsize()
      Get a dummy step size.
      Returns:
      geometric mean of getMinStep() and getMaxStep()