1 | ! |
---|
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 GPL. |
---|
9 | ! |
---|
10 | !============================================================================== |
---|
11 | ! |
---|
12 | ! ESMF Alarm-Clock Module |
---|
13 | module ESMF_AlarmClockMod |
---|
14 | ! |
---|
15 | !============================================================================== |
---|
16 | ! |
---|
17 | ! This file contains the AlarmCreate method. |
---|
18 | ! |
---|
19 | !------------------------------------------------------------------------------ |
---|
20 | ! INCLUDES |
---|
21 | #include <ESMF_TimeMgr.inc> |
---|
22 | |
---|
23 | !=============================================================================== |
---|
24 | !BOPI |
---|
25 | ! |
---|
26 | ! !MODULE: ESMF_AlarmClockMod |
---|
27 | ! |
---|
28 | ! !DESCRIPTION: |
---|
29 | ! Separate module that uses both ESMF_AlarmMod and ESMF_ClockMod. |
---|
30 | ! Separation is needed to avoid cyclic dependence. |
---|
31 | ! |
---|
32 | ! Defines F90 wrapper entry points for corresponding |
---|
33 | ! C++ class {\tt ESMC\_Alarm} |
---|
34 | ! |
---|
35 | ! See {\tt ../include/ESMC\_Alarm.h} for complete description |
---|
36 | ! |
---|
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 |
---|
42 | |
---|
43 | ! associated derived types |
---|
44 | use ESMF_TimeIntervalMod, only : ESMF_TimeInterval |
---|
45 | use ESMF_TimeMod, only : ESMF_Time |
---|
46 | |
---|
47 | implicit none |
---|
48 | |
---|
49 | !------------------------------------------------------------------------------ |
---|
50 | ! !PRIVATE TYPES: |
---|
51 | private |
---|
52 | !------------------------------------------------------------------------------ |
---|
53 | |
---|
54 | ! !PUBLIC MEMBER FUNCTIONS: |
---|
55 | public ESMF_AlarmCreate |
---|
56 | |
---|
57 | !============================================================================== |
---|
58 | |
---|
59 | contains |
---|
60 | |
---|
61 | !============================================================================== |
---|
62 | |
---|
63 | |
---|
64 | ! Create ESMF_Alarm using ESMF 2.1.0+ semantics |
---|
65 | FUNCTION ESMF_AlarmCreate( clock, RingTime, RingInterval, & |
---|
66 | StopTime, Enabled, rc ) |
---|
67 | |
---|
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 |
---|
92 | |
---|
93 | |
---|
94 | !------------------------------------------------------------------------------ |
---|
95 | |
---|
96 | end module ESMF_AlarmClockMod |
---|