bspline_4d Derived Type

type, public, extends(bspline_class) :: bspline_4d

Class for 4d b-spline interpolation.


Inherits

type~~bspline_4d~~InheritsGraph type~bspline_4d bspline_4d type~bspline_class bspline_class type~bspline_4d->type~bspline_class

Components

Type Visibility Attributes Name Initial
integer(kind=ip), private :: nx = 0_ip

Number of abcissae

integer(kind=ip), private :: ny = 0_ip

Number of abcissae

integer(kind=ip), private :: nz = 0_ip

Number of abcissae

integer(kind=ip), private :: nq = 0_ip

Number of abcissae

integer(kind=ip), private :: kx = 0_ip

The order of spline pieces in

integer(kind=ip), private :: ky = 0_ip

The order of spline pieces in

integer(kind=ip), private :: kz = 0_ip

The order of spline pieces in

integer(kind=ip), private :: kq = 0_ip

The order of spline pieces in

real(kind=wp), private, dimension(:,:,:,:,:), allocatable :: bcoef

array of coefficients of the b-spline interpolant (the last dimension is the output index)

real(kind=wp), private, dimension(:), allocatable :: tx

The knots in the direction for the spline interpolant

real(kind=wp), private, dimension(:), allocatable :: ty

The knots in the direction for the spline interpolant

real(kind=wp), private, dimension(:), allocatable :: tz

The knots in the direction for the spline interpolant

real(kind=wp), private, dimension(:), allocatable :: tq

The knots in the direction for the spline interpolant

integer(kind=ip), private :: inbvy = 1_ip

internal variable used for efficient processing

integer(kind=ip), private :: inbvz = 1_ip

internal variable used for efficient processing

integer(kind=ip), private :: inbvq = 1_ip

internal variable used for efficient processing

integer(kind=ip), private :: iloy = 1_ip

internal variable used for efficient processing

integer(kind=ip), private :: iloz = 1_ip

internal variable used for efficient processing

integer(kind=ip), private :: iloq = 1_ip

internal variable used for efficient processing

real(kind=wp), private, dimension(:,:,:), allocatable :: work_val_1

db4val work array of dimension ky,kz,kq

real(kind=wp), private, dimension(:,:), allocatable :: work_val_2

db4val work array of dimension kz,kq

real(kind=wp), private, dimension(:), allocatable :: work_val_3

db4val work array of dimension kq

real(kind=wp), private, dimension(:), allocatable :: work_val_4

db4val work array of dimension 3_ip*max(kx,ky,kz,kq)


Constructor

public interface bspline_4d

Constructor for bspline_4d

  • private elemental function bspline_4d_constructor_empty() result(me)

    It returns an empty bspline_4d type. Note that INITIALIZE still needs to be called before it can be used. Not really that useful except perhaps in some OpenMP applications.

    Arguments

    None

    Return Value type(bspline_4d)

  • private pure function bspline_4d_constructor_auto_knots(x, y, z, q, fcn, kx, ky, kz, kq, extrap) result(me)

    Constructor for a bspline_4d type (auto knots). This is a wrapper for initialize_4d_auto_knots.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in), dimension(:) :: x

    (nx) array of abcissae. Must be strictly increasing.

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

    (ny) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: z

    (nz) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: q

    (nq) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:,:,:,:) :: fcn

    (nx,ny,nz,nq) matrix of function values to interpolate. fcn(i,j,k,l) should contain the function value at the point (x(i),y(j),z(k),q(l))

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

    Return Value type(bspline_4d)

  • private pure function bspline_4d_constructor_specify_knots(x, y, z, q, fcn, kx, ky, kz, kq, tx, ty, tz, tq, extrap) result(me)

    Constructor for a bspline_4d type (user-specified knots). This is a wrapper for initialize_4d_specify_knots.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=wp), intent(in), dimension(:) :: x

    (nx) array of abcissae. Must be strictly increasing.

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

    (ny) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: z

    (nz) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: q

    (nq) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:,:,:,:) :: fcn

    (nx,ny,nz,nq) matrix of function values to interpolate. fcn(i,j,k,l) should contain the function value at the point (x(i),y(j),z(k),q(l))

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    real(kind=wp), intent(in), dimension(:) :: tx

    The (nx+kx) knots in the direction for the spline interpolant. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: ty

    The (ny+ky) knots in the direction for the spline interpolant. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: tz

    The (nz+kz) knots in the direction for the spline interpolant. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: tq

    The (nq+kq) knots in the direction for the spline interpolant. Must be non-decreasing.

    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

    Return Value type(bspline_4d)


