- Timestamp:
- 12/17/14 11:14:05 (10 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 7 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/calendar_util.cpp
r501 r545 128 128 129 129 /// Les opérateurs de comparaison. (Non testés pour le moment) 130 131 bool operator==(const CDuration& ddr, const CDuration& dr) 132 { 133 return ((ddr.year == dr.year) && (ddr.month == dr.month) && (dr.day == ddr.day) && 134 (ddr.hour == dr.hour) && (ddr.minute == dr.minute) && (dr.second == ddr.second) && 135 (ddr.timestep == dr.timestep)); 136 } 137 138 bool operator!=(const CDuration& ddr, const CDuration& dr) 139 { 140 return !(ddr == dr); 141 } 142 130 143 bool operator==(const CDate& dt0, const CDate& dt1) 131 144 { -
XIOS/trunk/src/calendar_util.hpp
r501 r545 23 23 24 24 /// Les opérateurs de comparaison. (Non testés pour le moment) 25 bool operator==(const CDuration& ddr, const CDuration& dr); 26 bool operator!=(const CDuration& ddr, const CDuration& dr); 27 25 28 bool operator==(const CDate& dt0, const CDate& dt1); 26 29 bool operator< (const CDate& dt0, const CDate& dt1); -
XIOS/trunk/src/generate_interface_impl.hpp
r537 r545 362 362 oss << "SUBROUTINE cxios_set_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; 363 363 oss << " USE ISO_C_BINDING" << iendl; 364 oss << " USE ID ATE" << iendl;364 oss << " USE IDURATION" << iendl; 365 365 oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; 366 366 oss << " TYPE(txios(duration)), VALUE :: " << name << iendl; … … 369 369 oss << "SUBROUTINE cxios_get_" << className << "_" << name << "(" << className << "_hdl, " << name << ") BIND(C)" << iendl; 370 370 oss << " USE ISO_C_BINDING" << iendl; 371 oss << " USE ID ATE" << iendl;371 oss << " USE IDURATION" << iendl; 372 372 oss << " INTEGER (kind = C_INTPTR_T), VALUE :: " << className << "_hdl" << iendl; 373 373 oss << " TYPE(txios(duration)) :: " << name << iendl; -
XIOS/trunk/src/interface/c/iccontext.cpp
r520 r545 29 29 30 30 // ------------------------ Création des handle ----------------------------- 31 31 32 32 void cxios_context_handle_create (XContextPtr * _ret, const char * _id, int _id_len) 33 33 { 34 std::string id; 34 std::string id; 35 35 if (!cstr2string(_id, _id_len, id)) return; 36 36 CTimer::get("XIOS").resume() ; 37 37 38 38 std::vector<xios::CContext*> def_vector = 39 39 xios::CContext::getRoot()->getChildList(); … … 53 53 // Lever une exeception ici 54 54 } 55 55 56 56 // ------------------------ Changements de contextes ------------------------ 57 57 58 void cxios_context_get_current(XContextPtr* context) 59 { 60 CTimer::get("XIOS").resume(); 61 *context = CContext::getCurrent(); 62 CTimer::get("XIOS").suspend(); 63 } 64 58 65 void cxios_context_set_current(XContextPtr context, bool withswap) 59 66 { … … 62 69 CTimer::get("XIOS").suspend() ; 63 70 } 64 65 71 66 72 // -------------------- Vérification des identifiants ----------------------- 67 73 … … 70 76 std::string id; 71 77 if (!cstr2string(_id, _id_len, id)) return; 72 78 73 79 CTimer::get("XIOS").resume(); 74 80 std::vector<xios::CContext*> def_vector = -
XIOS/trunk/src/interface/c/icdate.cpp
r537 r545 15 15 16 16 #include "icutil.hpp" 17 #include "icdate.hpp" 18 #include "exception.hpp" 19 #include "calendar_util.hpp" 17 20 #include "timer.hpp" 18 21 #include "context.hpp" 19 22 #include "context_client.hpp" 20 23 24 static const xios::CCalendar& getCalendar(const std::string& idFunc) 25 { 26 const xios::CContext* context = CContext::getCurrent(); 27 if (!context) 28 ERROR(idFunc, << "Impossible to do calendar operations: no current context available."); 29 const boost::shared_ptr<xios::CCalendar> cal = context->getCalendar(); 30 if (!cal) 31 ERROR(idFunc, << "Impossible to do calendar operations: no calendar was defined."); 32 return *cal; 33 } 34 21 35 extern "C" 22 36 { 23 // /////////////////////////////// Définitions ////////////////////////////// // 37 long long int cxios_date_convert_to_seconds(cxios_date date_c) 38 { 39 xios::CDate date = xios::CDate(getCalendar("long long int cxios_date_convert_to_seconds(cxios_date date_c)"), 40 date_c.year, date_c.month, date_c.day, 41 date_c.hour, date_c.minute, date_c.second); 42 return date; 43 } 24 44 25 void cxios_update_calendar(int step) 26 { 27 CTimer::get("XIOS").resume() ; 28 xios::CContext* context = CContext::getCurrent() ; 29 if (!context->hasServer) context->client->checkBuffers() ; 30 context->updateCalendar(step) ; 31 context->sendUpdateCalendar(step) ; 32 CTimer::get("XIOS").suspend() ; 33 } 45 cxios_date cxios_date_add_duration(cxios_date date_c, cxios_duration dur_c) 46 { 47 xios::CDate date = xios::CDate(getCalendar("cxios_date cxios_date_add_duration(cxios_date date_c, cxios_duration dur_c)"), 48 date_c.year, date_c.month, date_c.day, 49 date_c.hour, date_c.minute, date_c.second); 50 xios::CDuration dur = { dur_c.year, dur_c.month, dur_c.day, 51 dur_c.hour, dur_c.minute, dur_c.second, 52 dur_c.timestep }; 53 xios::CDate res = date + dur; 54 return { res.getYear(), res.getMonth(), res.getDay(), res.getHour(), res.getMinute(), res.getSecond() }; 55 } 34 56 57 cxios_date cxios_date_sub_duration(cxios_date date_c, cxios_duration dur_c) 58 { 59 xios::CDate date = xios::CDate(getCalendar("cxios_date cxios_date_sub_duration(cxios_date date_c, cxios_duration dur_c)"), 60 date_c.year, date_c.month, date_c.day, 61 date_c.hour, date_c.minute, date_c.second); 62 xios::CDuration dur = { dur_c.year, dur_c.month, dur_c.day, 63 dur_c.hour, dur_c.minute, dur_c.second, 64 dur_c.timestep }; 65 xios::CDate res = date - dur; 66 return { res.getYear(), res.getMonth(), res.getDay(), res.getHour(), res.getMinute(), res.getSecond() }; 67 } 68 69 cxios_duration cxios_date_sub(cxios_date date1_c, cxios_date date2_c) 70 { 71 xios::CDate date1 = xios::CDate(getCalendar("cxios_duration cxios_date_sub(cxios_date date1_c, cxios_date date2_c)"), 72 date1_c.year, date1_c.month, date1_c.day, 73 date1_c.hour, date1_c.minute, date1_c.second); 74 xios::CDate date2 = xios::CDate(getCalendar("cxios_duration cxios_date_sub(cxios_date date1_c, cxios_date date2_c)"), 75 date2_c.year, date2_c.month, date2_c.day, 76 date2_c.hour, date2_c.minute, date2_c.second); 77 xios::CDuration res = date1 - date2; 78 return { res.year, res.month, res.day, res.hour, res.minute, res.second, res.timestep }; 79 } 80 81 bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c) 82 { 83 xios::CDate date1 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 84 date1_c.year, date1_c.month, date1_c.day, 85 date1_c.hour, date1_c.minute, date1_c.second); 86 xios::CDate date2 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 87 date2_c.year, date2_c.month, date2_c.day, 88 date2_c.hour, date2_c.minute, date2_c.second); 89 return (date1 == date2); 90 } 91 92 bool cxios_date_neq(cxios_date date1_c, cxios_date date2_c) 93 { 94 xios::CDate date1 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 95 date1_c.year, date1_c.month, date1_c.day, 96 date1_c.hour, date1_c.minute, date1_c.second); 97 xios::CDate date2 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 98 date2_c.year, date2_c.month, date2_c.day, 99 date2_c.hour, date2_c.minute, date2_c.second); 100 return (date1 != date2); 101 } 102 103 bool cxios_date_lt(cxios_date date1_c, cxios_date date2_c) 104 { 105 xios::CDate date1 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 106 date1_c.year, date1_c.month, date1_c.day, 107 date1_c.hour, date1_c.minute, date1_c.second); 108 xios::CDate date2 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 109 date2_c.year, date2_c.month, date2_c.day, 110 date2_c.hour, date2_c.minute, date2_c.second); 111 return (date1 < date2); 112 } 113 114 bool cxios_date_le(cxios_date date1_c, cxios_date date2_c) 115 { 116 xios::CDate date1 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 117 date1_c.year, date1_c.month, date1_c.day, 118 date1_c.hour, date1_c.minute, date1_c.second); 119 xios::CDate date2 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 120 date2_c.year, date2_c.month, date2_c.day, 121 date2_c.hour, date2_c.minute, date2_c.second); 122 return (date1 <= date2); 123 } 124 125 bool cxios_date_gt(cxios_date date1_c, cxios_date date2_c) 126 { 127 xios::CDate date1 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 128 date1_c.year, date1_c.month, date1_c.day, 129 date1_c.hour, date1_c.minute, date1_c.second); 130 xios::CDate date2 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 131 date2_c.year, date2_c.month, date2_c.day, 132 date2_c.hour, date2_c.minute, date2_c.second); 133 return (date1 > date2); 134 } 135 136 bool cxios_date_ge(cxios_date date1_c, cxios_date date2_c) 137 { 138 xios::CDate date1 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 139 date1_c.year, date1_c.month, date1_c.day, 140 date1_c.hour, date1_c.minute, date1_c.second); 141 xios::CDate date2 = xios::CDate(getCalendar("bool cxios_date_eq(cxios_date date1_c, cxios_date date2_c)"), 142 date2_c.year, date2_c.month, date2_c.day, 143 date2_c.hour, date2_c.minute, date2_c.second); 144 return (date1 >= date2); 145 } 35 146 } // extern "C" -
XIOS/trunk/src/interface/fortran/context_interface.f90
r501 r545 1 1 MODULE CONTEXT_INTERFACE 2 2 USE, INTRINSIC :: ISO_C_BINDING 3 3 4 4 INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 5 5 6 6 SUBROUTINE cxios_context_handle_create(ret, idt, idt_size) BIND(C) 7 7 import C_CHAR, C_INTPTR_T, C_INT … … 10 10 INTEGER (kind = C_INT) , VALUE :: idt_size 11 11 END SUBROUTINE cxios_context_handle_create 12 12 13 SUBROUTINE cxios_context_get_current(context) BIND(C) 14 import C_INTPTR_T 15 INTEGER (kind = C_INTPTR_T) :: context 16 END SUBROUTINE cxios_context_get_current 17 13 18 SUBROUTINE cxios_context_set_current(context, withswap) BIND(C) 14 19 import C_BOOL, C_INT, C_INTPTR_T … … 25 30 26 31 END INTERFACE 27 32 28 33 END MODULE CONTEXT_INTERFACE -
XIOS/trunk/src/interface/fortran/icontext.F90
r501 r545 4 4 USE, INTRINSIC :: ISO_C_BINDING 5 5 USE CONTEXT_INTERFACE 6 USE IDATE 7 USE IDURATION 6 8 ! USE icontext_attr 7 USE IDATE8 9 9 10 10 11 TYPE txios(context) 11 12 INTEGER(kind = C_INTPTR_T) :: daddr 12 13 END TYPE txios(context) 13 14 14 15 15 16 CONTAINS ! Fonctions disponibles pour les utilisateurs. 16 17 17 18 SUBROUTINE xios(get_context_handle)(idt,ret) 18 19 IMPLICIT NONE 19 CHARACTER(len = *) , INTENT(IN) :: idt 20 CHARACTER(len = *) , INTENT(IN) :: idt 20 21 TYPE(txios(context)), INTENT(OUT):: ret 21 22 22 CALL cxios_context_handle_create(ret%daddr, idt, len(idt)) 23 CALL cxios_context_handle_create(ret%daddr, idt, len(idt)) 23 24 END SUBROUTINE xios(get_context_handle) 24 25 26 SUBROUTINE xios(get_current_context)(context) 27 IMPLICIT NONE 28 29 TYPE(txios(context)), INTENT(IN) :: context 30 31 CALL cxios_context_get_current(context%daddr) 32 33 END SUBROUTINE xios(get_current_context) 34 25 35 SUBROUTINE xios(set_current_context)(context, withswap) 26 36 IMPLICIT NONE … … 28 38 TYPE(txios(context)) , INTENT(IN) :: context 29 39 LOGICAL , OPTIONAL, INTENT(IN) :: withswap 30 LOGICAL (kind = 1) :: wswap40 LOGICAL (kind = 1) :: wswap 31 41 32 42 IF (PRESENT(withswap)) THEN … … 38 48 39 49 END SUBROUTINE xios(set_current_context) 40 50 41 51 LOGICAL FUNCTION xios(is_valid_context)(idt) 42 52 IMPLICIT NONE … … 49 59 END FUNCTION xios(is_valid_context) 50 60 51 61 52 62 END MODULE ICONTEXT -
XIOS/trunk/src/interface/fortran/idate.F90
r537 r545 2 2 MODULE IDATE 3 3 USE, INTRINSIC :: ISO_C_BINDING 4 USE DATE_INTERFACE 4 5 5 ! enum XCalendarType 6 INTEGER(kind = C_INT), PARAMETER :: D360 = 0 , ALLLEAP = 1 , NOLEAP = 2 , JULIAN = 3 , GREGORIAN = 4 6 INTERFACE OPERATOR(+) 7 MODULE PROCEDURE xios(date_add_duration) 8 END INTERFACE 7 9 8 TYPE, BIND(C) :: txios(date) 9 INTEGER(kind = C_INT) :: year, month, day, hour, minute, second 10 END TYPE txios(date) 10 INTERFACE OPERATOR(-) 11 MODULE PROCEDURE xios(date_sub_duration) 12 MODULE PROCEDURE xios(date_sub) 13 END INTERFACE 11 14 12 TYPE, BIND(C) :: txios(duration)13 REAL(kind = C_DOUBLE) :: year=0, month=0, day=0, hour=0, minute=0, second=0, timestep=014 END TYPE txios(duration)15 INTERFACE OPERATOR(==) 16 MODULE PROCEDURE xios(date_eq) 17 END INTERFACE 15 18 16 INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99 19 INTERFACE OPERATOR(/=) 20 MODULE PROCEDURE xios(date_neq) 21 END INTERFACE 17 22 18 SUBROUTINE cxios_update_calendar(step) BIND(C) 19 IMPORT C_INT 20 INTEGER (kind = C_INT), VALUE :: step 21 END SUBROUTINE cxios_update_calendar 23 INTERFACE OPERATOR(<) 24 MODULE PROCEDURE xios(date_lt) 25 END INTERFACE 22 26 27 INTERFACE OPERATOR(<=) 28 MODULE PROCEDURE xios(date_le) 23 29 END INTERFACE 24 30 31 INTERFACE OPERATOR(>) 32 MODULE PROCEDURE xios(date_gt) 33 END INTERFACE 34 35 INTERFACE OPERATOR(>=) 36 MODULE PROCEDURE xios(date_ge) 37 END INTERFACE 38 25 39 CONTAINS ! Fonctions disponibles pour les utilisateurs. 26 40 27 SUBROUTINE xios(update_calendar)(step) 28 IMPLICIT NONE 29 INTEGER, INTENT(IN):: step 30 31 IF (step < 0) THEN 32 PRINT *, "L'argument 'step' ne peut être négatif" 33 STOP 34 END IF 35 CALL cxios_update_calendar(step) 36 END SUBROUTINE xios(update_calendar) 41 FUNCTION xios(date_convert_to_seconds)(date) RESULT(res) 42 USE DATE_INTERFACE, only : txios(date) 43 IMPLICIT NONE 44 TYPE(txios(date)), INTENT(IN) :: date 45 INTEGER(kind = C_LONG_LONG) :: res 46 47 res = cxios_date_convert_to_seconds(date) 48 END FUNCTION xios(date_convert_to_seconds) 49 50 ! Addition: date + duration = date 51 52 FUNCTION xios(date_add_duration)(date, dur) RESULT(res) 53 USE DATE_INTERFACE, only : txios(date) 54 USE IDURATION, only : txios(duration) 55 IMPLICIT NONE 56 TYPE(txios(date)), INTENT(IN) :: date 57 TYPE(txios(duration)), INTENT(IN) :: dur 58 TYPE(txios(date)) :: res 59 60 res = cxios_date_add_duration(date, dur) 61 END FUNCTION xios(date_add_duration) 62 63 ! Subtraction: date - duration = date 64 65 FUNCTION xios(date_sub_duration)(date, dur) RESULT(res) 66 USE DATE_INTERFACE, only : txios(date) 67 USE IDURATION, only : txios(duration) 68 IMPLICIT NONE 69 TYPE(txios(date)), INTENT(IN) :: date 70 TYPE(txios(duration)), INTENT(IN) :: dur 71 TYPE(txios(date)) :: res 72 73 res = cxios_date_sub_duration(date, dur) 74 END FUNCTION xios(date_sub_duration) 75 76 ! Subtraction: date - date = duration 77 78 FUNCTION xios(date_sub)(date1, date2) RESULT(res) 79 USE DATE_INTERFACE, only : txios(date) 80 USE IDURATION, only : txios(duration) 81 IMPLICIT NONE 82 TYPE(txios(date)), INTENT(IN) :: date1, date2 83 TYPE(txios(duration)) :: res 84 85 res = cxios_date_sub(date1, date2) 86 END FUNCTION xios(date_sub) 87 88 FUNCTION xios(date_eq)(date1, date2) RESULT(res) 89 USE DATE_INTERFACE, only : txios(date) 90 IMPLICIT NONE 91 TYPE(txios(date)), INTENT(IN) :: date1, date2 92 LOGICAL :: res 93 94 res = cxios_date_eq(date1, date2) 95 END FUNCTION xios(date_eq) 96 97 FUNCTION xios(date_neq)(date1, date2) RESULT(res) 98 USE DATE_INTERFACE, only : txios(date) 99 IMPLICIT NONE 100 TYPE(txios(date)), INTENT(IN) :: date1, date2 101 LOGICAL :: res 102 103 res = cxios_date_neq(date1, date2) 104 END FUNCTION xios(date_neq) 105 106 FUNCTION xios(date_lt)(date1, date2) RESULT(res) 107 USE DATE_INTERFACE, only : txios(date) 108 IMPLICIT NONE 109 TYPE(txios(date)), INTENT(IN) :: date1, date2 110 LOGICAL :: res 111 112 res = cxios_date_lt(date1, date2) 113 END FUNCTION xios(date_lt) 114 115 FUNCTION xios(date_le)(date1, date2) RESULT(res) 116 USE DATE_INTERFACE, only : txios(date) 117 IMPLICIT NONE 118 TYPE(txios(date)), INTENT(IN) :: date1, date2 119 LOGICAL :: res 120 121 res = cxios_date_le(date1, date2) 122 END FUNCTION xios(date_le) 123 124 FUNCTION xios(date_gt)(date1, date2) RESULT(res) 125 USE DATE_INTERFACE, only : txios(date) 126 IMPLICIT NONE 127 TYPE(txios(date)), INTENT(IN) :: date1, date2 128 LOGICAL :: res 129 130 res = cxios_date_gt(date1, date2) 131 END FUNCTION xios(date_gt) 132 133 FUNCTION xios(date_ge)(date1, date2) RESULT(res) 134 USE DATE_INTERFACE, only : txios(date) 135 IMPLICIT NONE 136 TYPE(txios(date)), INTENT(IN) :: date1, date2 137 LOGICAL :: res 138 139 res = cxios_date_ge(date1, date2) 140 END FUNCTION xios(date_ge) 37 141 38 142 END MODULE IDATE -
XIOS/trunk/src/interface/fortran/ifield.F90
r538 r545 7 7 ! USE IFIELD_ATTR 8 8 ! USE IFIELDGROUP_ATTR 9 USE ID ATE9 USE IDURATION 10 10 11 11 TYPE txios(field) -
XIOS/trunk/src/interface/fortran/ifile.F90
r538 r545 7 7 ! USE IFILE_ATTR 8 8 ! USE IFILEGROUP_ATTR 9 USE ID ATE9 USE IDURATION 10 10 11 11 TYPE txios(file) -
XIOS/trunk/src/interface/fortran/ixios.F90
r537 r545 3 3 MODULE XIOS 4 4 5 USE icalendar, ONLY : xios(set_calendar), xios(set_timestep), xios(update_calendar) 5 6 6 7 USE icontext, ONLY : txios(context), xios(get_context_handle), xios(set_current_context), & … … 19 20 xios(setVar_logic), xios(setVar_char) 20 21 21 USE idate, ONLY : txios(date), txios(duration), xios(update_calendar) 22 USE idate, ONLY : txios(date), & 23 xios(date_convert_to_seconds), & 24 xios(date_add_duration), xios(date_sub_duration), xios(date_sub), & 25 xios(date_eq), xios(date_neq), xios(date_lt), xios(date_le), xios(date_gt), xios(date_ge), & 26 OPERATOR(+), OPERATOR(-), & 27 OPERATOR(==), OPERATOR(/=), OPERATOR(<), OPERATOR(<=), OPERATOR(>), OPERATOR(>=) 22 28 23 29 USE idomain, ONLY : txios(domain), txios(domaingroup), xios(get_domain_handle), & … … 32 38 xios(get_domaingroup_attr), xios(get_domaingroup_attr_hdl), & 33 39 xios(is_defined_domaingroup_attr), xios(is_defined_domaingroup_attr_hdl) 40 41 USE iduration, ONLY: txios(duration), & 42 xios(year), xios(month), xios(day), xios(hour), xios(minute), xios(second), xios(timestep), & 43 xios(duration_add), xios(duration_sub), xios(duration_mult), xios(duration_neg), & 44 xios(duration_eq), xios(duration_neq), & 45 OPERATOR(+), OPERATOR(-), OPERATOR(*) 34 46 35 47 USE ifield, ONLY : txios(field), txios(fieldgroup), xios(get_field_handle), & … … 184 196 185 197 PUBLIC :: xios(set_current_context) 186 PUBLIC :: xios(update_calendar)187 198 PUBLIC :: xios(initialize), xios(init_server), xios(finalize), xios(context_initialize),xios(context_is_initialized), & 188 199 xios(solve_inheritance), xios(close_context_definition), xios(context_finalize), xios(send_field), & 189 200 xios(field_is_active) 190 201 202 PUBLIC :: xios(set_calendar), xios(set_timestep), xios(update_calendar) 203 204 PUBLIC :: xios(year), xios(month), xios(day), xios(hour), xios(minute), xios(second), xios(timestep), & 205 xios(duration_add), xios(duration_sub), xios(duration_mult), xios(duration_neg), & 206 xios(duration_eq), xios(duration_neq) 207 208 PUBLIC :: xios(date_convert_to_seconds), & 209 xios(date_add_duration), xios(date_sub_duration), xios(date_sub), & 210 xios(date_eq), xios(date_neq), xios(date_lt), xios(date_le), xios(date_gt), xios(date_ge) 211 212 PUBLIC :: OPERATOR(+), OPERATOR(-), OPERATOR(*), & 213 OPERATOR(==), OPERATOR(/=), OPERATOR(<), OPERATOR(<=), OPERATOR(>), OPERATOR(>=) 214 191 215 PUBLIC :: xios(getVar) 192 216 PUBLIC :: xios(setVar) -
XIOS/trunk/src/interface/fortran_attr/context_interface_attr.F90
r537 r545 96 96 SUBROUTINE cxios_set_context_timestep(context_hdl, timestep) BIND(C) 97 97 USE ISO_C_BINDING 98 USE ID ATE98 USE IDURATION 99 99 INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl 100 100 TYPE(txios(duration)), VALUE :: timestep … … 103 103 SUBROUTINE cxios_get_context_timestep(context_hdl, timestep) BIND(C) 104 104 USE ISO_C_BINDING 105 USE ID ATE105 USE IDURATION 106 106 INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl 107 107 TYPE(txios(duration)) :: timestep -
XIOS/trunk/src/interface/fortran_attr/field_interface_attr.F90
r538 r545 151 151 SUBROUTINE cxios_set_field_freq_offset(field_hdl, freq_offset) BIND(C) 152 152 USE ISO_C_BINDING 153 USE ID ATE153 USE IDURATION 154 154 INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 155 155 TYPE(txios(duration)), VALUE :: freq_offset … … 158 158 SUBROUTINE cxios_get_field_freq_offset(field_hdl, freq_offset) BIND(C) 159 159 USE ISO_C_BINDING 160 USE ID ATE160 USE IDURATION 161 161 INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 162 162 TYPE(txios(duration)) :: freq_offset … … 172 172 SUBROUTINE cxios_set_field_freq_op(field_hdl, freq_op) BIND(C) 173 173 USE ISO_C_BINDING 174 USE ID ATE174 USE IDURATION 175 175 INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 176 176 TYPE(txios(duration)), VALUE :: freq_op … … 179 179 SUBROUTINE cxios_get_field_freq_op(field_hdl, freq_op) BIND(C) 180 180 USE ISO_C_BINDING 181 USE ID ATE181 USE IDURATION 182 182 INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl 183 183 TYPE(txios(duration)) :: freq_op -
XIOS/trunk/src/interface/fortran_attr/fieldgroup_interface_attr.F90
r538 r545 151 151 SUBROUTINE cxios_set_fieldgroup_freq_offset(fieldgroup_hdl, freq_offset) BIND(C) 152 152 USE ISO_C_BINDING 153 USE ID ATE153 USE IDURATION 154 154 INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 155 155 TYPE(txios(duration)), VALUE :: freq_offset … … 158 158 SUBROUTINE cxios_get_fieldgroup_freq_offset(fieldgroup_hdl, freq_offset) BIND(C) 159 159 USE ISO_C_BINDING 160 USE ID ATE160 USE IDURATION 161 161 INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 162 162 TYPE(txios(duration)) :: freq_offset … … 172 172 SUBROUTINE cxios_set_fieldgroup_freq_op(fieldgroup_hdl, freq_op) BIND(C) 173 173 USE ISO_C_BINDING 174 USE ID ATE174 USE IDURATION 175 175 INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 176 176 TYPE(txios(duration)), VALUE :: freq_op … … 179 179 SUBROUTINE cxios_get_fieldgroup_freq_op(fieldgroup_hdl, freq_op) BIND(C) 180 180 USE ISO_C_BINDING 181 USE ID ATE181 USE IDURATION 182 182 INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl 183 183 TYPE(txios(duration)) :: freq_op -
XIOS/trunk/src/interface/fortran_attr/file_interface_attr.F90
r538 r545 153 153 SUBROUTINE cxios_set_file_output_freq(file_hdl, output_freq) BIND(C) 154 154 USE ISO_C_BINDING 155 USE ID ATE155 USE IDURATION 156 156 INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 157 157 TYPE(txios(duration)), VALUE :: output_freq … … 160 160 SUBROUTINE cxios_get_file_output_freq(file_hdl, output_freq) BIND(C) 161 161 USE ISO_C_BINDING 162 USE ID ATE162 USE IDURATION 163 163 INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 164 164 TYPE(txios(duration)) :: output_freq … … 214 214 SUBROUTINE cxios_set_file_split_freq(file_hdl, split_freq) BIND(C) 215 215 USE ISO_C_BINDING 216 USE ID ATE216 USE IDURATION 217 217 INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 218 218 TYPE(txios(duration)), VALUE :: split_freq … … 221 221 SUBROUTINE cxios_get_file_split_freq(file_hdl, split_freq) BIND(C) 222 222 USE ISO_C_BINDING 223 USE ID ATE223 USE IDURATION 224 224 INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 225 225 TYPE(txios(duration)) :: split_freq … … 256 256 SUBROUTINE cxios_set_file_sync_freq(file_hdl, sync_freq) BIND(C) 257 257 USE ISO_C_BINDING 258 USE ID ATE258 USE IDURATION 259 259 INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 260 260 TYPE(txios(duration)), VALUE :: sync_freq … … 263 263 SUBROUTINE cxios_get_file_sync_freq(file_hdl, sync_freq) BIND(C) 264 264 USE ISO_C_BINDING 265 USE ID ATE265 USE IDURATION 266 266 INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 267 267 TYPE(txios(duration)) :: sync_freq -
XIOS/trunk/src/interface/fortran_attr/filegroup_interface_attr.F90
r538 r545 174 174 SUBROUTINE cxios_set_filegroup_output_freq(filegroup_hdl, output_freq) BIND(C) 175 175 USE ISO_C_BINDING 176 USE ID ATE176 USE IDURATION 177 177 INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 178 178 TYPE(txios(duration)), VALUE :: output_freq … … 181 181 SUBROUTINE cxios_get_filegroup_output_freq(filegroup_hdl, output_freq) BIND(C) 182 182 USE ISO_C_BINDING 183 USE ID ATE183 USE IDURATION 184 184 INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 185 185 TYPE(txios(duration)) :: output_freq … … 235 235 SUBROUTINE cxios_set_filegroup_split_freq(filegroup_hdl, split_freq) BIND(C) 236 236 USE ISO_C_BINDING 237 USE ID ATE237 USE IDURATION 238 238 INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 239 239 TYPE(txios(duration)), VALUE :: split_freq … … 242 242 SUBROUTINE cxios_get_filegroup_split_freq(filegroup_hdl, split_freq) BIND(C) 243 243 USE ISO_C_BINDING 244 USE ID ATE244 USE IDURATION 245 245 INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 246 246 TYPE(txios(duration)) :: split_freq … … 277 277 SUBROUTINE cxios_set_filegroup_sync_freq(filegroup_hdl, sync_freq) BIND(C) 278 278 USE ISO_C_BINDING 279 USE ID ATE279 USE IDURATION 280 280 INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 281 281 TYPE(txios(duration)), VALUE :: sync_freq … … 284 284 SUBROUTINE cxios_get_filegroup_sync_freq(filegroup_hdl, sync_freq) BIND(C) 285 285 USE ISO_C_BINDING 286 USE ID ATE286 USE IDURATION 287 287 INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 288 288 TYPE(txios(duration)) :: sync_freq -
XIOS/trunk/src/node/context.cpp
r541 r545 81 81 void CContext::solveCalendar(void) 82 82 { 83 if (this->calendar.get() != NULL) return;84 83 if (calendar_type.isEmpty()) 85 84 ERROR(" CContext::solveCalendar(void)", … … 94 93 << "[ context id = " << this->getId() << " ] " 95 94 << "Impossible to define a calendar: the timestep is missing."); 95 96 if (this->calendar) 97 { 98 if (this->calendar->getId() != calendar_type.getStringValue() 99 || this->calendar->getInitDate() != start_date.getValue() 100 || (time_origin.isEmpty() && this->calendar->getTimeOrigin() != start_date.getValue()) 101 || (!time_origin.isEmpty() && this->calendar->getTimeOrigin() != time_origin.getValue()) 102 || this->calendar->getTimeStep() != timestep.getValue()) 103 ERROR(" CContext::solveCalendar(void)", 104 << "[ context id = " << this->getId() << " ] " 105 << "Impossible to define a calendar again with new parameters."); 106 return; 107 } 96 108 97 109 #define DECLARE_CALENDAR(MType, eType) \ -
XIOS/trunk/src/test/test_client.f90
r537 r545 12 12 INTEGER :: comm 13 13 TYPE(xios_duration) :: dtime 14 TYPE(xios_date) :: date 14 15 TYPE(xios_context) :: ctx_hdl 15 16 INTEGER,PARAMETER :: ni_glo=100 … … 87 88 88 89 89 dtime%second=3600 90 CALL xios_set_context_attr("test", timestep=dtime) 91 92 ni=0 ; lonvalue(:)=0 93 CALL xios_get_domain_attr("domain_A",ni=ni,lonvalue=lonvalue) 94 95 print *,"ni",ni 96 print *,"lonvalue",lonvalue ; 90 dtime%second = 3600 91 CALL xios_set_context_attr("test", timestep=dtime) 97 92 98 CALL xios_is_defined_field_attr("field_A",enabled=ok) 99 PRINT *,"field_A : attribute enabled is defined ? ",ok 100 CALL xios_close_context_definition() 101 102 PRINT*,"field field_A is active ? ",xios_field_is_active("field_A") 103 DO ts=1,24*10 104 CALL xios_update_calendar(ts) 105 CALL xios_send_field("field_A",field_A) 106 CALL wait_us(5000) ; 107 ENDDO 93 ! Create the calendar before closing the context definition 94 ! so that calendar operations can be used 95 CALL xios_set_calendar() 96 CALL xios_get_context_attr("test", time_origin=date) 97 PRINT *, "time_origin = ", date 98 dtime%timestep = 1 99 dtime = 0.5 * dtime 100 PRINT *, "duration = ", dtime 101 date = date + 3 * (dtime + dtime) 102 PRINT *, "date = time_origin + 3 * (duration + duration) = ", date 103 PRINT *, "xios_date_convert_to_seconds(date) = ", xios_date_convert_to_seconds(date) 104 PRINT *, "xios_date_convert_to_seconds(date - 2.5h) = ", xios_date_convert_to_seconds(date - 2.5 * xios_hour) 108 105 109 CALL xios_context_finalize() 110 CALL xios_finalize() 106 ni=0 ; lonvalue(:)=0 107 CALL xios_get_domain_attr("domain_A",ni=ni,lonvalue=lonvalue) 108 109 print *,"ni",ni 110 print *,"lonvalue",lonvalue ; 111 112 CALL xios_is_defined_field_attr("field_A",enabled=ok) 113 PRINT *,"field_A : attribute enabled is defined ? ",ok 114 CALL xios_close_context_definition() 115 116 PRINT*,"field field_A is active ? ",xios_field_is_active("field_A") 117 DO ts=1,24*10 118 CALL xios_update_calendar(ts) 119 CALL xios_send_field("field_A",field_A) 120 CALL wait_us(5000) ; 121 ENDDO 122 123 CALL xios_context_finalize() 124 CALL xios_finalize() 111 125 112 126 CALL MPI_FINALIZE(ierr)
Note: See TracChangeset
for help on using the changeset viewer.