dbknot Subroutine

private subroutine dbknot(x, n, k, t)

Arguments

Type IntentOptional AttributesName
real(kind=wp), intent(in), dimension(n):: x
integer, intent(in) :: n
integer, intent(in) :: k
real(kind=wp), intent(out), dimension(:):: t

Called by

proc~~dbknot~~CalledByGraph proc~dbknot dbknot proc~db1ink db1ink proc~db1ink->proc~dbknot proc~db2ink db2ink proc~db2ink->proc~dbknot

Contents

Source Code


Source Code

    subroutine dbknot(x,n,k,t)

    implicit none

    integer,intent(in)                 :: n
    integer,intent(in)                 :: k
    real(wp),dimension(n),intent(in)   :: x
    real(wp),dimension(:),intent(out)  :: t

    integer  :: i, j, ipj, npj, ip1, jstrt
    real(wp) :: rnot

    !put k knots at each endpoint
    !(shift right endpoints slightly -- see pg 350 of reference)
    rnot = x(n) + 0.1_wp*( x(n)-x(n-1) )
    do j=1,k
        t(j)   = x(1)
        npj    = n + j
        t(npj) = rnot
    enddo

    !distribute remaining knots

    if (mod(k,2) == 1)  then

        !case of odd k --  knots between data points

        i = (k-1)/2 - k
        ip1 = i + 1
        jstrt = k + 1
        do j=jstrt,n
            ipj = i + j
            t(j) = 0.5_wp*( x(ipj) + x(ipj+1) )
        enddo

    else

        !case of even k --  knots at data points

        i = (k/2) - k
        jstrt = k+1
        do j=jstrt,n
            ipj = i + j
            t(j) = x(ipj)
        enddo

    endif

    endsubroutine dbknot