Changeset 537 for XIOS/trunk/src/interface
- Timestamp:
- 12/11/14 14:32:37 (10 years ago)
- Location:
- XIOS/trunk/src/interface
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/interface/c/icdate.cpp
r509 r537 23 23 // /////////////////////////////// Définitions ////////////////////////////// // 24 24 25 void cxios_set_timestep(double ts_year, double ts_month, double ts_day,26 double ts_hour, double ts_minute, double ts_second)27 {28 try29 {30 CTimer::get("XIOS").resume() ;31 CDuration dur = {ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second, 0};32 xios::CContext* context = CContext::getCurrent() ;33 context->timestep.setValue(dur.toString());34 CTimer::get("XIOS").suspend() ;35 }36 catch (xios::CException & exc)37 {38 std::cerr << exc.getMessage() << std::endl;39 exit (EXIT_FAILURE);40 }41 }42 43 25 void cxios_update_calendar(int step) 44 26 { -
XIOS/trunk/src/interface/c/icdate.hpp
r533 r537 4 4 5 5 typedef struct { int year, month, day, hour, minute, second; } cxios_date; 6 typedef struct { double year, month, day, hour, minute, second, timestep; } cxios_duration; 6 7 } // extern "C" -
XIOS/trunk/src/interface/c_attr/iccontext_attr.cpp
r532 r537 146 146 147 147 148 void cxios_set_context_timestep(context_Ptr context_hdl, c onst char * timestep, int timestep_size)148 void cxios_set_context_timestep(context_Ptr context_hdl, cxios_duration timestep_c) 149 149 { 150 std::string timestep_str; 151 if(!cstr2string(timestep, timestep_size, timestep_str)) return; 152 CTimer::get("XIOS").resume(); 153 context_hdl->timestep.setValue(timestep_str); 154 CTimer::get("XIOS").suspend(); 150 CTimer::get("XIOS").resume(); 151 context_hdl->timestep.allocate(); 152 CDuration& timestep = context_hdl->timestep.get(); 153 timestep.year = timestep_c.year; 154 timestep.month = timestep_c.month; 155 timestep.day = timestep_c.day; 156 timestep.hour = timestep_c.hour; 157 timestep.minute = timestep_c.minute; 158 timestep.second = timestep_c.second; 159 timestep.timestep = timestep_c.timestep; 160 CTimer::get("XIOS").suspend(); 155 161 } 156 162 157 void cxios_get_context_timestep(context_Ptr context_hdl, c har * timestep, int timestep_size)163 void cxios_get_context_timestep(context_Ptr context_hdl, cxios_duration* timestep_c) 158 164 { 159 CTimer::get("XIOS").resume(); 160 if(!string_copy(context_hdl->timestep.getInheritedValue(),timestep , timestep_size)) 161 ERROR("void cxios_get_context_timestep(context_Ptr context_hdl, char * timestep, int timestep_size)", <<"Input string is to short"); 162 CTimer::get("XIOS").suspend(); 165 CTimer::get("XIOS").resume(); 166 CDuration timestep = context_hdl->timestep.getInheritedValue(); 167 timestep_c->year = timestep.year; 168 timestep_c->month = timestep.month; 169 timestep_c->day = timestep.day; 170 timestep_c->hour = timestep.hour; 171 timestep_c->minute = timestep.minute; 172 timestep_c->second = timestep.second; 173 timestep_c->timestep = timestep.timestep; 174 CTimer::get("XIOS").suspend(); 163 175 } 164 176 -
XIOS/trunk/src/interface/fortran/idate.F90
r532 r537 10 10 END TYPE txios(date) 11 11 12 TYPE txios(time)13 REAL(kind = 8) :: year=0, month=0, day=0, hour=0, minute=0, second=014 END TYPE txios( time)12 TYPE, BIND(C) :: txios(duration) 13 REAL(kind = C_DOUBLE) :: year=0, month=0, day=0, hour=0, minute=0, second=0, timestep=0 14 END TYPE txios(duration) 15 15 16 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_DOUBLE20 REAL (kind = C_DOUBLE), VALUE :: ts_year, ts_month , ts_day , &21 ts_hour, ts_minute, ts_second22 END SUBROUTINE cxios_set_timestep23 17 24 18 SUBROUTINE cxios_update_calendar(step) BIND(C) … … 26 20 INTEGER (kind = C_INT), VALUE :: step 27 21 END SUBROUTINE cxios_update_calendar 28 22 29 23 END INTERFACE 30 24 31 25 CONTAINS ! Fonctions disponibles pour les utilisateurs. 32 26 33 34 SUBROUTINE xios(set_timestep)(timestep)35 IMPLICIT NONE36 TYPE(txios(time)), INTENT(IN):: timestep37 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 27 SUBROUTINE xios(update_calendar)(step) 46 28 IMPLICIT NONE … … 52 34 END IF 53 35 CALL cxios_update_calendar(step) 54 55 36 END SUBROUTINE xios(update_calendar) 56 37 57 58 38 END MODULE IDATE -
XIOS/trunk/src/interface/fortran/ixios.F90
r529 r537 19 19 xios(setVar_logic), xios(setVar_char) 20 20 21 USE idate, ONLY : txios(date), txios(time), xios(set_timestep),xios(update_calendar)21 USE idate, ONLY : txios(date), txios(duration), xios(update_calendar) 22 22 23 23 USE idomain, ONLY : txios(domain), txios(domaingroup), xios(get_domain_handle), & … … 158 158 PUBLIC :: txios(domain), txios(domaingroup),txios(field), txios(fieldgroup),txios(file), txios(filegroup), & 159 159 txios(grid), txios(gridgroup), txios(axis), txios(axisgroup),txios(context), txios(date), & 160 txios( time), txios(variable)160 txios(duration), txios(variable) 161 161 162 162 PUBLIC :: xios(set_attr), xios(set_domain_attr), xios(set_domaingroup_attr), xios(set_fieldgroup_attr), & … … 184 184 185 185 PUBLIC :: xios(set_current_context) 186 PUBLIC :: xios( set_timestep),xios(update_calendar)186 PUBLIC :: xios(update_calendar) 187 187 PUBLIC :: xios(initialize), xios(init_server), xios(finalize), xios(context_initialize),xios(context_is_initialized), & 188 188 xios(solve_inheritance), xios(close_context_definition), xios(context_finalize), xios(send_field), & -
XIOS/trunk/src/interface/fortran_attr/context_interface_attr.F90
r532 r537 56 56 USE IDATE 57 57 INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl 58 TYPE( xios_date), VALUE :: start_date58 TYPE(txios(date)), VALUE :: start_date 59 59 END SUBROUTINE cxios_set_context_start_date 60 60 … … 77 77 USE IDATE 78 78 INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl 79 TYPE( xios_date), VALUE :: time_origin79 TYPE(txios(date)), VALUE :: time_origin 80 80 END SUBROUTINE cxios_set_context_time_origin 81 81 … … 94 94 95 95 96 SUBROUTINE cxios_set_context_timestep(context_hdl, timestep , timestep_size) BIND(C)96 SUBROUTINE cxios_set_context_timestep(context_hdl, timestep) BIND(C) 97 97 USE ISO_C_BINDING 98 USE IDATE 98 99 INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl 99 CHARACTER(kind = C_CHAR) , DIMENSION(*) :: timestep 100 INTEGER (kind = C_INT) , VALUE :: timestep_size 100 TYPE(txios(duration)), VALUE :: timestep 101 101 END SUBROUTINE cxios_set_context_timestep 102 102 103 SUBROUTINE cxios_get_context_timestep(context_hdl, timestep , timestep_size) BIND(C)103 SUBROUTINE cxios_get_context_timestep(context_hdl, timestep) BIND(C) 104 104 USE ISO_C_BINDING 105 USE IDATE 105 106 INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl 106 CHARACTER(kind = C_CHAR) , DIMENSION(*) :: timestep 107 INTEGER (kind = C_INT) , VALUE :: timestep_size 107 TYPE(txios(duration)) :: timestep 108 108 END SUBROUTINE cxios_get_context_timestep 109 109 -
XIOS/trunk/src/interface/fortran_attr/icontext_attr.F90
r532 r537 21 21 TYPE(txios(date)) , OPTIONAL, INTENT(IN) :: start_date 22 22 TYPE(txios(date)) , OPTIONAL, INTENT(IN) :: time_origin 23 CHARACTER(len = *), OPTIONAL, INTENT(IN) :: timestep23 TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: timestep 24 24 25 25 CALL xios(get_context_handle)(context_id,context_hdl) … … 38 38 TYPE(txios(date)) , OPTIONAL, INTENT(IN) :: start_date 39 39 TYPE(txios(date)) , OPTIONAL, INTENT(IN) :: time_origin 40 CHARACTER(len = *), OPTIONAL, INTENT(IN) :: timestep40 TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: timestep 41 41 42 42 CALL xios(set_context_attr_hdl_) & … … 54 54 TYPE(txios(date)) , OPTIONAL, INTENT(IN) :: start_date_ 55 55 TYPE(txios(date)) , OPTIONAL, INTENT(IN) :: time_origin_ 56 CHARACTER(len = *), OPTIONAL, INTENT(IN) :: timestep_56 TYPE(txios(duration)) , OPTIONAL, INTENT(IN) :: timestep_ 57 57 58 58 IF (PRESENT(calendar_type_)) THEN … … 73 73 74 74 IF (PRESENT(timestep_)) THEN 75 CALL cxios_set_context_timestep(context_hdl%daddr, timestep_ , len(timestep_))75 CALL cxios_set_context_timestep(context_hdl%daddr, timestep_) 76 76 ENDIF 77 77 … … 90 90 TYPE(txios(date)) , OPTIONAL, INTENT(OUT) :: start_date 91 91 TYPE(txios(date)) , OPTIONAL, INTENT(OUT) :: time_origin 92 CHARACTER(len = *), OPTIONAL, INTENT(OUT) :: timestep92 TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: timestep 93 93 94 94 CALL xios(get_context_handle)(context_id,context_hdl) … … 107 107 TYPE(txios(date)) , OPTIONAL, INTENT(OUT) :: start_date 108 108 TYPE(txios(date)) , OPTIONAL, INTENT(OUT) :: time_origin 109 CHARACTER(len = *), OPTIONAL, INTENT(OUT) :: timestep109 TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: timestep 110 110 111 111 CALL xios(get_context_attr_hdl_) & … … 123 123 TYPE(txios(date)) , OPTIONAL, INTENT(OUT) :: start_date_ 124 124 TYPE(txios(date)) , OPTIONAL, INTENT(OUT) :: time_origin_ 125 CHARACTER(len = *), OPTIONAL, INTENT(OUT) :: timestep_125 TYPE(txios(duration)) , OPTIONAL, INTENT(OUT) :: timestep_ 126 126 127 127 IF (PRESENT(calendar_type_)) THEN … … 142 142 143 143 IF (PRESENT(timestep_)) THEN 144 CALL cxios_get_context_timestep(context_hdl%daddr, timestep_ , len(timestep_))144 CALL cxios_get_context_timestep(context_hdl%daddr, timestep_) 145 145 ENDIF 146 146
Note: See TracChangeset
for help on using the changeset viewer.