s_spline_1d__init Subroutine

private subroutine s_spline_1d__init(self, bsplines)

Type Bound

sll_t_spline_1d

Arguments

Type IntentOptional Attributes Name
class(sll_t_spline_1d), intent(out) :: self

1D spline: new element of 1D spline space

class(sll_c_bsplines), intent(in), target :: bsplines

B-splines: given basis of 1D spline space


Source Code

  subroutine s_spline_1d__init( self, bsplines )

    class(sll_t_spline_1d), intent(  out)         :: self
    class(sll_c_bsplines ), intent(in   ), target :: bsplines

    ! Store pointer to B-splines
    self%bspl => bsplines

    ! Allocate array of spline coefficients
    ! in case of periodic BCs, a larger array of coefficients is used in order
    ! to avoid a loop with calls to the "mod( , )" function at evaluation.
    associate( n => bsplines % nbasis, &
               g => merge( 1 + bsplines % degree/2, 0, bsplines % periodic ) )

      allocate( self%bcoef(1-g:n+g) )

    end associate

    ! Set all coefficients to zero
    self%bcoef = 0.0_f64

  end subroutine s_spline_1d__init