public abstract class AbstractStepInterpolator extends Object implements StepInterpolator
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).
FirstOrderIntegrator,
SecondOrderIntegrator,
StepHandler,
Serialized Form| Modifier and Type | Method and Description |
|---|---|
StepInterpolator |
copy()
Copy the instance.
|
void |
finalizeStep()
Finalize the step.
|
double |
getCurrentTime()
Get the current soft grid point time.
|
double |
getGlobalCurrentTime()
Get the current global grid point time.
|
double |
getGlobalPreviousTime()
Get the previous global grid point time.
|
double[] |
getInterpolatedDerivatives()
Get the derivatives of the state vector of the interpolated point.
|
double[] |
getInterpolatedSecondaryDerivatives(int index)
Get the interpolated secondary derivatives corresponding to the secondary equations.
|
double[] |
getInterpolatedSecondaryState(int index)
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.
|
double |
getPreviousTime()
Get the previous soft grid point time.
|
boolean |
isForward()
Check if the natural integration direction is forward.
|
abstract void |
readExternal(ObjectInput in) |
void |
setInterpolatedTime(double time)
Set the time of the interpolated point.
|
void |
setSoftCurrentTime(double softCurrentTime)
Restrict step range to a limited part of the global step.
|
void |
setSoftPreviousTime(double softPreviousTime)
Restrict step range to a limited part of the global step.
|
void |
shift()
Shift one step forward.
|
void |
storeTime(double t)
Store the current step time.
|
abstract void |
writeExternal(ObjectOutput out) |
public StepInterpolator copy() throws MaxCountExceededException
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.
copy in interface StepInterpolatorMaxCountExceededException - if the number of functions evaluations is exceeded
during step finalizationStepInterpolator.setInterpolatedTime(double)public void shift()
storeTimepublic void storeTime(double t)
t - current timepublic void setSoftPreviousTime(double softPreviousTime)
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 getPreviousTime(),
it does not change any other property
softPreviousTime - start of the restricted steppublic void setSoftCurrentTime(double softCurrentTime)
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 getCurrentTime(),
it does not change any other property
softCurrentTime - end of the restricted steppublic double getGlobalPreviousTime()
public double getGlobalCurrentTime()
public double getPreviousTime()
getPreviousTime in interface StepInterpolatorsetSoftPreviousTime(double)public double getCurrentTime()
getCurrentTime in interface StepInterpolatorsetSoftCurrentTime(double)public double getInterpolatedTime()
StepInterpolator.setInterpolatedTime(double) has not been called, it returns
the current grid point time.getInterpolatedTime in interface StepInterpolatorpublic void setInterpolatedTime(double time)
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 StepInterpolator.getInterpolatedState(),
StepInterpolator.getInterpolatedDerivatives(), StepInterpolator.getInterpolatedSecondaryState(int) and StepInterpolator.getInterpolatedSecondaryDerivatives(int). So if their content must be preserved
across several calls, user must copy them.
setInterpolatedTime in interface StepInterpolatortime - time of the interpolated pointStepInterpolator.getInterpolatedState(),
StepInterpolator.getInterpolatedDerivatives(),
StepInterpolator.getInterpolatedSecondaryState(int),
StepInterpolator.getInterpolatedSecondaryDerivatives(int)public boolean isForward()
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.
isForward in interface StepInterpolatorpublic 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
StepInterpolator.setInterpolatedTime(double) method.
getInterpolatedState in interface StepInterpolatorStepInterpolator.getInterpolatedTime()MaxCountExceededException - if the number of functions evaluations is exceededStepInterpolator.getInterpolatedDerivatives(),
StepInterpolator.getInterpolatedSecondaryState(int),
StepInterpolator.getInterpolatedSecondaryDerivatives(int),
StepInterpolator.setInterpolatedTime(double)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
StepInterpolator.setInterpolatedTime(double) method.
getInterpolatedDerivatives in interface StepInterpolatorStepInterpolator.getInterpolatedTime()MaxCountExceededException - if the number of functions evaluations is exceededStepInterpolator.getInterpolatedState(),
StepInterpolator.getInterpolatedSecondaryState(int),
StepInterpolator.getInterpolatedSecondaryDerivatives(int),
StepInterpolator.setInterpolatedTime(double)public double[] getInterpolatedSecondaryState(int index)
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
StepInterpolator.setInterpolatedTime(double) method.
getInterpolatedSecondaryState in interface StepInterpolatorindex - index of the secondary set, as returned by ExpandableStatefulODE.addSecondaryEquations(SecondaryEquations)MaxCountExceededException - if the number of functions evaluations is exceededStepInterpolator.getInterpolatedState(),
StepInterpolator.getInterpolatedDerivatives(),
StepInterpolator.getInterpolatedSecondaryDerivatives(int),
StepInterpolator.setInterpolatedTime(double)public double[] getInterpolatedSecondaryDerivatives(int index)
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.
getInterpolatedSecondaryDerivatives in interface StepInterpolatorindex - index of the secondary set, as returned by ExpandableStatefulODE.addSecondaryEquations(SecondaryEquations)MaxCountExceededException - if the number of functions evaluations is exceededStepInterpolator.getInterpolatedState(),
StepInterpolator.getInterpolatedDerivatives(),
StepInterpolator.getInterpolatedSecondaryState(int),
StepInterpolator.setInterpolatedTime(double)public final void finalizeStep()
throws MaxCountExceededException
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 setInterpolatedTime(double) is called.
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 handleStep is valid only for the duration
of the handleStep call, one cannot
simply store a reference and reuse it later. One should first
finalize the instance, then copy this finalized instance into a
new object that can be kept.
This method calls the protected doFinalize method
if it has never been called during this step and set a flag
indicating that it has been called once. It is the
doFinalize method which should perform the evaluations.
This wrapping prevents from calling doFinalize several
times and hence evaluating the differential equations too often.
Therefore, subclasses are not allowed not reimplement it, they
should rather reimplement doFinalize.
MaxCountExceededException - if the number of functions evaluations is exceededpublic abstract void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic abstract void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionJas4pp 1.5 © Java Analysis Studio for Particle Physics