s_bsplines_uniform__get_icell_and_offset Subroutine

private pure subroutine s_bsplines_uniform__get_icell_and_offset(self, x, icell, x_offset)

Arguments

Type IntentOptional Attributes Name
class(sll_t_bsplines_uniform), intent(in) :: self
real(kind=wp), intent(in) :: x
integer, intent(out) :: icell
real(kind=wp), intent(out) :: x_offset

Calls

proc~~s_bsplines_uniform__get_icell_and_offset~~CallsGraph proc~s_bsplines_uniform__get_icell_and_offset s_bsplines_uniform__get_icell_and_offset sll_assert sll_assert proc~s_bsplines_uniform__get_icell_and_offset->sll_assert

Called by

proc~~s_bsplines_uniform__get_icell_and_offset~~CalledByGraph proc~s_bsplines_uniform__get_icell_and_offset s_bsplines_uniform__get_icell_and_offset proc~s_bsplines_uniform__eval_basis sll_t_bsplines_uniform%s_bsplines_uniform__eval_basis proc~s_bsplines_uniform__eval_basis->proc~s_bsplines_uniform__get_icell_and_offset proc~s_bsplines_uniform__eval_basis_and_n_derivs sll_t_bsplines_uniform%s_bsplines_uniform__eval_basis_and_n_derivs proc~s_bsplines_uniform__eval_basis_and_n_derivs->proc~s_bsplines_uniform__get_icell_and_offset proc~s_bsplines_uniform__eval_deriv sll_t_bsplines_uniform%s_bsplines_uniform__eval_deriv proc~s_bsplines_uniform__eval_deriv->proc~s_bsplines_uniform__get_icell_and_offset

Source Code

  SLL_PURE subroutine s_bsplines_uniform__get_icell_and_offset( self, x, icell, x_offset )
    class(sll_t_bsplines_uniform), intent(in   ) :: self
    real(wp)                     , intent(in   ) :: x
    integer                      , intent(  out) :: icell
    real(wp)                     , intent(  out) :: x_offset

    SLL_ASSERT( x >= self % xmin )
    SLL_ASSERT( x <= self % xmax )

    if      (x == self%xmin) then; icell = 1          ; x_offset = 0.0_wp
    else if (x == self%xmax) then; icell = self%ncells; x_offset = 1.0_wp
    else
      x_offset = (x-self%xmin) * self%inv_dx  ! 0 <= x_offset <= num_cells
      icell    = int( x_offset )
      x_offset = x_offset - real( icell, wp ) ! 0 <= x_offset < 1
      icell    = icell + 1
    end if

  end subroutine s_bsplines_uniform__get_icell_and_offset