merge standard release WRF/WPS V3.0.1.1 into wrffire
[wrffire.git] / wrfv2_fire / external / esmf_time_f90 / ESMF_AlarmClock.F90
blob30682ca73f16c0ff68d94591a457db608b6b5605
2 ! Earth System Modeling Framework
3 ! Copyright 2002-2003, University Corporation for Atmospheric Research,
4 ! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
5 ! Laboratory, University of Michigan, National Centers for Environmental
6 ! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
7 ! NASA Goddard Space Flight Center.
8 ! Licensed under the University of Illinois-NCSA license.
10 !==============================================================================
12 !     ESMF Alarm-Clock Module
13       module ESMF_AlarmClockMod
15 !==============================================================================
17 ! This file contains the AlarmCreate method.
19 !------------------------------------------------------------------------------
20 ! INCLUDES
21 #include <ESMF_TimeMgr.inc>
23 !===============================================================================
24 !BOPI
26 ! !MODULE: ESMF_AlarmClockMod
28 ! !DESCRIPTION:
29 ! Separate module that uses both ESMF_AlarmMod and ESMF_ClockMod.  
30 ! Separation is needed to avoid cyclic dependence.  
32 ! Defines F90 wrapper entry points for corresponding
33 ! C++ class {\tt ESMC\_Alarm}
35 ! See {\tt ../include/ESMC\_Alarm.h} for complete description
37 !------------------------------------------------------------------------------
38 ! !USES:
39       ! inherit ESMF_Alarm and ESMF_Clock
40       use ESMF_AlarmMod, only : ESMF_Alarm, ESMF_AlarmSet
41       use ESMF_ClockMod, only : ESMF_Clock, ESMF_ClockAddAlarm
43       ! associated derived types
44       use ESMF_TimeIntervalMod, only : ESMF_TimeInterval
45       use ESMF_TimeMod,         only : ESMF_Time
47       implicit none
49 !------------------------------------------------------------------------------
50 ! !PRIVATE TYPES:
51      private
52 !------------------------------------------------------------------------------
54 ! !PUBLIC MEMBER FUNCTIONS:
55       public ESMF_AlarmCreate
57 !==============================================================================
59       contains
61 !==============================================================================
64 ! Create ESMF_Alarm using ESMF 2.1.0+ semantics
65       FUNCTION ESMF_AlarmCreate( clock, RingTime, RingInterval, &
66                                  StopTime, Enabled, rc )
68         ! return value
69         type(ESMF_Alarm) :: ESMF_AlarmCreate
70         ! !ARGUMENTS:
71         type(ESMF_Clock), intent(inout), optional :: clock
72         type(ESMF_Time), intent(in), optional :: RingTime
73         type(ESMF_TimeInterval), intent(in), optional :: RingInterval
74         type(ESMF_Time), intent(in), optional :: StopTime
75         logical, intent(in), optional :: Enabled
76         integer, intent(out), optional :: rc
77         ! locals
78         type(ESMF_Alarm) :: alarmtmp
79          ! TBH:  ignore allocate errors, for now
80         ALLOCATE( alarmtmp%alarmint )
81         CALL ESMF_AlarmSet( alarmtmp,                  &
82                             RingTime=RingTime,         &
83                             RingInterval=RingInterval, &
84                             StopTime=StopTime,         &
85                             Enabled=Enabled,           &
86                             rc=rc )
87         IF ( PRESENT ( clock ) ) THEN
88           CALL ESMF_ClockAddAlarm( clock, alarmtmp, rc )
89         ENDIF
90         ESMF_AlarmCreate = alarmtmp
91       END FUNCTION ESMF_AlarmCreate
94 !------------------------------------------------------------------------------
96       end module ESMF_AlarmClockMod