1 | ! Various dummy type definitions and routines for the sole purpose of |
---|
2 | ! mimicking newer ESMF interface features without necessarily implementing |
---|
3 | ! them. |
---|
4 | |
---|
5 | MODULE ESMF_Stubs |
---|
6 | |
---|
7 | IMPLICIT NONE |
---|
8 | |
---|
9 | PRIVATE |
---|
10 | |
---|
11 | ! Bogus typedefs |
---|
12 | TYPE ESMF_Grid |
---|
13 | INTEGER :: dummy |
---|
14 | END TYPE |
---|
15 | |
---|
16 | TYPE ESMF_GridComp |
---|
17 | INTEGER :: dummy |
---|
18 | END TYPE |
---|
19 | |
---|
20 | TYPE ESMF_State |
---|
21 | INTEGER :: dummy |
---|
22 | END TYPE |
---|
23 | |
---|
24 | TYPE ESMF_VM |
---|
25 | INTEGER :: dummy |
---|
26 | END TYPE |
---|
27 | |
---|
28 | TYPE ESMF_MsgType |
---|
29 | INTEGER :: mtype |
---|
30 | END TYPE |
---|
31 | TYPE(ESMF_MsgType), PARAMETER :: & |
---|
32 | ESMF_LOG_INFO = ESMF_MsgType(1), & |
---|
33 | ESMF_LOG_WARNING = ESMF_MsgType(2), & |
---|
34 | ESMF_LOG_ERROR = ESMF_MsgType(3) |
---|
35 | |
---|
36 | TYPE ESMF_LOG |
---|
37 | INTEGER :: dummy |
---|
38 | END TYPE |
---|
39 | |
---|
40 | LOGICAL, private, save :: initialized = .false. |
---|
41 | |
---|
42 | PUBLIC ESMF_Grid, ESMF_GridComp, ESMF_State, ESMF_VM |
---|
43 | PUBLIC ESMF_Initialize, ESMF_Finalize, ESMF_IsInitialized |
---|
44 | PUBLIC ESMF_LogWrite, ESMF_LOG, ESMF_MsgType |
---|
45 | PUBLIC ESMF_LOG_INFO, ESMF_LOG_WARNING, ESMF_LOG_ERROR |
---|
46 | |
---|
47 | CONTAINS |
---|
48 | |
---|
49 | |
---|
50 | ! NOOP |
---|
51 | SUBROUTINE ESMF_Initialize( vm, defaultCalendar, rc ) |
---|
52 | USE esmf_basemod |
---|
53 | USE esmf_calendarmod |
---|
54 | TYPE(ESMF_VM), INTENT(IN ), OPTIONAL :: vm |
---|
55 | TYPE(ESMF_CalendarType), INTENT(IN ), OPTIONAL :: defaultCalendar |
---|
56 | INTEGER, INTENT( OUT), OPTIONAL :: rc |
---|
57 | |
---|
58 | TYPE(ESMF_CalendarType) :: defaultCalType |
---|
59 | INTEGER :: status |
---|
60 | |
---|
61 | IF ( PRESENT( rc ) ) rc = ESMF_FAILURE |
---|
62 | ! Initialize the default time manager calendar |
---|
63 | IF ( PRESENT(defaultCalendar) )THEN |
---|
64 | defaultCalType = defaultCalendar |
---|
65 | ELSE |
---|
66 | defaultCalType = ESMF_CAL_NOLEAP |
---|
67 | END IF |
---|
68 | allocate( defaultCal ) |
---|
69 | defaultCal = ESMF_CalendarCreate( calendarType=defaultCalType, & |
---|
70 | rc=status) |
---|
71 | |
---|
72 | ! initialize tables in time manager |
---|
73 | CALL initdaym |
---|
74 | |
---|
75 | IF (status .ne. ESMF_SUCCESS) THEN |
---|
76 | PRINT *, "Error initializing the default time manager calendar" |
---|
77 | RETURN |
---|
78 | END IF |
---|
79 | initialized = .true. |
---|
80 | |
---|
81 | IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS |
---|
82 | END SUBROUTINE ESMF_Initialize |
---|
83 | |
---|
84 | |
---|
85 | FUNCTION ESMF_IsInitialized() |
---|
86 | LOGICAL ESMF_IsInitialized |
---|
87 | ESMF_IsInitialized = initialized |
---|
88 | END FUNCTION ESMF_IsInitialized |
---|
89 | |
---|
90 | |
---|
91 | ! NOOP |
---|
92 | SUBROUTINE ESMF_Finalize( rc ) |
---|
93 | USE esmf_basemod |
---|
94 | INTEGER, INTENT( OUT), OPTIONAL :: rc |
---|
95 | #if (defined SPMD) || (defined COUP_CSM) |
---|
96 | #include <mpif.h> |
---|
97 | #endif |
---|
98 | LOGICAL :: flag |
---|
99 | INTEGER :: ier |
---|
100 | |
---|
101 | IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS |
---|
102 | #if (defined SPMD) || (defined COUP_CSM) |
---|
103 | CALL MPI_Finalized( flag, ier ) |
---|
104 | IF ( ier .ne. mpi_success )THEN |
---|
105 | IF ( PRESENT( rc ) ) rc = ESMF_FAILURE |
---|
106 | END IF |
---|
107 | IF ( .NOT. flag ) THEN |
---|
108 | CALL MPI_Finalize( ier ) |
---|
109 | IF ( ier .ne. mpi_success )THEN |
---|
110 | IF ( PRESENT( rc ) ) rc = ESMF_FAILURE |
---|
111 | END IF |
---|
112 | END IF |
---|
113 | #endif |
---|
114 | END SUBROUTINE ESMF_Finalize |
---|
115 | |
---|
116 | ! NOOP |
---|
117 | SUBROUTINE ESMF_LogWrite( msg, MsgType, line, file, method, log, rc ) |
---|
118 | USE esmf_basemod |
---|
119 | CHARACTER(LEN=*), INTENT(IN) :: msg |
---|
120 | TYPE(ESMF_MsgType), INTENT(IN) :: msgtype |
---|
121 | INTEGER, INTENT(IN), OPTIONAL :: line |
---|
122 | CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: file |
---|
123 | CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: method |
---|
124 | TYPE(ESMF_LOG),TARGET,OPTIONAL :: log |
---|
125 | INTEGER, INTENT(OUT),OPTIONAL :: rc |
---|
126 | IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS |
---|
127 | END SUBROUTINE ESMF_LogWrite |
---|
128 | |
---|
129 | |
---|
130 | END MODULE ESMF_Stubs |
---|
131 | |
---|
132 | |
---|