Class AbstractODEStateInterpolator
- java.lang.Object
-
- org.hipparchus.ode.sampling.AbstractODEStateInterpolator
-
- All Implemented Interfaces:
Serializable,ODEStateInterpolator
- Direct Known Subclasses:
AdamsStateInterpolator,GraggBulirschStoerStateInterpolator,RungeKuttaStateInterpolator
public abstract class AbstractODEStateInterpolator extends Object implements ODEStateInterpolator
This abstract class represents an interpolator over the last step during an ODE integration.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).
- See Also:
ODEIntegrator,ODEStepHandler, Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractODEStateInterpolator(boolean isForward, ODEStateAndDerivative globalPreviousState, ODEStateAndDerivative globalCurrentState, ODEStateAndDerivative softPreviousState, ODEStateAndDerivative softCurrentState, EquationsMapper equationsMapper)Simple constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ODEStateAndDerivativecomputeInterpolatedStateAndDerivatives(EquationsMapper equationsMapper, double time, double theta, double thetaH, double oneMinusThetaH)Compute the state and derivatives at the interpolated time.protected abstract AbstractODEStateInterpolatorcreate(boolean newForward, ODEStateAndDerivative newGlobalPreviousState, ODEStateAndDerivative newGlobalCurrentState, ODEStateAndDerivative newSoftPreviousState, ODEStateAndDerivative newSoftCurrentState, EquationsMapper newMapper)Create a new instance.ODEStateAndDerivativegetCurrentState()Get the state at current grid point time.ODEStateAndDerivativegetGlobalCurrentState()Get the current global grid point state.ODEStateAndDerivativegetGlobalPreviousState()Get the previous global grid point state.ODEStateAndDerivativegetInterpolatedState(double time)Get the state at interpolated time.protected EquationsMappergetMapper()Get the mapper for ODE equations primary and secondary components.ODEStateAndDerivativegetPreviousState()Get the state at previous grid point time.booleanisCurrentStateInterpolated()Determines if thecurrent stateis computed directly by the integrator, or if it is calculated usinginterpolation.booleanisForward()Check if the natural integration direction is forward.booleanisPreviousStateInterpolated()Determines if theprevious stateis computed directly by the integrator, or if it is calculated usinginterpolation.AbstractODEStateInterpolatorrestrictStep(ODEStateAndDerivative previousState, ODEStateAndDerivative currentState)Create a new restricted version of the instance.
-
-
-
Constructor Detail
-
AbstractODEStateInterpolator
protected AbstractODEStateInterpolator(boolean isForward, ODEStateAndDerivative globalPreviousState, ODEStateAndDerivative globalCurrentState, ODEStateAndDerivative softPreviousState, ODEStateAndDerivative softCurrentState, EquationsMapper equationsMapper)Simple constructor.- Parameters:
isForward- integration direction indicatorglobalPreviousState- start of the global stepglobalCurrentState- end of the global stepsoftPreviousState- start of the restricted stepsoftCurrentState- end of the restricted stepequationsMapper- mapper for ODE equations primary and secondary components
-
-
Method Detail
-
restrictStep
public AbstractODEStateInterpolator restrictStep(ODEStateAndDerivative previousState, ODEStateAndDerivative currentState)
Create a new restricted version of the instance.The instance is not changed at all.
- Specified by:
restrictStepin interfaceODEStateInterpolator- Parameters:
previousState- start of the restricted stepcurrentState- end of the restricted step- Returns:
- restricted version of the instance
- See Also:
ODEStateInterpolator.getPreviousState(),ODEStateInterpolator.getCurrentState()
-
create
protected abstract AbstractODEStateInterpolator create(boolean newForward, ODEStateAndDerivative newGlobalPreviousState, ODEStateAndDerivative newGlobalCurrentState, ODEStateAndDerivative newSoftPreviousState, ODEStateAndDerivative newSoftCurrentState, EquationsMapper newMapper)
Create a new instance.- Parameters:
newForward- integration direction indicatornewGlobalPreviousState- start of the global stepnewGlobalCurrentState- end of the global stepnewSoftPreviousState- start of the restricted stepnewSoftCurrentState- end of the restricted stepnewMapper- equations mapper for the all equations- Returns:
- a new instance
-
getGlobalPreviousState
public ODEStateAndDerivative getGlobalPreviousState()
Get the previous global grid point state.- Returns:
- previous global grid point state
-
getGlobalCurrentState
public ODEStateAndDerivative getGlobalCurrentState()
Get the current global grid point state.- Returns:
- current global grid point state
-
getPreviousState
public ODEStateAndDerivative getPreviousState()
Get the state at previous grid point time.- Specified by:
getPreviousStatein interfaceODEStateInterpolator- Returns:
- state at previous grid point time
-
isPreviousStateInterpolated
public boolean isPreviousStateInterpolated()
Determines if theprevious stateis computed directly by the integrator, or if it is calculated usinginterpolation.Typically the previous state is directly computed by the integrator, but when events are detected the steps are shortened so that events occur on step boundaries which means the previous state may be computed by the interpolator.
- Specified by:
isPreviousStateInterpolatedin interfaceODEStateInterpolator- Returns:
trueif the previous state was calculated by the interpolator and false if it was computed directly by the integrator.
-
getCurrentState
public ODEStateAndDerivative getCurrentState()
Get the state at current grid point time.- Specified by:
getCurrentStatein interfaceODEStateInterpolator- Returns:
- state at current grid point time
-
isCurrentStateInterpolated
public boolean isCurrentStateInterpolated()
Determines if thecurrent stateis computed directly by the integrator, or if it is calculated usinginterpolation.Typically the current state is directly computed by the integrator, but when events are detected the steps are shortened so that events occur on step boundaries which means the current state may be computed by the interpolator.
- Specified by:
isCurrentStateInterpolatedin interfaceODEStateInterpolator- Returns:
trueif the current state was calculated by the interpolator and false if it was computed directly by the integrator.
-
getInterpolatedState
public ODEStateAndDerivative getInterpolatedState(double time)
Get the state at interpolated time.Setting the time outside of the current step is 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.
- Specified by:
getInterpolatedStatein interfaceODEStateInterpolator- Parameters:
time- time of the interpolated point- Returns:
- state at interpolated time
-
isForward
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.
- Specified by:
isForwardin interfaceODEStateInterpolator- Returns:
- true if the integration variable (time) increases during integration
-
getMapper
protected EquationsMapper getMapper()
Get the mapper for ODE equations primary and secondary components.- Returns:
- mapper for ODE equations primary and secondary components
-
computeInterpolatedStateAndDerivatives
protected abstract ODEStateAndDerivative computeInterpolatedStateAndDerivatives(EquationsMapper equationsMapper, double time, double theta, double thetaH, double oneMinusThetaH) throws MathIllegalStateException
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.- Parameters:
equationsMapper- mapper for ODE equations primary and secondary componentstime- interpolation timetheta- normalized interpolation abscissa within the step (theta is zero at the previous time step and one at the current time step)thetaH- time gap between the previous time and the interpolated timeoneMinusThetaH- time gap between the interpolated time and the current time- Returns:
- interpolated state and derivatives
- Throws:
MathIllegalStateException- if the number of functions evaluations is exceeded
-
-