Class RungeKuttaStepInterpolator
- All Implemented Interfaces:
Externalizable
,Serializable
,StepInterpolator
- Direct Known Subclasses:
ClassicalRungeKuttaStepInterpolator
,DormandPrince54StepInterpolator
,DormandPrince853StepInterpolator
,EulerStepInterpolator
,GillStepInterpolator
,HighamHall54StepInterpolator
,LutherStepInterpolator
,MidpointStepInterpolator
,ThreeEighthesStepInterpolator
- Since:
- 1.2
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AbstractIntegrator
Reference to the integrator.protected double[]
Previous state.protected double[][]
Slopes at the intermediate pointsFields inherited from class org.apache.commons.math3.ode.sampling.AbstractStepInterpolator
currentState, h, interpolatedDerivatives, interpolatedPrimaryDerivatives, interpolatedPrimaryState, interpolatedSecondaryDerivatives, interpolatedSecondaryState, interpolatedState, interpolatedTime
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Simple constructor.(package private)
RungeKuttaStepInterpolator
(RungeKuttaStepInterpolator interpolator) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
reinitialize
(AbstractIntegrator rkIntegrator, double[] y, double[][] yDotArray, boolean forward, EquationsMapper primaryMapper, EquationsMapper[] secondaryMappers) Reinitialize the instancevoid
shift()
Shift one step forward.void
Methods inherited from class org.apache.commons.math3.ode.sampling.AbstractStepInterpolator
computeInterpolatedStateAndDerivatives, copy, doCopy, doFinalize, finalizeStep, getCurrentTime, getGlobalCurrentTime, getGlobalPreviousTime, getInterpolatedDerivatives, getInterpolatedSecondaryDerivatives, getInterpolatedSecondaryState, getInterpolatedState, getInterpolatedTime, getPreviousTime, isForward, readBaseExternal, reinitialize, setInterpolatedTime, setSoftCurrentTime, setSoftPreviousTime, storeTime, writeBaseExternal
-
Field Details
-
previousState
protected double[] previousStatePrevious state. -
yDotK
protected double[][] yDotKSlopes at the intermediate points -
integrator
Reference to the integrator.
-
-
Constructor Details
-
RungeKuttaStepInterpolator
protected RungeKuttaStepInterpolator()Simple constructor. This constructor builds an instance that is not usable yet, thereinitialize(org.apache.commons.math3.ode.AbstractIntegrator, double[], double[][], boolean, org.apache.commons.math3.ode.EquationsMapper, org.apache.commons.math3.ode.EquationsMapper[])
method should be called before using the instance in order to initialize the internal arrays. This constructor is used only in order to delay the initialization in some cases. TheRungeKuttaIntegrator
andEmbeddedRungeKuttaIntegrator
classes use the prototyping design pattern to create the step interpolators by cloning an uninitialized model and latter initializing the copy. -
RungeKuttaStepInterpolator
RungeKuttaStepInterpolator(RungeKuttaStepInterpolator interpolator) Copy constructor.The copied interpolator should have been finalized before the copy, otherwise the copy will not be able to perform correctly any interpolation and will throw a
NullPointerException
later. Since we don't want this constructor to throw the exceptions finalization may involve and since we don't want this method to modify the state of the copied interpolator, finalization is not done automatically, it remains under user control.The copy is a deep copy: its arrays are separated from the original arrays of the instance.
- Parameters:
interpolator
- interpolator to copy from.
-
-
Method Details
-
reinitialize
public void reinitialize(AbstractIntegrator rkIntegrator, double[] y, double[][] yDotArray, boolean forward, EquationsMapper primaryMapper, EquationsMapper[] secondaryMappers) Reinitialize the instanceSome Runge-Kutta integrators need fewer functions evaluations than their counterpart step interpolators. So the interpolator should perform the last evaluations they need by themselves. The
RungeKuttaIntegrator
andEmbeddedRungeKuttaIntegrator
abstract classes call this method in order to let the step interpolator perform the evaluations it needs. These evaluations will be performed during the call todoFinalize
if any, i.e. only if the step handler either calls thefinalizeStep
method or thegetInterpolatedState
method (for an interpolator which needs a finalization) or if it clones the step interpolator.- Parameters:
rkIntegrator
- integrator being usedy
- reference to the integrator array holding the state at the end of the stepyDotArray
- reference to the integrator array holding all the intermediate slopesforward
- integration direction indicatorprimaryMapper
- equations mapper for the primary equations setsecondaryMappers
- equations mappers for the secondary equations sets
-
shift
public void shift()Shift one step forward. Copy the current time into the previous time, hence preparing the interpolator for future calls tostoreTime
- Overrides:
shift
in classAbstractStepInterpolator
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Specified by:
writeExternal
in classAbstractStepInterpolator
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Specified by:
readExternal
in classAbstractStepInterpolator
- Throws:
IOException
ClassNotFoundException
-