Initialize a bspline_1d type with multiple outputs: nf functions of
the same inputs, on the same grid (with user-specified knots).
The last dimension of fcn is the output index.
This is a wrapper for db1ink (multiple-output version).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(bspline_1d), | intent(inout) | :: | me |
the spline |
||
| 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 |
||
| 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_multi(me,x,fcn,kx,tx,iflag,extrap) implicit none class(bspline_1d),intent(inout) :: me !! the spline real(wp),dimension(:),intent(in) :: x !! `(nx)` array of \(x\) abcissae. Must be strictly increasing. real(wp),dimension(:,:),intent(in) :: fcn !! `(nx,nf)` array of function values to interpolate !! (the last dimension is the output index) integer(ip),intent(in) :: kx !! The order of spline pieces in \(x\) real(wp),dimension(:),intent(in) :: tx !! The `(nx+kx)` knots in the \(x\) direction. 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),dimension(1) :: n !! number of points in each direction integer(ip) :: nf !! number of outputs call me%destroy() n(1) = size(x,kind=ip) nf = size(fcn,2,kind=ip) call check_knot_vectors_sizes(nx=n(1),kx=kx,tx=tx,iflag=iflag) if (iflag/=0_ip) then me%iflag = iflag return end if me%nx = n(1) me%kx = kx allocate(me%tx(n(1)+kx)) allocate(me%bcoef(n(1),nf)) allocate(me%work_val_1(3_ip*kx)) me%tx = tx call db1ink(x,n(1),fcn,kx,1_ip,me%tx,me%bcoef,iflag) if (iflag==0_ip) then me%nf = nf call me%set_extrap_flag(extrap) end if me%initialized = iflag==0_ip me%iflag = iflag end subroutine initialize_1d_specify_knots_multi