initialize_from_coefficients_1d Subroutine

private pure subroutine initialize_from_coefficients_1d(me, tx, bcoef, kx, iflag, extrap)

Initialize a bspline_1d 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_1d

Arguments

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

(nx) 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(out) :: iflag

status flag:

logical, intent(in), optional :: extrap

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


Calls

proc~~initialize_from_coefficients_1d~~CallsGraph proc~initialize_from_coefficients_1d bspline_1d%initialize_from_coefficients_1d proc~check_coefficients check_coefficients proc~initialize_from_coefficients_1d->proc~check_coefficients proc~destroy_1d bspline_1d%destroy_1d proc~initialize_from_coefficients_1d->proc~destroy_1d proc~set_extrap_flag bspline_class%set_extrap_flag proc~initialize_from_coefficients_1d->proc~set_extrap_flag proc~destroy_base bspline_class%destroy_base proc~destroy_1d->proc~destroy_base

Called by

proc~~initialize_from_coefficients_1d~~CalledByGraph proc~initialize_from_coefficients_1d bspline_1d%initialize_from_coefficients_1d none~initialize_from_coefficients bspline_1d%initialize_from_coefficients none~initialize_from_coefficients->proc~initialize_from_coefficients_1d proc~initialize_from_coefficients_1d_multi bspline_1d%initialize_from_coefficients_1d_multi none~initialize_from_coefficients->proc~initialize_from_coefficients_1d_multi proc~initialize_from_coefficients_1d_multi->none~initialize_from_coefficients

Source Code

    pure subroutine initialize_from_coefficients_1d(me,tx,bcoef,kx,iflag,extrap)

    implicit none

    class(bspline_1d),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) :: bcoef  !! `(nx)` 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(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(1) :: 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) then

        me%nx = n(1)
        me%kx = kx
        allocate(me%bcoef(n(1),1_ip))  ! (assigned below: no temporary array)
        me%bcoef(:,1) = bcoef
        me%nf = 1_ip
        me%tx = tx
        allocate(me%work_val_1(3_ip*kx))

        call me%set_extrap_flag(extrap)

    end if

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

    end subroutine initialize_from_coefficients_1d