ESMF_ConfigValidate Subroutine

public subroutine ESMF_ConfigValidate(config, keywordEnforcer, options, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Config), intent(inout) :: config
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
character(len=*), intent(in), optional :: options
integer, intent(out), optional :: rc

Calls

proc~~esmf_configvalidate~~CallsGraph proc~esmf_configvalidate ESMF_ConfigValidate proc~esmf_configgetinit ESMF_ConfigGetInit proc~esmf_configvalidate->proc~esmf_configgetinit proc~esmf_imerr ESMF_IMErr proc~esmf_configvalidate->proc~esmf_imerr proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_configvalidate->proc~esmf_logfounderror proc~esmf_logwrite ESMF_LogWrite proc~esmf_configvalidate->proc~esmf_logwrite proc~esmf_utilarray2string ESMF_UtilArray2String proc~esmf_configvalidate->proc~esmf_utilarray2string proc~esmf_imerr->proc~esmf_logfounderror proc~esmf_initcheckdeep ESMF_InitCheckDeep proc~esmf_imerr->proc~esmf_initcheckdeep proc~esmf_logfounderror->proc~esmf_logwrite esmf_breakpoint esmf_breakpoint proc~esmf_logfounderror->esmf_breakpoint proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_logfounderror->proc~esmf_logrc2msg c_esmc_vmwtime c_esmc_vmwtime proc~esmf_logwrite->c_esmc_vmwtime proc~esmf_logclose ESMF_LogClose proc~esmf_logwrite->proc~esmf_logclose proc~esmf_logflush ESMF_LogFlush proc~esmf_logwrite->proc~esmf_logflush proc~esmf_logopenfile ESMF_LogOpenFile proc~esmf_logwrite->proc~esmf_logopenfile proc~esmf_utiliounitflush ESMF_UtilIOUnitFlush proc~esmf_logwrite->proc~esmf_utiliounitflush proc~esmf_utilstring2array ESMF_UtilString2Array proc~esmf_logwrite->proc~esmf_utilstring2array proc~esmf_logclose->proc~esmf_logflush proc~esmf_logflush->proc~esmf_utilarray2string proc~esmf_logflush->proc~esmf_utiliounitflush proc~esmf_logopenfile->proc~esmf_utiliounitflush proc~esmf_utiliounitget ESMF_UtilIOUnitGet proc~esmf_logopenfile->proc~esmf_utiliounitget c_esmc_loggeterrormsg c_esmc_loggeterrormsg proc~esmf_logrc2msg->c_esmc_loggeterrormsg

Called by

proc~~esmf_configvalidate~~CalledByGraph proc~esmf_configvalidate ESMF_ConfigValidate proc~f_esmf_configvalidate f_esmf_configvalidate proc~f_esmf_configvalidate->proc~esmf_configvalidate proc~f_esmf_configvalidatenooptions f_esmf_configvalidatenooptions proc~f_esmf_configvalidatenooptions->proc~esmf_configvalidate proc~finalization Finalization proc~finalization->proc~esmf_configvalidate proc~sections Sections proc~sections->proc~esmf_configvalidate

Source Code

    subroutine ESMF_ConfigValidate(config, &
      keywordEnforcer, options, rc)

! !ARGUMENTS:
      type(ESMF_Config), intent(inout)          :: config 
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      character (len=*), intent(in),   optional :: options
      integer,           intent(out),  optional :: rc 
!
!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \end{itemize}
!
! !DESCRIPTION: 
!   Checks whether a {\tt config} object is valid.
!
!   The arguments are:
!   \begin{description}
!   \item [config]
!     {\tt ESMF\_Config} object to be validated.
!   \item[{[options]}]
!     \begin{sloppypar}
!     If none specified:  simply check that the buffer is not full and the
!       pointers are within range.
!     "unusedAttributes" - Report to the default logfile all attributes not
!       retrieved via a call to {\tt ESMF\_ConfigGetAttribute()} or
!       {\tt ESMF\_ConfigGetChar()}.  The attribute name (label) will be
!       logged via {\tt ESMF\_LogErr} with the WARNING log message type.
!       For an array-valued attribute, retrieving at least one value via
!       {\tt ESMF\_ConfigGetAttribute()} or {\tt ESMF\_ConfigGetChar()}
!       constitutes being "used."
!     \end{sloppypar}
!   \item [{[rc]}]
!     Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     Equals {\tt ESMF\_RC\_ATTR\_UNUSED} if any unused attributes are found
!     with option "unusedAttributes" above.
!   \end{description}

!EOP -------------------------------------------------------------------
      character(len=ESMF_MAXSTR) :: logmsg
      integer :: i, localrc

      if (present(rc)) then
        rc = ESMF_RC_NOT_IMPL
      endif
      localrc = ESMF_RC_NOT_IMPL

      ! check variables
      ESMF_INIT_CHECK_DEEP(ESMF_ConfigGetInit,config,rc)

      ! validate internal buffer indices

      if (config%cptr%nbuf < 0 .or. config%cptr%nbuf > NBUF_MAX) then
        if (ESMF_LogFoundError(ESMF_RC_INTNRL_LIST, &
                                  msg="config%cptr%nbuf out-of-range.", &
                                  ESMF_CONTEXT, rcToReturn=rc)) return
      endif

      if (config%cptr%next_line < 0 .or. config%cptr%next_line >= config%cptr%nbuf) then
        if (ESMF_LogFoundError(ESMF_RC_INTNRL_LIST, &
                                  msg="config%cptr%next_line out-of-range.", &
                                  ESMF_CONTEXT, rcToReturn=rc)) return
      endif

      if (config%cptr%nattr < 0 .or. config%cptr%nattr > NATT_MAX) then
        if (ESMF_LogFoundError(ESMF_RC_INTNRL_LIST, &
                                  msg="config%cptr%nattr out-of-range.", &
                                  ESMF_CONTEXT, rcToReturn=rc)) return
      endif

      ! optional validations

      if (present(options)) then
        if (options == "unusedAttributes") then
          do i = 1, config%cptr%nattr
            if (.not.(config%cptr%attr_used(i)%used)) then
              logmsg = "Config attribute label '" // &
                  ESMF_UtilArray2String (config%cptr%attr_used(i)%label) // &
                  "' unused (not retrieved via ESMF_ConfigGetAttribute() " // &
                  "or ESMF_ConfigGetChar())."
              call ESMF_LogWrite(logmsg, ESMF_LOGMSG_WARNING, ESMF_CONTEXT)
                localrc = ESMF_RC_ATTR_UNUSED
            endif
          enddo
        endif
      endif

      if (present(rc)) then
        if (localrc == ESMF_RC_ATTR_UNUSED) then
          rc = localrc
        else
          rc = ESMF_SUCCESS
        end if
      end if

      return

    end subroutine ESMF_ConfigValidate