| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(sll_t_spline_interpolator_1d), | intent(out) | :: | self |
1D spline interpolator |
||
| class(sll_c_bsplines), | intent(in), | target | :: | bspl |
B-splines (basis) |
|
| integer, | intent(in) | :: | bc_xmin |
boundary condition at xmin |
||
| integer, | intent(in) | :: | bc_xmax |
boundary condition at xmax |
subroutine s_spline_interpolator_1d__init( self, bspl, bc_xmin, bc_xmax ) class(sll_t_spline_interpolator_1d), intent( out) :: self class(sll_c_bsplines), target, intent(in ) :: bspl integer , intent(in ) :: bc_xmin integer , intent(in ) :: bc_xmax integer :: kl, ku character(len=32) :: matrix_type ! Sanity checks SLL_ASSERT( any( bc_xmin == allowed_bcs ) ) SLL_ASSERT( any( bc_xmax == allowed_bcs ) ) if (bspl % periodic) then SLL_ASSERT( bc_xmin == sll_p_periodic ) SLL_ASSERT( bc_xmax == sll_p_periodic ) end if ! Save pointer to B-splines ! (later needed to verify 1D spline input to 'compute_interpolant') self % bspl => bspl ! Save other data self % bc_xmin = bc_xmin self % bc_xmax = bc_xmax self % nbc_xmin = merge ( bspl%degree/2, 0, bc_xmin == sll_p_hermite ) self % nbc_xmax = merge ( bspl%degree/2, 0, bc_xmax == sll_p_hermite ) self % odd = modulo( bspl%degree , 2 ) ! Save average cell size for normalization of derivatives self%dx = (bspl%xmax - bspl%xmin) / bspl%ncells ! Compute interpolation points and number of diagonals in linear system if (bspl % uniform) then call s_compute_interpolation_points_uniform( self, self%tau ) call s_compute_num_diags_uniform( self, kl, ku ) else call s_compute_interpolation_points_non_uniform( self, self%tau ) call s_compute_num_diags_non_uniform( self, kl, ku ) end if ! Special case: linear spline ! No need for matrix assembly if (self % bspl % degree == 1) return ! Determine matrix storage type and allocate matrix associate( nbasis => self % bspl % nbasis ) if (bc_xmin == sll_p_periodic) then if (kl+1+ku >= nbasis) then matrix_type = "dense" else matrix_type = "periodic_banded" end if else matrix_type = "banded" end if call sll_s_spline_matrix_new( self%matrix, matrix_type, nbasis, kl, ku ) end associate ! nbasis ! Fill in entries A_ij of linear system A*x = b for interpolation call s_build_system( self, self%matrix ) ! Factorize matrix A to speed-up solution for any given b call self % matrix % factorize() end subroutine s_spline_interpolator_1d__init