2D nearest neighbor interpolation routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(nearest_interp_2d), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in) | :: | x | |||
real(kind=wp), | intent(in) | :: | y | |||
real(kind=wp), | intent(out) | :: | f |
Nearest |
||
integer, | intent(out), | optional | :: | istat |
|
pure subroutine nearest_2d(me,x,y,f,istat) implicit none class(nearest_interp_2d),intent(inout) :: me real(wp),intent(in) :: x real(wp),intent(in) :: y real(wp),intent(out) :: f !! Nearest \( f(x,y) \) integer,intent(out),optional :: istat !! `0` : no problems, !! `-1` : class has not been initialized integer :: mflag integer,dimension(2) :: ix, iy integer :: i, j 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) f = me%f(i,j) if (present(istat)) istat = 0 else if (present(istat)) istat = -1 f = zero end if end subroutine nearest_2d