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 !------------------------------------------------------------------------------
21 #include <ESMF_TimeMgr.inc>
23 !===============================================================================
26 ! !MODULE: ESMF_AlarmClockMod
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 !------------------------------------------------------------------------------
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
49 !------------------------------------------------------------------------------
52 !------------------------------------------------------------------------------
54 ! !PUBLIC MEMBER FUNCTIONS:
55 public ESMF_AlarmCreate
57 !==============================================================================
61 !==============================================================================
64 ! Create ESMF_Alarm using ESMF 2.1.0+ semantics
65 FUNCTION ESMF_AlarmCreate( clock, RingTime, RingInterval, &
66 StopTime, Enabled, rc )
69 type(ESMF_Alarm) :: ESMF_AlarmCreate
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
78 type(ESMF_Alarm) :: alarmtmp
79 ! TBH: ignore allocate errors, for now
80 ALLOCATE( alarmtmp%alarmint )
81 CALL ESMF_AlarmSet( alarmtmp, &
83 RingInterval=RingInterval, &
87 IF ( PRESENT ( clock ) ) THEN
88 CALL ESMF_ClockAddAlarm( clock, alarmtmp, rc )
90 ESMF_AlarmCreate = alarmtmp
91 END FUNCTION ESMF_AlarmCreate
94 !------------------------------------------------------------------------------
96 end module ESMF_AlarmClockMod