Host-side registry walk (outer shim) for field id.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_data_input_t), | intent(inout) | :: | this | |||
| integer, | intent(in) | :: | id | |||
| real(kind=wp), | intent(in) | :: | t |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | n0 | ||||
| integer, | private | :: | n1 | ||||
| logical, | private | :: | oor | ||||
| real(kind=wp), | private | :: | t_query | ||||
| real(kind=wp), | private | :: | w |
subroutine data_input_refresh_brackets(this, id, t) !! Host-side registry walk (outer shim) for field `id`. class(ocean_data_input_t), intent(inout) :: this integer, intent(in) :: id real(wp), intent(in) :: t integer :: n0, n1 real(wp) :: w, t_query logical :: oor associate (fld => this%fields(id)) if (fld%time_mode == DATA_TIME_STATIC) then fld%t_last = t return end if t_query = t + fld%t_offset call data_input_locate(fld%t_axis, fld%nt, fld%time_mode, fld%cycle_period, & t_query, n0, n1, w, oor) if (oor) then if (fld%oor == DATA_OOR_ERROR) then call logger%error("ocean_data_input: query time "//to_string(t_query)// & "s is outside the file time axis ["// & to_string(fld%t_axis(1))//", "// & to_string(fld%t_axis(fld%nt))//"]s (field id "// & to_string(id)//"); pass oor=DATA_OOR_CLAMP to clamp instead") error stop "ocean_data_input: query time out of range" end if if (.not. fld%oor_warned) then call logger%warning("ocean_data_input: field id "//to_string(id)// & "clamped at the time-axis boundary (query time "// & to_string(t_query)//"s out of range)") fld%oor_warned = .true. end if end if ! `!$acc update device(...)` is only correct HERE (the runtime ! per-step path, always called after `ocean_state_enter_data` ! has mapped `fld%f0`/`fld%f1`) — never inside ! `data_input_read_slab_impl` itself, which is also called from ! `register_common` at SETUP time for a DATA_TIME_STATIC field, ! before anything is device-mapped (CLAUDE.md gotcha: an ! `update device` on an unmapped array is undefined). if (n0 /= fld%rec0) then call data_input_read_slab_impl(fld, n0, into_f1=.false.) !$acc update device(fld%f0) end if if (n1 /= fld%rec1) then if (n1 == n0) then fld%f1 = fld%f0 !$acc update device(fld%f1) else call data_input_read_slab_impl(fld, n1, into_f1=.true.) !$acc update device(fld%f1) end if end if if (n0 /= fld%rec0 .or. n1 /= fld%rec1) then if (this%verbose) then call logger%info("ocean_data_input: field id "//to_string(id)// & " bracket advanced to records ("//to_string(n0)//", "// & to_string(n1)//"), w = "//to_string(w)// & ", t = "//to_string(t)) end if end if fld%rec0 = n0 fld%rec1 = n1 fld%w = w fld%t_last = t end associate end subroutine data_input_refresh_brackets