7 #include "sll_assert.h"
8 #include "sll_errors.h"
53 integer,
intent(in) :: degree
54 logical,
intent(in) :: periodic
55 real(
wp),
intent(in) :: xmin
56 real(
wp),
intent(in) :: xmax
57 integer,
intent(in) :: ncells
58 real(
wp),
optional,
intent(in) :: breaks(:)
63 sll_assert(.not.
allocated(bsplines))
64 sll_assert(degree > 0)
65 sll_assert(ncells > 0)
66 sll_assert(xmin < xmax)
69 uniform = .not.
present(breaks)
72 if (.not. uniform)
then
73 sll_assert(
size(breaks) == ncells + 1)
74 sll_assert(xmin == breaks(1))
75 sll_assert(xmax == breaks(
size(breaks)))
86 select type (bsplines)
88 call bsplines%init(degree, periodic, xmin, xmax, ncells)
90 call bsplines%init(degree, periodic, breaks)
94 bsplines%radial = .false.
111 class(
sll_c_bsplines),
allocatable,
intent(inout) :: bsplines_radial
112 class(
sll_c_bsplines),
allocatable,
intent(inout) :: bsplines_angular
113 integer,
intent(in) :: degree(2)
114 integer,
intent(in) :: ncells(2)
115 real(
wp),
intent(in) :: max_radius
116 real(
wp),
intent(in) :: theta_lims(2)
117 real(
wp),
optional,
intent(in) :: breaks_radial(:)
118 real(
wp),
optional,
intent(in) :: breaks_angular(:)
120 character(len=*),
parameter :: this_sub_name =
"sll_s_bsplines_new_2d_polar"
122 logical :: uniform(2)
126 sll_assert(.not.
allocated(bsplines_radial))
127 sll_assert(.not.
allocated(bsplines_angular))
128 sll_assert(degree(1) > 0)
129 sll_assert(degree(2) > 0)
130 sll_assert(ncells(1) > 0)
131 sll_assert(ncells(2) > 0)
132 sll_assert(theta_lims(1) < theta_lims(2))
135 sll_assert(max_radius > 0.0_wp)
136 sll_assert(modulo(ncells(2), 2) == 0)
139 if (
present(breaks_radial))
then
141 sll_error(this_sub_name,
"non-uniform option not yet implemented.")
146 if (
present(breaks_angular))
then
148 sll_error(this_sub_name,
"non-uniform option not yet implemented.")
153 dr = max_radius/(real(ncells(1),
wp) - 0.5_wp)
156 bsplines=bsplines_radial, &
162 breaks=breaks_radial)
165 bsplines=bsplines_angular, &
168 xmin=theta_lims(1), &
169 xmax=theta_lims(2), &
171 breaks=breaks_angular)
174 bsplines_radial%radial = .true.
183 class(
sll_c_bsplines),
allocatable,
intent(inout) :: extended_basis
185 character(len=*),
parameter :: this_sub_name =
"sll_s_bsplines_new_mirror_copy"
187 sll_assert(radial_basis%radial)
188 sll_assert(.not.
allocated(extended_basis))
190 select type (radial_basis)
194 bsplines=extended_basis, &
195 degree=radial_basis%degree, &
197 xmin=-radial_basis%xmax, &
198 xmax=radial_basis%xmax, &
199 ncells=radial_basis%ncells*2 - 1)
202 sll_error(this_sub_name,
"non-uniform option not yet implemented.")
Abstract class for B-splines of arbitrary degree.
Access point to B-splines of arbitrary degree providing factory function.
subroutine, public sll_s_bsplines_new_mirror_copy(radial_basis, extended_basis)
Create B-splines by mirroring radial basis onto extended domain [-R,R].
integer, parameter wp
Working precision.
subroutine, public sll_s_bsplines_new(bsplines, degree, periodic, xmin, xmax, ncells, breaks)
Allocate and initialize uniform or non-uniform B-splines.
subroutine, public sll_s_bsplines_new_2d_polar(bsplines_radial, bsplines_angular, degree, ncells, max_radius, theta_lims, breaks_radial, breaks_angular)
Allocate and initialize two B-splines for use on polar grid.
Module to select the kind parameter.
integer, parameter, public f64
f64 is the kind type for 64-bit reals (double precision)
Abstract type, B-splines.