db6val_default Subroutine

private pure subroutine db6val_default(xval, yval, zval, qval, rval, sval, idx, idy, idz, idq, idr, ids, tx, ty, tz, tq, tr, ts, nx, ny, nz, nq, nr, ns, kx, ky, kz, kq, kr, ks, bcoef, f, iflag, inbvx, inbvy, inbvz, inbvq, inbvr, inbvs, iloy, iloz, iloq, ilor, ilos, w5, w4, w3, w2, w1, w0, extrap)

Evaluates the tensor product piecewise polynomial interpolant constructed by the routine db6ink or one of its derivatives at the point (xval,yval,zval,qval,rval,sval).

To evaluate the interpolant itself, set idx=idy=idz=idq=idr=ids=0, to evaluate the first partial with respect to x, set idx=1,idy=idz=idq=idr=ids=0, and so on.

See db3val header for more information.

History

  • Jacob Williams, 2/24/2015 : Created this routine.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: xval

coordinate of evaluation point.

real(kind=wp), intent(in) :: yval

coordinate of evaluation point.

real(kind=wp), intent(in) :: zval

coordinate of evaluation point.

real(kind=wp), intent(in) :: qval

coordinate of evaluation point.

real(kind=wp), intent(in) :: rval

coordinate of evaluation point.

real(kind=wp), intent(in) :: sval

coordinate of evaluation point.

integer(kind=ip), intent(in) :: idx

derivative of piecewise polynomial to evaluate.

integer(kind=ip), intent(in) :: idy

derivative of piecewise polynomial to evaluate.

integer(kind=ip), intent(in) :: idz

derivative of piecewise polynomial to evaluate.

integer(kind=ip), intent(in) :: idq

derivative of piecewise polynomial to evaluate.

integer(kind=ip), intent(in) :: idr

derivative of piecewise polynomial to evaluate.

integer(kind=ip), intent(in) :: ids

derivative of piecewise polynomial to evaluate.

real(kind=wp), intent(in), dimension(nx+kx) :: tx

sequence of knots defining the piecewise polynomial in the direction. (same as in last call to db6ink)

real(kind=wp), intent(in), dimension(ny+ky) :: ty

sequence of knots defining the piecewise polynomial in the direction. (same as in last call to db6ink)

real(kind=wp), intent(in), dimension(nz+kz) :: tz

sequence of knots defining the piecewise polynomial in the direction. (same as in last call to db6ink)

real(kind=wp), intent(in), dimension(nq+kq) :: tq

sequence of knots defining the piecewise polynomial in the direction. (same as in last call to db6ink)

real(kind=wp), intent(in), dimension(nr+kr) :: tr

sequence of knots defining the piecewise polynomial in the direction. (same as in last call to db6ink)

real(kind=wp), intent(in), dimension(ns+ks) :: ts

sequence of knots defining the piecewise polynomial in the direction. (same as in last call to db6ink)

integer(kind=ip), intent(in) :: nx

the number of interpolation points in . (same as in last call to db6ink)

integer(kind=ip), intent(in) :: ny

the number of interpolation points in . (same as in last call to db6ink)

integer(kind=ip), intent(in) :: nz

the number of interpolation points in . (same as in last call to db6ink)

integer(kind=ip), intent(in) :: nq

the number of interpolation points in . (same as in last call to db6ink)

integer(kind=ip), intent(in) :: nr

the number of interpolation points in . (same as in last call to db6ink)

integer(kind=ip), intent(in) :: ns

the number of interpolation points in . (same as in last call to db6ink)

integer(kind=ip), intent(in) :: kx

order of polynomial pieces in . (same as in last call to db6ink)

integer(kind=ip), intent(in) :: ky

order of polynomial pieces in . (same as in last call to db6ink)

integer(kind=ip), intent(in) :: kz

order of polynomial pieces in . (same as in last call to db6ink)

integer(kind=ip), intent(in) :: kq

order of polynomial pieces in . (same as in last call to db6ink)

integer(kind=ip), intent(in) :: kr

order of polynomial pieces in . (same as in last call to db6ink)

integer(kind=ip), intent(in) :: ks

order of polynomial pieces in . (same as in last call to db6ink)

real(kind=wp), intent(in), dimension(nx,ny,nz,nq,nr,ns) :: bcoef

the b-spline coefficients computed by db6ink.

real(kind=wp), intent(out) :: f

interpolated value

integer(kind=ip), intent(out) :: iflag

status flag:

  • : no errors
  • : error
integer(kind=ip), intent(inout) :: inbvx

