Initialize a bspline_2d 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 db2ink (multiple-output version).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(bspline_2d), | intent(inout) | :: | me |
the spline |
||
| real(kind=wp), | intent(in), | dimension(:) | :: | x |
|
|
| real(kind=wp), | intent(in), | dimension(:) | :: | y |
|
|
| real(kind=wp), | intent(in), | dimension(:,:,:) | :: | fcn |
|
|
| integer(kind=ip), | intent(in) | :: | kx |
The order of spline pieces in |
||
| integer(kind=ip), | intent(in) | :: | ky |
The order of spline pieces in |
||
| real(kind=wp), | intent(in), | dimension(:) | :: | tx |
The |
|
| real(kind=wp), | intent(in), | dimension(:) | :: | ty |
The |
|
| integer(kind=ip), | intent(out) | :: | iflag |
status flag (see db2ink) |
||
| logical, | intent(in), | optional | :: | extrap |
if true, then extrapolation is allowed (default is false) |
pure subroutine initialize_2d_specify_knots_multi(me,x,y,fcn,kx,ky,tx,ty,iflag,extrap) implicit none class(bspline_2d),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) :: y !! `(ny)` array of \(y\) abcissae. Must be strictly increasing. real(wp),dimension(:,:,:),intent(in) :: fcn !! `(nx,ny,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\) integer(ip),intent(in) :: ky !! The order of spline pieces in \(y\) real(wp),dimension(:),intent(in) :: tx !! The `(nx+kx)` knots in the \(x\) direction. real(wp),dimension(:),intent(in) :: ty !! The `(ny+ky)` knots in the \(y\) direction. integer(ip),intent(out) :: iflag !! status flag (see [[db2ink]]) logical,intent(in),optional :: extrap !! if true, then extrapolation is allowed !! (default is false) integer(ip),dimension(2) :: n !! number of points in each direction integer(ip) :: nf !! number of outputs call me%destroy() n(1) = size(x,kind=ip) n(2) = size(y,kind=ip) nf = size(fcn,3,kind=ip) call check_knot_vectors_sizes(nx=n(1),kx=kx,tx=tx,ny=n(2),ky=ky,ty=ty,iflag=iflag) if (iflag/=0_ip) then me%iflag = iflag return end if me%nx = n(1) me%ny = n(2) me%kx = kx me%ky = ky allocate(me%tx(n(1)+kx)) allocate(me%ty(n(2)+ky)) allocate(me%bcoef(n(1),n(2),nf)) allocate(me%work_val_1(ky)) allocate(me%work_val_2(3_ip*max(kx,ky))) me%tx = tx me%ty = ty call db2ink(x,n(1),y,n(2),fcn,kx,ky,1_ip,me%tx,me%ty,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_2d_specify_knots_multi