org.apache.commons.math3.ode.nonstiff
Class RungeKutta6StepInterpolator

java.lang.Object
  extended by org.apache.commons.math3.ode.sampling.AbstractStepInterpolator
      extended by org.apache.commons.math3.ode.nonstiff.RungeKutta6StepInterpolator
All Implemented Interfaces:
Externalizable, Serializable, StepInterpolator

public class RungeKutta6StepInterpolator
extends AbstractStepInterpolator

Interpolator for RungeKutta6Integrator.

Warning: This interpolator currently performs a simple linear interpolation. As a result, resulting interpolated points may not be very accurate, particularly for high dynamics systems.

Since:
1.3
Version:
1.3
Author:
Cedric Dental
See Also:
Serialized Form
Concurrency :
not thread-safe

Field Summary
protected  AbstractIntegrator integrator
          Reference to the integrator.
protected  double[] previousState
          Previous state.
protected  double[][] yDotK
          Slopes at the intermediate points
 
Fields inherited from class org.apache.commons.math3.ode.sampling.AbstractStepInterpolator
currentState, h, interpolatedDerivatives, interpolatedPrimaryDerivatives, interpolatedPrimaryState, interpolatedSecondaryDerivatives, interpolatedSecondaryState, interpolatedState, interpolatedTime
 
Constructor Summary
RungeKutta6StepInterpolator()
          Simple constructor.
RungeKutta6StepInterpolator(RungeKutta6StepInterpolator interpolator)
          Copy constructor.
 
Method Summary
protected  void computeInterpolatedStateAndDerivatives(double theta, double oneMinusThetaH)
          Compute the state and derivatives at the interpolated time.
protected  StepInterpolator doCopy()
          Really copy the finalized instance.
 void readExternal(ObjectInput in)
          
 void reinitialize(AbstractIntegrator rkIntegrator, double[] y, double[][] yDotArray, boolean forward, EquationsMapper primaryMapper, EquationsMapper[] secondaryMappers)
          Reinitialize the instance
 void shift()
          Shift one step forward.
 void writeExternal(ObjectOutput out)
          
 
Methods inherited from class org.apache.commons.math3.ode.sampling.AbstractStepInterpolator
copy, doFinalize, finalizeStep, getCurrentTime, getGlobalCurrentTime, getGlobalPreviousTime, getInterpolatedDerivatives, getInterpolatedSecondaryDerivatives, getInterpolatedSecondaryState, getInterpolatedState, getInterpolatedTime, getPreviousTime, isForward, readBaseExternal, reinitialize, setInterpolatedTime, setSoftCurrentTime, setSoftPreviousTime, storeTime, writeBaseExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

previousState

protected double[] previousState
Previous state.


yDotK

protected double[][] yDotK
Slopes at the intermediate points


integrator

protected AbstractIntegrator integrator
Reference to the integrator.

Constructor Detail

RungeKutta6StepInterpolator

public RungeKutta6StepInterpolator()
Simple constructor. This constructor builds an instance that is not usable yet, the RungeKuttaStepInterpolator.reinitialize(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. The RungeKuttaIntegrator class uses the prototyping design pattern to create the step interpolators by cloning an uninitialized model and latter initializing the copy.


RungeKutta6StepInterpolator

public RungeKutta6StepInterpolator(RungeKutta6StepInterpolator interpolator)
Copy constructor.

Parameters:
interpolator - interpolator to copy from. The copy is a deep copy: its arrays are separated from the original arrays of the instance
Method Detail

doCopy

protected StepInterpolator doCopy()
Really copy the finalized instance.

This method is called by AbstractStepInterpolator.copy() after the step has been finalized. It must perform a deep copy to have an new instance completely independent for the original instance.

Specified by:
doCopy in class AbstractStepInterpolator
Returns:
a copy of the finalized instance

computeInterpolatedStateAndDerivatives

protected void computeInterpolatedStateAndDerivatives(double theta,
                                                      double oneMinusThetaH)
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.

Specified by:
computeInterpolatedStateAndDerivatives in class AbstractStepInterpolator
Parameters:
theta - normalized interpolation abscissa within the step (theta is zero at the previous time step and one at the current time step)
oneMinusThetaH - time gap between the interpolated time and the current time

reinitialize

public void reinitialize(AbstractIntegrator rkIntegrator,
                         double[] y,
                         double[][] yDotArray,
                         boolean forward,
                         EquationsMapper primaryMapper,
                         EquationsMapper[] secondaryMappers)
Reinitialize the instance

Some 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 and EmbeddedRungeKuttaIntegrator 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 to doFinalize if any, i.e. only if the step handler either calls the finalizeStep method or the getInterpolatedState method (for an interpolator which needs a finalization) or if it clones the step interpolator.

Parameters:
rkIntegrator - integrator being used
y - reference to the integrator array holding the state at the end of the step
yDotArray - reference to the integrator array holding all the intermediate slopes
forward - integration direction indicator
primaryMapper - equations mapper for the primary equations set
secondaryMappers - 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 to storeTime

Overrides:
shift in class AbstractStepInterpolator

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException

Specified by:
writeExternal in interface Externalizable
Specified by:
writeExternal in class AbstractStepInterpolator
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException

Specified by:
readExternal in interface Externalizable
Specified by:
readExternal in class AbstractStepInterpolator
Throws:
IOException
ClassNotFoundException


Copyright © 2016 CNES. All Rights Reserved.