Safe accessor: return clamped_tracer(it) or 0 if unallocated/out of range.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in), | allocatable | :: | arr(:) | ||
| integer, | intent(in) | :: | it |
pure function get_clamped_tracer(arr, it) result(val) !! Safe accessor: return clamped_tracer(it) or 0 if unallocated/out of range. real(wp), allocatable, intent(in) :: arr(:) integer, intent(in) :: it real(wp) :: val val = 0.0_wp if (allocated(arr)) then if (it <= size(arr)) val = arr(it) end if end function get_clamped_tracer