Find highest gain and loss levels of energy layer over all models.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | layer |
Energy layer, 0 to 2. |
||
| integer(kind=int32), | intent(out) | :: | gmax |
Highest positive level, or 0. |
||
| integer(kind=int32), | intent(out) | :: | lmax |
Magnitude of most negative level, or 0. |
subroutine scan_levels(layer, gmax, lmax) !! Find highest gain and loss levels of energy layer over all models. ! Arguments integer(int32), intent(in) :: layer !! Energy layer, 0 to 2. integer(int32), intent(out) :: gmax !! Highest positive level, or 0. integer(int32), intent(out) :: lmax !! Magnitude of most negative level, or 0. integer(int32) :: i, n, k integer(int32), allocatable :: vals(:), idxs(:) gmax = 0; lmax = 0 do i = 1, nmodels call get_layer(i, layer, vals, idxs, n) do k = 1, n gmax = max(gmax, vals(k)) lmax = max(lmax, -vals(k)) end do deallocate (vals, idxs) end do end subroutine scan_levels