initialize_from_coefficients_5d Subroutine

private pure subroutine initialize_from_coefficients_5d(me, tx, ty, tz, tq, tr, bcoef, kx, ky, kz, kq, kr, iflag, extrap)

Initialize a bspline_5d 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.

The number of coefficients in each direction is taken from the shape of bcoef.

Type Bound

bspline_5d

Arguments

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

The (nr+kr) knots in the direction. Must be non-decreasing.

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

(nx,ny,nz,nq,nr) 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(in) :: kr

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

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

status flag:

logical, intent(in), optional :: extrap

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


Calls

proc~~initialize_from_coefficients_5d~~CallsGraph proc~initialize_from_coefficients_5d bspline_5d%initialize_from_coefficients_5d proc~check_coefficients check_coefficients proc~initialize_from_coefficients_5d->proc~check_coefficients proc~destroy_5d bspline_5d%destroy_5d proc~initialize_from_coefficients_5d->proc~destroy_5d proc~set_extrap_flag bspline_class%set_extrap_flag proc~initialize_from_coefficients_5d->proc~set_extrap_flag proc~destroy_base bspline_class%destroy_base proc~destroy_5d->proc~destroy_base

Called by

proc~~initialize_from_coefficients_5d~~CalledByGraph proc~initialize_from_coefficients_5d bspline_5d%initialize_from_coefficients_5d none~initialize_from_coefficients~5 bspline_5d%initialize_from_coefficients none~initialize_from_coefficients~5->proc~initialize_from_coefficients_5d proc~initialize_from_coefficients_5d_multi bspline_5d%initialize_from_coefficients_5d_multi none~initialize_from_coefficients~5->proc~initialize_from_coefficients_5d_multi proc~initialize_from_coefficients_5d_multi->none~initialize_from_coefficients~5

Source Code

    pure subroutine initialize_from_coefficients_5d(me,tx,ty,tz,tq,tr,bcoef,kx,ky,kz,kq,kr,iflag,extrap)

    implicit none

    class(bspline_5d),intent(inout) :: me  !! the spline
    real(wp),dimension(:),intent(in) :: tx  !! The `(nx+kx)` knots in the \(x\) direction.
                                            !! Must be non-decreasing.
    real(wp),dimension(:),intent(in) :: ty  !! The `(ny+ky)` knots in the \(y\) direction.
                                            !! Must be non-decreasing.
    real(wp),dimension(:),intent(in) :: tz  !! The `(nz+kz)` knots in the \(z\) direction.
                                            !! Must be non-decreasing.
    real(wp),dimension(:),intent(in) :: tq  !! The `(nq+kq)` knots in the \(q\) direction.
                                            !! Must be non-decreasing.
    real(wp),dimension(:),intent(in) :: tr  !! The `(nr+kr)` knots in the \(r\) direction.
                                            !! Must be non-decreasing.
    real(wp),dimension(:,:,:,:,:),intent(in) :: bcoef  !! `(nx,ny,nz,nq,nr)` array of b-spline coefficients
    integer(ip),intent(in) :: kx  !! The order of spline pieces in \(x\)
                                  !! ( \( 1 \le k_x \le n_x \) )
                                  !! (order = polynomial degree + 1)
    integer(ip),intent(in) :: ky  !! The order of spline pieces in \(y\)
                                  !! ( \( 1 \le k_y \le n_y \) )
                                  !! (order = polynomial degree + 1)
    integer(ip),intent(in) :: kz  !! The order of spline pieces in \(z\)
                                  !! ( \( 1 \le k_z \le n_z \) )
                                  !! (order = polynomial degree + 1)
    integer(ip),intent(in) :: kq  !! The order of spline pieces in \(q\)
                                  !! ( \( 1 \le k_q \le n_q \) )
                                  !! (order = polynomial degree + 1)
    integer(ip),intent(in) :: kr  !! The order of spline pieces in \(r\)
                                  !! ( \( 1 \le k_r \le n_r \) )
                                  !! (order = polynomial degree + 1)
    integer(ip),intent(out) :: iflag  !! status flag:
                                      !!
                                      !! * 0: no errors
                                      !! * 5001-5005: invalid knots or coefficients
                                      !!   (see [[get_status_message]])
    logical,intent(in),optional :: extrap  !! if true, then extrapolation is allowed
                                           !! (default is false)

    integer(ip),dimension(5) :: n  !! number of coefficients in each direction

    call me%destroy()

    n = shape(bcoef,kind=ip)
    call check_coefficients(n(1),kx,tx,iflag)
    if (iflag==0_ip) call check_coefficients(n(2),ky,ty,iflag)
    if (iflag==0_ip) call check_coefficients(n(3),kz,tz,iflag)
    if (iflag==0_ip) call check_coefficients(n(4),kq,tq,iflag)
    if (iflag==0_ip) call check_coefficients(n(5),kr,tr,iflag)

    if (iflag == 0_ip) then

        me%nx = n(1)
        me%ny = n(2)
        me%nz = n(3)
        me%nq = n(4)
        me%nr = n(5)
        me%kx = kx
        me%ky = ky
        me%kz = kz
        me%kq = kq
        me%kr = kr
        allocate(me%bcoef(n(1),n(2),n(3),n(4),n(5),1_ip))  ! (assigned below: no temporary array)
        me%bcoef(:,:,:,:,:,1) = bcoef
        me%nf = 1_ip
        me%tx = tx
        me%ty = ty
        me%tz = tz
        me%tq = tq
        me%tr = tr
        allocate(me%work_val_1(ky,kz,kq,kr))
        allocate(me%work_val_2(kz,kq,kr))
        allocate(me%work_val_3(kq,kr))
        allocate(me%work_val_4(kr))
        allocate(me%work_val_5(3_ip*max(kx,ky,kz,kq,kr)))

        call me%set_extrap_flag(extrap)

    end if

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

    end subroutine initialize_from_coefficients_5d