sll_s_spline_1d_compute_num_cells Subroutine

public subroutine sll_s_spline_1d_compute_num_cells(degree, bc_xmin, bc_xmax, nipts, ncells)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: degree

spline degree

integer, intent(in) :: bc_xmin

boundary condition type at left boundary (x=xmin)

integer, intent(in) :: bc_xmax

boundary condition type at right boundary (x=xmax)

integer, intent(in) :: nipts

desired number of interpolation points

integer, intent(out) :: ncells

calculated number of cells in domain


Calls

proc~~sll_s_spline_1d_compute_num_cells~~CallsGraph proc~sll_s_spline_1d_compute_num_cells sll_s_spline_1d_compute_num_cells sll_assert sll_assert proc~sll_s_spline_1d_compute_num_cells->sll_assert sll_error sll_error proc~sll_s_spline_1d_compute_num_cells->sll_error

Source Code

  subroutine sll_s_spline_1d_compute_num_cells( &
      degree , &
      bc_xmin, &
      bc_xmax, &
      nipts  , &
      ncells )

    integer, intent(in   ) :: degree
    integer, intent(in   ) :: bc_xmin
    integer, intent(in   ) :: bc_xmax
    integer, intent(in   ) :: nipts
    integer, intent(  out) :: ncells

    ! Sanity checks
    SLL_ASSERT( degree > 0  )
    SLL_ASSERT( any( bc_xmin == allowed_bcs ) )
    SLL_ASSERT( any( bc_xmax == allowed_bcs ) )

    if (any( [bc_xmin,bc_xmax]==sll_p_periodic ) .and. bc_xmin /= bc_xmax) then
      SLL_ERROR( "sll_s_spline_1d_compute_num_cells", "Incompatible BCs" )
    end if

    if (bc_xmin == sll_p_periodic) then
      ncells = nipts
    else
      associate( nbc_xmin => merge( degree/2, 0, bc_xmin == sll_p_hermite ), &
                 nbc_xmax => merge( degree/2, 0, bc_xmax == sll_p_hermite ) )
        ncells = nipts + nbc_xmin + nbc_xmax - degree
      end associate
    end if

  end subroutine sll_s_spline_1d_compute_num_cells