Class AbstractStepInterpolator

    • Method Detail

      • 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
      • storeTime

        public void storeTime​(double t)
        Store the current step time.
        Parameters:
        t - current time
      • setSoftPreviousTime

        public void setSoftPreviousTime​(double softPreviousTime)
        Restrict step range to a limited part of the global step.

        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

        Parameters:
        softPreviousTime - start of the restricted step
        Since:
        2.2
      • setSoftCurrentTime

        public void setSoftCurrentTime​(double softCurrentTime)
        Restrict step range to a limited part of the global step.

        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

        Parameters:
        softCurrentTime - end of the restricted step
        Since:
        2.2
      • getGlobalPreviousTime

        public double getGlobalPreviousTime()
        Get the previous global grid point time.
        Returns:
        previous global grid point time
        Since:
        2.2
      • getGlobalCurrentTime

        public double getGlobalCurrentTime()
        Get the current global grid point time.
        Returns:
        current global grid point time
        Since:
        2.2
      • setInterpolatedTime

        public void setInterpolatedTime​(double time)
        Set the time of the interpolated point.

        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. If a specific state must be preserved, a copy of the instance must be created using StepInterpolator.copy().

        Specified by:
        setInterpolatedTime in interface StepInterpolator
        Parameters:
        time - time of the interpolated point
      • 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:
        isForward in interface StepInterpolator
        Returns:
        true if the integration variable (time) increases during integration
      • finalizeStep

        public final void finalizeStep()
                                throws DerivativeException
        Finalize the step.

        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.

        Throws:
        DerivativeException - this exception is propagated to the caller if the underlying user function triggers one
      • writeExternal

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

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