1 | #include "xios_fortran_prefix.hpp" |
---|
2 | MODULE IDATE |
---|
3 | USE, INTRINSIC :: ISO_C_BINDING |
---|
4 | |
---|
5 | ! enum XCalendarType |
---|
6 | INTEGER(kind = C_INT), PARAMETER :: D360 = 0 , ALLLEAP = 1 , NOLEAP = 2 , JULIAN = 3 , GREGORIAN = 4 |
---|
7 | |
---|
8 | TYPE, BIND(C) :: txios(date) |
---|
9 | INTEGER(kind = C_INT) :: year, month, day, hour, minute, second |
---|
10 | END TYPE txios(date) |
---|
11 | |
---|
12 | TYPE txios(time) |
---|
13 | REAL(kind = 8) :: year=0, month=0, day=0, hour=0, minute=0, second=0 |
---|
14 | END TYPE txios(time) |
---|
15 | |
---|
16 | INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 |
---|
17 | |
---|
18 | SUBROUTINE cxios_set_timestep(ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second) BIND(C) |
---|
19 | IMPORT C_DOUBLE |
---|
20 | REAL (kind = C_DOUBLE), VALUE :: ts_year, ts_month , ts_day , & |
---|
21 | ts_hour, ts_minute, ts_second |
---|
22 | END SUBROUTINE cxios_set_timestep |
---|
23 | |
---|
24 | SUBROUTINE cxios_update_calendar(step) BIND(C) |
---|
25 | IMPORT C_INT |
---|
26 | INTEGER (kind = C_INT), VALUE :: step |
---|
27 | END SUBROUTINE cxios_update_calendar |
---|
28 | |
---|
29 | END INTERFACE |
---|
30 | |
---|
31 | CONTAINS ! Fonctions disponibles pour les utilisateurs. |
---|
32 | |
---|
33 | |
---|
34 | SUBROUTINE xios(set_timestep)(timestep) |
---|
35 | IMPLICIT NONE |
---|
36 | TYPE(txios(time)), INTENT(IN):: timestep |
---|
37 | |
---|
38 | CALL cxios_set_timestep(timestep%year, timestep%month , timestep%day, & |
---|
39 | timestep%hour, timestep%minute, timestep%second) |
---|
40 | |
---|
41 | END SUBROUTINE xios(set_timestep) |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | SUBROUTINE xios(update_calendar)(step) |
---|
46 | IMPLICIT NONE |
---|
47 | INTEGER, INTENT(IN):: step |
---|
48 | |
---|
49 | IF (step < 0) THEN |
---|
50 | PRINT *, "L'argument 'step' ne peut être négatif" |
---|
51 | STOP |
---|
52 | END IF |
---|
53 | CALL cxios_update_calendar(step) |
---|
54 | |
---|
55 | END SUBROUTINE xios(update_calendar) |
---|
56 | |
---|
57 | |
---|
58 | END MODULE IDATE |
---|