Finalization Procedures

final :: finalize_4d


Type-Bound Procedures

procedure, public, non_overridable :: status_ok

returns true if the last iflag status code was =0.

  • private elemental function status_ok(me) result(ok)

    This routines returns true if the iflag code from the last routine called was =0. Maybe of the routines have output iflag variables, so they can be checked explicitly, or this routine can be used.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_class), intent(in) :: me

    Return Value logical

procedure, public, non_overridable :: status_message => get_bspline_status_message

retrieve the last status message

  • private pure function get_bspline_status_message(me, iflag) result(msg)

    Get the status message from a bspline_class routine call.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_class), intent(in) :: me
    integer(kind=ip), intent(in), optional :: iflag

    the corresponding status code

    Return Value character(len=:), allocatable

    status message associated with the flag

procedure, public, non_overridable :: clear_flag => clear_bspline_flag

to reset the iflag saved in the class.

  • private elemental subroutine clear_bspline_flag(me)

    This sets the iflag variable in the class to 0 (which indicates that everything is OK). It can be used after an error is encountered.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_class), intent(inout) :: me

procedure, public, non_overridable :: number_of_outputs

number of outputs (functions) of the spline

  • private pure function number_of_outputs(me) result(nf)

    Returns the number of outputs (functions of the same inputs) of the spline: 1 for a spline initialized with a single function, and nf for one initialized with nf functions (the last dimension of fcn). Returns 0 if the class is not initialized.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_class), intent(in) :: me

    the spline

    Return Value integer(kind=ip)

    number of outputs

  • private pure subroutine initialize_4d_auto_knots(me, x, y, z, q, fcn, kx, ky, kz, kq, iflag, extrap)

    Initialize a bspline_4d type (with automatically-computed knots). This is a wrapper for db4ink.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me
    real(kind=wp), intent(in), dimension(:) :: x

    (nx) array of abcissae. Must be strictly increasing.

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

    (ny) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: z

    (nz) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: q

    (nq) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:,:,:,:) :: fcn

    (nx,ny,nz,nq) matrix of function values to interpolate. fcn(i,j,k,l) should contain the function value at the point (x(i),y(j),z(k),q(l))

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(out) :: iflag

    status flag (see db4ink)

    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

  • private pure subroutine initialize_4d_specify_knots(me, x, y, z, q, fcn, kx, ky, kz, kq, tx, ty, tz, tq, iflag, extrap)

    Initialize a bspline_4d type (with user-specified knots). This is a wrapper for db4ink.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me
    real(kind=wp), intent(in), dimension(:) :: x

    (nx) array of abcissae. Must be strictly increasing.

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

    (ny) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: z

    (nz) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: q

    (nq) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:,:,:,:) :: fcn

    (nx,ny,nz,nq) matrix of function values to interpolate. fcn(i,j,k,l) should contain the function value at the point (x(i),y(j),z(k),q(l))

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    real(kind=wp), intent(in), dimension(:) :: tx

    The (nx+kx) knots in the direction for the spline interpolant. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: ty

    The (ny+ky) knots in the direction for the spline interpolant. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: tz

    The (nz+kz) knots in the direction for the spline interpolant. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: tq

    The (nq+kq) knots in the direction for the spline interpolant. Must be non-decreasing.

    integer(kind=ip), intent(out) :: iflag

    status flag (see db4ink)

    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

  • private pure subroutine initialize_4d_auto_knots_multi(me, x, y, z, q, fcn, kx, ky, kz, kq, iflag, extrap)

    Initialize a bspline_4d type with multiple outputs: nf functions of the same inputs, on the same grid. The last dimension of fcn is the output index. This is a wrapper for db4ink (multiple-output version).

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

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

    (nx) array of abcissae. Must be strictly increasing.

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

    (ny) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: z

    (nz) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: q

    (nq) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:,:,:,:,:) :: fcn

    (nx,ny,nz,nq,nf) array of function values to interpolate (the last dimension is the output index)

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in

    integer(kind=ip), intent(out) :: iflag

    status flag (see db4ink)

    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

  • private pure subroutine initialize_4d_specify_knots_multi(me, x, y, z, q, fcn, kx, ky, kz, kq, tx, ty, tz, tq, iflag, extrap)

    Initialize a bspline_4d type with multiple outputs: nf functions of the same inputs, on the same grid (with user-specified knots). The last dimension of fcn is the output index. This is a wrapper for db4ink (multiple-output version).

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

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

    (nx) array of abcissae. Must be strictly increasing.

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

    (ny) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: z

    (nz) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: q

    (nq) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:,:,:,:,:) :: fcn

    (nx,ny,nz,nq,nf) array of function values to interpolate (the last dimension is the output index)

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in

    real(kind=wp), intent(in), dimension(:) :: tx

    The (nx+kx) knots in the direction.

    real(kind=wp), intent(in), dimension(:) :: ty

    The (ny+ky) knots in the direction.

    real(kind=wp), intent(in), dimension(:) :: tz

    The (nz+kz) knots in the direction.

    real(kind=wp), intent(in), dimension(:) :: tq

    The (nq+kq) knots in the direction.

    integer(kind=ip), intent(out) :: iflag

    status flag (see db4ink)

    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

