public class ContinuousOutputModel extends Object implements StepHandler, Serializable
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 setInterpolatedTime
and getInterpolatedState
to retrieve this
information at any time. It is important to wait for the
integration to be over before attempting to call setInterpolatedTime
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.
An important feature of this class is that it implements the
Serializable
interface. This means that the result of
an integration can be serialized and reused later (if stored into a
persistent medium like a filesystem or a database) or elsewhere (if
sent to another application). Only the result of the integration is
stored, there is no reference to the integrated problem by
itself.
One should be aware that the amount of data stored in a
ContinuousOutputModel 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
).
StepHandler
,
StepInterpolator
,
Serialized FormConstructor and Description 

ContinuousOutputModel()
Simple constructor.

Modifier and Type  Method and Description 

void 
append(ContinuousOutputModel model)
Append another model at the end of the instance.

double 
getFinalTime()
Get the final integration time.

double 
getInitialTime()
Get the initial integration time.

double[] 
getInterpolatedDerivatives()
Get the derivatives of the state vector of the interpolated point.

double[] 
getInterpolatedSecondaryDerivatives(int secondaryStateIndex)
Get the interpolated secondary derivatives corresponding to the secondary equations.

double[] 
getInterpolatedSecondaryState(int secondaryStateIndex)
Get the interpolated secondary state corresponding to the secondary equations.

double[] 
getInterpolatedState()
Get the state vector of the interpolated point.

double 
getInterpolatedTime()
Get the time of the interpolated point.

void 
handleStep(StepInterpolator interpolator,
boolean isLast)
Handle the last accepted step.

void 
init(double t0,
double[] y0,
double t)
Initialize step handler at the start of an ODE integration.

void 
setInterpolatedTime(double time)
Set the time of the interpolated point.

public ContinuousOutputModel()
public void append(ContinuousOutputModel model) throws MathIllegalArgumentException, MaxCountExceededException
model
 model to add at the end of the instanceMathIllegalArgumentException
 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 finalizationpublic void init(double t0, double[] y0, double t)
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.
init
in interface StepHandler
t0
 start value of the independent time variabley0
 array containing the start value of the state vectort
 target time for the integrationpublic void handleStep(StepInterpolator interpolator, boolean isLast) throws MaxCountExceededException
handleStep
in interface StepHandler
interpolator
 interpolator for the last accepted step.isLast
 true if the step is the last oneMaxCountExceededException
 if the number of functions evaluations is exceeded
during step finalizationpublic double getInitialTime()
public double getFinalTime()
public double getInterpolatedTime()
setInterpolatedTime(double)
has not been called, it returns
the final integration time.public void setInterpolatedTime(double time)
This method should not be called before the integration is over because some internal variables are set only once the last step has been handled.
Setting the time outside of the integration interval is now allowed, but should be used with care since the accuracy of the interpolator will probably be very poor far from this interval. This allowance has been added to simplify implementation of search algorithms near the interval endpoints.
Note that each time this method is called, the internal arrays
returned in getInterpolatedState()
, getInterpolatedDerivatives()
and getInterpolatedSecondaryState(int)
will be overwritten. So if their content must be preserved
across several calls, user must copy them.
time
 time of the interpolated pointgetInterpolatedState()
,
getInterpolatedDerivatives()
,
getInterpolatedSecondaryState(int)
public double[] getInterpolatedState() throws MaxCountExceededException
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.
getInterpolatedTime()
MaxCountExceededException
 if the number of functions evaluations is exceededsetInterpolatedTime(double)
,
getInterpolatedDerivatives()
,
getInterpolatedSecondaryState(int)
,
getInterpolatedSecondaryDerivatives(int)
public double[] getInterpolatedDerivatives() throws MaxCountExceededException
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.
getInterpolatedTime()
MaxCountExceededException
 if the number of functions evaluations is exceededsetInterpolatedTime(double)
,
getInterpolatedState()
,
getInterpolatedSecondaryState(int)
,
getInterpolatedSecondaryDerivatives(int)
public double[] getInterpolatedSecondaryState(int secondaryStateIndex) throws MaxCountExceededException
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.
secondaryStateIndex
 index of the secondary set, as returned by ExpandableStatefulODE.addSecondaryEquations(SecondaryEquations)
MaxCountExceededException
 if the number of functions evaluations is exceededsetInterpolatedTime(double)
,
getInterpolatedState()
,
getInterpolatedDerivatives()
,
getInterpolatedSecondaryDerivatives(int)
public double[] getInterpolatedSecondaryDerivatives(int secondaryStateIndex) throws MaxCountExceededException
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.
secondaryStateIndex
 index of the secondary set, as returned by ExpandableStatefulODE.addSecondaryEquations(SecondaryEquations)
MaxCountExceededException
 if the number of functions evaluations is exceededsetInterpolatedTime(double)
,
getInterpolatedState()
,
getInterpolatedDerivatives()
,
getInterpolatedSecondaryState(int)
Copyright © 2003–2015 The Apache Software Foundation. All rights reserved.