Ignore:
Timestamp:
01/26/15 14:39:26 (9 years ago)
Author:
rlacroix
Message:

Revised calendar functionalities:

  • the calendar is now configured from a specific calendar child node of the context in the XML configuration file. Example: <calendar type="Gregorian" start_date="2012-03-01 15:00:00" time_origin="2012-02-29 15:00:00" timestep="1h" />
  • the calendar type should now be configured when defining the start time and/or the time origin.
  • the start time and the time origin are now optional, 0000-01-01 00:00:00 will be used by default. It is also possible to define them partially. For example, 2015 and 2014-12 are valid dates corresponding respectively to 2015-01-01 00:00:00 and 2014-12-01 00:00:00.
  • an optional duration offset can be added to the start date and time origin. For example, it's possible to define the date 2015-01-12 12:00:00 as 2015-01-11 + 36h or 2015-01-11 12:00:00 + 1d. The duration format is the same as the time step. Being that the date is optional, it is possible to only use a duration (for example + 42s is the same as 0000-01-01 00:00:00 + 42s). An error will be raised if a duration based on the time step is used before the time step was configured. For example, the following would cause an error: <calendar type="Gregorian" start_date="+ 1ts" /> but <calendar type="Gregorian" start_date="+ 1ts" timestep="0.5h" /> would not.
  • new Fortran interface to define the calendar:
    • xios_define_calendar(type[, timestep, start_date, time_origin]) will create a calendar when none had previously been defined. Only the type argument is mandatory, the rest is optional. Calendar operations on dates and durations are possible as soon as the calendar is created (either using this procedure or directly from the XML configuration file).
    • the following getter and setter procedures are available: xios_set_timestep, xios_set_start_date, xios_set_time_origin, xios_get_calendar_type, xios_get_timestep, xios_get_start_date, xios_get_time_origin.
  • new Fortran interface to interact with the calendar: xios_update_calendar, xios_get_current_date, xios_get_year_length_in_seconds, xios_get_day_length_in_seconds.
  • new Fortran interface for date conversion: xios_date_get_second_of_year, xios_date_get_day_of_year, xios_date_get_fraction_of_year, xios_date_get_second_of_day, xios_date_get_fraction_of_day.
  • two new placeholders are available to format the file name when splitting the output (split_freq_format attribute):
    • %S the number of seconds since the time origin
    • %D the integral number of days since the time origin
