| 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 | INTEGER :: ier |
|---|
| 99 | |
|---|
| 100 | IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS |
|---|
| 101 | #if (defined SPMD) || (defined COUP_CSM) |
|---|
| 102 | CALL MPI_Finalize( ier ) |
|---|
| 103 | IF ( ier .ne. mpi_success )THEN |
|---|
| 104 | IF ( PRESENT( rc ) ) rc = ESMF_FAILURE |
|---|
| 105 | END IF |
|---|
| 106 | #endif |
|---|
| 107 | END SUBROUTINE ESMF_Finalize |
|---|
| 108 | |
|---|
| 109 | ! NOOP |
|---|
| 110 | SUBROUTINE ESMF_LogWrite( msg, MsgType, line, file, method, log, rc ) |
|---|
| 111 | USE esmf_basemod |
|---|
| 112 | CHARACTER(LEN=*), INTENT(IN) :: msg |
|---|
| 113 | TYPE(ESMF_MsgType), INTENT(IN) :: msgtype |
|---|
| 114 | INTEGER, INTENT(IN), OPTIONAL :: line |
|---|
| 115 | CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: file |
|---|
| 116 | CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: method |
|---|
| 117 | TYPE(ESMF_LOG),TARGET,OPTIONAL :: log |
|---|
| 118 | INTEGER, INTENT(OUT),OPTIONAL :: rc |
|---|
| 119 | IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS |
|---|
| 120 | END SUBROUTINE ESMF_LogWrite |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | END MODULE ESMF_Stubs |
|---|
| 124 | |
|---|
| 125 | |
|---|