initialization parameter which must be set to 1 the first time this routine is called, and must not be changed by the user.

integer(kind=ip), intent(inout) :: inbvy

not used (kept for backward compatibility)

integer(kind=ip), intent(inout) :: inbvz

not used (kept for backward compatibility)

integer(kind=ip), intent(inout) :: inbvq

not used (kept for backward compatibility)

integer(kind=ip), intent(inout) :: inbvr

not used (kept for backward compatibility)

integer(kind=ip), intent(inout) :: inbvs

not used (kept for backward compatibility)

integer(kind=ip), intent(inout) :: iloy

initialization parameter which must be set to 1 the first time this routine is called, and must not be changed by the user.

integer(kind=ip), intent(inout) :: iloz

initialization parameter which must be set to 1 the first time this routine is called, and must not be changed by the user.

integer(kind=ip), intent(inout) :: iloq

initialization parameter which must be set to 1 the first time this routine is called, and must not be changed by the user.

integer(kind=ip), intent(inout) :: ilor

initialization parameter which must be set to 1 the first time this routine is called, and must not be changed by the user.

integer(kind=ip), intent(inout) :: ilos

initialization parameter which must be set to 1 the first time this routine is called, and must not be changed by the user.

real(kind=wp), intent(inout), dimension(ky,kz,kq,kr,ks) :: w5

work array

real(kind=wp), intent(inout), dimension(kz,kq,kr,ks) :: w4

work array

real(kind=wp), intent(inout), dimension(kq,kr,ks) :: w3

work array

real(kind=wp), intent(inout), dimension(kr,ks) :: w2

work array

real(kind=wp), intent(inout), dimension(ks) :: w1

work array

real(kind=wp), intent(inout), dimension(3_ip*max(kx,ky,kz,kq,kr,ks)) :: w0

not used (kept for backward compatibility)

logical, intent(in), optional :: extrap

if extrapolation is allowed (if not present, default is False)


Calls

proc~~db6val_default~~CallsGraph proc~db6val_default db6val_default proc~check_value check_value proc~db6val_default->proc~check_value proc~dbvalu_weights dbvalu_weights proc~db6val_default->proc~dbvalu_weights proc~dintrv dintrv proc~dbvalu_weights->proc~dintrv proc~get_temp_x_for_extrap get_temp_x_for_extrap proc~dintrv->proc~get_temp_x_for_extrap

Called by

proc~~db6val_default~~CalledByGraph proc~db6val_default db6val_default interface~db6val db6val interface~db6val->proc~db6val_default proc~evaluate_6d bspline_6d%evaluate_6d proc~evaluate_6d->interface~db6val proc~evaluate_6d_multi bspline_6d%evaluate_6d_multi proc~evaluate_6d_multi->interface~db6val

