InterpolationND Derived Type

type, public, extends(Object) :: InterpolationND

Linear interpolation object housing information necessary for linearly interpolating N-dimensional data using weighted averages. If interpolation points are outside of the grid will return 0 for interpolated value. NOTE: Does not support changing the number of interpolation points after the first interpolation call.


Components

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

True only if user explicitly sets it to true

type(Interpolation1D), private, dimension(:), allocatable :: interpObjs

Individual 1D interpolation objects. They must correspond to the axes of the data this object should be interpolating

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

An array of shape (Nd,:) where Nd is the dimensionality of the data being interpolated containing the coordinates of the origin of each hyper-cube of points used in interpolation

type(IntArray), private, dimension(:), allocatable :: hyperCube

Indices of individual hyper-cube points (e.g. [0,1,1,1,0] etc.)

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

Hypercube vertex weigths (2^Nd,:) for each interpolation point


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 :: getFirstDataIndicesForDim

  • interface

    private pure module function getFirstDataIndicesForDim(this, dim) result(inds)

    Getter for firstDataIndex of component 1D interpolation object with index dim

    Arguments

    Type IntentOptional Attributes Name
    class(InterpolationND), intent(in) :: this
    integer(kind=ik), intent(in) :: dim

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

procedure, public :: getInterpWeightsForDim

  • interface

    private pure module function getInterpWeightsForDim(this, dim) result(weights)

    Getter for interpWeights of component 1D interpolation object with index dim

    Arguments

    Type IntentOptional Attributes Name
    class(InterpolationND), intent(in) :: this
    integer(kind=ik), intent(in) :: dim

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

procedure, public :: getInterpPointsForDim

  • interface

    private pure module function getInterpPointsForDim(this, dim) result(points)

    Getter for interpolationPoints of component 1D interpolation object with index dim

    Arguments

    Type IntentOptional Attributes Name
    class(InterpolationND), intent(in) :: this
    integer(kind=ik), intent(in) :: dim

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

procedure, public :: updateInterpolationPoints

  • interface

    private pure module subroutine updateInterpolationPoints(this, interpolationPoints)

    Update the interpolation points and weights of all individual 1D interpolation objects and the weights/data indices used

    Arguments

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

procedure, public :: interpolate

  • interface

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

    Interpolate FlatNDData onto interpolation points using weighted averages of vertices of the containing hypercube

    Arguments

    Type IntentOptional Attributes Name
    class(InterpolationND), intent(in) :: this
    type(FlatNDData), intent(in) :: targetArray

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

procedure, public :: init => initInterpolation

  • interface

    private pure module subroutine initInterpolation(this, interpolationObjs)

    Initialization routine for ND interpolation object

    Arguments

    Type IntentOptional Attributes Name
    class(InterpolationND), intent(inout) :: this
    type(Interpolation1D), intent(in), dimension(:) :: interpolationObjs