initialize_2d_specify_knots_multi Subroutine

private pure subroutine initialize_2d_specify_knots_multi(me, x, y, fcn, kx, ky, tx, ty, iflag, extrap)

Initialize a bspline_2d 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 db2ink (multiple-output version).

Type Bound

bspline_2d

Arguments

Type IntentOptional Attributes Name
class(bspline_2d), 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(:,:,:) :: fcn

(nx,ny,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

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.

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

status flag (see db2ink)

logical, intent(in), optional :: extrap

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


Calls

proc~~initialize_2d_specify_knots_multi~~CallsGraph proc~initialize_2d_specify_knots_multi bspline_2d%initialize_2d_specify_knots_multi interface~db2ink db2ink proc~initialize_2d_specify_knots_multi->interface~db2ink proc~check_knot_vectors_sizes check_knot_vectors_sizes proc~initialize_2d_specify_knots_multi->proc~check_knot_vectors_sizes proc~destroy_2d bspline_2d%destroy_2d proc~initialize_2d_specify_knots_multi->proc~destroy_2d proc~set_extrap_flag bspline_class%set_extrap_flag proc~initialize_2d_specify_knots_multi->proc~set_extrap_flag proc~db2ink_default db2ink_default interface~db2ink->proc~db2ink_default proc~db2ink_multi db2ink_multi interface~db2ink->proc~db2ink_multi proc~destroy_base bspline_class%destroy_base proc~destroy_2d->proc~destroy_base proc~check_inputs check_inputs proc~db2ink_default->proc~check_inputs proc~dbknot dbknot proc~db2ink_default->proc~dbknot proc~dbtpcf dbtpcf proc~db2ink_default->proc~dbtpcf proc~db2ink_multi->proc~db2ink_default proc~dbintk dbintk proc~dbtpcf->proc~dbintk proc~dbnslv dbnslv proc~dbtpcf->proc~dbnslv proc~dbintk->proc~dbnslv proc~dbnfac dbnfac proc~dbintk->proc~dbnfac proc~dbspvn dbspvn proc~dbintk->proc~dbspvn

Source Code

    pure subroutine initialize_2d_specify_knots_multi(me,x,y,fcn,kx,ky,tx,ty,iflag,extrap)

    implicit none

    class(bspline_2d),intent(inout) :: me  !! the spline
    real(wp),dimension(:),intent(in) :: x  !! `(nx)` array of \(x\) abcissae. Must be strictly increasing.
    real(wp),dimension(:),intent(in) :: y  !! `(ny)` array of \(y\) abcissae. Must be strictly increasing.
    real(wp),dimension(:,:,:),intent(in) :: fcn  !! `(nx,ny,nf)` array of function values to interpolate
                                                  !! (the last dimension is the output index)
    integer(ip),intent(in) :: kx  !! The order of spline pieces in \(x\)
    integer(ip),intent(in) :: ky  !! The order of spline pieces in \(y\)
    real(wp),dimension(:),intent(in) :: tx  !! The `(nx+kx)` knots in the \(x\) direction.
    real(wp),dimension(:),intent(in) :: ty  !! The `(ny+ky)` knots in the \(y\) direction.
    integer(ip),intent(out) :: iflag  !! status flag (see [[db2ink]])
    logical,intent(in),optional :: extrap  !! if true, then extrapolation is allowed
                                           !! (default is false)

    integer(ip),dimension(2) :: n  !! number of points in each direction
    integer(ip) :: nf  !! number of outputs

    call me%destroy()

    n(1) = size(x,kind=ip)
    n(2) = size(y,kind=ip)
    nf = size(fcn,3,kind=ip)

    call check_knot_vectors_sizes(nx=n(1),kx=kx,tx=tx,ny=n(2),ky=ky,ty=ty,iflag=iflag)
    if (iflag/=0_ip) then
        me%iflag = iflag
        return
    end if

    me%nx = n(1)
    me%ny = n(2)
    me%kx = kx
    me%ky = ky
    allocate(me%tx(n(1)+kx))
    allocate(me%ty(n(2)+ky))
    allocate(me%bcoef(n(1),n(2),nf))
    allocate(me%work_val_1(ky))
    allocate(me%work_val_2(3_ip*max(kx,ky)))

    me%tx = tx
    me%ty = ty
    call db2ink(x,n(1),y,n(2),fcn,kx,ky,1_ip,me%tx,me%ty,me%bcoef,iflag)

    if (iflag==0_ip) then
        me%nf = nf
        call me%set_extrap_flag(extrap)
    end if

    me%initialized = iflag==0_ip
    me%iflag = iflag

    end subroutine initialize_2d_specify_knots_multi