mfm_time.f

来自「CCSM Research Tools: Community Atmospher」· F 代码 · 共 377 行

F
377
字号
!===============================================================================! MFM_Time Class!===============================================================================!! Time objects are part of the Modeling Framework Time Management module ! (MFM_TimeMgmt).  A time object represents a time interval as days and a time ! of day.!!     Public Member Functions:!     ------------------------!     MFM_TimeInit (Interface only)!     MFM_TimeSet (Interface only)!     MFM_TimeGet (Interface only)!     MFM_TimeIncrement (Interface only)!     MFM_TimeDecrement (Interface only)!     MFM_TimeGetDays!     MFM_TimeDiff!     MFM_TimePrint!!     Private Member Functions:!     -------------------------!     MFM_TimeInitIS (overloads MFM_TimeInit)!     MFM_TimeInitUndefined (overloads MFM_TimeInit)!     MFM_TimeCopyInit (overloads MFM_TimeInit)!     MFM_TimeSetIS (overloads MFM_TimeSet)!     MFM_TimeGetIS (overloads MFM_TimeGet)!     MFM_TimeIncrementIS (overloads MFM_TimeIncrement)!     MFM_TimeDecrementIS (overloads MFM_TimeDecrement)!!===============================================================================!BOP!! !IROUTINE:  MFM_TimeInitIS!! !INTERFACE:      function MFM_TimeInitIS(days, seconds, rc)! !PARAMETERS:          type(MFM_Time) :: MFM_TimeInitIS        ! returned time object          integer, intent(in) :: days             ! days in time      integer, intent(in) :: seconds          ! seconds in time      integer, intent(out), optional :: rc    ! return code! !DESCRIPTION:!     Initializes a time object that is based on integer seconds.  !     Acceptable values for days and seconds are non-negative values !     and the value {\tt MFM\_TIME\_UNDEFINED}.  !!EOP!-------------------------------------------------------------------------------      integer stub      call MF_TimeInitIS(MFM_TimeInitIS, days, seconds, stub)      if (present(rc)) rc = stub      end function MFM_TimeInitIS!===============================================================================!BOP!! !IROUTINE:  MFM_TimeInitUndefined!! !INTERFACE:      function MFM_TimeInitUndefined(rc)! !RETURN VALUE:          type(MFM_Time) :: MFM_TimeInitUndefined       ! returned time object    ! !PARAMETERS:      integer, intent(out), optional :: rc          ! return code! !DESCRIPTION:!     Initializes a new time object with undefined contents.  The value of !     internal attributes is set to {\tt MFM\_TIME\_UNDEFINED}.  !!EOP!-------------------------------------------------------------------------------      integer stub      call MF_TimeInitUndefined(MFM_TimeInitUndefined, stub)      if (present(rc)) rc = stub           end function MFM_TimeInitUndefined!===============================================================================!BOP!! !IROUTINE:  MFM_TimeCopyInit!! !INTERFACE:      function MFM_TimeCopyInit(orig, rc)! !RETURN VALUE:          type(MFM_Time) :: MFM_TimeCopyInit        ! returned time object! !PARAMETERS:      type(MFM_Time), intent(in) :: orig        ! original time          integer, intent(out), optional :: rc      ! return code! !DESCRIPTION:!     Initializes a new time object to the contents of another time.  !!EOP!-------------------------------------------------------------------------------      integer stub      call MF_TimeCopyInit(MFM_TimeCopyInit, orig, stub)      if (present(rc)) rc = stub        end function MFM_TimeCopyInit!===============================================================================!BOP!! !IROUTINE:  MFM_TimeSetIS!! !INTERFACE:      subroutine MFM_TimeSetIS(time, days, seconds, rc)! !PARAMETERS:      type(MFM_Time), intent(out) :: time      ! time      integer, intent(in) :: days              ! days      integer, intent(in) :: seconds           ! seconds      integer, intent(out), optional :: rc     ! return code! !DESCRIPTION:!     Sets (or resets) the attributes of {\tt time} to {\tt days} and !     {\tt seconds}.  Non-negative values of {\tt days} and {\tt seconds} !     are valid; the value {\tt MFM\_TIME\_UNDEFINED} is not.!!EOP!-------------------------------------------------------------------------------      integer stub      call MF_TimeSetIS(time, days, seconds, stub)      if (present(rc)) rc = stub          end subroutine MFM_TimeSetIS!===============================================================================!BOP!! !IROUTINE:  MFM_TimeGetIS!! !INTERFACE:      subroutine MFM_TimeGetIS(time, days, seconds, rc)! !PARAMETERS:      type(MFM_Time), intent(in) :: time    ! time      integer, intent(out) :: days          ! returned days      integer, intent(out) :: seconds       ! returned seconds      integer, intent(out), optional :: rc  ! return code! !DESCRIPTION:!     Returns {\tt time} in the form of integer {\tt days} and {\tt seconds}.!!EOP!-------------------------------------------------------------------------------      integer stub      call MF_TimeGetIS(time, days, seconds, stub)      if (present(rc)) rc = stub           end subroutine MFM_TimeGetIS!===============================================================================!BOP!! !IROUTINE:  MFM_TimeGetDays!! !INTERFACE:      function MFM_TimeGetDays(time, rc)! !RETURN VALUE:      real(8) :: MFM_TimeGetDays                ! returned time value! !PARAMETERS:      type(MFM_Time), intent(in) :: time        ! time      integer, intent(out), optional :: rc      ! return code! !DESCRIPTION:!     Returns {\tt time} in the form of real {\tt days}.!!EOP!-------------------------------------------------------------------------------      integer stub      call MF_TimeGetDays(time, MFM_TimeGetDays, stub)      if (present(rc)) rc = stub         end function MFM_TimeGetDays!===============================================================================!BOP!! !IROUTINE:  MFM_TimeIncrementIS!! !INTERFACE:      function MFM_TimeIncrementIS(time, days, seconds, rc)! !RETURN VALUE:      type(MFM_Time) :: MFM_TimeIncrementIS      ! returned incremented time! !PARAMETERS:      type(MFM_Time), intent(in) :: time         ! time      integer, intent(in) :: days                ! day increment      integer, intent(in) :: seconds             ! second increment      integer, intent(out), optional :: rc       ! return code! !DESCRIPTION:!     Increments {\tt time} by {\tt days} and {\tt seconds}.  Non-negative!     values of {\tt days} and {\tt seconds} are valid.!!EOP!-------------------------------------------------------------------------------      integer stub      call MF_TimeInitUndefined(MFM_TimeIncrementIS, stub)      if (stub == MFM_SUCCESS) then        call MF_TimeIncrementIS(time, MFM_TimeIncrementIS,      &                        days, seconds, stub)      end if      if (present(rc)) rc = stub           end function MFM_TimeIncrementIS!===============================================================================!BOP!! !IROUTINE:  MFM_TimeCopy!! !INTERFACE:      subroutine MFM_TimeCopy(time, orig, rc)! !PARAMETERS:      type(MFM_Time), intent(in) :: orig         ! original time      type(MFM_Time), intent(out) :: time        ! copy      integer, intent(out), optional :: rc       ! return code! !DESCRIPTION:!     Copies the time {\tt orig} into {\tt time}.  Both times must be!     initialized.!!EOP!-------------------------------------------------------------------------------      integer stub      call MF_TimeCopy(time, orig, stub)      if (present(rc)) rc = stub      end subroutine MFM_TimeCopy!===============================================================================!BOP!! !IROUTINE:  MFM_TimeDiff!! !INTERFACE:      subroutine MFM_TimeDiff(earlyTime, lateTime, diff, isLater, rc)! !PARAMETERS:      type(MFM_Time), intent(in) :: earlyTime    ! earlier time      type(MFM_Time), intent(in) :: lateTime     ! later time      type(MFM_Time), intent(out) :: diff        ! difference between earlier                                                 !   and later times      logical, intent(out) :: isLater            ! true if later date is in                                                 !   fact later      integer, intent(out), optional :: rc       ! return code! !DESCRIPTION:!     Takes the difference between two times and returns the difference !     in {\tt diff}.  The returned value {\tt isLater} is true if !     {\tt lateTime} represents a time quantity greater than or equal to !     {\tt earlyTime}.!     !!EOP!-------------------------------------------------------------------------------      integer stub      call MF_TimeDiff(earlyTime, lateTime, diff, isLater, stub)      if (present(rc)) rc = stub      end subroutine MFM_TimeDiff!===============================================================================!BOP!! !IROUTINE:  MFM_TimeDecrementIS!! !INTERFACE:      function MFM_TimeDecrementIS(time, days, seconds, rc)! !RETURN VALUE:      type(MFM_Time) :: MFM_TimeDecrementIS     ! returned decremented time! !PARAMETERS:      type(MFM_Time), intent(in) :: time        ! time      integer, intent(in) :: days               ! days      integer, intent(in) :: seconds            ! seconds      integer, intent(out), optional :: rc      ! return code ! !DESCRIPTION:!     Decrements {\tt time} by {\tt days} and {\tt seconds}.  Non-negative!     values of {\tt days} and {\tt seconds} are valid.!!EOP!-------------------------------------------------------------------------------      integer stub      call MF_TimeInitUndefined(MFM_TimeDecrementIS, stub)            if (stub == MFM_SUCCESS) then        call MF_TimeDecrementIS(time, MFM_TimeDecrementIS, days,      &                        seconds, stub)      end if      if (present(rc)) rc = stub           end function MFM_TimeDecrementIS!===============================================================================!BOP!! !IROUTINE:  MFM_TimePrint!! !INTERFACE:      subroutine MFM_TimePrint(time, rc)! !PARAMETERS:      type(MFM_Time), intent(in) :: time            ! time      integer, intent(out), optional :: rc          ! return code! !DESCRIPTION:!     Prints the attributes of {\tt time} to stdout.!!EOP!-------------------------------------------------------------------------------      integer stub      call MF_TimePrint(time, stub)      if (present(rc)) rc = stub           end subroutine MFM_TimePrint!===============================================================================

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?