UpdateBasis Subroutine

private pure subroutine UpdateBasis(me, nk, k, p)

Updates all component of the basis according to input knot vector.

Arguments

Type IntentOptional AttributesName
class(basis), intent(inout) :: me
integer, intent(in) :: nk

Number of the knots

real(kind=wp), intent(in) :: k(nk)

New knot vector

integer, intent(in), optional :: p

New basis degree


Contents

Source Code


Source Code

        pure subroutine UpdateBasis(me,nk,k,p)
            class(basis), intent(inout)     :: me
            integer, intent(in)             :: nk       !< Number of the knots
            real(wp), intent(in)            :: k(nk)    !< New knot vector 
            integer, intent(in), optional   :: p        !< New basis degree
            !locals
            ! real(wp), allocatable       :: uniq(:)
            integer                     :: i

            deallocate(me%kv)
            if(present(p)) me%p = p
            me%nk   = nk
            me%m    = nk - 1
            me%nb   = nk - ( me%p + 1 )     !number of basis functions or control points
            me%n    = me%nb - 1          !highest index of the basis functions or control points
            allocate(me%kv(0:nk-1), source=k)
                        
            !calculate bezier segments, minimum and maximum regularities
            call me%BSegments(me%nbez,me%unik)
            if(allocated(me%mult)) deallocate(me%mult)
            allocate(me%mult(me%nbez+1))
            do i=1,me%nbez+1
                me%mult(i) = me%FindMult(i=me%FindSpan(me%unik(i)),u=me%unik(i))
            end do
            if(me%nbez>1)then
                me%minreg = me%p - maxval(me%mult(2:me%nbez))
                me%maxreg = me%p - minval(me%mult(2:me%nbez))
            else
                me%minreg = me%p
                me%maxreg = me%p
             end if
            
            !me%ngp = me%get_nquad()

        end subroutine UpdateBasis