Interpolation1D Derived Type

type, public, extends(Object) :: Interpolation1D

Linear interpolation object housing information necessary for linearly interpolating 1D data. Will fail assertsion if interpolation points are outside of the grid.


Components

Type Visibility Attributes Name Initial
logical, public :: userDefined = .false.

True only if user explicitly sets it to true

integer(kind=ik), private, allocatable, dimension(:) :: firstDataIndex

Array containing the first interpolation index (the second is 1 above the first)

real(kind=rk), private, allocatable, dimension(:) :: interpWeights

Array containing interpolation weights for each interpolation point. Will be set to -1 if the point is outside the grid.

real(kind=rk), private, allocatable, dimension(:) :: interpPoints

Points at which this interpolation object provides values

real(kind=rk), private, allocatable, dimension(:) :: gridBuffer

Buffer for grid values used when updating interpolation points


Type-Bound Procedures

procedure, public :: isDefined => isDefinedObject

  • interface

    private pure module function isDefinedObject(this) result(defined)

    Getter for userDefined

    Arguments

    Type IntentOptional Attributes Name
    class(Object), intent(in) :: this

    Return Value logical

procedure, public :: makeDefined => makeDefinedObject

  • interface

    private pure module subroutine makeDefinedObject(this)

    Set userDefined to .true.

    Arguments

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

procedure, public :: makeUndefined => makeUndefinedObject

  • interface

    private pure module subroutine makeUndefinedObject(this)

    Set userDefined to .false.

    Arguments

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

procedure, public :: getFirstDataIndices

  • interface

    private pure module function getFirstDataIndices(this) result(inds)

    Getter for firstDataIndex

    Arguments

    Type IntentOptional Attributes Name
    class(Interpolation1D), intent(in) :: this

    Return Value integer(kind=ik), allocatable, dimension(:)

procedure, public :: getInterpWeights

  • interface

    private pure module function getInterpWeights(this) result(weights)

    Getter for interpWeights

    Arguments

    Type IntentOptional Attributes Name
    class(Interpolation1D), intent(in) :: this

    Return Value real(kind=rk), allocatable, dimension(:)

procedure, public :: getInterpPoints

  • interface

    private pure module function getInterpPoints(this) result(points)

    Getter for interpPoints

    Arguments

    Type IntentOptional Attributes Name
    class(Interpolation1D), intent(in) :: this

    Return Value real(kind=rk), allocatable, dimension(:)

procedure, public :: updateInterpolationPoints

  • interface

    private pure module subroutine updateInterpolationPoints(this, interpolationPoints)

    Updates the interpolation points and weightss

    Arguments

    Type IntentOptional Attributes Name
    class(Interpolation1D), intent(inout) :: this
    real(kind=rk), intent(in), dimension(:) :: interpolationPoints

procedure, public :: interpolate

  • interface

    private pure module function interpolate(this, targetArray) result(interpVals)

    Interpolate input array defined on the same grid as the interpolation object at points

    Arguments

    Type IntentOptional Attributes Name
    class(Interpolation1D), intent(in) :: this
    real(kind=rk), intent(in), dimension(:) :: targetArray

    Return Value real(kind=rk), allocatable, dimension(:)

procedure, public :: init => initInterpolation

  • interface

    private pure module subroutine initInterpolation(this, gridPoints, interpolationPoints)

    Initialization routine for 1D interpolation object

    Arguments

    Type IntentOptional Attributes Name
    class(Interpolation1D), intent(inout) :: this
    real(kind=rk), intent(in), dimension(:) :: gridPoints
    real(kind=rk), intent(in), optional, dimension(:) :: interpolationPoints