Ignore:
Timestamp:
12/17/14 11:14:05 (9 years ago)
Author:
rlacroix
Message:

Expose the calendar operations through the Fortran interface.

  • Add arithmetic operations on the xios_duration and xios_date types:
    • xios_duration + xios_duration = xios_duration
    • xios_duration - xios_duration = xios_duration
    • scalar * xios_duration = xios_duration * scalar = xios_duration
    • - xios_duration = xios_duration
    • xios_date + xios_duration = xios_date
    • xios_date - xios_duration = xios_date
    • xios_date - xios_date = xios_duration
  • Add comparison operations on the xios_duration and xios_date types:
    • xios_duration: ==, /=
    • xios_date: ==, /=, <, <=, >, >=
  • Add a new function "xios_date_convert_to_seconds" to convert a date into the number of seconds since the time origin of the calendar
  • Define some constant durations "xios_second", "xios_minute", "xios_hour", "xios_day", "xios_month", "xios_year" et "xios_timestep" to ease the definition of new durations (for example, 10h is just 10 * xios_hour)
  • Add a new function "xios_set_calendar" so that one can manually create the calendar attached to the current context and thus use the calendar operations before calling "xios_close_context_definition". This function can accept optional parameters so that the calendar attributes (calendar_type, start_date, time_origin and timestep) can be easily overwritten. Note that you cannot define a new calendar after one was already created (either because "xios_set_calendar" or "xios_close_context_definition" was used)
  • Readd the function "xios_set_timestep" as a simplified alias of "xios_set_context_attr(context, timestep)" for the current context
File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/interface/c/iccontext.cpp

    r520 r545  
    2929 
    3030   // ------------------------ Création des handle ----------------------------- 
    31     
     31 
    3232   void cxios_context_handle_create (XContextPtr * _ret, const char * _id, int _id_len) 
    3333   { 
    34       std::string id;  
     34      std::string id; 
    3535      if (!cstr2string(_id, _id_len, id)) return; 
    3636      CTimer::get("XIOS").resume() ; 
    37        
     37 
    3838      std::vector<xios::CContext*> def_vector = 
    3939            xios::CContext::getRoot()->getChildList(); 
     
    5353      // Lever une exeception ici 
    5454   } 
    55     
     55 
    5656   // ------------------------ 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 
    5865   void cxios_context_set_current(XContextPtr context, bool withswap) 
    5966   { 
     
    6269      CTimer::get("XIOS").suspend() ; 
    6370   } 
    64     
    65   
     71 
    6672   // -------------------- Vérification des identifiants ----------------------- 
    6773 
     
    7076      std::string id; 
    7177      if (!cstr2string(_id, _id_len, id)) return; 
    72        
     78 
    7379      CTimer::get("XIOS").resume(); 
    7480      std::vector<xios::CContext*> def_vector = 
Note: See TracChangeset for help on using the changeset viewer.