Define a cubic spline by points and function values, with boundary conditions and represent it as a B-Spline for evaluation
Interpolation of function values f(x_i)=f_i, i=1,n with a cubic spline, given left and right boundary condition types of boundary conditions: 0: not-a-knot 1: f'(x_boundary)=0 2: f''(x_boundary)=0
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | x(:) |
x positions |
||
| real(kind=wp), | intent(in) | :: | f(:) |
function values at x positions |
||
| integer, | intent(in) | :: | BC(1:2) |
Boundary condition at x(1)/x(n): =0: not-a-knot, =1: first der. =BC_val(1)/BC_val(2), =2: second der. =BC_val(1)/BC_val(2) |
||
| real(kind=wp), | intent(in), | optional | :: | BC_val(1:2) |
Boundary value for BC(1:2) >0, |
self
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | public, | ALLOCATABLE | :: | coefs(:) |
B-Spline coefficients |
||
| real(kind=wp), | public, | ALLOCATABLE | :: | knots(:) |
knots (=break points with repeated knots at the end) |
||
| class(sll_c_bsplines), | public, | ALLOCATABLE | :: | bspl |
b-spline class |
| public function cubspl_new (x, f, BC, BC_val) | Interpolation of function values f(x_i)=f_i, i=1,n with a cubic spline, given left and right boundary condition types of boundary conditions: 0: not-a-knot 1: f'(x_boundary)=0 2: f''(x_boundary)=0 |
| final :: cubspl_free |
| procedure, public :: eval => cubspl_eval | |
| procedure, public :: eval_at_rho => cubspl_eval | for testing |
Interpolation of function values f(x_i)=f_i, i=1,n with a cubic spline, given left and right boundary condition types of boundary conditions: 0: not-a-knot 1: f'(x_boundary)=0 2: f''(x_boundary)=0
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | x(:) |
x positions |
||
| real(kind=wp), | intent(in) | :: | f(:) |
function values at x positions |
||
| integer, | intent(in) | :: | BC(1:2) |
Boundary condition at x(1)/x(n): =0: not-a-knot, =1: first der. =BC_val(1)/BC_val(2), =2: second der. =BC_val(1)/BC_val(2) |
||
| real(kind=wp), | intent(in), | optional | :: | BC_val(1:2) |
Boundary value for BC(1:2) >0, |
self
evaluate the n-th derivative of the bsplProfile at position s
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(t_cubspl), | intent(in) | :: | sf |
self |
||
| real(kind=wp), | intent(in) | :: | xpos(:) |
position |
||
| integer, | intent(in) | :: | deriv |
derivative (=0: no derivative) |
used as rhs, then overwritten in solve
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | x(:) |
x positions |
||
| real(kind=wp), | intent(in) | :: | f(:) |
function values at x positions |
||
| real(kind=wp), | intent(inout), | ALLOCATABLE | :: | coefs(:) |
B-Spline coefficients of interpolated cubic spline |
|
| real(kind=wp), | intent(inout), | ALLOCATABLE | :: | knots(:) |
B-Spline knots of interpolated cubic spline |
|
| integer, | intent(in) | :: | BC(1:2) |
Boundary condition at x(1)/x(n): =0: not-a-knot, =1: first der. =BC_val(1)/BC_val(2), =2: second der. =BC_val(1)/BC_val(2) |
||
| real(kind=wp), | intent(in), | optional | :: | BC_val(1:2) |
Boundary value for BC(1:2) >0, |
finalize the type rProfile
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(t_cubspl), | intent(inout) | :: | sf |
self |