getBilinearInterp Function

public function getBilinearInterp(x, y, xvec, yvec, f11, f12, f21, f22)

Returns bilinearly interpolated values at (x,y)

Arguments

Type IntentOptional AttributesName
real, intent(in) :: x

Queried x

real, intent(in) :: y

Queried y

real, intent(in), dimension(2):: xvec
real, intent(in), dimension(2):: yvec
real, intent(in) :: f11
real, intent(in) :: f12
real, intent(in) :: f21
real, intent(in) :: f22

Return Value real


Called by

proc~~getbilinearinterp~~CalledByGraph proc~getbilinearinterp getBilinearInterp proc~getcm getCM proc~getcm->proc~getbilinearinterp proc~getcl getCL proc~getcl->proc~getbilinearinterp proc~getcd getCD proc~getcd->proc~getbilinearinterp

Contents

Source Code


Source Code

  function getBilinearInterp(x,y,xvec,yvec,f11,f12,f21,f22)
    !! Returns bilinearly interpolated values at (x,y)
    real, intent(in) :: x !! Queried x
    real, intent(in) :: y !! Queried y
    real, intent(in), dimension(2) :: xvec
    real, intent(in), dimension(2) :: yvec
    real, intent(in) :: f11, f12, f21, f22
    real :: getBilinearInterp
    real, dimension(2,2) :: fMat

    fMat(1,:) = (/f11,f12/)
    fMat(2,:) = (/f21,f22/)

    getBilinearInterp = dot_product((/xvec(2)-x,x-xvec(1)/),matmul(fMat,(/yvec(2)-y,y-yvec(1)/)))
    getBilinearInterp = getBilinearInterp/(xvec(2)-xvec(1))/(yvec(2)-yvec(1))

  end function getBilinearInterp