Top Description Methods
org.apache.commons.math3.ode.sampling

public Interface StepInterpolator

extends Externalizable
Known Direct Implementers
org.apache.commons.math3.ode.sampling.AbstractStepInterpolator
Imports
java.io.Externalizable, org.apache.commons.math3.exception.MaxCountExceededException

This interface represents an interpolator over the last step during an ODE integration.

The various ODE integrators provide objects implementing this interface to the step handlers. These objects are often custom objects tightly bound to the integrator internal algorithms. The handlers can use these objects to retrieve the state vector at intermediate times between the previous and the current grid points (this feature is often called dense output).

One important thing to note is that the step handlers may be so tightly bound to the integrators that they often share some internal state arrays. This imply that one should never use a direct reference to a step interpolator outside of the step handler, either for future use or for use in another thread. If such a need arise, the step interpolator must be copied using the dedicated copy() method.

Since
1.2
See Also
org.apache.commons.math3.ode.FirstOrderIntegrator, org.apache.commons.math3.ode.SecondOrderIntegrator, StepHandler

Method Summary

Modifier and TypeMethod and Description
public StepInterpolator

Returns:

a deep copy of the instance, which can be used independently.
copy
()

Copy the instance.

public double

Returns:

current grid point time
getCurrentTime
()

Get the current grid point time.

public double[]

Returns:

derivatives of the state vector at time getInterpolatedTime
getInterpolatedDerivatives
()

Get the derivatives of the state vector of the interpolated point.

public double[]

Returns:

interpolated secondary derivatives at the current interpolation date
getInterpolatedSecondaryDerivatives
(int
index of the secondary set, as returned by ExpandableStatefulODE.addSecondaryEquations(SecondaryEquations)
index
)

Get the interpolated secondary derivatives corresponding to the secondary equations.

public double[]

Returns:

interpolated secondary state at the current interpolation date
getInterpolatedSecondaryState
(int
index of the secondary set, as returned by ExpandableStatefulODE.addSecondaryEquations(SecondaryEquations)
index
)

Get the interpolated secondary state corresponding to the secondary equations.

public double[]

Returns:

state vector at time getInterpolatedTime
getInterpolatedState
()

Get the state vector of the interpolated point.

public double

Returns:

interpolation point time
getInterpolatedTime
()

Get the time of the interpolated point.

public double

Returns:

previous grid point time
getPreviousTime
()

Get the previous grid point time.

public boolean

Returns:

true if the integration variable (time) increases during integration
isForward
()

Check if the natural integration direction is forward.

public void
setInterpolatedTime(double
time of the interpolated point
time
)

Set the time of the interpolated point.

Inherited from java.io.Externalizable:
readExternalwriteExternal

Method Detail

copyback to summary
public StepInterpolator copy() throws MaxCountExceededException

Copy the instance.

The copied instance is guaranteed to be independent from the original one. Both can be used with different settings for interpolated time without any side effect.

Returns:StepInterpolator

a deep copy of the instance, which can be used independently.

Exceptions
MaxCountExceededException:
if the number of functions evaluations is exceeded during step finalization
See Also
setInterpolatedTime(double)
getCurrentTimeback to summary
public double getCurrentTime()

Get the current grid point time.

Returns:double

current grid point time

getInterpolatedDerivativesback to summary
public double[] getInterpolatedDerivatives() throws MaxCountExceededException

Get the derivatives of the state vector of the interpolated point.

The returned vector is a reference to a reused array, so it should not be modified and it should be copied if it needs to be preserved across several calls to the associated setInterpolatedTime(double) method.

Returns:double[]

derivatives of the state vector at time getInterpolatedTime

Exceptions
MaxCountExceededException:
if the number of functions evaluations is exceeded
Since
2.0
See Also
getInterpolatedState(), getInterpolatedSecondaryState(int), getInterpolatedSecondaryDerivatives(int), setInterpolatedTime(double)
getInterpolatedSecondaryDerivativesback to summary
public double[] getInterpolatedSecondaryDerivatives(int index) throws MaxCountExceededException

Get the interpolated secondary derivatives corresponding to the secondary equations.

The returned vector is a reference to a reused array, so it should not be modified and it should be copied if it needs to be preserved across several calls.

Parameters
index:int

index of the secondary set, as returned by ExpandableStatefulODE.addSecondaryEquations(SecondaryEquations)

Returns:double[]

interpolated secondary derivatives at the current interpolation date

Exceptions
MaxCountExceededException:
if the number of functions evaluations is exceeded
Since
3.0
See Also
getInterpolatedState(), getInterpolatedDerivatives(), getInterpolatedSecondaryState(int), setInterpolatedTime(double)
getInterpolatedSecondaryStateback to summary
public double[] getInterpolatedSecondaryState(int index) throws MaxCountExceededException

Get the interpolated secondary state corresponding to the secondary equations.

The returned vector is a reference to a reused array, so it should not be modified and it should be copied if it needs to be preserved across several calls to the associated setInterpolatedTime(double) method.

Parameters
index:int

index of the secondary set, as returned by ExpandableStatefulODE.addSecondaryEquations(SecondaryEquations)

Returns:double[]

interpolated secondary state at the current interpolation date

Exceptions
MaxCountExceededException:
if the number of functions evaluations is exceeded
Since
3.0
See Also
getInterpolatedState(), getInterpolatedDerivatives(), getInterpolatedSecondaryDerivatives(int), setInterpolatedTime(double)
getInterpolatedStateback to summary
public double[] getInterpolatedState() throws MaxCountExceededException

Get the state vector of the interpolated point.

The returned vector is a reference to a reused array, so it should not be modified and it should be copied if it needs to be preserved across several calls to the associated setInterpolatedTime(double) method.

Returns:double[]

state vector at time getInterpolatedTime

Exceptions
MaxCountExceededException:
if the number of functions evaluations is exceeded
See Also
getInterpolatedDerivatives(), getInterpolatedSecondaryState(int), getInterpolatedSecondaryDerivatives(int), setInterpolatedTime(double)
getInterpolatedTimeback to summary
public double getInterpolatedTime()

Get the time of the interpolated point. If setInterpolatedTime has not been called, it returns the current grid point time.

Returns:double

interpolation point time

getPreviousTimeback to summary
public double getPreviousTime()

Get the previous grid point time.

Returns:double

previous grid point time

isForwardback to summary
public boolean isForward()

Check if the natural integration direction is forward.

This method provides the integration direction as specified by the integrator itself, it avoid some nasty problems in degenerated cases like null steps due to cancellation at step initialization, step control or discrete events triggering.

Returns:boolean

true if the integration variable (time) increases during integration

setInterpolatedTimeback to summary
public void setInterpolatedTime(double time)

Set the time of the interpolated point.

Setting the time outside of the current step is now allowed, but should be used with care since the accuracy of the interpolator will probably be very poor far from this step. This allowance has been added to simplify implementation of search algorithms near the step endpoints.

Setting the time changes the instance internal state. This includes the internal arrays returned in getInterpolatedState(), getInterpolatedDerivatives(), getInterpolatedSecondaryState(int) and getInterpolatedSecondaryDerivatives(int). So if their content must be preserved across several calls, user must copy them.

Parameters
time:double

time of the interpolated point

See Also
getInterpolatedState(), getInterpolatedDerivatives(), getInterpolatedSecondaryState(int), getInterpolatedSecondaryDerivatives(int)