| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sll_t_bsplines_non_uniform), | intent(out) | :: | self |
non-uniform B-splines |
||
| integer, | intent(in) | :: | degree |
spline degree |
||
| logical, | intent(in) | :: | periodic |
.true. if domain is periodic, .false. otherwise |
||
| real(kind=wp), | intent(in) | :: | breaks(:) |
subroutine s_bsplines_non_uniform__init( self, degree, periodic, breaks ) class(sll_t_bsplines_non_uniform), intent( out) :: self integer , intent(in ) :: degree logical , intent(in ) :: periodic real(wp) , intent(in ) :: breaks(:) integer :: i real(wp) :: period ! length of period for periodic B-splines ! Public attributes self % degree = degree self % periodic = periodic self % uniform = .false. self % ncells = size(breaks) - 1 self % nbasis = merge( self%ncells, self%ncells+degree, periodic ) self % offset = merge( degree/2 , 0 , periodic ) self % xmin = breaks(1) self % xmax = breaks(self%ncells+1) ! Create the knots array from the grid points. Here take the grid points ! as knots and simply add to the left and the right the ! amount of knots that depends on the degree of the requested ! spline. We aim at setting up the indexing in such a way that the ! original indexing of 'grid' is preserved, i.e.: grid(i) = knot(i), at ! least whenever the scope of the indices defined here is active. associate( npoints => self%ncells+1 ) allocate( self % knots(1-degree:npoints+degree) ) do i = 1, npoints self%knots(i) = breaks(i) end do ! Fill out the extra nodes if ( periodic ) then period = breaks(npoints) - breaks(1) do i = 1, degree self%knots(1-i) = breaks(npoints-i) - period self%knots(npoints+i) = breaks(i+1) + period end do else ! open do i = 1, degree self%knots(1-i) = breaks(1) self%knots(npoints+i) = breaks(npoints) end do end if end associate end subroutine s_bsplines_non_uniform__init