Package org.hipparchus.ode.nonstiff
Class StepsizeHelper
java.lang.Object
org.hipparchus.ode.nonstiff.StepsizeHelper
Helper for adaptive stepsize control.
- Since:
- 2.0
-
Constructor Summary
ConstructorDescriptionStepsizeHelper
(double minStep, double maxStep, double[] vecAbsoluteTolerance, double[] vecRelativeTolerance) Simple constructor..StepsizeHelper
(double minStep, double maxStep, double scalAbsoluteTolerance, double scalRelativeTolerance) Simple constructor. -
Method Summary
Modifier and TypeMethodDescriptiondouble
filterStep
(double h, boolean forward, boolean acceptSmall) Filter the integration step.<T extends CalculusFieldElement<T>>
TfilterStep
(T h, boolean forward, boolean acceptSmall) Filter the integration step.double
Get a dummy step size.double
Get the initial step.int
Get the main set dimension.double
Get the maximal step.double
Get the minimal step.double
getRelativeTolerance
(int i) Get the relative tolerance for one component.double
getTolerance
(int i, double scale) Get the tolerance for one component.<T extends CalculusFieldElement<T>>
TgetTolerance
(int i, T scale) Get the tolerance for one component.void
setInitialStepSize
(double initialStepSize) Set the initial step size.protected void
setMainSetDimension
(int mainSetDimension) Set main set dimension.
-
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 thismaxStep
- maximal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than thisscalAbsoluteTolerance
- allowed absolute errorscalRelativeTolerance
- 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 thismaxStep
- maximal step (sign is irrelevant, regardless of integration direction, forward or backward), the last step can be smaller than thisvecAbsoluteTolerance
- allowed absolute errorvecRelativeTolerance
- allowed relative error
-
-
Method Details
-
setMainSetDimension
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 selectscale
- scale factor for relative tolerance (i.e. y[i])- Returns:
- tolerance for selected component
-
getTolerance
Get the tolerance for one component.- Type Parameters:
T
- type of the field elements- Parameters:
i
- component to selectscale
- 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 stepforward
- forward integration indicatoracceptSmall
- 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 stepforward
- forward integration indicatoracceptSmall
- 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()
andgetMaxStep()
-