ocean_data_input_init Subroutine

private 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.

Type Bound

ocean_data_input_t

Arguments

Type IntentOptional Attributes Name
class(ocean_data_input_t), intent(inout) :: this
type(ocean_data_config_t), intent(in), optional :: cfg

Calls

proc~~ocean_data_input_init~~CallsGraph proc~ocean_data_input_init ocean_data_input_t%ocean_data_input_init proc~ocean_data_input_destroy ocean_data_input_t%ocean_data_input_destroy proc~ocean_data_input_init->proc~ocean_data_input_destroy proc~data_input_workspace_cleanup data_input_workspace_cleanup proc~ocean_data_input_destroy->proc~data_input_workspace_cleanup proc~nc_close nc_close proc~ocean_data_input_destroy->proc~nc_close nf90_close nf90_close proc~nc_close->nf90_close proc~nc_check nc_check proc~nc_close->proc~nc_check nf90_strerror nf90_strerror proc~nc_check->nf90_strerror proc~fail fail proc~nc_check->proc~fail error error proc~fail->error proc~error_ring_push error_ring_push proc~fail->proc~error_ring_push

Called by

proc~~ocean_data_input_init~~CalledByGraph proc~ocean_data_input_init ocean_data_input_t%ocean_data_input_init proc~ocean_data_input_load_static_2d ocean_data_input_load_static_2d proc~ocean_data_input_load_static_2d->proc~ocean_data_input_init proc~seed_cavity_draft seed_cavity_draft proc~seed_cavity_draft->proc~ocean_data_input_load_static_2d proc~ocean_state_seed_from_cfg ocean_state_seed_from_cfg proc~ocean_state_seed_from_cfg->proc~seed_cavity_draft proc~engine_setup engine_setup proc~engine_setup->proc~ocean_state_seed_from_cfg proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup

Variables

Type Visibility Attributes Name Initial
integer, private :: max_fields
logical, private :: verbose

Source Code

   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