resolve_canonical_spec Subroutine

private pure subroutine resolve_canonical_spec(specs, name, time_op, dt_out, coord, skip)

Look up canonical diagnostic name in the parsed specs and apply its overrides: skip=.true. if the entry is :off; otherwise time_op / dt_out / coord are overwritten when the entry sets them. No matching entry (or absent specs) leaves the caller’s defaults untouched.

Arguments

Type IntentOptional Attributes Name
type(diag_spec_t), intent(in), optional :: specs(:)
character(len=*), intent(in) :: name
integer, intent(inout) :: time_op
real(kind=wp), intent(inout) :: dt_out
integer, intent(inout) :: coord
logical, intent(out) :: skip

Called by

proc~~resolve_canonical_spec~~CalledByGraph proc~resolve_canonical_spec resolve_canonical_spec proc~register_one_canonical register_one_canonical proc~register_one_canonical->proc~resolve_canonical_spec proc~register_default_diags register_default_diags proc~register_default_diags->proc~register_one_canonical proc~apply_diag_selection apply_diag_selection proc~apply_diag_selection->proc~register_default_diags proc~engine_configure_diag engine_configure_diag proc~engine_configure_diag->proc~apply_diag_selection proc~engine_setup engine_setup proc~engine_setup->proc~engine_configure_diag

Variables

Type Visibility Attributes Name Initial
integer, private :: i

Source Code

   pure subroutine resolve_canonical_spec(specs, name, time_op, dt_out, coord, skip)
      !! Look up canonical diagnostic `name` in the parsed `specs` and apply
      !! its overrides: `skip=.true.` if the entry is `:off`; otherwise
      !! `time_op` / `dt_out` / `coord` are overwritten when the entry sets
      !! them.  No matching entry (or absent `specs`) leaves the caller's
      !! defaults untouched.
      type(diag_spec_t), intent(in), optional :: specs(:)
      character(len=*), intent(in) :: name
      integer, intent(inout) :: time_op
      real(wp), intent(inout) :: dt_out
      integer, intent(inout) :: coord
      logical, intent(out) :: skip
      integer :: i

      skip = .false.
      if (.not. present(specs)) return
      do i = 1, size(specs)
         if (trim(specs(i)%name) == trim(name)) then
            if (specs(i)%off) then
               skip = .true.
               return
            end if
            if (specs(i)%time_op /= DIAG_OP_UNSET) time_op = specs(i)%time_op
            if (specs(i)%dt_out > 0.0_wp) dt_out = specs(i)%dt_out
            if (specs(i)%coord /= DIAG_COORD_UNSET) coord = specs(i)%coord
            return
         end if
      end do
   end subroutine resolve_canonical_spec