procedure, private :: initialize_4d_auto_knots_multi

  • private pure subroutine initialize_4d_auto_knots_multi(me, x, y, z, q, fcn, kx, ky, kz, kq, iflag, extrap)

    Initialize a bspline_4d type with multiple outputs: nf functions of the same inputs, on the same grid. The last dimension of fcn is the output index. This is a wrapper for db4ink (multiple-output version).

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

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

    (nx) array of abcissae. Must be strictly increasing.

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

    (ny) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: z

    (nz) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: q

    (nq) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:,:,:,:,:) :: fcn

    (nx,ny,nz,nq,nf) array of function values to interpolate (the last dimension is the output index)

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in

    integer(kind=ip), intent(out) :: iflag

    status flag (see db4ink)

    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

procedure, private :: initialize_4d_specify_knots_multi

  • private pure subroutine initialize_4d_specify_knots_multi(me, x, y, z, q, fcn, kx, ky, kz, kq, tx, ty, tz, tq, iflag, extrap)

    Initialize a bspline_4d type with multiple outputs: nf functions of the same inputs, on the same grid (with user-specified knots). The last dimension of fcn is the output index. This is a wrapper for db4ink (multiple-output version).

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

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

    (nx) array of abcissae. Must be strictly increasing.

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

    (ny) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: z

    (nz) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: q

    (nq) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:,:,:,:,:) :: fcn

    (nx,ny,nz,nq,nf) array of function values to interpolate (the last dimension is the output index)

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in

    real(kind=wp), intent(in), dimension(:) :: tx

    The (nx+kx) knots in the direction.

    real(kind=wp), intent(in), dimension(:) :: ty

    The (ny+ky) knots in the direction.

    real(kind=wp), intent(in), dimension(:) :: tz

    The (nz+kz) knots in the direction.

    real(kind=wp), intent(in), dimension(:) :: tq

    The (nq+kq) knots in the direction.

    integer(kind=ip), intent(out) :: iflag

    status flag (see db4ink)

    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

procedure, private :: initialize_4d_auto_knots

  • private pure subroutine initialize_4d_auto_knots(me, x, y, z, q, fcn, kx, ky, kz, kq, iflag, extrap)

    Initialize a bspline_4d type (with automatically-computed knots). This is a wrapper for db4ink.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me
    real(kind=wp), intent(in), dimension(:) :: x

    (nx) array of abcissae. Must be strictly increasing.

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

    (ny) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: z

    (nz) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: q

    (nq) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:,:,:,:) :: fcn

    (nx,ny,nz,nq) matrix of function values to interpolate. fcn(i,j,k,l) should contain the function value at the point (x(i),y(j),z(k),q(l))

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(out) :: iflag

    status flag (see db4ink)

    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

