Compute by use of linear interpolation the value in the middle
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | x_list(:) | |||
| real(kind=dp), | intent(in) | :: | y_list(:) | |||
| real(kind=dp), | intent(in) | :: | x_value | |||
| real(kind=dp), | intent(out) | :: | y_value |
pure subroutine LT_lin_interp_list(x_list, y_list, x_value, y_value) real(dp), intent(in) :: x_list(:), y_list(:) real(dp), intent(in) :: x_value real(dp), intent(out) :: y_value integer :: ix, iMin, iMax real(dp) :: temp iMin = 1 iMax = size(x_list) if (x_value <= x_list(iMin)) then y_value = y_list(iMin) else if (x_value >= x_list(iMax)) then y_value = y_list(iMax) else ix = find_index_adaptive(x_list, x_value) temp = (x_value - x_list(ix-1)) / (x_list(ix) - x_list(ix-1)) y_value = (1 - temp) * y_list(ix-1) + temp * y_list(ix) end if end subroutine LT_lin_interp_list