ESMF_BasePrint Subroutine

public subroutine ESMF_BasePrint(base, options, filename, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Base), intent(in) :: base
character(len=*), intent(in), optional :: options
character(len=*), intent(in), optional :: filename
integer, intent(out), optional :: rc

Source Code

  subroutine ESMF_BasePrint(base, options, filename, rc)
!
! !ARGUMENTS:
    type(ESMF_Base),  intent(in)              :: base
    character(len=*), intent(in),   optional  :: options
    character(len=*), intent(in),   optional  :: filename
    integer,          intent(out),  optional  :: rc
!
! !DESCRIPTION:
!     Interface to call through to C++ and print base object values. \\
!
!     The arguments are:
!     \begin{description}
!     \item[base]
!       Any ESMF type.
!     \item[options]
!       Print options.
!     \item[{[filename]}]
!       Used to determine whether to write to file or stdout.
!     \item[{[rc]}]
!       Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!
!
!EOPI
    integer                     :: localrc
    integer                     :: ignore_iostat
    character(len=ESMF_MAXSTR)  :: opts
    type(ESMF_Logical)          :: tofile

    ! Initialize return code; assume routine not implemented
    if (present(rc)) rc = ESMF_RC_NOT_IMPL
    localrc = ESMF_RC_NOT_IMPL

    ! Check init status of arguments
    ESMF_INIT_CHECK_DEEP(ESMF_BaseGetInit, base, rc)

    if (present(options)) then
        opts = options
    else
        opts = ''
    endif

    tofile = present (filename)

    call ESMF_UtilIOUnitFlush (unit=ESMF_UtilIOstdout, rc=ignore_iostat)
    ! Ignore iostat, because sometimes stdout is not open at this point
    ! and some compilers FLUSH statements will complain.

    call c_ESMC_BasePrint(base, 0, opts, tofile, filename, ESMF_TRUE, localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! Return successfully
    if (present(rc)) rc = ESMF_SUCCESS
  end subroutine ESMF_BasePrint