ocean_diag_disable Subroutine

private subroutine ocean_diag_disable(this, name)

Turn OFF the registered diagnostic name so the dispatcher skips it entirely (no fill, no fold, no emit). Fail-loud if name matches no registered var — a typo must not silently leave a diagnostic running. Lists the registered names on abort.

Type Bound

ocean_diag_t

Arguments

Type IntentOptional Attributes Name
class(ocean_diag_t), intent(inout) :: this
character(len=*), intent(in) :: name

Calls

proc~~ocean_diag_disable~~CallsGraph proc~ocean_diag_disable ocean_diag_t%ocean_diag_disable error error proc~ocean_diag_disable->error

Variables

Type Visibility Attributes Name Initial
character(len=1024), private :: avail
integer, private :: i

Source Code

   subroutine ocean_diag_disable(this, name)
      !! Turn OFF the registered diagnostic `name` so the dispatcher skips
      !! it entirely (no fill, no fold, no emit).  Fail-loud if `name`
      !! matches no registered var — a typo must not silently leave a
      !! diagnostic running.  Lists the registered names on abort.
      class(ocean_diag_t), intent(inout) :: this
      character(len=*), intent(in) :: name
      integer :: i
      character(len=1024) :: avail

      do i = 1, this%nvars
         if (trim(this%vars(i)%name) == trim(name)) then
            this%vars(i)%enabled = .false.
            return
         end if
      end do

      avail = ""
      do i = 1, this%nvars
         avail = trim(avail)//" "//trim(this%vars(i)%name)
      end do
      call logger%error("ocean_diag%disable: no registered diagnostic named '"// &
                        trim(name)//"' — registered:"//trim(avail))
      error stop "ocean_diag%disable: unknown diagnostic name"
   end subroutine ocean_diag_disable