procedure, private :: initialize_4d_specify_knots

  • private pure subroutine initialize_4d_specify_knots(me, x, y, z, q, fcn, kx, ky, kz, kq, tx, ty, tz, tq, iflag, extrap)

    Initialize a bspline_4d type (with user-specified knots). This is a wrapper for db4ink.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me
    real(kind=wp), intent(in), dimension(:) :: x

    (nx) array of abcissae. Must be strictly increasing.

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

    (ny) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: z

    (nz) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:) :: q

    (nq) array of abcissae. Must be strictly increasing.

    real(kind=wp), intent(in), dimension(:,:,:,:) :: fcn

    (nx,ny,nz,nq) matrix of function values to interpolate. fcn(i,j,k,l) should contain the function value at the point (x(i),y(j),z(k),q(l))

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    real(kind=wp), intent(in), dimension(:) :: tx

    The (nx+kx) knots in the direction for the spline interpolant. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: ty

    The (ny+ky) knots in the direction for the spline interpolant. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: tz

    The (nz+kz) knots in the direction for the spline interpolant. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: tq

    The (nq+kq) knots in the direction for the spline interpolant. Must be non-decreasing.

    integer(kind=ip), intent(out) :: iflag

    status flag (see db4ink)

    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

generic, public :: evaluate => evaluate_4d, evaluate_4d_multi

  • private pure subroutine evaluate_4d(me, xval, yval, zval, qval, idx, idy, idz, idq, f, iflag)

    Evaluate a bspline_4d interpolate. This is a wrapper for db4val.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me
    real(kind=wp), intent(in) :: xval

    coordinate of evaluation point.

    real(kind=wp), intent(in) :: yval

    coordinate of evaluation point.

    real(kind=wp), intent(in) :: zval

    coordinate of evaluation point.

    real(kind=wp), intent(in) :: qval

    coordinate of evaluation point.

    integer(kind=ip), intent(in) :: idx

    derivative of piecewise polynomial to evaluate.

    integer(kind=ip), intent(in) :: idy

    derivative of piecewise polynomial to evaluate.

    integer(kind=ip), intent(in) :: idz

    derivative of piecewise polynomial to evaluate.

    integer(kind=ip), intent(in) :: idq

    derivative of piecewise polynomial to evaluate.

    real(kind=wp), intent(out) :: f

    interpolated value

    integer(kind=ip), intent(out) :: iflag

    status flag (see db4val)

  • private pure subroutine evaluate_4d_multi(me, xval, yval, zval, qval, idx, idy, idz, idq, f, iflag)

    Evaluate all the outputs of a bspline_4d with multiple outputs. This is a wrapper for db4val (multiple-output version).

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

    real(kind=wp), intent(in) :: xval

    coordinate of evaluation point.

    real(kind=wp), intent(in) :: yval

    coordinate of evaluation point.

    real(kind=wp), intent(in) :: zval

    coordinate of evaluation point.

    real(kind=wp), intent(in) :: qval

    coordinate of evaluation point.

    integer(kind=ip), intent(in) :: idx

    derivative of piecewise polynomial to evaluate.

    integer(kind=ip), intent(in) :: idy

    derivative of piecewise polynomial to evaluate.

    integer(kind=ip), intent(in) :: idz

    derivative of piecewise polynomial to evaluate.

    integer(kind=ip), intent(in) :: idq

    derivative of piecewise polynomial to evaluate.

    real(kind=wp), intent(out), dimension(:) :: f

    (nf) interpolated values of the outputs (see number_of_outputs)

    integer(kind=ip), intent(out) :: iflag

    status flag (see db4val)

procedure, private :: evaluate_4d

  • private pure subroutine evaluate_4d(me, xval, yval, zval, qval, idx, idy, idz, idq, f, iflag)

    Evaluate a bspline_4d interpolate. This is a wrapper for db4val.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me
    real(kind=wp), intent(in) :: xval

    coordinate of evaluation point.

    real(kind=wp), intent(in) :: yval

    coordinate of evaluation point.

    real(kind=wp), intent(in) :: zval

    coordinate of evaluation point.

    real(kind=wp), intent(in) :: qval

    coordinate of evaluation point.

    integer(kind=ip), intent(in) :: idx

    derivative of piecewise polynomial to evaluate.

    integer(kind=ip), intent(in) :: idy

    derivative of piecewise polynomial to evaluate.

    integer(kind=ip), intent(in) :: idz

    derivative of piecewise polynomial to evaluate.

    integer(kind=ip), intent(in) :: idq

    derivative of piecewise polynomial to evaluate.

    real(kind=wp), intent(out) :: f

    interpolated value

    integer(kind=ip), intent(out) :: iflag

    status flag (see db4val)

