Allocate the field registry. cfg optional so ocean_state_init
(which many tests call directly with no config_t in hand) can
construct a default-sized (16 slots, quiet) reader identically to
the scaffold it replaces; ocean_state_init_from_config re-calls
this with the real cfg%ocean%data once cfg is available —
safe because nothing is registered between the two calls.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_data_input_t), | intent(inout) | :: | this | |||
| type(ocean_data_config_t), | intent(in), | optional | :: | cfg |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | max_fields | ||||
| logical, | private | :: | verbose |
subroutine ocean_data_input_init(this, cfg) !! Allocate the field registry. `cfg` optional so `ocean_state_init` !! (which many tests call directly with no `config_t` in hand) can !! construct a default-sized (16 slots, quiet) reader identically to !! the scaffold it replaces; `ocean_state_init_from_config` re-calls !! this with the real `cfg%ocean%data` once `cfg` is available — !! safe because nothing is registered between the two calls. class(ocean_data_input_t), intent(inout) :: this type(ocean_data_config_t), intent(in), optional :: cfg integer :: max_fields logical :: verbose max_fields = 16 verbose = .false. if (present(cfg)) then max_fields = cfg%max_fields verbose = cfg%verbose end if call this%destroy() allocate (this%fields(max(max_fields, 1))) this%nfields = 0 this%nfields_max = max_fields this%verbose = verbose this%is_init = .true. end subroutine ocean_data_input_init