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 XDate |
---|
9 | INTEGER :: year, month, day, hour, minute, second |
---|
10 | END TYPE XDate |
---|
11 | |
---|
12 | TYPE XDuration |
---|
13 | REAL(kind = 8) :: year, month, day, hour, minute, second |
---|
14 | END TYPE XDuration |
---|
15 | |
---|
16 | TYPE txios(date) |
---|
17 | INTEGER :: year, month, day, hour, minute, second |
---|
18 | END TYPE txios(date) |
---|
19 | |
---|
20 | TYPE txios(time) |
---|
21 | REAL(kind = 8) :: year=0, month=0, day=0, hour=0, minute=0, second=0 |
---|
22 | END TYPE txios(time) |
---|
23 | |
---|
24 | INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 |
---|
25 | |
---|
26 | SUBROUTINE cxios_set_timestep(ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second) BIND(C) |
---|
27 | IMPORT C_DOUBLE |
---|
28 | REAL (kind = C_DOUBLE), VALUE :: ts_year, ts_month , ts_day , & |
---|
29 | ts_hour, ts_minute, ts_second |
---|
30 | END SUBROUTINE cxios_set_timestep |
---|
31 | |
---|
32 | SUBROUTINE cxios_update_calendar(step) BIND(C) |
---|
33 | IMPORT C_INT |
---|
34 | INTEGER (kind = C_INT), VALUE :: step |
---|
35 | END SUBROUTINE cxios_update_calendar |
---|
36 | |
---|
37 | END INTERFACE |
---|
38 | |
---|
39 | CONTAINS ! Fonctions disponibles pour les utilisateurs. |
---|
40 | |
---|
41 | |
---|
42 | SUBROUTINE xios(set_timestep)(timestep) |
---|
43 | IMPLICIT NONE |
---|
44 | TYPE(txios(time)), INTENT(IN):: timestep |
---|
45 | |
---|
46 | CALL cxios_set_timestep(timestep%year, timestep%month , timestep%day, & |
---|
47 | timestep%hour, timestep%minute, timestep%second) |
---|
48 | |
---|
49 | END SUBROUTINE xios(set_timestep) |
---|
50 | |
---|
51 | |
---|
52 | |
---|
53 | SUBROUTINE xios(update_calendar)(step) |
---|
54 | IMPLICIT NONE |
---|
55 | INTEGER, INTENT(IN):: step |
---|
56 | |
---|
57 | IF (step < 0) THEN |
---|
58 | PRINT *, "L'argument 'step' ne peut être négatif" |
---|
59 | STOP |
---|
60 | END IF |
---|
61 | CALL cxios_update_calendar(step) |
---|
62 | |
---|
63 | END SUBROUTINE xios(update_calendar) |
---|
64 | |
---|
65 | |
---|
66 | !!!!!!!!!!!! anciennes interfaces !!!!!!!!!!!!!!!! |
---|
67 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
68 | |
---|
69 | SUBROUTINE set_timestep(timestep) |
---|
70 | TYPE(XDuration), INTENT(IN):: timestep |
---|
71 | CALL cxios_set_timestep(timestep%year, timestep%month , timestep%day, & |
---|
72 | timestep%hour, timestep%minute, timestep%second) |
---|
73 | END SUBROUTINE set_timestep |
---|
74 | |
---|
75 | SUBROUTINE update_calendar(step) |
---|
76 | INTEGER, INTENT(IN):: step |
---|
77 | IF (step < 0) THEN |
---|
78 | PRINT *, "L'argument 'step' ne peut être négatif" |
---|
79 | STOP |
---|
80 | END IF |
---|
81 | CALL cxios_update_calendar(step) |
---|
82 | END SUBROUTINE update_calendar |
---|
83 | |
---|
84 | END MODULE IDATE |
---|