procedure, private :: evaluate_4d_multi

  • private pure subroutine evaluate_4d_multi(me, xval, yval, zval, qval, idx, idy, idz, idq, f, iflag)

    Evaluate all the outputs of a bspline_4d with multiple outputs. This is a wrapper for db4val (multiple-output version).

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

    real(kind=wp), intent(in) :: xval

    coordinate of evaluation point.

    real(kind=wp), intent(in) :: yval

    coordinate of evaluation point.

    real(kind=wp), intent(in) :: zval

    coordinate of evaluation point.

    real(kind=wp), intent(in) :: qval

    coordinate of evaluation point.

    integer(kind=ip), intent(in) :: idx

    derivative of piecewise polynomial to evaluate.

    integer(kind=ip), intent(in) :: idy

    derivative of piecewise polynomial to evaluate.

    integer(kind=ip), intent(in) :: idz

    derivative of piecewise polynomial to evaluate.

    integer(kind=ip), intent(in) :: idq

    derivative of piecewise polynomial to evaluate.

    real(kind=wp), intent(out), dimension(:) :: f

    (nf) interpolated values of the outputs (see number_of_outputs)

    integer(kind=ip), intent(out) :: iflag

    status flag (see db4val)

procedure, public :: destroy => destroy_4d

  • private pure subroutine destroy_4d(me)

    Destructor for bspline_4d class.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

procedure, public :: size_of => size_4d

  • private pure function size_4d(me) result(s)

    Actual size of a bspline_4d structure in bits.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(in) :: me

    Return Value integer(kind=ip)

    size of the structure in bits

generic, public :: initialize_from_coefficients => initialize_from_coefficients_4d, initialize_from_coefficients_4d_multi

  • private pure subroutine initialize_from_coefficients_4d(me, tx, ty, tz, tq, bcoef, kx, ky, kz, kq, iflag, extrap)

    Initialize a bspline_4d type directly from its knots and b-spline coefficients (for example, those saved from another object with get_knots and get_coefficients), without interpolating any data.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

    real(kind=wp), intent(in), dimension(:) :: tx

    The (nx+kx) knots in the direction. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: ty

    The (ny+ky) knots in the direction. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: tz

    The (nz+kz) knots in the direction. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: tq

    The (nq+kq) knots in the direction. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:,:,:,:) :: bcoef

    (nx,ny,nz,nq) array of b-spline coefficients

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(out) :: iflag

    status flag:

    Read more…
    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

  • private pure subroutine initialize_from_coefficients_4d_multi(me, tx, ty, tz, tq, bcoef, kx, ky, kz, kq, iflag, extrap)

    Initialize a bspline_4d type with multiple outputs directly from its knots and b-spline coefficients. The last dimension of bcoef is the output index.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

    real(kind=wp), intent(in), dimension(:) :: tx

    The (nx+kx) knots in the direction.

    real(kind=wp), intent(in), dimension(:) :: ty

    The (ny+ky) knots in the direction.

    real(kind=wp), intent(in), dimension(:) :: tz

    The (nz+kz) knots in the direction.

    real(kind=wp), intent(in), dimension(:) :: tq

    The (nq+kq) knots in the direction.

    real(kind=wp), intent(in), dimension(:,:,:,:,:) :: bcoef

    (nx,ny,nz,nq,nf) array of b-spline coefficients

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in

    integer(kind=ip), intent(out) :: iflag

    status flag (see initialize_from_coefficients_4d), or 6005 if bcoef has no outputs

    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

procedure, private :: initialize_from_coefficients_4d

  • private pure subroutine initialize_from_coefficients_4d(me, tx, ty, tz, tq, bcoef, kx, ky, kz, kq, iflag, extrap)

    Initialize a bspline_4d type directly from its knots and b-spline coefficients (for example, those saved from another object with get_knots and get_coefficients), without interpolating any data.

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

    real(kind=wp), intent(in), dimension(:) :: tx

    The (nx+kx) knots in the direction. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: ty

    The (ny+ky) knots in the direction. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: tz

    The (nz+kz) knots in the direction. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:) :: tq

    The (nq+kq) knots in the direction. Must be non-decreasing.

    real(kind=wp), intent(in), dimension(:,:,:,:) :: bcoef

    (nx,ny,nz,nq) array of b-spline coefficients

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in ( ) (order = polynomial degree + 1)

    integer(kind=ip), intent(out) :: iflag

    status flag:

    Read more…
    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