Source Code

    pure subroutine db6val_default(xval,yval,zval,qval,rval,sval,&
                           idx,idy,idz,idq,idr,ids,&
                           tx,ty,tz,tq,tr,ts,&
                           nx,ny,nz,nq,nr,ns,&
                           kx,ky,kz,kq,kr,ks,&
                           bcoef,f,iflag,&
                           inbvx,inbvy,inbvz,inbvq,inbvr,inbvs,&
                           iloy,iloz,iloq,ilor,ilos,&
                           w5,w4,w3,w2,w1,w0,extrap)

    implicit none

    integer(ip),intent(in)                           :: idx      !! \(x\) derivative of piecewise polynomial to evaluate.
    integer(ip),intent(in)                           :: idy      !! \(y\) derivative of piecewise polynomial to evaluate.
    integer(ip),intent(in)                           :: idz      !! \(z\) derivative of piecewise polynomial to evaluate.
    integer(ip),intent(in)                           :: idq      !! \(q\) derivative of piecewise polynomial to evaluate.
    integer(ip),intent(in)                           :: idr      !! \(r\) derivative of piecewise polynomial to evaluate.
    integer(ip),intent(in)                           :: ids      !! \(s\) derivative of piecewise polynomial to evaluate.
    integer(ip),intent(in)                           :: nx       !! the number of interpolation points in \(x\).
                                                                 !! (same as in last call to [[db6ink]])
    integer(ip),intent(in)                           :: ny       !! the number of interpolation points in \(y\).
                                                                 !! (same as in last call to [[db6ink]])
    integer(ip),intent(in)                           :: nz       !! the number of interpolation points in \(z\).
                                                                 !! (same as in last call to [[db6ink]])
    integer(ip),intent(in)                           :: nq       !! the number of interpolation points in \(q\).
                                                                 !! (same as in last call to [[db6ink]])
    integer(ip),intent(in)                           :: nr       !! the number of interpolation points in \(r\).
                                                                 !! (same as in last call to [[db6ink]])
    integer(ip),intent(in)                           :: ns       !! the number of interpolation points in \(s\).
                                                                 !! (same as in last call to [[db6ink]])
    integer(ip),intent(in)                           :: kx       !! order of polynomial pieces in \(x\).
                                                                 !! (same as in last call to [[db6ink]])
    integer(ip),intent(in)                           :: ky       !! order of polynomial pieces in \(y\).
                                                                 !! (same as in last call to [[db6ink]])
    integer(ip),intent(in)                           :: kz       !! order of polynomial pieces in \(z\).
                                                                 !! (same as in last call to [[db6ink]])
    integer(ip),intent(in)                           :: kq       !! order of polynomial pieces in \(q\).
                                                                 !! (same as in last call to [[db6ink]])
    integer(ip),intent(in)                           :: kr       !! order of polynomial pieces in \(r\).
                                                                 !! (same as in last call to [[db6ink]])
    integer(ip),intent(in)                           :: ks       !! order of polynomial pieces in \(s\).
                                                                 !! (same as in last call to [[db6ink]])
    real(wp),intent(in)                              :: xval     !! \(x\) coordinate of evaluation point.
    real(wp),intent(in)                              :: yval     !! \(y\) coordinate of evaluation point.
    real(wp),intent(in)                              :: zval     !! \(z\) coordinate of evaluation point.
    real(wp),intent(in)                              :: qval     !! \(q\) coordinate of evaluation point.
    real(wp),intent(in)                              :: rval     !! \(r\) coordinate of evaluation point.
    real(wp),intent(in)                              :: sval     !! \(s\) coordinate of evaluation point.
    real(wp),dimension(nx+kx),intent(in)             :: tx       !! sequence of knots defining the piecewise polynomial
                                                                 !! in the \(x\) direction.
                                                                 !! (same as in last call to [[db6ink]])
    real(wp),dimension(ny+ky),intent(in)             :: ty       !! sequence of knots defining the piecewise polynomial
                                                                 !! in the \(y\) direction.
                                                                 !! (same as in last call to [[db6ink]])
    real(wp),dimension(nz+kz),intent(in)             :: tz       !! sequence of knots defining the piecewise polynomial
                                                                 !! in the \(z\) direction.
                                                                 !! (same as in last call to [[db6ink]])
    real(wp),dimension(nq+kq),intent(in)             :: tq       !! sequence of knots defining the piecewise polynomial
                                                                 !! in the \(q\) direction.
                                                                 !! (same as in last call to [[db6ink]])
    real(wp),dimension(nr+kr),intent(in)             :: tr       !! sequence of knots defining the piecewise polynomial
                                                                 !! in the \(r\) direction.
                                                                 !! (same as in last call to [[db6ink]])
    real(wp),dimension(ns+ks),intent(in)             :: ts       !! sequence of knots defining the piecewise polynomial
                                                                 !! in the \(s\) direction.
                                                                 !! (same as in last call to [[db6ink]])
    real(wp),dimension(nx,ny,nz,nq,nr,ns),intent(in) :: bcoef    !! the b-spline coefficients computed by [[db6ink]].
    real(wp),intent(out)                             :: f        !! interpolated value
    integer(ip),intent(out)                          :: iflag    !! status flag:
                                                                 !!
                                                                 !! * \( = 0 \)   : no errors
                                                                 !! * \( \ne 0 \) : error
    integer(ip),intent(inout)                        :: inbvx    !! initialization parameter which must be set
                                                                 !! to 1 the first time this routine is called,
                                                                 !! and must not be changed by the user.
    integer(ip),intent(inout)                        :: inbvy    !! not used (kept for backward compatibility)
    integer(ip),intent(inout)                        :: inbvz    !! not used (kept for backward compatibility)
    integer(ip),intent(inout)                        :: inbvq    !! not used (kept for backward compatibility)
    integer(ip),intent(inout)                        :: inbvr    !! not used (kept for backward compatibility)
    integer(ip),intent(inout)                        :: inbvs    !! not used (kept for backward compatibility)
    integer(ip),intent(inout)                        :: iloy     !! initialization parameter which must be set
                                                                 !! to 1 the first time this routine is called,
                                                                 !! and must not be changed by the user.
    integer(ip),intent(inout)                        :: iloz     !! initialization parameter which must be set
                                                                 !! to 1 the first time this routine is called,
                                                                 !! and must not be changed by the user.
    integer(ip),intent(inout)                        :: iloq     !! initialization parameter which must be set
                                                                 !! to 1 the first time this routine is called,
                                                                 !! and must not be changed by the user.
    integer(ip),intent(inout)                        :: ilor     !! initialization parameter which must be set
                                                                 !! to 1 the first time this routine is called,
                                                                 !! and must not be changed by the user.
    integer(ip),intent(inout)                        :: ilos     !! initialization parameter which must be set
                                                                 !! to 1 the first time this routine is called,
                                                                 !! and must not be changed by the user.
    real(wp),dimension(ky,kz,kq,kr,ks),intent(inout)              :: w5 !! work array
    real(wp),dimension(kz,kq,kr,ks),intent(inout)                 :: w4 !! work array
    real(wp),dimension(kq,kr,ks),intent(inout)                    :: w3 !! work array
    real(wp),dimension(kr,ks),intent(inout)                       :: w2 !! work array
    real(wp),dimension(ks),intent(inout)                          :: w1 !! work array
    real(wp),dimension(3_ip*max(kx,ky,kz,kq,kr,ks)),intent(inout) :: w0 !! not used (kept for backward compatibility)
    logical,intent(in),optional                      :: extrap   !! if extrapolation is allowed
                                                                 !! (if not present, default is False)

    integer(ip) :: leftx, lefty, leftz, leftq, leftr, lefts  !! interval indices
    integer(ip) :: ix, iy, iz, iq, ir, is  !! coefficient offsets
    integer(ip) :: j, k, q, r, s  !! counters
    real(wp),dimension(kx) :: bx  !! basis function weights in x
    real(wp),dimension(ky) :: by  !! basis function weights in y
    real(wp),dimension(kz) :: bz  !! basis function weights in z
    real(wp),dimension(kq) :: bq  !! basis function weights in q
    real(wp),dimension(kr) :: br  !! basis function weights in r
    real(wp),dimension(ks) :: bs  !! basis function weights in s

    f = 0.0_wp

    iflag = check_value(xval,tx,1_ip,extrap); if (iflag/=0_ip) return
    iflag = check_value(yval,ty,2_ip,extrap); if (iflag/=0_ip) return
    iflag = check_value(zval,tz,3_ip,extrap); if (iflag/=0_ip) return
    iflag = check_value(qval,tq,4_ip,extrap); if (iflag/=0_ip) return
    iflag = check_value(rval,tr,5_ip,extrap); if (iflag/=0_ip) return
    iflag = check_value(sval,ts,6_ip,extrap); if (iflag/=0_ip) return

    ! interval and basis function weights in each direction
    call dbvalu_weights(tx,nx,kx,idx,xval,inbvx,leftx,bx,iflag,extrap)
    if (iflag/=0_ip) return
    call dbvalu_weights(ty,ny,ky,idy,yval,iloy,lefty,by,iflag,extrap)
    if (iflag/=0_ip) return
    call dbvalu_weights(tz,nz,kz,idz,zval,iloz,leftz,bz,iflag,extrap)
    if (iflag/=0_ip) return
    call dbvalu_weights(tq,nq,kq,idq,qval,iloq,leftq,bq,iflag,extrap)
    if (iflag/=0_ip) return
    call dbvalu_weights(tr,nr,kr,idr,rval,ilor,leftr,br,iflag,extrap)
    if (iflag/=0_ip) return
    call dbvalu_weights(ts,ns,ks,ids,sval,ilos,lefts,bs,iflag,extrap)
    if (iflag/=0_ip) return

    ix = leftx - kx
    iy = lefty - ky
    iz = leftz - kz
    iq = leftq - kq
    ir = leftr - kr
    is = lefts - ks

    ! contract the coefficients one direction at a time
    do s=1_ip,ks
        do r=1_ip,kr
            do q=1_ip,kq
                do k=1_ip,kz
                    do j=1_ip,ky
                        w5(j,k,q,r,s) = dot_product(bx,bcoef(ix+1_ip:leftx,iy+j,iz+k,iq+q,ir+r,is+s))
                    end do
                    w4(k,q,r,s) = dot_product(by,w5(:,k,q,r,s))
                end do
                w3(q,r,s) = dot_product(bz,w4(:,q,r,s))
            end do
            w2(r,s) = dot_product(bq,w3(:,r,s))
        end do
        w1(s) = dot_product(br,w2(:,s))
    end do
    f = dot_product(bs,w1)

    end subroutine db6val_default