Class DenseOutputModel
- java.lang.Object
-
- org.hipparchus.ode.DenseOutputModel
-
- All Implemented Interfaces:
Serializable
,ODEStepHandler
- Direct Known Subclasses:
ContinuousOutputModel
public class DenseOutputModel extends Object implements ODEStepHandler, Serializable
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 callgetInterpolatedState
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
).- See Also:
ODEStepHandler
,ODEStateInterpolator
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DenseOutputModel()
Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(DenseOutputModel model)
Append another model at the end of the instance.double
getFinalTime()
Get the final integration time.double
getInitialTime()
Get the initial integration time.ODEStateAndDerivative
getInterpolatedState(double time)
Get the state at interpolated time.void
handleStep(ODEStateInterpolator interpolator, boolean isLast)
Handle the last accepted step.void
init(ODEStateAndDerivative initialState, double targetTime)
Initialize step handler at the start of an ODE integration.
-
-
-
Method Detail
-
append
public void append(DenseOutputModel model) throws MathIllegalArgumentException, MathIllegalStateException
Append another model at the end of the instance.- Parameters:
model
- model to add at the end of the instance- Throws:
MathIllegalArgumentException
- if the model to append is not compatible with the instance (dimension of the state vector, propagation direction, hole between the dates)MathIllegalStateException
- if the number of functions evaluations is exceeded during step finalization
-
init
public void init(ODEStateAndDerivative initialState, double targetTime)
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.
The default implementation does nothing
- Specified by:
init
in interfaceODEStepHandler
- Parameters:
initialState
- initial time, state vector and derivativetargetTime
- target time for the integration
-
handleStep
public void handleStep(ODEStateInterpolator interpolator, boolean isLast) throws MathIllegalStateException
Handle the last accepted step. A copy of the information provided by the last step is stored in the instance for later use.- Specified by:
handleStep
in interfaceODEStepHandler
- Parameters:
interpolator
- interpolator for the last accepted step.isLast
- true if the step is the last one- Throws:
MathIllegalStateException
- if the number of functions evaluations is exceeded during step finalization
-
getInitialTime
public double getInitialTime()
Get the initial integration time.- Returns:
- initial integration time
-
getFinalTime
public double getFinalTime()
Get the final integration time.- Returns:
- final integration time
-
getInterpolatedState
public ODEStateAndDerivative getInterpolatedState(double time)
Get the state at interpolated time.- Parameters:
time
- time of the interpolated point- Returns:
- state at interpolated time
-
-