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.
| Type | Intent | Optional | 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 |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | dn3 |
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