procedure, private :: initialize_from_coefficients_4d_multi

  • private pure subroutine initialize_from_coefficients_4d_multi(me, tx, ty, tz, tq, bcoef, kx, ky, kz, kq, iflag, extrap)

    Initialize a bspline_4d type with multiple outputs directly from its knots and b-spline coefficients. The last dimension of bcoef is the output index.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

    real(kind=wp), intent(in), dimension(:) :: tx

    The (nx+kx) knots in the direction.

    real(kind=wp), intent(in), dimension(:) :: ty

    The (ny+ky) knots in the direction.

    real(kind=wp), intent(in), dimension(:) :: tz

    The (nz+kz) knots in the direction.

    real(kind=wp), intent(in), dimension(:) :: tq

    The (nq+kq) knots in the direction.

    real(kind=wp), intent(in), dimension(:,:,:,:,:) :: bcoef

    (nx,ny,nz,nq,nf) array of b-spline coefficients

    integer(kind=ip), intent(in) :: kx

    The order of spline pieces in

    integer(kind=ip), intent(in) :: ky

    The order of spline pieces in

    integer(kind=ip), intent(in) :: kz

    The order of spline pieces in

    integer(kind=ip), intent(in) :: kq

    The order of spline pieces in

    integer(kind=ip), intent(out) :: iflag

    status flag (see initialize_from_coefficients_4d), or 6005 if bcoef has no outputs

    logical, intent(in), optional :: extrap

    if true, then extrapolation is allowed (default is false)

procedure, public :: get_knots => get_knots_4d

  • private pure subroutine get_knots_4d(me, tx, ty, tz, tq, iflag)

    Returns the knot vectors of a bspline_4d.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

    real(kind=wp), intent(out), dimension(:), allocatable :: tx

    the (nx+kx) knots in the direction

    real(kind=wp), intent(out), dimension(:), allocatable :: ty

    the (ny+ky) knots in the direction

    real(kind=wp), intent(out), dimension(:), allocatable :: tz

    the (nz+kz) knots in the direction

    real(kind=wp), intent(out), dimension(:), allocatable :: tq

    the (nq+kq) knots in the direction

    integer(kind=ip), intent(out) :: iflag

    status flag: 0 if no errors, 1 if the class is not initialized

generic, public :: get_coefficients => get_coefficients_4d, get_coefficients_4d_multi

  • private pure subroutine get_coefficients_4d(me, bcoef, iflag)

    Returns the b-spline coefficients of a bspline_4d. These are the values of the control points (see greville_abscissae for their locations).

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

    real(kind=wp), intent(out), dimension(:,:,:,:), allocatable :: bcoef

    (nx,ny,nz,nq) array of b-spline coefficients

    integer(kind=ip), intent(out) :: iflag

    status flag: 0 if no errors, 1 if the class is not initialized

  • private pure subroutine get_coefficients_4d_multi(me, bcoef, iflag)

    Returns the b-spline coefficients of a bspline_4d with any number of outputs. The last dimension of bcoef is the output index.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

    real(kind=wp), intent(out), dimension(:,:,:,:,:), allocatable :: bcoef

    (nx,ny,nz,nq,nf) array of b-spline coefficients

    integer(kind=ip), intent(out) :: iflag

    status flag: 0 if no errors, 1 if the class is not initialized

procedure, private :: get_coefficients_4d

  • private pure subroutine get_coefficients_4d(me, bcoef, iflag)

    Returns the b-spline coefficients of a bspline_4d. These are the values of the control points (see greville_abscissae for their locations).

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

    real(kind=wp), intent(out), dimension(:,:,:,:), allocatable :: bcoef

    (nx,ny,nz,nq) array of b-spline coefficients

    integer(kind=ip), intent(out) :: iflag

    status flag: 0 if no errors, 1 if the class is not initialized

