The various ODE integrators provide objects extending this class to the step handlers. The handlers can use these objects to retrieve the state vector at intermediate times between the previous and the current grid points (dense output).
org.apache.commons.math3.ode.FirstOrderIntegrator , org.apache.commons.math3.ode.SecondOrderIntegrator , StepHandler
| Modifier and Type | Field and Description |
|---|---|
| protected double[] | currentState
current state |
| private boolean | dirtyState
indicator for dirty state. |
| private boolean | finalized
indicate if the step has been finalized or not. |
| private boolean | forward
integration direction. |
| private double | globalCurrentTime
global current time |
| private double | globalPreviousTime
global previous time |
| protected double | h
current time step |
| protected double[] | interpolatedDerivatives
interpolated derivatives |
| protected double[] | interpolatedPrimaryDerivatives
interpolated primary derivatives |
| protected double[] | interpolatedPrimaryState
interpolated primary state |
| protected double[][] | interpolatedSecondaryDerivatives
interpolated secondary derivatives |
| protected double[][] | interpolatedSecondaryState
interpolated secondary state |
| protected double[] | interpolatedState
interpolated state |
| protected double | interpolatedTime
interpolated time |
| private EquationsMapper | primaryMapper
Equations mapper for the primary equations set. |
| private EquationsMapper[] | secondaryMappers
Equations mappers for the secondary equations sets. |
| private double | softCurrentTime
soft current time |
| private double | softPreviousTime
soft previous time |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | AbstractStepInterpolator(final double[]
reference to the integrator array holding the state at
the end of the step y, final boolean integration direction indicator forward, final EquationsMapper equations mapper for the primary equations set primaryMapper, final EquationsMapper[] equations mappers for the secondary equations sets secondaryMappers)Simple constructor. |
| protected | AbstractStepInterpolator(final AbstractStepInterpolator
interpolator to copy from. interpolator)Copy constructor. |
| Modifier and Type | Method and Description |
|---|---|
| private void | allocateInterpolatedArrays(final int
total dimension (negative if arrays should be set to null) dimension)Allocate the various interpolated states arrays. |
| protected abstract void | computeInterpolatedStateAndDerivatives(double
normalized interpolation abscissa within the step
(theta is zero at the previous time step and one at the current time step) theta, double time gap between the interpolated time and
the current time oneMinusThetaH)Compute the state and derivatives at the interpolated time. |
| public StepInterpolator | |
| protected abstract StepInterpolator | |
| protected void | |
| private void | |
| public final void | |
| public double | Returns: current soft grid point timeImplements org. Get the current soft grid point time. |
| public double | Returns: current global grid point timeGet the current global grid point time. |
| public double | Returns: previous global grid point timeGet the previous global grid point time. |
| public double[] | getInterpolatedDerivatives()
Implements org. Get the derivatives of the state vector of the interpolated point. |
| public double[] | getInterpolatedSecondaryDerivatives(final int
index of the secondary set, as returned by index)ExpandableStatefulODE.Implements org. Get the interpolated secondary derivatives corresponding to the secondary equations. |
| public double[] | getInterpolatedSecondaryState(final int
index of the secondary set, as returned by index)ExpandableStatefulODE.Implements org. Get the interpolated secondary state corresponding to the secondary equations. |
| public double[] | getInterpolatedState()
Implements org. Get the state vector of the interpolated point. |
| public double | getInterpolatedTime()
Implements org. Get the time of the interpolated point. |
| public double | Returns: previous soft grid point timeImplements org. Get the previous soft grid point time. |
| public boolean | isForward()
Implements org. Check if the natural integration direction is forward. |
| protected double | Returns: interpolated time to be set later by the callerstream where to read the state from in)Read the base state of the instance. |
| public abstract void | readExternal(ObjectInput
the stream to read data from in order to restore the object in)Redeclares java. The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. |
| protected void | reinitialize(final double[]
reference to the integrator array holding the state at the end of the step y, final boolean integration direction indicator isForward, final EquationsMapper equations mapper for the primary equations set primary, final EquationsMapper[] equations mappers for the secondary equations sets secondary)Reinitialize the instance |
| public void | setInterpolatedTime(final double
time of the interpolated point time)Implements org. Set the time of the interpolated point. |
| public void | setSoftCurrentTime(final double
end of the restricted step softCurrentTime)Restrict step range to a limited part of the global step. |
| public void | setSoftPreviousTime(final double
start of the restricted step softPreviousTime)Restrict step range to a limited part of the global step. |
| public void | |
| public void | |
| protected void | writeBaseExternal(final ObjectOutput
stream where to save the state out)Save the base state of the instance. |
| public abstract void | writeExternal(ObjectOutput
the stream to write the object to out)Redeclares java. The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays. |
| currentState | back to summary |
|---|---|
| protected double[] currentState current state | |
| dirtyState | back to summary |
|---|---|
| private boolean dirtyState indicator for dirty state. | |
| finalized | back to summary |
|---|---|
| private boolean finalized indicate if the step has been finalized or not. | |
| forward | back to summary |
|---|---|
| private boolean forward integration direction. | |
| globalCurrentTime | back to summary |
|---|---|
| private double globalCurrentTime global current time | |
| globalPreviousTime | back to summary |
|---|---|
| private double globalPreviousTime global previous time | |
| h | back to summary |
|---|---|
| protected double h current time step | |
| interpolatedDerivatives | back to summary |
|---|---|
| protected double[] interpolatedDerivatives interpolated derivatives | |
| interpolatedPrimaryDerivatives | back to summary |
|---|---|
| protected double[] interpolatedPrimaryDerivatives interpolated primary derivatives | |
| interpolatedPrimaryState | back to summary |
|---|---|
| protected double[] interpolatedPrimaryState interpolated primary state | |
| interpolatedSecondaryDerivatives | back to summary |
|---|---|
| protected double[][] interpolatedSecondaryDerivatives interpolated secondary derivatives | |
| interpolatedSecondaryState | back to summary |
|---|---|
| protected double[][] interpolatedSecondaryState interpolated secondary state | |
| interpolatedState | back to summary |
|---|---|
| protected double[] interpolatedState interpolated state | |
| interpolatedTime | back to summary |
|---|---|
| protected double interpolatedTime interpolated time | |
| primaryMapper | back to summary |
|---|---|
| private EquationsMapper primaryMapper Equations mapper for the primary equations set. | |
| secondaryMappers | back to summary |
|---|---|
| private EquationsMapper[] secondaryMappers Equations mappers for the secondary equations sets. | |
| softCurrentTime | back to summary |
|---|---|
| private double softCurrentTime soft current time | |
| softPreviousTime | back to summary |
|---|---|
| private double softPreviousTime soft previous time | |
| AbstractStepInterpolator | back to summary |
|---|---|
| protected AbstractStepInterpolator() Simple constructor.
This constructor builds an instance that is not usable yet, the
| |
| AbstractStepInterpolator | back to summary |
|---|---|
| protected AbstractStepInterpolator(final double[] y, final boolean forward, final EquationsMapper primaryMapper, final EquationsMapper[] secondaryMappers) Simple constructor.
| |
| AbstractStepInterpolator | back to summary |
|---|---|
| protected AbstractStepInterpolator(final AbstractStepInterpolator interpolator) Copy constructor. The copied interpolator should have been finalized before the
copy, otherwise the copy will not be able to perform correctly
any derivative computation and will throw a The copy is a deep copy: its arrays are separated from the original arrays of the instance.
| |
| allocateInterpolatedArrays | back to summary |
|---|---|
| private void allocateInterpolatedArrays(final int dimension) Allocate the various interpolated states arrays.
| |
| computeInterpolatedStateAndDerivatives | back to summary |
|---|---|
| protected abstract void computeInterpolatedStateAndDerivatives(double theta, double oneMinusThetaH) throws MaxCountExceededException Compute the state and derivatives at the interpolated time. This is the main processing method that should be implemented by the derived classes to perform the interpolation.
| |
| copy | back to summary |
|---|---|
| public StepInterpolator copy() throws MaxCountExceededException Implements org. Doc from org. 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.
| |
| doCopy | back to summary |
|---|---|
| protected abstract StepInterpolator doCopy() Really copy the finalized instance. This method is called by
| |
| doFinalize | back to summary |
|---|---|
| protected void doFinalize() throws MaxCountExceededException Really finalize the step. The default implementation of this method does nothing.
| |
| evaluateCompleteInterpolatedState | back to summary |
|---|---|
| private void evaluateCompleteInterpolatedState() throws MaxCountExceededException Lazy evaluation of complete interpolated state.
| |
| finalizeStep | back to summary |
|---|---|
| public final void finalizeStep() throws MaxCountExceededException Finalize the step. Some embedded Runge-Kutta integrators need fewer functions
evaluations than their counterpart step interpolators. These
interpolators should perform the last evaluations they need by
themselves only if they need them. This method triggers these
extra evaluations. It can be called directly by the user step
handler and it is called automatically if Once this method has been called, no other evaluation will be performed on this step. If there is a need to have some side effects between the step handler and the differential equations (for example update some data in the equations once the step has been done), it is advised to call this method explicitly from the step handler before these side effects are set up. If the step handler induces no side effect, then this method can safely be ignored, it will be called transparently as needed. Warning since the step interpolator provided
to the step handler as a parameter of the This method calls the protected
| |
| getCurrentTime | back to summary |
|---|---|
| public double getCurrentTime() Implements org. Get the current soft grid point time.
| |
| getGlobalCurrentTime | back to summary |
|---|---|
| public double getGlobalCurrentTime() Get the current global grid point time.
| |
| getGlobalPreviousTime | back to summary |
|---|---|
| public double getGlobalPreviousTime() Get the previous global grid point time.
| |
| getInterpolatedDerivatives | back to summary |
|---|---|
| public double[] getInterpolatedDerivatives() throws MaxCountExceededException Implements org. Doc from org. 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
| |
| getInterpolatedSecondaryDerivatives | back to summary |
|---|---|
| public double[] getInterpolatedSecondaryDerivatives(final int index) throws MaxCountExceededException Implements org. Doc from org. 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.
| |
| getInterpolatedSecondaryState | back to summary |
|---|---|
| public double[] getInterpolatedSecondaryState(final int index) throws MaxCountExceededException Implements org. Doc from org. 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
| |
| getInterpolatedState | back to summary |
|---|---|
| public double[] getInterpolatedState() throws MaxCountExceededException Implements org. Doc from org. 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
| |
| getInterpolatedTime | back to summary |
|---|---|
| public double getInterpolatedTime() Implements org. Doc from org. Get the time of the interpolated point.
If
| |
| getPreviousTime | back to summary |
|---|---|
| public double getPreviousTime() Implements org. Get the previous soft grid point time.
| |
| isForward | back to summary |
|---|---|
| public boolean isForward() Implements org. Doc from org. 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.
| |
| readBaseExternal | back to summary |
|---|---|
| protected double readBaseExternal(final ObjectInput in) throws IOException, ClassNotFoundException Read the base state of the instance.
This method does neither set the interpolated
time nor state. It is up to the derived class to reset it
properly calling the
| |
| readExternal | back to summary |
|---|---|
| public abstract void readExternal(ObjectInput in) throws IOException, ClassNotFoundException Redeclares java. Doc from java. The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.
| |
| reinitialize | back to summary |
|---|---|
| protected void reinitialize(final double[] y, final boolean isForward, final EquationsMapper primary, final EquationsMapper[] secondary) Reinitialize the instance
| |
| setInterpolatedTime | back to summary |
|---|---|
| public void setInterpolatedTime(final double time) Implements org. Doc from org. 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
| |
| setSoftCurrentTime | back to summary |
|---|---|
| public void setSoftCurrentTime(final double softCurrentTime) Restrict step range to a limited part of the global step.
This method can be used to restrict a step and make it appear
as if the original step was smaller. Calling this method
only changes the value returned by
| |
| setSoftPreviousTime | back to summary |
|---|---|
| public void setSoftPreviousTime(final double softPreviousTime) Restrict step range to a limited part of the global step.
This method can be used to restrict a step and make it appear
as if the original step was smaller. Calling this method
only changes the value returned by
| |
| shift | back to summary |
|---|---|
| public void shift() Shift one step forward.
Copy the current time into the previous time, hence preparing the
interpolator for future calls to | |
| storeTime | back to summary |
|---|---|
| public void storeTime(final double t) Store the current step time.
| |
| writeBaseExternal | back to summary |
|---|---|
| protected void writeBaseExternal(final ObjectOutput out) throws IOException Save the base state of the instance. This method performs step finalization if it has not been done before.
| |
| writeExternal | back to summary |
|---|---|
| public abstract void writeExternal(ObjectOutput out) throws IOException Redeclares java. Doc from java. The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
| |