s_bsplines_uniform__eval_basis Subroutine

private pure subroutine s_bsplines_uniform__eval_basis(self, x, values, jmin)

Evaluate value at x of all basis functions with support in local cell values[j] = B_j(x) for jmin <= j <= jmin+degree

Type Bound

sll_t_bsplines_uniform

Arguments

Type IntentOptional Attributes Name
class(sll_t_bsplines_uniform), intent(in) :: self

uniform B-splines

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

evaluation point

real(kind=wp), intent(out) :: values(0:)
integer, intent(out) :: jmin

index of first non-zero B-spline


Calls

proc~~s_bsplines_uniform__eval_basis~~CallsGraph proc~s_bsplines_uniform__eval_basis sll_t_bsplines_uniform%s_bsplines_uniform__eval_basis proc~s_bsplines_uniform__get_icell_and_offset s_bsplines_uniform__get_icell_and_offset proc~s_bsplines_uniform__eval_basis->proc~s_bsplines_uniform__get_icell_and_offset sll_assert sll_assert proc~s_bsplines_uniform__eval_basis->sll_assert proc~s_bsplines_uniform__get_icell_and_offset->sll_assert

Source Code

  SLL_PURE subroutine s_bsplines_uniform__eval_basis( self, x, values, jmin )
    class(sll_t_bsplines_uniform), intent(in   ) :: self
    real(wp)                     , intent(in   ) :: x
    real(wp)                     , intent(  out) :: values(0:)
    integer                      , intent(  out) :: jmin

    integer  :: icell
    real(wp) :: x_offset

    integer  :: j, r
    real(wp) :: j_real
    real(wp) :: xx
    real(wp) :: temp
    real(wp) :: saved

    ! Check on inputs
    SLL_ASSERT( size(values) == 1+self%degree )

    ! 1. Compute cell index 'icell' and x_offset
    call s_bsplines_uniform__get_icell_and_offset( self, x, icell, x_offset )

    ! 2. Compute index range of B-splines with support over cell 'icell'
    jmin = icell - self%offset

    ! 3. Compute values of aforementioned B-splines
    associate( bspl => values, spline_degree => self%degree )

      bspl(0) = 1.0_wp
      do j = 1, spline_degree
         j_real = real(j,wp)
         xx     = -x_offset
         saved  = 0.0_wp
         do r = 0, j-1
            xx      = xx + 1.0_wp
            temp    = bspl(r) * inv(j)
            bspl(r) = saved + xx * temp
            saved   = (j_real - xx) * temp
         end do
         bspl(j) = saved
      end do

    end associate  ! bspl, spline_degree

  end subroutine s_bsplines_uniform__eval_basis