nearest_4d Subroutine

private pure subroutine nearest_4d(me, x, y, z, q, f, istat)

4D nearest neighbor interpolation routine.

Type Bound

nearest_interp_4d

Arguments

Type IntentOptional Attributes Name
class(nearest_interp_4d), intent(inout) :: me
real(kind=wp), intent(in) :: x
real(kind=wp), intent(in) :: y
real(kind=wp), intent(in) :: z
real(kind=wp), intent(in) :: q
real(kind=wp), intent(out) :: f

Nearest

integer, intent(out), optional :: istat

0 : no problems, -1 : class has not been initialized


Calls

proc~~nearest_4d~~CallsGraph proc~nearest_4d linear_interpolation_module::nearest_interp_4d%nearest_4d f f proc~nearest_4d->f proc~dintrv linear_interpolation_module::dintrv proc~nearest_4d->proc~dintrv

Source Code

    pure subroutine nearest_4d(me,x,y,z,q,f,istat)

    implicit none

    class(nearest_interp_4d),intent(inout) :: me
    real(wp),intent(in)                    :: x
    real(wp),intent(in)                    :: y
    real(wp),intent(in)                    :: z
    real(wp),intent(in)                    :: q
    real(wp),intent(out)                   :: f     !! Nearest \( f(x,y,z,q) \)
    integer,intent(out),optional           :: istat !! `0`  : no problems,
                                                    !! `-1` : class has not been initialized

    integer :: mflag
    integer,dimension(2) :: ix, iy, iz, iq
    integer :: i, j, k, l

    if (me%initialized) then

        call dintrv(me%x,x,me%ilox,ix(1),ix(2),mflag,i)
        call dintrv(me%y,y,me%iloy,iy(1),iy(2),mflag,j)
        call dintrv(me%z,z,me%iloz,iz(1),iz(2),mflag,k)
        call dintrv(me%q,q,me%iloq,iq(1),iq(2),mflag,l)

        f = me%f(i,j,k,l)
        if (present(istat)) istat = 0

    else

        if (present(istat)) istat = -1
        f = zero

    end if

    end subroutine nearest_4d