spline_interpolator Derived Type

type, public, extends(base_interpolator) :: spline_interpolator

Defines a type meant for performing cubic spline interpolation.


Contents


Type-Bound Procedures

procedure, public :: initialize => si_init

  • private subroutine si_init(this, x, y, ibcbeg, ybcbeg, ibcend, ybcend, err)

    Initializes the interpolation object.

    Arguments

    Type IntentOptional Attributes Name
    class(spline_interpolator), intent(inout) :: this

    The spline_interpolator object.

    real(kind=real64), intent(in), dimension(:) :: x

    An N-element array containing the x-coordinate data in either monotonically increasing or decreasing order.

    real(kind=real64), intent(in), dimension(:) :: y

    An N-element array containing the y-coordinate data.

    integer(kind=int32), intent(in), optional :: ibcbeg

    An optional input that defines the nature of the boundary condition at the beginning of the spline. If no parameter, or an invalid parameter, is specified, the default condition (SPLINE_QUADRATIC_OVER_INTERVAL) is used.

    • SPLINE_QUADRATIC_OVER_INTERVAL: The spline is quadratic over its initial interval. No value is required for ybcbeg.

    • SPLINE_KNOWN_FIRST_DERIVATIVE: The spline's first derivative at its initial point is provided in ybcbeg.

    • SPLINE_KNOWN_SECOND_DERIVATIVE: The spline's second derivative at its initial point is provided in ybcbeg.

    • SPLINE_CONTINUOUS_THIRD_DERIVATIVE: The third derivative is continuous at x(2). No value is required for ybcbeg.

    real(kind=real64), intent(in), optional :: ybcbeg

    If needed, the value of the initial point boundary condition. If needed, but not supplied, a default value of zero will be used.

    integer(kind=int32), intent(in), optional :: ibcend

    An optional input that defines the nature of the boundary condition at the end of the spline. If no parameter, or an invalid parameter, is specified, the default condition (SPLINE_QUADRATIC_OVER_INTERVAL) is used.

    • SPLINE_QUADRATIC_OVER_INTERVAL: The spline is quadratic over its final interval. No value is required for ybcend.

    • SPLINE_KNOWN_FIRST_DERIVATIVE: The spline's first derivative at its final point is provided in ybcend.

    • SPLINE_KNOWN_SECOND_DERIVATIVE: The spline's second derivative at its final point is provided in ybcend.

    • SPLINE_CONTINUOUS_THIRD_DERIVATIVE: The third derivative is continuous at x(n-1). No value is required for ybcend.

    real(kind=real64), intent(in), optional :: ybcend

    If needed, the value of the final point boundary condition. If needed, but not supplied, a default value of zero will be used.

    class(errors), intent(inout), optional, target :: err

    An error handling object.

procedure, public :: interpolate => bi_interp

  • private subroutine bi_interp(this, x, yi, err)

    Performs the interpolation.

    Arguments

    Type IntentOptional Attributes Name
    class(base_interpolator), intent(inout) :: this

    The base_interpolator object.

    real(kind=real64), intent(in), dimension(:) :: x

    An N-element array containing the x values at which to compute the interpolation.

    real(kind=real64), intent(out), dimension(:) :: yi

    An N-element array containing the interpolated data.

    class(errors), intent(inout), optional, target :: err

    An error handling object.

procedure, public :: interpolate_value => si_raw_interp

  • private function si_raw_interp(this, x) result(rst)

    Interpolates a single value.

    Arguments

    Type IntentOptional Attributes Name
    class(spline_interpolator), intent(inout) :: this

    The spline_interpolator object.

    real(kind=real64), intent(in) :: x

    The value at which to compute the interpolation.

    Return Value real(kind=real64)

    The interpolated value.