procedure, private :: get_coefficients_4d_multi

  • private pure subroutine get_coefficients_4d_multi(me, bcoef, iflag)

    Returns the b-spline coefficients of a bspline_4d with any number of outputs. The last dimension of bcoef is the output index.

    Arguments

    Type IntentOptional Attributes Name
    class(bspline_4d), intent(inout) :: me

    the spline

    real(kind=wp), intent(out), dimension(:,:,:,:,:), allocatable :: bcoef

    (nx,ny,nz,nq,nf) array of b-spline coefficients

    integer(kind=ip), intent(out) :: iflag

    status flag: 0 if no errors, 1 if the class is not initialized

Source Code

    type,extends(bspline_class),public :: bspline_4d
        !! Class for 4d b-spline interpolation.
        private
        integer(ip) :: nx = 0_ip  !! Number of \(x\) abcissae
        integer(ip) :: ny = 0_ip  !! Number of \(y\) abcissae
        integer(ip) :: nz = 0_ip  !! Number of \(z\) abcissae
        integer(ip) :: nq = 0_ip  !! Number of \(q\) abcissae
        integer(ip) :: kx = 0_ip  !! The order of spline pieces in \(x\)
        integer(ip) :: ky = 0_ip  !! The order of spline pieces in \(y\)
        integer(ip) :: kz = 0_ip  !! The order of spline pieces in \(z\)
        integer(ip) :: kq = 0_ip  !! The order of spline pieces in \(q\)
        real(wp),dimension(:,:,:,:,:),allocatable :: bcoef  !! array of coefficients of the b-spline interpolant
                                                          !! (the last dimension is the output index)
        real(wp),dimension(:),allocatable :: tx  !! The knots in the \(x\) direction for the spline interpolant
        real(wp),dimension(:),allocatable :: ty  !! The knots in the \(y\) direction for the spline interpolant
        real(wp),dimension(:),allocatable :: tz  !! The knots in the \(z\) direction for the spline interpolant
        real(wp),dimension(:),allocatable :: tq  !! The knots in the \(q\) direction for the spline interpolant
        integer(ip) :: inbvy = 1_ip  !! internal variable used for efficient processing
        integer(ip) :: inbvz = 1_ip  !! internal variable used for efficient processing
        integer(ip) :: inbvq = 1_ip  !! internal variable used for efficient processing
        integer(ip) :: iloy  = 1_ip  !! internal variable used for efficient processing
        integer(ip) :: iloz  = 1_ip  !! internal variable used for efficient processing
        integer(ip) :: iloq  = 1_ip  !! internal variable used for efficient processing
        real(wp),dimension(:,:,:),allocatable :: work_val_1  !! [[db4val]] work array of dimension `ky,kz,kq`
        real(wp),dimension(:,:),allocatable   :: work_val_2  !! [[db4val]] work array of dimension `kz,kq`
        real(wp),dimension(:),allocatable     :: work_val_3  !! [[db4val]] work array of dimension `kq`
        real(wp),dimension(:),allocatable     :: work_val_4  !! [[db4val]] work array of dimension `3_ip*max(kx,ky,kz,kq)`
        contains
        private
        generic,public :: initialize => initialize_4d_auto_knots,initialize_4d_specify_knots,&
                                        initialize_4d_auto_knots_multi,initialize_4d_specify_knots_multi
        procedure :: initialize_4d_auto_knots_multi
        procedure :: initialize_4d_specify_knots_multi
        procedure :: initialize_4d_auto_knots
        procedure :: initialize_4d_specify_knots
        generic,public :: evaluate => evaluate_4d, evaluate_4d_multi
        procedure :: evaluate_4d
        procedure :: evaluate_4d_multi
        procedure,public :: destroy => destroy_4d
        procedure,public :: size_of => size_4d
        generic,public :: initialize_from_coefficients => initialize_from_coefficients_4d,&
                                                          initialize_from_coefficients_4d_multi
        procedure :: initialize_from_coefficients_4d
        procedure :: initialize_from_coefficients_4d_multi
        procedure,public :: get_knots => get_knots_4d
        generic,public :: get_coefficients => get_coefficients_4d, get_coefficients_4d_multi
        procedure :: get_coefficients_4d
        procedure :: get_coefficients_4d_multi
        final :: finalize_4d
    end type bspline_4d