initialize_4d_auto_knots Subroutine

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.

Type Bound

bspline_4d

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)


Calls

proc~~initialize_4d_auto_knots~~CallsGraph proc~initialize_4d_auto_knots bspline_oo_module::bspline_4d%initialize_4d_auto_knots proc~db4ink bspline_sub_module::db4ink proc~initialize_4d_auto_knots->proc~db4ink proc~destroy_4d bspline_oo_module::bspline_4d%destroy_4d proc~initialize_4d_auto_knots->proc~destroy_4d proc~set_extrap_flag bspline_oo_module::bspline_class%set_extrap_flag proc~initialize_4d_auto_knots->proc~set_extrap_flag proc~check_inputs bspline_sub_module::check_inputs proc~db4ink->proc~check_inputs proc~dbknot bspline_sub_module::dbknot proc~db4ink->proc~dbknot proc~dbtpcf bspline_sub_module::dbtpcf proc~db4ink->proc~dbtpcf proc~dbintk bspline_sub_module::dbintk proc~dbtpcf->proc~dbintk proc~dbnslv bspline_sub_module::dbnslv proc~dbtpcf->proc~dbnslv proc~dbintk->proc~dbnslv proc~dbnfac bspline_sub_module::dbnfac proc~dbintk->proc~dbnfac proc~dbspvn bspline_sub_module::dbspvn proc~dbintk->proc~dbspvn

Called by

proc~~initialize_4d_auto_knots~~CalledByGraph proc~initialize_4d_auto_knots bspline_oo_module::bspline_4d%initialize_4d_auto_knots proc~bspline_4d_constructor_auto_knots bspline_oo_module::bspline_4d_constructor_auto_knots proc~bspline_4d_constructor_auto_knots->proc~initialize_4d_auto_knots interface~bspline_4d bspline_oo_module::bspline_4d interface~bspline_4d->proc~bspline_4d_constructor_auto_knots

Source Code

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

    implicit none

    class(bspline_4d),intent(inout)            :: me
    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)           :: z   !! `(nz)` array of \(z\) abcissae. Must be strictly increasing.
    real(wp),dimension(:),intent(in)           :: q   !! `(nq)` array of \(q\) abcissae. Must be strictly increasing.
    real(wp),dimension(:,:,:,:),intent(in)     :: 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(ip),intent(in)                     :: kx  !! The order of spline pieces in \(x\)
                                                      !! ( \( 2 \le k_x < n_x \) )
                                                      !! (order = polynomial degree + 1)
    integer(ip),intent(in)                     :: ky  !! The order of spline pieces in \(y\)
                                                      !! ( \( 2 \le k_y < n_y \) )
                                                      !! (order = polynomial degree + 1)
    integer(ip),intent(in)                     :: kz  !! The order of spline pieces in \(z\)
                                                      !! ( \( 2 \le k_z < n_z \) )
                                                      !! (order = polynomial degree + 1)
    integer(ip),intent(in)                     :: kq  !! The order of spline pieces in \(q\)
                                                      !! ( \( 2 \le k_q < n_q \) )
                                                      !! (order = polynomial degree + 1)
    integer(ip),intent(out)  :: iflag                     !! status flag (see [[db4ink]])
    logical,intent(in),optional  :: extrap            !! if true, then extrapolation is allowed
                                                      !! (default is false)

    integer(ip) :: iknot
    integer(ip) :: nx,ny,nz,nq

    call me%destroy()

    nx = size(x,kind=ip)
    ny = size(y,kind=ip)
    nz = size(z,kind=ip)
    nq = size(q,kind=ip)

    me%nx = nx
    me%ny = ny
    me%nz = nz
    me%nq = nq

    me%kx = kx
    me%ky = ky
    me%kz = kz
    me%kq = kq

    allocate(me%tx(nx+kx))
    allocate(me%ty(ny+ky))
    allocate(me%tz(nz+kz))
    allocate(me%tq(nq+kq))
    allocate(me%bcoef(nx,ny,nz,nq))
    allocate(me%work_val_1(ky,kz,kq))
    allocate(me%work_val_2(kz,kq))
    allocate(me%work_val_3(kq))
    allocate(me%work_val_4(3_ip*max(kx,ky,kz,kq)))

    iknot = 0_ip         !knot sequence chosen by db4ink

    call db4ink(x,nx,y,ny,z,nz,q,nq,&
                fcn,&
                kx,ky,kz,kq,&
                iknot,&
                me%tx,me%ty,me%tz,me%tq,&
                me%bcoef,iflag)

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

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

    end subroutine initialize_4d_auto_knots