Get a location in the lookup table
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(LT3_t), | intent(in) | :: | my_lt | |||
| real(kind=dp), | intent(in) | :: | x1 | |||
| real(kind=dp), | intent(in) | :: | x2 | |||
| real(kind=dp), | intent(in) | :: | x3 |
elemental function LT3_get_loc(my_lt, x1, x2, x3) result(my_loc) type(LT3_t), intent(in) :: my_lt real(dp), intent(in) :: x1, x2, x3 type(LT3_loc_t) :: my_loc real(dp) :: frac(3) frac = ([x1, x2, x3] - my_lt%x_min) * my_lt%inv_dx my_loc%low_ix = ceiling(frac) my_loc%low_frac = my_loc%low_ix - frac ! Check bounds where (my_loc%low_ix < 1) my_loc%low_ix = 1 my_loc%low_frac = 1 end where where (my_loc%low_ix >= my_lt%n_points) my_loc%low_ix = my_lt%n_points - 1 my_loc%low_frac = 0 end where end function LT3_get_loc