Initialize a bspline_1d type (with user-specified knots). This is a wrapper for db1ink.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(bspline_1d), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in), | dimension(:) | :: | x |
|
|
real(kind=wp), | intent(in), | dimension(:) | :: | fcn |
|
|
integer(kind=ip), | intent(in) | :: | kx |
The order of spline pieces in ( ) (order = polynomial degree + 1) |
||
real(kind=wp), | intent(in), | dimension(:) | :: | tx |
The |
|
integer(kind=ip), | intent(out) | :: | iflag |
status flag (see db1ink) |
||
logical, | intent(in), | optional | :: | extrap |
if true, then extrapolation is allowed (default is false) |
pure subroutine initialize_1d_specify_knots(me,x,fcn,kx,tx,iflag,extrap) implicit none class(bspline_1d),intent(inout) :: me real(wp),dimension(:),intent(in) :: x !! `(nx)` array of \(x\) abcissae. Must be strictly increasing. real(wp),dimension(:),intent(in) :: fcn !! `(nx)` array of function values to interpolate. `fcn(i)` should !! contain the function value at the point `x(i)` integer(ip),intent(in) :: kx !! The order of spline pieces in \(x\) !! ( \( 2 \le k_x < n_x \) ) !! (order = polynomial degree + 1) real(wp),dimension(:),intent(in) :: tx !! The `(nx+kx)` knots in the \(x\) direction !! for the spline interpolant. !! Must be non-decreasing. integer(ip),intent(out) :: iflag !! status flag (see [[db1ink]]) logical,intent(in),optional :: extrap !! if true, then extrapolation is allowed !! (default is false) integer(ip) :: nx call me%destroy() nx = size(x,kind=ip) call check_knot_vectors_sizes(nx=nx,kx=kx,tx=tx,iflag=iflag) if (iflag == 0_ip) then me%nx = nx me%kx = kx allocate(me%tx(nx+kx)) allocate(me%bcoef(nx)) allocate(me%work_val_1(3_ip*kx)) me%tx = tx call db1ink(x,nx,fcn,kx,1_ip,me%tx,me%bcoef,iflag) call me%set_extrap_flag(extrap) end if me%initialized = iflag==0_ip me%iflag = iflag end subroutine initialize_1d_specify_knots