check_registered Subroutine

private subroutine check_registered(this, id, is_3d, n1, n2, n3)

Fail-loud guard shared by every per-step/fill accessor: id must name an active field of the right rank, and the caller’s dest shape must match what was declared at registration.

Arguments

Type IntentOptional Attributes Name
class(ocean_data_input_t), intent(in) :: this
integer, intent(in) :: id
logical, intent(in) :: is_3d
integer, intent(in) :: n1
integer, intent(in) :: n2
integer, intent(in), optional :: n3

Calls

proc~~check_registered~~CallsGraph proc~check_registered check_registered error error proc~check_registered->error to_string to_string proc~check_registered->to_string

Called by

proc~~check_registered~~CalledByGraph proc~check_registered check_registered proc~ocean_data_input_fill_static_host ocean_data_input_fill_static_host proc~ocean_data_input_fill_static_host->proc~check_registered proc~ocean_data_input_fill_static_host_3d ocean_data_input_fill_static_host_3d proc~ocean_data_input_fill_static_host_3d->proc~check_registered proc~ocean_data_input_update_2d ocean_data_input_update_2d proc~ocean_data_input_update_2d->proc~check_registered proc~ocean_data_input_update_3d ocean_data_input_update_3d proc~ocean_data_input_update_3d->proc~check_registered proc~ocean_data_forcing_apply ocean_data_forcing_apply proc~ocean_data_forcing_apply->proc~ocean_data_input_update_2d proc~ocean_data_input_load_static_2d ocean_data_input_load_static_2d proc~ocean_data_input_load_static_2d->proc~ocean_data_input_fill_static_host proc~engine_step engine_step proc~engine_step->proc~ocean_data_forcing_apply proc~seed_cavity_draft seed_cavity_draft proc~seed_cavity_draft->proc~ocean_data_input_load_static_2d proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_step proc~ocean_state_seed_from_cfg ocean_state_seed_from_cfg proc~ocean_state_seed_from_cfg->proc~seed_cavity_draft proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~engine_setup engine_setup proc~engine_setup->proc~ocean_state_seed_from_cfg

Variables

Type Visibility Attributes Name Initial
integer, private :: dn3

Source Code

   subroutine check_registered(this, id, is_3d, n1, n2, n3)
      !! Fail-loud guard shared by every per-step/fill accessor: `id`
      !! must name an active field of the right rank, and the caller's
      !! `dest` shape must match what was declared at registration.
      class(ocean_data_input_t), intent(in) :: this
      integer, intent(in) :: id, n1, n2
      logical, intent(in) :: is_3d
      integer, intent(in), optional :: n3
      integer :: dn3

      if (id < 1 .or. id > this%nfields) then
         call logger%error("ocean_data_input: invalid field id "//to_string(id))
         error stop "ocean_data_input: invalid field id"
      end if
      if (.not. this%fields(id)%active) then
         call logger%error("ocean_data_input: field id "//to_string(id)//" is not active")
         error stop "ocean_data_input: field id not active"
      end if
      if (this%fields(id)%is_3d .neqv. is_3d) then
         call logger%error("ocean_data_input: field id "//to_string(id)// &
                           " rank mismatch (registered "// &
                           merge("3-D", "2-D", this%fields(id)%is_3d)//", called as "// &
                           merge("3-D", "2-D", is_3d)//")")
         error stop "ocean_data_input: field rank mismatch"
      end if
      dn3 = 1
      if (present(n3)) dn3 = n3
      if (n1 /= this%fields(id)%dest_n1 .or. n2 /= this%fields(id)%dest_n2 .or. &
          dn3 /= this%fields(id)%dest_n3) then
         call logger%error("ocean_data_input: field id "//to_string(id)// &
                           " dest shape ("//to_string(n1)//","//to_string(n2)//","// &
                           to_string(dn3)//") does not match the registered shape ("// &
                           to_string(this%fields(id)%dest_n1)//","// &
                           to_string(this%fields(id)%dest_n2)//","// &
                           to_string(this%fields(id)%dest_n3)//")")
         error stop "ocean_data_input: dest shape mismatch"
      end if
   end subroutine check_registered