source: XIOS/trunk/src/interface/c_attr/icfile_attr.cpp @ 711

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

Support creating the timeseries automatically.

Fields which should be outputted as timeseries must have the ts_enabled attribute set to true.

Files have a new attribute timeseries which must be one of:

  • none: no timeseries are outputted, only the regular file (default behavior when the attribute is ommited).
  • only: only the timeseries are outputted, the regular file is not created.
  • both: both the timeseries and the regular files are outputted.
  • exclusive: the timeseries are outputted and a regular file is created with only the fields which were not marked for output as a timeserie (if any).

The name of the files created for the timeseries is composed of a prefix followed by the name of the variable. The file attribute ts_prefix can be used to control the prefix used (by default, the name of the regular file is used).

All the attributes of the regular file are inherited by the files created for the timeseries. The field attribute ts_split_freq can be used to configure the splitting for each timeseries (by default, the splitting frequency of the regular file is used).

  • 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: 17.6 KB
Line 
1/* ************************************************************************** *
2 *               Interface auto generated - do not modify                     *
3 * ************************************************************************** */
4
5#include <boost/multi_array.hpp>
6#include <boost/shared_ptr.hpp>
7#include "xios.hpp"
8#include "attribute_template.hpp"
9#include "object_template.hpp"
10#include "group_template.hpp"
11#include "icutil.hpp"
12#include "icdate.hpp"
13#include "timer.hpp"
14#include "node_type.hpp"
15
16extern "C"
17{
18  typedef xios::CFile* file_Ptr;
19
20  void cxios_set_file_append(file_Ptr file_hdl, bool append)
21  {
22    CTimer::get("XIOS").resume();
23    file_hdl->append.setValue(append);
24    CTimer::get("XIOS").suspend();
25  }
26
27  void cxios_get_file_append(file_Ptr file_hdl, bool* append)
28  {
29    CTimer::get("XIOS").resume();
30    *append = file_hdl->append.getInheritedValue();
31    CTimer::get("XIOS").suspend();
32  }
33
34  bool cxios_is_defined_file_append(file_Ptr file_hdl)
35  {
36     CTimer::get("XIOS").resume();
37     bool isDefined = file_hdl->append.hasInheritedValue();
38     CTimer::get("XIOS").suspend();
39     return isDefined;
40  }
41
42
43  void cxios_set_file_compression_level(file_Ptr file_hdl, int compression_level)
44  {
45    CTimer::get("XIOS").resume();
46    file_hdl->compression_level.setValue(compression_level);
47    CTimer::get("XIOS").suspend();
48  }
49
50  void cxios_get_file_compression_level(file_Ptr file_hdl, int* compression_level)
51  {
52    CTimer::get("XIOS").resume();
53    *compression_level = file_hdl->compression_level.getInheritedValue();
54    CTimer::get("XIOS").suspend();
55  }
56
57  bool cxios_is_defined_file_compression_level(file_Ptr file_hdl)
58  {
59     CTimer::get("XIOS").resume();
60     bool isDefined = file_hdl->compression_level.hasInheritedValue();
61     CTimer::get("XIOS").suspend();
62     return isDefined;
63  }
64
65
66  void cxios_set_file_description(file_Ptr file_hdl, const char * description, int description_size)
67  {
68    std::string description_str;
69    if (!cstr2string(description, description_size, description_str)) return;
70    CTimer::get("XIOS").resume();
71    file_hdl->description.setValue(description_str);
72    CTimer::get("XIOS").suspend();
73  }
74
75  void cxios_get_file_description(file_Ptr file_hdl, char * description, int description_size)
76  {
77    CTimer::get("XIOS").resume();
78    if (!string_copy(file_hdl->description.getInheritedValue(), description, description_size))
79      ERROR("void cxios_get_file_description(file_Ptr file_hdl, char * description, int description_size)", << "Input string is too short");
80    CTimer::get("XIOS").suspend();
81  }
82
83  bool cxios_is_defined_file_description(file_Ptr file_hdl)
84  {
85     CTimer::get("XIOS").resume();
86     bool isDefined = file_hdl->description.hasInheritedValue();
87     CTimer::get("XIOS").suspend();
88     return isDefined;
89  }
90
91
92  void cxios_set_file_enabled(file_Ptr file_hdl, bool enabled)
93  {
94    CTimer::get("XIOS").resume();
95    file_hdl->enabled.setValue(enabled);
96    CTimer::get("XIOS").suspend();
97  }
98
99  void cxios_get_file_enabled(file_Ptr file_hdl, bool* enabled)
100  {
101    CTimer::get("XIOS").resume();
102    *enabled = file_hdl->enabled.getInheritedValue();
103    CTimer::get("XIOS").suspend();
104  }
105
106  bool cxios_is_defined_file_enabled(file_Ptr file_hdl)
107  {
108     CTimer::get("XIOS").resume();
109     bool isDefined = file_hdl->enabled.hasInheritedValue();
110     CTimer::get("XIOS").suspend();
111     return isDefined;
112  }
113
114
115  void cxios_set_file_format(file_Ptr file_hdl, const char * format, int format_size)
116  {
117    std::string format_str;
118    if (!cstr2string(format, format_size, format_str)) return;
119    CTimer::get("XIOS").resume();
120    file_hdl->format.fromString(format_str);
121    CTimer::get("XIOS").suspend();
122  }
123
124  void cxios_get_file_format(file_Ptr file_hdl, char * format, int format_size)
125  {
126    CTimer::get("XIOS").resume();
127    if (!string_copy(file_hdl->format.getInheritedStringValue(), format, format_size))
128      ERROR("void cxios_get_file_format(file_Ptr file_hdl, char * format, int format_size)", << "Input string is too short");
129    CTimer::get("XIOS").suspend();
130  }
131
132  bool cxios_is_defined_file_format(file_Ptr file_hdl)
133  {
134     CTimer::get("XIOS").resume();
135     bool isDefined = file_hdl->format.hasInheritedValue();
136     CTimer::get("XIOS").suspend();
137     return isDefined;
138  }
139
140
141  void cxios_set_file_min_digits(file_Ptr file_hdl, int min_digits)
142  {
143    CTimer::get("XIOS").resume();
144    file_hdl->min_digits.setValue(min_digits);
145    CTimer::get("XIOS").suspend();
146  }
147
148  void cxios_get_file_min_digits(file_Ptr file_hdl, int* min_digits)
149  {
150    CTimer::get("XIOS").resume();
151    *min_digits = file_hdl->min_digits.getInheritedValue();
152    CTimer::get("XIOS").suspend();
153  }
154
155  bool cxios_is_defined_file_min_digits(file_Ptr file_hdl)
156  {
157     CTimer::get("XIOS").resume();
158     bool isDefined = file_hdl->min_digits.hasInheritedValue();
159     CTimer::get("XIOS").suspend();
160     return isDefined;
161  }
162
163
164  void cxios_set_file_mode(file_Ptr file_hdl, const char * mode, int mode_size)
165  {
166    std::string mode_str;
167    if (!cstr2string(mode, mode_size, mode_str)) return;
168    CTimer::get("XIOS").resume();
169    file_hdl->mode.fromString(mode_str);
170    CTimer::get("XIOS").suspend();
171  }
172
173  void cxios_get_file_mode(file_Ptr file_hdl, char * mode, int mode_size)
174  {
175    CTimer::get("XIOS").resume();
176    if (!string_copy(file_hdl->mode.getInheritedStringValue(), mode, mode_size))
177      ERROR("void cxios_get_file_mode(file_Ptr file_hdl, char * mode, int mode_size)", << "Input string is too short");
178    CTimer::get("XIOS").suspend();
179  }
180
181  bool cxios_is_defined_file_mode(file_Ptr file_hdl)
182  {
183     CTimer::get("XIOS").resume();
184     bool isDefined = file_hdl->mode.hasInheritedValue();
185     CTimer::get("XIOS").suspend();
186     return isDefined;
187  }
188
189
190  void cxios_set_file_name(file_Ptr file_hdl, const char * name, int name_size)
191  {
192    std::string name_str;
193    if (!cstr2string(name, name_size, name_str)) return;
194    CTimer::get("XIOS").resume();
195    file_hdl->name.setValue(name_str);
196    CTimer::get("XIOS").suspend();
197  }
198
199  void cxios_get_file_name(file_Ptr file_hdl, char * name, int name_size)
200  {
201    CTimer::get("XIOS").resume();
202    if (!string_copy(file_hdl->name.getInheritedValue(), name, name_size))
203      ERROR("void cxios_get_file_name(file_Ptr file_hdl, char * name, int name_size)", << "Input string is too short");
204    CTimer::get("XIOS").suspend();
205  }
206
207  bool cxios_is_defined_file_name(file_Ptr file_hdl)
208  {
209     CTimer::get("XIOS").resume();
210     bool isDefined = file_hdl->name.hasInheritedValue();
211     CTimer::get("XIOS").suspend();
212     return isDefined;
213  }
214
215
216  void cxios_set_file_name_suffix(file_Ptr file_hdl, const char * name_suffix, int name_suffix_size)
217  {
218    std::string name_suffix_str;
219    if (!cstr2string(name_suffix, name_suffix_size, name_suffix_str)) return;
220    CTimer::get("XIOS").resume();
221    file_hdl->name_suffix.setValue(name_suffix_str);
222    CTimer::get("XIOS").suspend();
223  }
224
225  void cxios_get_file_name_suffix(file_Ptr file_hdl, char * name_suffix, int name_suffix_size)
226  {
227    CTimer::get("XIOS").resume();
228    if (!string_copy(file_hdl->name_suffix.getInheritedValue(), name_suffix, name_suffix_size))
229      ERROR("void cxios_get_file_name_suffix(file_Ptr file_hdl, char * name_suffix, int name_suffix_size)", << "Input string is too short");
230    CTimer::get("XIOS").suspend();
231  }
232
233  bool cxios_is_defined_file_name_suffix(file_Ptr file_hdl)
234  {
235     CTimer::get("XIOS").resume();
236     bool isDefined = file_hdl->name_suffix.hasInheritedValue();
237     CTimer::get("XIOS").suspend();
238     return isDefined;
239  }
240
241
242  void cxios_set_file_output_freq(file_Ptr file_hdl, cxios_duration output_freq_c)
243  {
244    CTimer::get("XIOS").resume();
245    file_hdl->output_freq.allocate();
246    CDuration& output_freq = file_hdl->output_freq.get();
247    output_freq.year = output_freq_c.year;
248    output_freq.month = output_freq_c.month;
249    output_freq.day = output_freq_c.day;
250    output_freq.hour = output_freq_c.hour;
251    output_freq.minute = output_freq_c.minute;
252    output_freq.second = output_freq_c.second;
253    output_freq.timestep = output_freq_c.timestep;
254    CTimer::get("XIOS").suspend();
255  }
256
257  void cxios_get_file_output_freq(file_Ptr file_hdl, cxios_duration* output_freq_c)
258  {
259    CTimer::get("XIOS").resume();
260    CDuration output_freq = file_hdl->output_freq.getInheritedValue();
261    output_freq_c->year = output_freq.year;
262    output_freq_c->month = output_freq.month;
263    output_freq_c->day = output_freq.day;
264    output_freq_c->hour = output_freq.hour;
265    output_freq_c->minute = output_freq.minute;
266    output_freq_c->second = output_freq.second;
267    output_freq_c->timestep = output_freq.timestep;
268    CTimer::get("XIOS").suspend();
269  }
270
271  bool cxios_is_defined_file_output_freq(file_Ptr file_hdl)
272  {
273     CTimer::get("XIOS").resume();
274     bool isDefined = file_hdl->output_freq.hasInheritedValue();
275     CTimer::get("XIOS").suspend();
276     return isDefined;
277  }
278
279
280  void cxios_set_file_output_level(file_Ptr file_hdl, int output_level)
281  {
282    CTimer::get("XIOS").resume();
283    file_hdl->output_level.setValue(output_level);
284    CTimer::get("XIOS").suspend();
285  }
286
287  void cxios_get_file_output_level(file_Ptr file_hdl, int* output_level)
288  {
289    CTimer::get("XIOS").resume();
290    *output_level = file_hdl->output_level.getInheritedValue();
291    CTimer::get("XIOS").suspend();
292  }
293
294  bool cxios_is_defined_file_output_level(file_Ptr file_hdl)
295  {
296     CTimer::get("XIOS").resume();
297     bool isDefined = file_hdl->output_level.hasInheritedValue();
298     CTimer::get("XIOS").suspend();
299     return isDefined;
300  }
301
302
303  void cxios_set_file_par_access(file_Ptr file_hdl, const char * par_access, int par_access_size)
304  {
305    std::string par_access_str;
306    if (!cstr2string(par_access, par_access_size, par_access_str)) return;
307    CTimer::get("XIOS").resume();
308    file_hdl->par_access.fromString(par_access_str);
309    CTimer::get("XIOS").suspend();
310  }
311
312  void cxios_get_file_par_access(file_Ptr file_hdl, char * par_access, int par_access_size)
313  {
314    CTimer::get("XIOS").resume();
315    if (!string_copy(file_hdl->par_access.getInheritedStringValue(), par_access, par_access_size))
316      ERROR("void cxios_get_file_par_access(file_Ptr file_hdl, char * par_access, int par_access_size)", << "Input string is too short");
317    CTimer::get("XIOS").suspend();
318  }
319
320  bool cxios_is_defined_file_par_access(file_Ptr file_hdl)
321  {
322     CTimer::get("XIOS").resume();
323     bool isDefined = file_hdl->par_access.hasInheritedValue();
324     CTimer::get("XIOS").suspend();
325     return isDefined;
326  }
327
328
329  void cxios_set_file_split_freq(file_Ptr file_hdl, cxios_duration split_freq_c)
330  {
331    CTimer::get("XIOS").resume();
332    file_hdl->split_freq.allocate();
333    CDuration& split_freq = file_hdl->split_freq.get();
334    split_freq.year = split_freq_c.year;
335    split_freq.month = split_freq_c.month;
336    split_freq.day = split_freq_c.day;
337    split_freq.hour = split_freq_c.hour;
338    split_freq.minute = split_freq_c.minute;
339    split_freq.second = split_freq_c.second;
340    split_freq.timestep = split_freq_c.timestep;
341    CTimer::get("XIOS").suspend();
342  }
343
344  void cxios_get_file_split_freq(file_Ptr file_hdl, cxios_duration* split_freq_c)
345  {
346    CTimer::get("XIOS").resume();
347    CDuration split_freq = file_hdl->split_freq.getInheritedValue();
348    split_freq_c->year = split_freq.year;
349    split_freq_c->month = split_freq.month;
350    split_freq_c->day = split_freq.day;
351    split_freq_c->hour = split_freq.hour;
352    split_freq_c->minute = split_freq.minute;
353    split_freq_c->second = split_freq.second;
354    split_freq_c->timestep = split_freq.timestep;
355    CTimer::get("XIOS").suspend();
356  }
357
358  bool cxios_is_defined_file_split_freq(file_Ptr file_hdl)
359  {
360     CTimer::get("XIOS").resume();
361     bool isDefined = file_hdl->split_freq.hasInheritedValue();
362     CTimer::get("XIOS").suspend();
363     return isDefined;
364  }
365
366
367  void cxios_set_file_split_freq_format(file_Ptr file_hdl, const char * split_freq_format, int split_freq_format_size)
368  {
369    std::string split_freq_format_str;
370    if (!cstr2string(split_freq_format, split_freq_format_size, split_freq_format_str)) return;
371    CTimer::get("XIOS").resume();
372    file_hdl->split_freq_format.setValue(split_freq_format_str);
373    CTimer::get("XIOS").suspend();
374  }
375
376  void cxios_get_file_split_freq_format(file_Ptr file_hdl, char * split_freq_format, int split_freq_format_size)
377  {
378    CTimer::get("XIOS").resume();
379    if (!string_copy(file_hdl->split_freq_format.getInheritedValue(), split_freq_format, split_freq_format_size))
380      ERROR("void cxios_get_file_split_freq_format(file_Ptr file_hdl, char * split_freq_format, int split_freq_format_size)", << "Input string is too short");
381    CTimer::get("XIOS").suspend();
382  }
383
384  bool cxios_is_defined_file_split_freq_format(file_Ptr file_hdl)
385  {
386     CTimer::get("XIOS").resume();
387     bool isDefined = file_hdl->split_freq_format.hasInheritedValue();
388     CTimer::get("XIOS").suspend();
389     return isDefined;
390  }
391
392
393  void cxios_set_file_sync_freq(file_Ptr file_hdl, cxios_duration sync_freq_c)
394  {
395    CTimer::get("XIOS").resume();
396    file_hdl->sync_freq.allocate();
397    CDuration& sync_freq = file_hdl->sync_freq.get();
398    sync_freq.year = sync_freq_c.year;
399    sync_freq.month = sync_freq_c.month;
400    sync_freq.day = sync_freq_c.day;
401    sync_freq.hour = sync_freq_c.hour;
402    sync_freq.minute = sync_freq_c.minute;
403    sync_freq.second = sync_freq_c.second;
404    sync_freq.timestep = sync_freq_c.timestep;
405    CTimer::get("XIOS").suspend();
406  }
407
408  void cxios_get_file_sync_freq(file_Ptr file_hdl, cxios_duration* sync_freq_c)
409  {
410    CTimer::get("XIOS").resume();
411    CDuration sync_freq = file_hdl->sync_freq.getInheritedValue();
412    sync_freq_c->year = sync_freq.year;
413    sync_freq_c->month = sync_freq.month;
414    sync_freq_c->day = sync_freq.day;
415    sync_freq_c->hour = sync_freq.hour;
416    sync_freq_c->minute = sync_freq.minute;
417    sync_freq_c->second = sync_freq.second;
418    sync_freq_c->timestep = sync_freq.timestep;
419    CTimer::get("XIOS").suspend();
420  }
421
422  bool cxios_is_defined_file_sync_freq(file_Ptr file_hdl)
423  {
424     CTimer::get("XIOS").resume();
425     bool isDefined = file_hdl->sync_freq.hasInheritedValue();
426     CTimer::get("XIOS").suspend();
427     return isDefined;
428  }
429
430
431  void cxios_set_file_time_counter(file_Ptr file_hdl, const char * time_counter, int time_counter_size)
432  {
433    std::string time_counter_str;
434    if (!cstr2string(time_counter, time_counter_size, time_counter_str)) return;
435    CTimer::get("XIOS").resume();
436    file_hdl->time_counter.fromString(time_counter_str);
437    CTimer::get("XIOS").suspend();
438  }
439
440  void cxios_get_file_time_counter(file_Ptr file_hdl, char * time_counter, int time_counter_size)
441  {
442    CTimer::get("XIOS").resume();
443    if (!string_copy(file_hdl->time_counter.getInheritedStringValue(), time_counter, time_counter_size))
444      ERROR("void cxios_get_file_time_counter(file_Ptr file_hdl, char * time_counter, int time_counter_size)", << "Input string is too short");
445    CTimer::get("XIOS").suspend();
446  }
447
448  bool cxios_is_defined_file_time_counter(file_Ptr file_hdl)
449  {
450     CTimer::get("XIOS").resume();
451     bool isDefined = file_hdl->time_counter.hasInheritedValue();
452     CTimer::get("XIOS").suspend();
453     return isDefined;
454  }
455
456
457  void cxios_set_file_timeseries(file_Ptr file_hdl, const char * timeseries, int timeseries_size)
458  {
459    std::string timeseries_str;
460    if (!cstr2string(timeseries, timeseries_size, timeseries_str)) return;
461    CTimer::get("XIOS").resume();
462    file_hdl->timeseries.fromString(timeseries_str);
463    CTimer::get("XIOS").suspend();
464  }
465
466  void cxios_get_file_timeseries(file_Ptr file_hdl, char * timeseries, int timeseries_size)
467  {
468    CTimer::get("XIOS").resume();
469    if (!string_copy(file_hdl->timeseries.getInheritedStringValue(), timeseries, timeseries_size))
470      ERROR("void cxios_get_file_timeseries(file_Ptr file_hdl, char * timeseries, int timeseries_size)", << "Input string is too short");
471    CTimer::get("XIOS").suspend();
472  }
473
474  bool cxios_is_defined_file_timeseries(file_Ptr file_hdl)
475  {
476     CTimer::get("XIOS").resume();
477     bool isDefined = file_hdl->timeseries.hasInheritedValue();
478     CTimer::get("XIOS").suspend();
479     return isDefined;
480  }
481
482
483  void cxios_set_file_ts_prefix(file_Ptr file_hdl, const char * ts_prefix, int ts_prefix_size)
484  {
485    std::string ts_prefix_str;
486    if (!cstr2string(ts_prefix, ts_prefix_size, ts_prefix_str)) return;
487    CTimer::get("XIOS").resume();
488    file_hdl->ts_prefix.setValue(ts_prefix_str);
489    CTimer::get("XIOS").suspend();
490  }
491
492  void cxios_get_file_ts_prefix(file_Ptr file_hdl, char * ts_prefix, int ts_prefix_size)
493  {
494    CTimer::get("XIOS").resume();
495    if (!string_copy(file_hdl->ts_prefix.getInheritedValue(), ts_prefix, ts_prefix_size))
496      ERROR("void cxios_get_file_ts_prefix(file_Ptr file_hdl, char * ts_prefix, int ts_prefix_size)", << "Input string is too short");
497    CTimer::get("XIOS").suspend();
498  }
499
500  bool cxios_is_defined_file_ts_prefix(file_Ptr file_hdl)
501  {
502     CTimer::get("XIOS").resume();
503     bool isDefined = file_hdl->ts_prefix.hasInheritedValue();
504     CTimer::get("XIOS").suspend();
505     return isDefined;
506  }
507
508
509  void cxios_set_file_type(file_Ptr file_hdl, const char * type, int type_size)
510  {
511    std::string type_str;
512    if (!cstr2string(type, type_size, type_str)) return;
513    CTimer::get("XIOS").resume();
514    file_hdl->type.fromString(type_str);
515    CTimer::get("XIOS").suspend();
516  }
517
518  void cxios_get_file_type(file_Ptr file_hdl, char * type, int type_size)
519  {
520    CTimer::get("XIOS").resume();
521    if (!string_copy(file_hdl->type.getInheritedStringValue(), type, type_size))
522      ERROR("void cxios_get_file_type(file_Ptr file_hdl, char * type, int type_size)", << "Input string is too short");
523    CTimer::get("XIOS").suspend();
524  }
525
526  bool cxios_is_defined_file_type(file_Ptr file_hdl)
527  {
528     CTimer::get("XIOS").resume();
529     bool isDefined = file_hdl->type.hasInheritedValue();
530     CTimer::get("XIOS").suspend();
531     return isDefined;
532  }
533}
Note: See TracBrowser for help on using the repository browser.