File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/generate_fortran_interface.cpp

    r531 r549  
    1010int main (int argc, char ** argv, char ** UNUSED (env)) 
    1111{ 
    12 //  string path="./src/attr_interface/" ; 
    13   string path="./interface/" ; 
    14    
    15   CContext* context=CContext::create("interface") ; 
    16   CAxis axis ; 
    17   CAxisGroup axisgroup ; 
     12//  string path="./src/attr_interface/"; 
     13  string path="./interface/"; 
     14 
     15  CContext* context=CContext::create("interface"); 
     16  CCalendarWrapper calendarWrapper; 
     17  CAxis axis; 
     18  CAxisGroup axisgroup; 
    1819  CField field; 
    19   CFieldGroup fieldgroup ; 
     20  CFieldGroup fieldgroup; 
    2021  CVariable variable; 
    21   CVariableGroup variablegroup ; 
    22   CDomain domain ; 
    23   CDomainGroup domaingroup ; 
    24   CGrid grid ; 
    25   CGridGroup gridgroup ; 
    26    
     22  CVariableGroup variablegroup; 
     23  CDomain domain; 
     24  CDomainGroup domaingroup; 
     25  CGrid grid; 
     26  CGridGroup gridgroup; 
     27 
    2728  CFile afile; 
    2829  CFileGroup filegroup; 
    29    
    30   ostringstream oss ; 
     30 
     31  ostringstream oss; 
    3132  ofstream file; 
    32    
    33   file.open((path+"axis_interface_attr.F90").c_str());  
    34   axis.generateFortran2003Interface(file) ; 
    35   file.close(); 
    36    
    37   file.open((path+"icaxis_attr.cpp").c_str());  
    38   axis.generateCInterface(file) ; 
    39   file.close(); 
    40    
    41   file.open((path+"iaxis_attr.F90").c_str());  
    42   axis.generateFortranInterface(file) ; 
    43   file.close(); 
    44    
    45   file.open((path+"axisgroup_interface_attr.F90").c_str());  
    46   axisgroup.generateFortran2003Interface(file) ; 
    47   file.close(); 
    48    
    49   file.open((path+"icaxisgroup_attr.cpp").c_str());  
    50   axisgroup.generateCInterface(file) ; 
    51   file.close(); 
    52    
    53   file.open((path+"iaxisgroup_attr.F90").c_str());  
    54   axisgroup.generateFortranInterface(file) ; 
    55   file.close(); 
    56    
    57   file.open((path+"domain_interface_attr.F90").c_str());  
    58   domain.generateFortran2003Interface(file) ; 
    59   file.close(); 
    60    
    61   file.open((path+"icdomain_attr.cpp").c_str());  
    62   domain.generateCInterface(file) ; 
    63   file.close(); 
    64    
    65   file.open((path+"idomain_attr.F90").c_str());  
    66   domain.generateFortranInterface(file) ; 
    67   file.close(); 
    68    
    69   file.open((path+"domaingroup_interface_attr.F90").c_str());  
    70   domaingroup.generateFortran2003Interface(file) ; 
    71   file.close(); 
    72    
    73   file.open((path+"icdomaingroup_attr.cpp").c_str());  
    74   domaingroup.generateCInterface(file) ; 
    75   file.close(); 
    76    
    77   file.open((path+"idomaingroup_attr.F90").c_str());  
    78   domaingroup.generateFortranInterface(file) ; 
    79   file.close(); 
    80    
    81    
    82   file.open((path+"grid_interface_attr.F90").c_str());  
    83   grid.generateFortran2003Interface(file) ; 
    84   file.close(); 
    85    
    86   file.open((path+"icgrid_attr.cpp").c_str());  
    87   grid.generateCInterface(file) ; 
    88   file.close(); 
    89    
    90   file.open((path+"igrid_attr.F90").c_str());  
    91   grid.generateFortranInterface(file) ; 
    92   file.close(); 
    93    
    94   file.open((path+"gridgroup_interface_attr.F90").c_str());  
    95   gridgroup.generateFortran2003Interface(file) ; 
    96   file.close(); 
    97    
    98   file.open((path+"icgridgroup_attr.cpp").c_str());  
    99   gridgroup.generateCInterface(file) ; 
    100   file.close(); 
    101    
    102   file.open((path+"igridgroup_attr.F90").c_str());  
    103   gridgroup.generateFortranInterface(file) ; 
    104   file.close(); 
    105    
    106    
    107   file.open((path+"field_interface_attr.F90").c_str());  
    108   field.generateFortran2003Interface(file) ; 
    109   file.close(); 
    110    
    111   file.open((path+"icfield_attr.cpp").c_str());  
    112   field.generateCInterface(file) ; 
    113   file.close(); 
    114    
    115   file.open((path+"ifield_attr.F90").c_str());  
    116   field.generateFortranInterface(file) ; 
    117   file.close(); 
    118    
    119   file.open((path+"fieldgroup_interface_attr.F90").c_str());  
    120   fieldgroup.generateFortran2003Interface(file) ; 
    121   file.close(); 
    122    
    123   file.open((path+"icfieldgroup_attr.cpp").c_str());  
    124   fieldgroup.generateCInterface(file) ; 
    125   file.close(); 
    126    
    127   file.open((path+"ifieldgroup_attr.F90").c_str());  
    128   fieldgroup.generateFortranInterface(file) ; 
    129   file.close(); 
    130    
    131  
    132  
    133   file.open((path+"variable_interface_attr.F90").c_str());  
    134   variable.generateFortran2003Interface(file) ; 
    135   file.close(); 
    136    
    137   file.open((path+"icvariable_attr.cpp").c_str());  
    138   variable.generateCInterface(file) ; 
    139   file.close(); 
    140    
    141   file.open((path+"ivariable_attr.F90").c_str());  
    142   variable.generateFortranInterface(file) ; 
    143   file.close(); 
    144    
    145   file.open((path+"variablegroup_interface_attr.F90").c_str());  
    146   variablegroup.generateFortran2003Interface(file) ; 
    147   file.close(); 
    148    
    149   file.open((path+"icvariablegroup_attr.cpp").c_str());  
    150   variablegroup.generateCInterface(file) ; 
    151   file.close(); 
    152    
    153   file.open((path+"ivariablegroup_attr.F90").c_str());  
    154   variablegroup.generateFortranInterface(file) ; 
    155   file.close(); 
    156  
    157  
    158  
    159   file.open((path+"file_interface_attr.F90").c_str());  
    160   afile.generateFortran2003Interface(file) ; 
    161   file.close(); 
    162    
    163   file.open((path+"icfile_attr.cpp").c_str());  
    164   afile.generateCInterface(file) ; 
    165   file.close(); 
    166    
    167   file.open((path+"ifile_attr.F90").c_str());  
    168   afile.generateFortranInterface(file) ; 
    169   file.close(); 
    170    
    171   file.open((path+"filegroup_interface_attr.F90").c_str());  
    172   filegroup.generateFortran2003Interface(file) ; 
    173   file.close(); 
    174    
    175   file.open((path+"icfilegroup_attr.cpp").c_str());  
    176   filegroup.generateCInterface(file) ; 
    177   file.close(); 
    178    
    179   file.open((path+"ifilegroup_attr.F90").c_str());  
    180   filegroup.generateFortranInterface(file) ; 
    181   file.close(); 
    182    
    183   
    184   file.open((path+"context_interface_attr.F90").c_str());  
    185   context->generateFortran2003Interface(file) ; 
    186   file.close(); 
    187    
    188   file.open((path+"iccontext_attr.cpp").c_str());  
    189   context->generateCInterface(file) ; 
    190   file.close(); 
    191    
    192   file.open((path+"icontext_attr.F90").c_str());  
    193   context->generateFortranInterface(file) ; 
    194   file.close(); 
    195    
     33 
     34  file.open((path+"axis_interface_attr.F90").c_str()); 
     35  axis.generateFortran2003Interface(file); 
     36  file.close(); 
     37 
     38  file.open((path+"icaxis_attr.cpp").c_str()); 
     39  axis.generateCInterface(file); 
     40  file.close(); 
     41 
     42  file.open((path+"iaxis_attr.F90").c_str()); 
     43  axis.generateFortranInterface(file); 
     44  file.close(); 
     45 
     46  file.open((path+"axisgroup_interface_attr.F90").c_str()); 
     47  axisgroup.generateFortran2003Interface(file); 
     48  file.close(); 
     49 
     50  file.open((path+"icaxisgroup_attr.cpp").c_str()); 
     51  axisgroup.generateCInterface(file); 
     52  file.close(); 
     53 
     54  file.open((path+"iaxisgroup_attr.F90").c_str()); 
     55  axisgroup.generateFortranInterface(file); 
     56  file.close(); 
     57 
     58  file.open((path+"domain_interface_attr.F90").c_str()); 
     59  domain.generateFortran2003Interface(file); 
     60  file.close(); 
     61 
     62  file.open((path+"icdomain_attr.cpp").c_str()); 
     63  domain.generateCInterface(file); 
     64  file.close(); 
     65 
     66  file.open((path+"idomain_attr.F90").c_str()); 
     67  domain.generateFortranInterface(file); 
     68  file.close(); 
     69 
     70  file.open((path+"domaingroup_interface_attr.F90").c_str()); 
     71  domaingroup.generateFortran2003Interface(file); 
     72  file.close(); 
     73 
     74  file.open((path+"icdomaingroup_attr.cpp").c_str()); 
     75  domaingroup.generateCInterface(file); 
     76  file.close(); 
     77 
     78  file.open((path+"idomaingroup_attr.F90").c_str()); 
     79  domaingroup.generateFortranInterface(file); 
     80  file.close(); 
     81 
     82 
     83  file.open((path+"grid_interface_attr.F90").c_str()); 
     84  grid.generateFortran2003Interface(file); 
     85  file.close(); 
     86 
     87  file.open((path+"icgrid_attr.cpp").c_str()); 
     88  grid.generateCInterface(file); 
     89  file.close(); 
     90 
     91  file.open((path+"igrid_attr.F90").c_str()); 
     92  grid.generateFortranInterface(file); 
     93  file.close(); 
     94 
     95  file.open((path+"gridgroup_interface_attr.F90").c_str()); 
     96  gridgroup.generateFortran2003Interface(file); 
     97  file.close(); 
     98 
     99  file.open((path+"icgridgroup_attr.cpp").c_str()); 
     100  gridgroup.generateCInterface(file); 
     101  file.close(); 
     102 
     103  file.open((path+"igridgroup_attr.F90").c_str()); 
     104  gridgroup.generateFortranInterface(file); 
     105  file.close(); 
     106 
     107 
     108  file.open((path+"field_interface_attr.F90").c_str()); 
     109  field.generateFortran2003Interface(file); 
     110  file.close(); 
     111 
     112  file.open((path+"icfield_attr.cpp").c_str()); 
     113  field.generateCInterface(file); 
     114  file.close(); 
     115 
     116  file.open((path+"ifield_attr.F90").c_str()); 
     117  field.generateFortranInterface(file); 
     118  file.close(); 
     119 
     120  file.open((path+"fieldgroup_interface_attr.F90").c_str()); 
     121  fieldgroup.generateFortran2003Interface(file); 
     122  file.close(); 
     123 
     124  file.open((path+"icfieldgroup_attr.cpp").c_str()); 
     125  fieldgroup.generateCInterface(file); 
     126  file.close(); 
     127 
     128  file.open((path+"ifieldgroup_attr.F90").c_str()); 
     129  fieldgroup.generateFortranInterface(file); 
     130  file.close(); 
     131 
     132 
     133 
     134  file.open((path+"variable_interface_attr.F90").c_str()); 
     135  variable.generateFortran2003Interface(file); 
     136  file.close(); 
     137 
     138  file.open((path+"icvariable_attr.cpp").c_str()); 
     139  variable.generateCInterface(file); 
     140  file.close(); 
     141 
     142  file.open((path+"ivariable_attr.F90").c_str()); 
     143  variable.generateFortranInterface(file); 
     144  file.close(); 
     145 
     146  file.open((path+"variablegroup_interface_attr.F90").c_str()); 
     147  variablegroup.generateFortran2003Interface(file); 
     148  file.close(); 
     149 
     150  file.open((path+"icvariablegroup_attr.cpp").c_str()); 
     151  variablegroup.generateCInterface(file); 
     152  file.close(); 
     153 
     154  file.open((path+"ivariablegroup_attr.F90").c_str()); 
     155  variablegroup.generateFortranInterface(file); 
     156  file.close(); 
     157 
     158 
     159 
     160  file.open((path+"file_interface_attr.F90").c_str()); 
     161  afile.generateFortran2003Interface(file); 
     162  file.close(); 
     163 
     164  file.open((path+"icfile_attr.cpp").c_str()); 
     165  afile.generateCInterface(file); 
     166  file.close(); 
     167 
     168  file.open((path+"ifile_attr.F90").c_str()); 
     169  afile.generateFortranInterface(file); 
     170  file.close(); 
     171 
     172  file.open((path+"filegroup_interface_attr.F90").c_str()); 
     173  filegroup.generateFortran2003Interface(file); 
     174  file.close(); 
     175 
     176  file.open((path+"icfilegroup_attr.cpp").c_str()); 
     177  filegroup.generateCInterface(file); 
     178  file.close(); 
     179 
     180  file.open((path+"ifilegroup_attr.F90").c_str()); 
     181  filegroup.generateFortranInterface(file); 
     182  file.close(); 
     183 
     184 
     185  file.open((path+"calendar_wrapper_interface_attr.F90").c_str()); 
     186  calendarWrapper.generateFortran2003Interface(file); 
     187  file.close(); 
     188 
     189  file.open((path+"iccalendar_wrapper_attr.cpp").c_str()); 
     190  calendarWrapper.generateCInterface(file); 
     191  file.close(); 
     192 
     193  file.open((path+"icalendar_wrapper_attr.F90").c_str()); 
     194  calendarWrapper.generateFortranInterface(file); 
     195  file.close(); 
     196 
     197 
     198  file.open((path+"context_interface_attr.F90").c_str()); 
     199  context->generateFortran2003Interface(file); 
     200  file.close(); 
     201 
     202  file.open((path+"iccontext_attr.cpp").c_str()); 
     203  context->generateCInterface(file); 
     204  file.close(); 
     205 
     206  file.open((path+"icontext_attr.F90").c_str()); 
     207  context->generateFortranInterface(file); 
     208  file.close(); 
     209 
    196210} 
Note: See TracChangeset for help on using the changeset viewer.