ESMF_CalendarGet Subroutine

public subroutine ESMF_CalendarGet(calendar, keywordEnforcer, name, calkindflag, daysPerMonth, monthsPerYear, secondsPerDay, secondsPerYear, daysPerYear, daysPerYearDn, daysPerYearDd, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Calendar), intent(in) :: calendar
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
character(len=*), intent(out), optional :: name
type(ESMF_CalKind_Flag), intent(out), optional :: calkindflag
integer, intent(out), optional :: daysPerMonth(:)
integer, intent(out), optional :: monthsPerYear
integer(kind=ESMF_KIND_I4), intent(out), optional :: secondsPerDay
integer(kind=ESMF_KIND_I4), intent(out), optional :: secondsPerYear
integer(kind=ESMF_KIND_I4), intent(out), optional :: daysPerYear
integer(kind=ESMF_KIND_I4), intent(out), optional :: daysPerYearDn
integer(kind=ESMF_KIND_I4), intent(out), optional :: daysPerYearDd
integer, intent(out), optional :: rc

Source Code

      subroutine ESMF_CalendarGet(calendar, keywordEnforcer, &
        name, calkindflag, daysPerMonth, monthsPerYear, &
        secondsPerDay, secondsPerYear, &
        daysPerYear, daysPerYearDn, daysPerYearDd, rc)

! !ARGUMENTS:
      type(ESMF_Calendar),    intent(in)            :: calendar
      type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      type(ESMF_CalKind_Flag),intent(out), optional :: calkindflag
      integer,                intent(out), optional :: daysPerMonth(:)
      integer,                intent(out), optional :: monthsPerYear
      integer(ESMF_KIND_I4),  intent(out), optional :: secondsPerDay
      integer(ESMF_KIND_I4),  intent(out), optional :: secondsPerYear
      integer(ESMF_KIND_I4),  intent(out), optional :: daysPerYear
      integer(ESMF_KIND_I4),  intent(out), optional :: daysPerYearDn
      integer(ESMF_KIND_I4),  intent(out), optional :: daysPerYearDd
      character (len=*),      intent(out), optional :: name
      integer,                intent(out), optional :: rc

!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \end{itemize}
!
! !DESCRIPTION:
!     Gets one or more of an {\tt ESMF\_Calendar}'s properties.
!
!     The arguments are:
!     \begin{description}
!     \item[calendar]
!          The object instance to query.
!     \item[{[calkindflag]}]
!          The {\tt CalKind\_Flag} ESMF\_CALKIND\_GREGORIAN, 
!          ESMF\_CALKIND\_JULIAN, etc.
!     \item[{[daysPerMonth]}]
!          Integer array of days per month, for each month of the year.
!     \item[{[monthsPerYear]}]
!          Integer number of months per year; the size of the
!          daysPerMonth array.
!     \item[{[secondsPerDay]}]
!          Integer number of seconds per day.
!     \item[{[secondsPerYear]}]
!          Integer number of seconds per year.
!     \item[{[daysPerYear]}]
!          Integer number of days per year.  For calendars with
!          intercalations, daysPerYear is the number of days for years without
!          an intercalation.  For other calendars, it is the number of days in
!          every year.
!     \item[{[daysPerYearDn]}]
!          \begin{sloppypar}
!          Integer fractional number of days per year (numerator).
!          For calendars with intercalations, daysPerYearDn/daysPerYearDd is
!          the average fractional number of days per year (e.g. 25/100 for
!          Julian 4-year intercalation).  For other calendars, it is zero.
!          \end{sloppypar}
!     \item[{[daysPerYearDd]}]
!          Integer fractional number of days per year (denominator).  See
!          daysPerYearDn above.
!     \item[{[name]}]
!          The name of this calendar.
!     \item[{[rc]}]
!          Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!     
!EOP

      ! temp name for C++ to fill
      character (len=ESMF_MAXSTR) :: tempName

      ! initialize name lengths to zero for non-existent name
      !   and initialize daysPerMonth list size to zero for not-present list
      integer :: nameLen
      integer :: tempNameLen
      integer :: sizeofDaysPerMonth
      integer :: localrc                        ! local return code

      ! Assume failure until success
      if (present(rc)) rc = ESMF_RC_NOT_IMPL
      localrc = ESMF_RC_NOT_IMPL

      ! check input
      ESMF_INIT_CHECK_DEEP(ESMF_CalendarGetInit,calendar,rc)

      nameLen = 0
      tempNameLen = 0
      sizeofDaysPerMonth = 0

      ! get length of given name for C++ validation
      if (present(name)) then
        nameLen = len(name)
      end if

      ! get size of given daysPerMonth list for C++ validation
      if (present(daysPerMonth)) then   
        sizeofDaysPerMonth = size(daysPerMonth)
      end if

      ! invoke C to C++ entry point

      if (present(daysPerMonth)) then
        call c_ESMC_CalendarGet1(calendar, nameLen, tempNameLen, tempName, &
                         calkindflag, &
                         daysPerMonth(1), sizeofDaysPerMonth, &
                         monthsPerYear, secondsPerDay, secondsPerYear, &
                         daysPerYear, daysPerYearDn, daysPerYearDd, localrc)
        if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
          ESMF_CONTEXT, rcToReturn=rc)) return
      else
        call c_ESMC_CalendarGet0(calendar, nameLen, tempNameLen, tempName, &
                         calkindflag, &
                         sizeofDaysPerMonth, &
                         monthsPerYear, secondsPerDay, secondsPerYear, &
                         daysPerYear, daysPerYearDn, daysPerYearDd, localrc)
        if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
          ESMF_CONTEXT, rcToReturn=rc)) return
      end if
    
      ! copy temp name back to given name to restore native Fortran
      !   storage style
      if (present(name)) then
        name = tempName(1:tempNameLen)
      endif

      ! Return success
      if (present(rc)) rc = ESMF_SUCCESS
      end subroutine ESMF_CalendarGet