Class GraggBulirschStoerStepInterpolator

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, StepInterpolator

    class GraggBulirschStoerStepInterpolator
    extends AbstractStepInterpolator
    This class implements an interpolator for the Gragg-Bulirsch-Stoer integrator.

    This interpolator compute dense output inside the last step produced by a Gragg-Bulirsch-Stoer integrator.

    This implementation is basically a reimplementation in Java of the odex fortran code by E. Hairer and G. Wanner. The redistribution policy for this code is available here, for convenience, it is reproduced below.

    Copyright (c) 2004, Ernst Hairer
    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
    • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    Since:
    1.2
    See Also:
    GraggBulirschStoerIntegrator
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Serializable version identifier.
        See Also:
        Constant Field Values
      • y0Dot

        private double[] y0Dot
        Slope at the beginning of the step.
      • y1

        private double[] y1
        State at the end of the step.
      • y1Dot

        private double[] y1Dot
        Slope at the end of the step.
      • yMidDots

        private double[][] yMidDots
        Derivatives at the middle of the step. element 0 is state at midpoint, element 1 is first derivative ...
      • polynomials

        private double[][] polynomials
        Interpolation polynomials.
      • errfac

        private double[] errfac
        Error coefficients for the interpolation.
      • currentDegree

        private int currentDegree
        Degree of the interpolation polynomials.
    • Constructor Detail

      • GraggBulirschStoerStepInterpolator

        public GraggBulirschStoerStepInterpolator()
        Simple constructor. This constructor should not be used directly, it is only intended for the serialization process.
      • GraggBulirschStoerStepInterpolator

        GraggBulirschStoerStepInterpolator​(double[] y,
                                           double[] y0Dot,
                                           double[] y1,
                                           double[] y1Dot,
                                           double[][] yMidDots,
                                           boolean forward,
                                           EquationsMapper primaryMapper,
                                           EquationsMapper[] secondaryMappers)
        Simple constructor.
        Parameters:
        y - reference to the integrator array holding the current state
        y0Dot - reference to the integrator array holding the slope at the beginning of the step
        y1 - reference to the integrator array holding the state at the end of the step
        y1Dot - reference to the integrator array holding the slope at the end of the step
        yMidDots - reference to the integrator array holding the derivatives at the middle point of the step
        forward - integration direction indicator
        primaryMapper - equations mapper for the primary equations set
        secondaryMappers - equations mappers for the secondary equations sets
      • GraggBulirschStoerStepInterpolator

        GraggBulirschStoerStepInterpolator​(GraggBulirschStoerStepInterpolator 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

      • resetTables

        private void resetTables​(int maxDegree)
        Reallocate the internal tables. Reallocate the internal tables in order to be able to handle interpolation polynomials up to the given degree
        Parameters:
        maxDegree - maximal degree to handle
      • computeCoefficients

        public void computeCoefficients​(int mu,
                                        double h)
        Compute the interpolation coefficients for dense output.
        Parameters:
        mu - degree of the interpolation polynomial
        h - current step
      • estimateError

        public double estimateError​(double[] scale)
        Estimate interpolation error.
        Parameters:
        scale - scaling array
        Returns:
        estimate of the interpolation error
      • 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
      • writeExternal

        public void writeExternal​(java.io.ObjectOutput out)
                           throws java.io.IOException
        Specified by:
        writeExternal in interface java.io.Externalizable
        Specified by:
        writeExternal in class AbstractStepInterpolator
        Throws:
        java.io.IOException
      • readExternal

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException,
                                 java.lang.ClassNotFoundException
        Specified by:
        readExternal in interface java.io.Externalizable
        Specified by:
        readExternal in class AbstractStepInterpolator
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException