Returns bilinearly interpolated values at (x,y)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
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