db1ink_alt Subroutine

private pure subroutine db1ink_alt(x, nx, fcn, kx, ibcl, ibcr, fbcl, fbcr, kntopt, tx, bcoef, iflag)

Alternate version of db1ink_default, where the boundary conditions can be specified.

History

  • Jacob Williams, 9/4/2018 : created this routine.

See also

  • dbint4 -- the main routine that is called here.

Note

The spline order kx must be at least 3.

Arguments

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

vector of abscissae of length nx, distinct and in increasing order

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

number of data points,

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

vector of ordinates of length nx

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

spline order (kx >= 3)

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

selection parameter for left boundary condition: constrain the ibcl-th derivative at x(1) to fbcl (1 <= ibcl <= kx-1, e.g. ibcl = 2 for a natural spline)

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

selection parameter for right boundary condition: constrain the ibcr-th derivative at x(nx) to fbcr (1 <= ibcr <= kx-1, e.g. ibcr = 2 for a natural spline)

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

left boundary values governed by ibcl

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

right boundary values governed by ibcr

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

knot selection parameter:

  • kntopt = 1 sets knot multiplicity at t(kx) and t(nx+3) to kx
  • kntopt = 2 sets a symmetric placement of knots about t(kx) and t(nx+3)
real(kind=wp), intent(out), dimension(:) :: tx

knot array of length nx+kx+2

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

b spline coefficient array of length nx+2

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

status flag (see dbint4)


Calls

proc~~db1ink_alt~~CallsGraph proc~db1ink_alt db1ink_alt proc~check_inputs check_inputs proc~db1ink_alt->proc~check_inputs proc~dbint4 dbint4 proc~db1ink_alt->proc~dbint4 proc~dbspvd dbspvd proc~dbint4->proc~dbspvd proc~dgbfa dgbfa proc~dbint4->proc~dgbfa proc~dgbsl dgbsl proc~dbint4->proc~dgbsl proc~dintrv dintrv proc~dbint4->proc~dintrv proc~dbspvn dbspvn proc~dbspvd->proc~dbspvn proc~get_temp_x_for_extrap get_temp_x_for_extrap proc~dintrv->proc~get_temp_x_for_extrap

Called by

proc~~db1ink_alt~~CalledByGraph proc~db1ink_alt db1ink_alt interface~db1ink db1ink interface~db1ink->proc~db1ink_alt proc~initialize_1d_auto_knots bspline_1d%initialize_1d_auto_knots proc~initialize_1d_auto_knots->interface~db1ink proc~initialize_1d_auto_knots_multi bspline_1d%initialize_1d_auto_knots_multi proc~initialize_1d_auto_knots_multi->interface~db1ink proc~initialize_1d_specify_knots bspline_1d%initialize_1d_specify_knots proc~initialize_1d_specify_knots->interface~db1ink proc~initialize_1d_specify_knots_multi bspline_1d%initialize_1d_specify_knots_multi proc~initialize_1d_specify_knots_multi->interface~db1ink proc~bspline_1d_constructor_auto_knots bspline_1d_constructor_auto_knots proc~bspline_1d_constructor_auto_knots->proc~initialize_1d_auto_knots proc~bspline_1d_constructor_specify_knots bspline_1d_constructor_specify_knots proc~bspline_1d_constructor_specify_knots->proc~initialize_1d_specify_knots interface~bspline_1d bspline_1d interface~bspline_1d->proc~bspline_1d_constructor_auto_knots interface~bspline_1d->proc~bspline_1d_constructor_specify_knots

Source Code

    pure subroutine db1ink_alt(x,nx,fcn,kx,ibcl,ibcr,fbcl,fbcr,kntopt,tx,bcoef,iflag)

    implicit none

    real(wp),dimension(:),intent(in)   :: x       !! \(x\) vector of abscissae of length `nx`, distinct
                                                  !! and in increasing order
    integer(ip),intent(in)             :: nx      !! number of data points, \( n_x \ge \max(2,k_x-2) \)
    real(wp),dimension(:),intent(in)   :: fcn     !! \(y\) vector of ordinates of length `nx`
    integer(ip),intent(in)             :: kx      !! spline order (`kx >= 3`)
    integer(ip),intent(in)             :: ibcl    !! selection parameter for left boundary condition:
                                                  !! constrain the `ibcl`-th derivative at `x(1)` to `fbcl`
                                                  !! (`1 <= ibcl <= kx-1`, e.g. `ibcl = 2` for a natural spline)
    integer(ip),intent(in)             :: ibcr    !! selection parameter for right boundary condition:
                                                  !! constrain the `ibcr`-th derivative at `x(nx)` to `fbcr`
                                                  !! (`1 <= ibcr <= kx-1`, e.g. `ibcr = 2` for a natural spline)
    real(wp),intent(in)                :: fbcl    !! left boundary values governed by `ibcl`
    real(wp),intent(in)                :: fbcr    !! right boundary values governed by `ibcr`
    integer(ip),intent(in)             :: kntopt  !! knot selection parameter:
                                                  !!
                                                  !! * `kntopt = 1` sets knot multiplicity at `t(kx)` and
                                                  !!   `t(nx+3)` to `kx`
                                                  !! * `kntopt = 2` sets a symmetric placement of knots
                                                  !!   about `t(kx)` and `t(nx+3)`
    real(wp),dimension(:),intent(out)  :: tx      !! knot array of length `nx+kx+2`
    real(wp),dimension(:),intent(out)  :: bcoef   !! b spline coefficient array of length `nx+2`
    integer(ip),intent(out)            :: iflag   !! status flag (see [[dbint4]])

    integer(ip)                         :: n         !! number of coefficients (n=nx+2)
    logical                             :: status_ok !! status flag for error checking

    real(wp),dimension(0),parameter :: tleft = 0.0_wp   !! not used for this case (see [[dbint4]])
    real(wp),dimension(0),parameter :: tright = 0.0_wp  !! not used for this case (see [[dbint4]])

    if (kntopt /= 1_ip .and. kntopt /= 2_ip) then
        iflag = 2005_ip ! use db1ink_alt_2 to specify the end knots
    else

        call check_inputs(  1_ip,& ! so it will check size of t
                            iflag,&
                            nx=nx,&
                            kx=kx,&
                            x=x,&
                            f1=fcn,&
                            bcoef1=bcoef,&
                            tx=tx,&
                            status_ok=status_ok,&
                            alt=.true.)

        if (status_ok) then
            call dbint4(x,fcn,nx,ibcl,ibcr,fbcl,fbcr,kntopt,tleft,tright,tx,bcoef,n,kx,iflag)
        end if

    end if

    end subroutine db1ink_alt