Changeset 794
- Timestamp:
- 11/19/15 16:55:17 (7 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/interface/c/icdate.cpp
r591 r794 41 41 date_c.hour, date_c.minute, date_c.second); 42 42 return date; 43 } 44 45 void cxios_date_convert_to_string(cxios_date date_c, char* str, int str_size) 46 { 47 xios::CDate date = xios::CDate(getCalendar("void cxios_date_convert_to_string(cxios_date date_c, char* str, int str_size)"), 48 date_c.year, date_c.month, date_c.day, 49 date_c.hour, date_c.minute, date_c.second); 50 51 if (!string_copy(date.toString(), str, str_size)) 52 ERROR("void cxios_date_convert_to_string(cxios_date date_c, char* str, int str_size)", << "Input string is too short"); 43 53 } 44 54 -
XIOS/trunk/src/interface/c/icduration.cpp
r545 r794 1 #include "icutil.hpp" 1 2 #include "icdate.hpp" 2 3 #include "calendar_util.hpp" … … 4 5 extern "C" 5 6 { 7 void cxios_duration_convert_to_string(cxios_duration dur_c, char* str, int str_size) 8 { 9 xios::CDuration dur = { dur_c.year, dur_c.month, dur_c.day, 10 dur_c.hour, dur_c.minute, dur_c.second, 11 dur_c.timestep }; 12 13 if (!string_copy(dur.toString(), str, str_size)) 14 ERROR("void cxios_duration_convert_to_string(cxios_duration dur_c, char* str, int str_size)", << "Input string is too short"); 15 } 16 6 17 cxios_duration cxios_duration_add(cxios_duration dur1_c, cxios_duration dur2_c) 7 18 { -
XIOS/trunk/src/interface/fortran/date_interface.F90
r576 r794 18 18 TYPE(txios(date)), VALUE :: date 19 19 END FUNCTION cxios_date_convert_to_seconds 20 21 SUBROUTINE cxios_date_convert_to_string(date, str, str_size) BIND(C) 22 USE ISO_C_BINDING 23 IMPORT :: txios(date) 24 TYPE(txios(date)), VALUE :: date 25 CHARACTER(kind = C_CHAR), DIMENSION(*) :: str 26 INTEGER(kind = C_INT), VALUE :: str_size 27 END SUBROUTINE cxios_date_convert_to_string 20 28 21 29 TYPE(txios(date)) FUNCTION cxios_date_add_duration(date, dur) BIND(C) -
XIOS/trunk/src/interface/fortran/duration_interface.F90
r545 r794 9 9 10 10 INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 11 12 SUBROUTINE cxios_duration_convert_to_string(dur, str, str_size) BIND(C) 13 USE ISO_C_BINDING 14 IMPORT :: txios(duration) 15 TYPE(txios(duration)), VALUE :: dur 16 CHARACTER(kind = C_CHAR), DIMENSION(*) :: str 17 INTEGER(kind = C_INT), VALUE :: str_size 18 END SUBROUTINE cxios_duration_convert_to_string 11 19 12 20 TYPE(txios(duration)) FUNCTION cxios_duration_add(dur1, dur2) BIND(C) -
XIOS/trunk/src/interface/fortran/idate.F90
r558 r794 43 43 CONTAINS ! Fonctions disponibles pour les utilisateurs. 44 44 45 ! Conversion functions 46 45 47 FUNCTION xios(date_convert_to_seconds)(date) RESULT(res) 46 48 USE DATE_INTERFACE, only : txios(date) … … 52 54 END FUNCTION xios(date_convert_to_seconds) 53 55 56 SUBROUTINE xios(date_convert_to_string)(date, str) 57 USE DATE_INTERFACE, only : txios(date) 58 IMPLICIT NONE 59 TYPE(txios(date)), INTENT(IN) :: date 60 CHARACTER(len = *), INTENT(OUT) :: str 61 62 CALL cxios_date_convert_to_string(date, str, len(str)) 63 END SUBROUTINE xios(date_convert_to_string) 64 54 65 ! Addition: date + duration = date 55 66 -
XIOS/trunk/src/interface/fortran/iduration.F90
r545 r794 49 49 50 50 CONTAINS 51 52 ! Conversion function 53 54 SUBROUTINE xios(duration_convert_to_string)(dur, str) 55 USE DURATION_INTERFACE, only : txios(duration) 56 IMPLICIT NONE 57 TYPE(txios(duration)), INTENT(IN) :: dur 58 CHARACTER(len = *), INTENT(OUT) :: str 59 60 CALL cxios_duration_convert_to_string(dur, str, len(str)) 61 END SUBROUTINE xios(duration_convert_to_string) 51 62 52 63 ! Addition -
XIOS/trunk/src/interface/fortran/ixios.F90
r788 r794 23 23 USE iduration, ONLY: txios(duration), & 24 24 xios(year), xios(month), xios(day), xios(hour), xios(minute), xios(second), xios(timestep), & 25 xios(duration_convert_to_string), & 25 26 xios(duration_add), xios(duration_sub), xios(duration_mult), xios(duration_neg), & 26 27 xios(duration_eq), xios(duration_neq), & … … 28 29 29 30 USE idate, ONLY : txios(date), & 30 xios(date_convert_to_seconds), 31 xios(date_convert_to_seconds), xios(date_convert_to_string), & 31 32 xios(date_add_duration), xios(date_sub_duration), xios(date_sub), & 32 33 xios(date_eq), xios(date_neq), xios(date_lt), xios(date_le), xios(date_gt), xios(date_ge), & -
XIOS/trunk/src/test/test_client.f90
r723 r794 12 12 INTEGER :: comm 13 13 TYPE(xios_duration) :: dtime 14 CHARACTER(len=20) :: dtime_str 14 15 TYPE(xios_date) :: date 16 CHARACTER(len=20) :: date_str 15 17 CHARACTER(len=15) :: calendar_type 16 18 TYPE(xios_context) :: ctx_hdl … … 98 100 PRINT *, "--> year length = ", xios_get_year_length_in_seconds(date%year) 99 101 PRINT *, "--> day length = ", xios_get_day_length_in_seconds() 100 PRINT *, "time_origin = ", date 102 CALL xios_date_convert_to_string(date, date_str) 103 PRINT *, "time_origin = ", date_str 101 104 PRINT *, "xios_date_get_second_of_year(time_origin) = ", xios_date_get_second_of_year(date) 102 105 PRINT *, "xios_date_get_day_of_year(time_origin) = ", xios_date_get_day_of_year(date) … … 106 109 dtime%timestep = 1 107 110 dtime = 0.5 * dtime 108 PRINT *, "duration = ", dtime 111 CALL xios_duration_convert_to_string(dtime, dtime_str) 112 PRINT *, "duration = ", dtime_str 109 113 date = date + 3 * (dtime + dtime) 110 PRINT *, "date = time_origin + 3 * (duration + duration) = ", date 114 CALL xios_date_convert_to_string(date, date_str) 115 PRINT *, "date = time_origin + 3 * (duration + duration) = ", date_str 111 116 PRINT *, "xios_date_convert_to_seconds(date) = ", xios_date_convert_to_seconds(date) 112 117 PRINT *, "xios_date_convert_to_seconds(date - 2.5h) = ", xios_date_convert_to_seconds(date - 2.5 * xios_hour)
Note: See TracChangeset
for help on using the changeset viewer.