source: XIOS/trunk/src/generate_fortran_interface.cpp @ 576

Last change on this file since 576 was 549, checked in by rlacroix, 9 years ago

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
  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
  • Property svn:eol-style set to native
File size: 5.4 KB
Line 
1#include "xmlioserver.hpp"
2#include "generate_interface.hpp"
3#include "indent.hpp"
4#include "attribute_template.hpp"
5#include "object_template.hpp"
6#include "group_template.hpp"
7#include "context.hpp"
8#include "file.hpp"
9
10int main (int argc, char ** argv, char ** UNUSED (env))
11{
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;
19  CField field;
20  CFieldGroup fieldgroup;
21  CVariable variable;
22  CVariableGroup variablegroup;
23  CDomain domain;
24  CDomainGroup domaingroup;
25  CGrid grid;
26  CGridGroup gridgroup;
27
28  CFile afile;
29  CFileGroup filegroup;
30
31  ostringstream oss;
32  ofstream file;
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
210}
Note: See TracBrowser for help on using the repository browser.