Top Description Fields Constructors Methods
org.apache.commons.math3.ode

public Class ContinuousOutputFieldModel<T extends RealFieldElement<T>>

extends Object
implements FieldStepHandler<T extends RealFieldElement<T>>
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.ode.sampling.FieldStepHandler
Type Parameters
<T>
the type of the field elements
Imports
java.util.ArrayList, .List, org.apache.commons.math3.RealFieldElement, org.apache.commons.math3.exception.DimensionMismatchException, .MathIllegalArgumentException, .MaxCountExceededException, org.apache.commons.math3.exception.util.LocalizedFormats, org.apache.commons.math3.ode.sampling.FieldStepHandler, .FieldStepInterpolator, org.apache.commons.math3.util.FastMath

This class stores all information provided by an ODE integrator during the integration process and build a continuous model of the solution from this.

This class act as a step handler from the integrator point of view. It is called iteratively during the integration process and stores a copy of all steps information in a sorted collection for later use. Once the integration process is over, the user can use the getInterpolatedState method to retrieve this information at any time. It is important to wait for the integration to be over before attempting to call getInterpolatedState(RealFieldElement) because some internal variables are set only once the last step has been handled.

This is useful for example if the main loop of the user application should remain independent from the integration process or if one needs to mimic the behaviour of an analytical model despite a numerical model is used (i.e. one needs the ability to get the model value at any time or to navigate through the data).

If problem modeling is done with several separate integration phases for contiguous intervals, the same ContinuousOutputModel can be used as step handler for all integration phases as long as they are performed in order and in the same direction. As an example, one can extrapolate the trajectory of a satellite with one model (i.e. one set of differential equations) up to the beginning of a maneuver, use another more complex model including thrusters modeling and accurate attitude control during the maneuver, and revert to the first model after the end of the maneuver. If the same continuous output model handles the steps of all integration phases, the user do not need to bother when the maneuver begins or ends, he has all the data available in a transparent manner.

One should be aware that the amount of data stored in a ContinuousOutputFieldModel instance can be important if the state vector is large, if the integration interval is long or if the steps are small (which can result from small tolerance settings in adaptive step size integrators).

Since
3.6
See Also
FieldStepHandler, FieldStepInterpolator

Field Summary

Modifier and TypeField and Description
private T
finalTime

Final integration time.

private boolean
forward

Integration direction indicator.

private int
index

Current interpolator index.

private T
initialTime

Initial integration time.

private List<FieldStepInterpolator<T>>
steps

Steps table.

Constructor Summary

AccessConstructor and Description
public
ContinuousOutputFieldModel()

Simple constructor.

Method Summary

Modifier and TypeMethod and Description
public void
append(final ContinuousOutputFieldModel<T>
model to add at the end of the instance
model
)

Append another model at the end of the instance.

private void
checkDimensionsEquality(final int
first dimension
d1
,
final int
second dimansion
d2
)

Check dimensions equality.

public T

Returns:

final integration time
getFinalTime
()

Get the final integration time.

public T

Returns:

initial integration time
getInitialTime
()

Get the initial integration time.

public FieldODEStateAndDerivative<T>

Returns:

state at interpolated time
getInterpolatedState
(final T
time of the interpolated point
time
)

Get the state at interpolated time.

public void
handleStep(final FieldStepInterpolator<T>
interpolator for the last accepted step.
interpolator
,
final boolean
true if the step is the last one
isLast
)

Implements org.apache.commons.math3.ode.sampling.FieldStepHandler.handleStep.

Handle the last accepted step.

public void
init(final FieldODEStateAndDerivative<T>
initial time, state vector and derivative
initialState
,
final T
target time for the integration
t
)

Implements org.apache.commons.math3.ode.sampling.FieldStepHandler.init.

Initialize step handler at the start of an ODE integration.

private int

Returns:

-1 if the double is before the interval, 0 if it is in the interval, and +1 if it is after the interval, according to the interval direction
locatePoint
(final T
point to locate
time
,
final FieldStepInterpolator<T>
step interval
interval
)

Compare a step interval and a double.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

finalTimeback to summary
private T finalTime

Final integration time.

forwardback to summary
private boolean forward

Integration direction indicator.

indexback to summary
private int index

Current interpolator index.

initialTimeback to summary
private T initialTime

Initial integration time.

stepsback to summary
private List<FieldStepInterpolator<T>> steps

Steps table.

Constructor Detail

ContinuousOutputFieldModelback to summary
public ContinuousOutputFieldModel()

Simple constructor. Build an empty continuous output model.

Method Detail

appendback to summary
public void append(final ContinuousOutputFieldModel<T> model) throws MathIllegalArgumentException, MaxCountExceededException

Append another model at the end of the instance.

Parameters
model:ContinuousOutputFieldModel<T>

model to add at the end of the instance

Exceptions
MathIllegalArgumentException:
if the model to append is not compatible with the instance (dimension of the state vector, propagation direction, hole between the dates)
MaxCountExceededException:
if the number of functions evaluations is exceeded during step finalization
DimensionMismatchException:
if the dimensions of the states or the number of secondary states do not match
checkDimensionsEqualityback to summary
private void checkDimensionsEquality(final int d1, final int d2) throws DimensionMismatchException

Check dimensions equality.

Parameters
d1:int

first dimension

d2:int

second dimansion

Exceptions
DimensionMismatchException:
if dimensions do not match
getFinalTimeback to summary
public T getFinalTime()

Get the final integration time.

Returns:T

final integration time

getInitialTimeback to summary
public T getInitialTime()

Get the initial integration time.

Returns:T

initial integration time

getInterpolatedStateback to summary
public FieldODEStateAndDerivative<T> getInterpolatedState(final T time)

Get the state at interpolated time.

Parameters
time:T

time of the interpolated point

Returns:FieldODEStateAndDerivative<T>

state at interpolated time

handleStepback to summary
public void handleStep(final FieldStepInterpolator<T> interpolator, final boolean isLast) throws MaxCountExceededException

Implements org.apache.commons.math3.ode.sampling.FieldStepHandler.handleStep.

Handle the last accepted step. A copy of the information provided by the last step is stored in the instance for later use.

Parameters
interpolator:FieldStepInterpolator<T>

interpolator for the last accepted step.

isLast:boolean

true if the step is the last one

Exceptions
MaxCountExceededException:
if the number of functions evaluations is exceeded during step finalization
initback to summary
public void init(final FieldODEStateAndDerivative<T> initialState, final T t)

Implements org.apache.commons.math3.ode.sampling.FieldStepHandler.init.

Doc from org.apache.commons.math3.ode.sampling.FieldStepHandler.init.

Initialize step handler at the start of an ODE integration.

This method is called once at the start of the integration. It may be used by the step handler to initialize some internal data if needed.

Parameters
initialState:FieldODEStateAndDerivative<T>

initial time, state vector and derivative

t:T

target time for the integration

locatePointback to summary
private int locatePoint(final T time, final FieldStepInterpolator<T> interval)

Compare a step interval and a double.

Parameters
time:T

point to locate

interval:FieldStepInterpolator<T>

step interval

Returns:int

-1 if the double is before the interval, 0 if it is in the interval, and +1 if it is after the interval, according to the interval direction