1 | /* ************************************************************************** * |
---|
2 | * Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011 * |
---|
3 | * ************************************************************************** */ |
---|
4 | |
---|
5 | #include <boost/multi_array.hpp> |
---|
6 | #include <boost/shared_ptr.hpp> |
---|
7 | |
---|
8 | #include "xios.hpp" |
---|
9 | |
---|
10 | #include "attribute_template.hpp" |
---|
11 | #include "object_template.hpp" |
---|
12 | #include "group_template.hpp" |
---|
13 | |
---|
14 | #include "icutil.hpp" |
---|
15 | #include "timer.hpp" |
---|
16 | #include "context.hpp" |
---|
17 | #include "node_type.hpp" |
---|
18 | |
---|
19 | extern "C" |
---|
20 | { |
---|
21 | // /////////////////////////////// Définitions ////////////////////////////// // |
---|
22 | |
---|
23 | // ----------------------- Redéfinition de types ---------------------------- |
---|
24 | |
---|
25 | typedef xios::CContext * XContextPtr; |
---|
26 | |
---|
27 | typedef xios::CGrid * XGridPtr; |
---|
28 | typedef xios::CGridGroup * XGridGroupPtr; |
---|
29 | |
---|
30 | typedef xios::CFile * XFilePtr; |
---|
31 | typedef xios::CFileGroup * XFileGroupPtr; |
---|
32 | |
---|
33 | typedef xios::CField * XFieldPtr; |
---|
34 | typedef xios::CFieldGroup * XFieldGroupPtr; |
---|
35 | |
---|
36 | typedef xios::CDomain * XDomainPtr; |
---|
37 | typedef xios::CDomainGroup * XDomainGroupPtr; |
---|
38 | |
---|
39 | typedef xios::CScalar * XScalarPtr; |
---|
40 | typedef xios::CScalarGroup * XScalarGroupPtr; |
---|
41 | |
---|
42 | typedef xios::CAxis * XAxisPtr; |
---|
43 | typedef xios::CAxisGroup * XAxisGroupPtr; |
---|
44 | |
---|
45 | typedef xios::CVariable * XVariablePtr; |
---|
46 | typedef xios::CVariableGroup * XVariableGroupPtr; |
---|
47 | |
---|
48 | typedef xios::CTransformation<CDomain> * XTransformationDomainPtr; |
---|
49 | typedef xios::CZoomDomain * XZoomDomainPtr; |
---|
50 | typedef xios::CInterpolateDomain * XInterpolateDomainPtr; |
---|
51 | typedef xios::CGenerateRectilinearDomain * XGenerateRectilinearDomainPtr; |
---|
52 | |
---|
53 | typedef xios::CTransformation<CAxis> * XTransformationAxisPtr; |
---|
54 | typedef xios::CZoomAxis * XZoomAxisPtr; |
---|
55 | typedef xios::CInterpolateAxis * XInterpolateAxisPtr; |
---|
56 | typedef xios::CInverseAxis * XInverseAxisPtr; |
---|
57 | |
---|
58 | typedef xios::CTransformation<CScalar> * XTransformationScalarPtr; |
---|
59 | typedef xios::CReduceAxisToScalar * XReduceAxisToScalarPtr; |
---|
60 | |
---|
61 | // ----------------------- Ajout d'enfant à un parent ----------------------- |
---|
62 | |
---|
63 | void cxios_xml_tree_add_field |
---|
64 | (XFieldGroupPtr parent_, XFieldPtr * child_, const char * child_id, int child_id_size) |
---|
65 | { |
---|
66 | std::string child_id_str; |
---|
67 | CTimer::get("XIOS").resume() ; |
---|
68 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
69 | { |
---|
70 | *child_ = parent_->createChild(child_id_str) ; |
---|
71 | } |
---|
72 | else |
---|
73 | { |
---|
74 | *child_ = parent_->createChild() ; |
---|
75 | } |
---|
76 | CTimer::get("XIOS").suspend() ; |
---|
77 | } |
---|
78 | |
---|
79 | void cxios_xml_tree_add_grid |
---|
80 | (XGridGroupPtr parent_, XGridPtr * child_, const char * child_id, int child_id_size) |
---|
81 | { |
---|
82 | std::string child_id_str; |
---|
83 | CTimer::get("XIOS").resume() ; |
---|
84 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
85 | { |
---|
86 | *child_ = parent_->createChild(child_id_str) ; |
---|
87 | } |
---|
88 | else |
---|
89 | { |
---|
90 | *child_ = parent_->createChild() ; |
---|
91 | } |
---|
92 | CTimer::get("XIOS").suspend() ; |
---|
93 | } |
---|
94 | |
---|
95 | void cxios_xml_tree_add_file |
---|
96 | (XFileGroupPtr parent_, XFilePtr * child_, const char * child_id, int child_id_size) |
---|
97 | { |
---|
98 | std::string child_id_str; |
---|
99 | CTimer::get("XIOS").resume() ; |
---|
100 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
101 | { |
---|
102 | *child_ = parent_->createChild(child_id_str) ; |
---|
103 | } |
---|
104 | else |
---|
105 | { |
---|
106 | *child_ = parent_->createChild() ; |
---|
107 | } |
---|
108 | CTimer::get("XIOS").suspend() ; |
---|
109 | } |
---|
110 | |
---|
111 | void cxios_xml_tree_add_axis |
---|
112 | (XAxisGroupPtr parent_, XAxisPtr * child_, const char * child_id, int child_id_size) |
---|
113 | { |
---|
114 | std::string child_id_str; |
---|
115 | CTimer::get("XIOS").resume() ; |
---|
116 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
117 | { |
---|
118 | *child_ = parent_->createChild(child_id_str) ; |
---|
119 | } |
---|
120 | else |
---|
121 | { |
---|
122 | *child_ = parent_->createChild() ; |
---|
123 | } |
---|
124 | CTimer::get("XIOS").suspend() ; |
---|
125 | } |
---|
126 | |
---|
127 | void cxios_xml_tree_add_scalar |
---|
128 | (XScalarGroupPtr parent_, XScalarPtr * child_, const char * child_id, int child_id_size) |
---|
129 | { |
---|
130 | std::string child_id_str; |
---|
131 | CTimer::get("XIOS").resume() ; |
---|
132 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
133 | { |
---|
134 | *child_ = parent_->createChild(child_id_str) ; |
---|
135 | } |
---|
136 | else |
---|
137 | { |
---|
138 | *child_ = parent_->createChild() ; |
---|
139 | } |
---|
140 | CTimer::get("XIOS").suspend() ; |
---|
141 | } |
---|
142 | |
---|
143 | void cxios_xml_tree_add_domain |
---|
144 | (XDomainGroupPtr parent_, XDomainPtr * child_, const char * child_id, int child_id_size) |
---|
145 | { |
---|
146 | std::string child_id_str; |
---|
147 | CTimer::get("XIOS").resume() ; |
---|
148 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
149 | { |
---|
150 | *child_ = parent_->createChild(child_id_str) ; |
---|
151 | } |
---|
152 | else |
---|
153 | { |
---|
154 | *child_ = parent_->createChild() ; |
---|
155 | } |
---|
156 | CTimer::get("XIOS").suspend() ; |
---|
157 | } |
---|
158 | |
---|
159 | void cxios_xml_tree_add_fieldtofile |
---|
160 | (XFilePtr parent_, XFieldPtr * child_, const char * child_id, int child_id_size) |
---|
161 | { |
---|
162 | std::string child_id_str; |
---|
163 | CTimer::get("XIOS").resume() ; |
---|
164 | |
---|
165 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
166 | { |
---|
167 | *child_ = parent_->addField(child_id_str); |
---|
168 | } |
---|
169 | else |
---|
170 | { |
---|
171 | *child_ = parent_->addField(); |
---|
172 | } |
---|
173 | CTimer::get("XIOS").suspend() ; |
---|
174 | } |
---|
175 | |
---|
176 | void cxios_xml_tree_add_variabletofile |
---|
177 | (XFilePtr parent_, XVariablePtr * child_, const char * child_id, int child_id_size) |
---|
178 | { |
---|
179 | std::string child_id_str; |
---|
180 | CTimer::get("XIOS").resume() ; |
---|
181 | |
---|
182 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
183 | { |
---|
184 | *child_ = parent_->addVariable(child_id_str); |
---|
185 | } |
---|
186 | else |
---|
187 | { |
---|
188 | *child_ = parent_->addVariable(); |
---|
189 | } |
---|
190 | CTimer::get("XIOS").suspend() ; |
---|
191 | } |
---|
192 | |
---|
193 | void cxios_xml_tree_add_variabletofield |
---|
194 | (XFieldPtr parent_, XVariablePtr * child_, const char * child_id, int child_id_size) |
---|
195 | { |
---|
196 | std::string child_id_str; |
---|
197 | CTimer::get("XIOS").resume() ; |
---|
198 | |
---|
199 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
200 | { |
---|
201 | *child_ = parent_->addVariable(child_id_str); |
---|
202 | } |
---|
203 | else |
---|
204 | { |
---|
205 | *child_ = parent_->addVariable(); |
---|
206 | } |
---|
207 | CTimer::get("XIOS").suspend() ; |
---|
208 | } |
---|
209 | // ----------------------- Ajout de groupe à un parent ---------------------- |
---|
210 | |
---|
211 | void cxios_xml_tree_add_fieldgroup |
---|
212 | (XFieldGroupPtr parent_, XFieldGroupPtr * child_, const char * child_id, int child_id_size) |
---|
213 | { |
---|
214 | std::string child_id_str; |
---|
215 | CTimer::get("XIOS").resume() ; |
---|
216 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
217 | { |
---|
218 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
219 | } |
---|
220 | else |
---|
221 | { |
---|
222 | *child_ = parent_->createChildGroup() ; |
---|
223 | } |
---|
224 | CTimer::get("XIOS").suspend() ; |
---|
225 | } |
---|
226 | |
---|
227 | void cxios_xml_tree_add_gridgroup |
---|
228 | (XGridGroupPtr parent_, XGridGroupPtr * child_, const char * child_id, int child_id_size) |
---|
229 | { |
---|
230 | std::string child_id_str; |
---|
231 | CTimer::get("XIOS").resume() ; |
---|
232 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
233 | { |
---|
234 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
235 | } |
---|
236 | else |
---|
237 | { |
---|
238 | *child_ = parent_->createChildGroup() ; |
---|
239 | } |
---|
240 | CTimer::get("XIOS").suspend() ; |
---|
241 | } |
---|
242 | |
---|
243 | void cxios_xml_tree_add_filegroup |
---|
244 | (XFileGroupPtr parent_, XFileGroupPtr * child_, const char * child_id, int child_id_size) |
---|
245 | { |
---|
246 | std::string child_id_str; |
---|
247 | CTimer::get("XIOS").resume() ; |
---|
248 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
249 | { |
---|
250 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
251 | } |
---|
252 | else |
---|
253 | { |
---|
254 | *child_ = parent_->createChildGroup() ; |
---|
255 | } |
---|
256 | CTimer::get("XIOS").suspend() ; |
---|
257 | } |
---|
258 | |
---|
259 | void cxios_xml_tree_add_scalargroup |
---|
260 | (XScalarGroupPtr parent_, XScalarGroupPtr * child_, const char * child_id, int child_id_size) |
---|
261 | { |
---|
262 | std::string child_id_str; |
---|
263 | CTimer::get("XIOS").resume() ; |
---|
264 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
265 | { |
---|
266 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
267 | } |
---|
268 | else |
---|
269 | { |
---|
270 | *child_ = parent_->createChildGroup() ; |
---|
271 | } |
---|
272 | CTimer::get("XIOS").suspend() ; |
---|
273 | } |
---|
274 | |
---|
275 | void cxios_xml_tree_add_axisgroup |
---|
276 | (XAxisGroupPtr parent_, XAxisGroupPtr * child_, const char * child_id, int child_id_size) |
---|
277 | { |
---|
278 | std::string child_id_str; |
---|
279 | CTimer::get("XIOS").resume() ; |
---|
280 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
281 | { |
---|
282 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
283 | } |
---|
284 | else |
---|
285 | { |
---|
286 | *child_ = parent_->createChildGroup() ; |
---|
287 | } |
---|
288 | CTimer::get("XIOS").suspend() ; |
---|
289 | } |
---|
290 | |
---|
291 | void cxios_xml_tree_add_domaingroup |
---|
292 | (XDomainGroupPtr parent_, XDomainGroupPtr * child_, const char * child_id, int child_id_size) |
---|
293 | { |
---|
294 | std::string child_id_str; |
---|
295 | CTimer::get("XIOS").resume() ; |
---|
296 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
297 | { |
---|
298 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
299 | } |
---|
300 | else |
---|
301 | { |
---|
302 | *child_ = parent_->createChildGroup() ; |
---|
303 | } |
---|
304 | CTimer::get("XIOS").suspend() ; |
---|
305 | } |
---|
306 | |
---|
307 | void cxios_xml_tree_add_fieldgrouptofile |
---|
308 | (XFilePtr parent_, XFieldGroupPtr * child_, const char * child_id, int child_id_size) |
---|
309 | { |
---|
310 | std::string child_id_str; |
---|
311 | CTimer::get("XIOS").resume() ; |
---|
312 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
313 | { |
---|
314 | *child_ = parent_->addFieldGroup(child_id_str); |
---|
315 | } |
---|
316 | else |
---|
317 | { |
---|
318 | *child_ = parent_->addFieldGroup(); |
---|
319 | } |
---|
320 | CTimer::get("XIOS").suspend() ; |
---|
321 | } |
---|
322 | |
---|
323 | void cxios_xml_tree_add_variablegrouptofile |
---|
324 | (XFilePtr parent_, XVariableGroupPtr * child_, const char * child_id, int child_id_size) |
---|
325 | { |
---|
326 | std::string child_id_str; |
---|
327 | CTimer::get("XIOS").resume() ; |
---|
328 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
329 | { |
---|
330 | *child_ = parent_->addVariableGroup(child_id_str); |
---|
331 | } |
---|
332 | else |
---|
333 | { |
---|
334 | *child_ = parent_->addVariableGroup(); |
---|
335 | } |
---|
336 | CTimer::get("XIOS").suspend() ; |
---|
337 | } |
---|
338 | |
---|
339 | void cxios_xml_tree_add_variablegrouptofield |
---|
340 | (XFieldPtr parent_, XVariableGroupPtr * child_, const char * child_id, int child_id_size) |
---|
341 | { |
---|
342 | std::string child_id_str; |
---|
343 | CTimer::get("XIOS").resume() ; |
---|
344 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
345 | { |
---|
346 | *child_ = parent_->addVariableGroup(child_id_str); |
---|
347 | } |
---|
348 | else |
---|
349 | { |
---|
350 | *child_ = parent_->addVariableGroup(); |
---|
351 | } |
---|
352 | CTimer::get("XIOS").suspend() ; |
---|
353 | } |
---|
354 | |
---|
355 | void cxios_xml_tree_add_scalartogrid |
---|
356 | (XGridPtr parent_, XScalarPtr * child_, const char * child_id, int child_id_size) |
---|
357 | { |
---|
358 | std::string child_id_str; |
---|
359 | CTimer::get("XIOS").resume() ; |
---|
360 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
361 | { |
---|
362 | *child_ = parent_->addScalar(child_id_str); |
---|
363 | } |
---|
364 | else |
---|
365 | { |
---|
366 | *child_ = parent_->addScalar(); |
---|
367 | } |
---|
368 | CTimer::get("XIOS").suspend() ; |
---|
369 | } |
---|
370 | |
---|
371 | void cxios_xml_tree_add_axistogrid |
---|
372 | (XGridPtr parent_, XAxisPtr * child_, const char * child_id, int child_id_size) |
---|
373 | { |
---|
374 | std::string child_id_str; |
---|
375 | CTimer::get("XIOS").resume() ; |
---|
376 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
377 | { |
---|
378 | *child_ = parent_->addAxis(child_id_str); |
---|
379 | } |
---|
380 | else |
---|
381 | { |
---|
382 | *child_ = parent_->addAxis(); |
---|
383 | } |
---|
384 | CTimer::get("XIOS").suspend() ; |
---|
385 | } |
---|
386 | |
---|
387 | void cxios_xml_tree_add_domaintogrid |
---|
388 | (XGridPtr parent_, XDomainPtr * child_, const char * child_id, int child_id_size) |
---|
389 | { |
---|
390 | std::string child_id_str; |
---|
391 | CTimer::get("XIOS").resume() ; |
---|
392 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
393 | { |
---|
394 | *child_ = parent_->addDomain(child_id_str); |
---|
395 | } |
---|
396 | else |
---|
397 | { |
---|
398 | *child_ = parent_->addDomain(); |
---|
399 | } |
---|
400 | CTimer::get("XIOS").suspend() ; |
---|
401 | } |
---|
402 | |
---|
403 | void cxios_xml_tree_add_zoomdomaintodomain |
---|
404 | (XDomainPtr parent_, XZoomDomainPtr * child_, const char * child_id, int child_id_size) |
---|
405 | { |
---|
406 | std::string child_id_str; |
---|
407 | XTransformationDomainPtr tmpChild_; |
---|
408 | CTimer::get("XIOS").resume() ; |
---|
409 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
410 | { |
---|
411 | tmpChild_ = parent_->addTransformation(TRANS_ZOOM_DOMAIN, child_id_str); |
---|
412 | } |
---|
413 | else |
---|
414 | { |
---|
415 | tmpChild_ = parent_->addTransformation(TRANS_ZOOM_DOMAIN); |
---|
416 | } |
---|
417 | *child_ = static_cast<XZoomDomainPtr>(tmpChild_); |
---|
418 | CTimer::get("XIOS").suspend() ; |
---|
419 | } |
---|
420 | |
---|
421 | void cxios_xml_tree_add_interpolatedomaintodomain |
---|
422 | (XDomainPtr parent_, XInterpolateDomainPtr * child_, const char * child_id, int child_id_size) |
---|
423 | { |
---|
424 | std::string child_id_str; |
---|
425 | XTransformationDomainPtr tmpChild_; |
---|
426 | CTimer::get("XIOS").resume() ; |
---|
427 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
428 | { |
---|
429 | tmpChild_ = parent_->addTransformation(TRANS_INTERPOLATE_DOMAIN, child_id_str); |
---|
430 | } |
---|
431 | else |
---|
432 | { |
---|
433 | tmpChild_ = parent_->addTransformation(TRANS_INTERPOLATE_DOMAIN); |
---|
434 | } |
---|
435 | *child_ = static_cast<XInterpolateDomainPtr>(tmpChild_); |
---|
436 | CTimer::get("XIOS").suspend() ; |
---|
437 | } |
---|
438 | |
---|
439 | void cxios_xml_tree_add_generatedomaintodomain |
---|
440 | (XDomainPtr parent_, XGenerateRectilinearDomainPtr * child_, const char * child_id, int child_id_size) |
---|
441 | { |
---|
442 | std::string child_id_str; |
---|
443 | XTransformationDomainPtr tmpChild_; |
---|
444 | CTimer::get("XIOS").resume() ; |
---|
445 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
446 | { |
---|
447 | tmpChild_ = parent_->addTransformation(TRANS_GENERATE_RECTILINEAR_DOMAIN, child_id_str); |
---|
448 | } |
---|
449 | else |
---|
450 | { |
---|
451 | tmpChild_ = parent_->addTransformation(TRANS_GENERATE_RECTILINEAR_DOMAIN); |
---|
452 | } |
---|
453 | *child_ = static_cast<XGenerateRectilinearDomainPtr>(tmpChild_); |
---|
454 | CTimer::get("XIOS").suspend() ; |
---|
455 | } |
---|
456 | |
---|
457 | void cxios_xml_tree_add_zoomaxistoaxis |
---|
458 | (XAxisPtr parent_, XZoomAxisPtr * child_, const char * child_id, int child_id_size) |
---|
459 | { |
---|
460 | std::string child_id_str; |
---|
461 | XTransformationAxisPtr tmpChild_; |
---|
462 | CTimer::get("XIOS").resume() ; |
---|
463 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
464 | { |
---|
465 | tmpChild_ = parent_->addTransformation(TRANS_ZOOM_AXIS, child_id_str); |
---|
466 | } |
---|
467 | else |
---|
468 | { |
---|
469 | tmpChild_ = parent_->addTransformation(TRANS_ZOOM_AXIS); |
---|
470 | } |
---|
471 | *child_ = static_cast<XZoomAxisPtr>(tmpChild_); |
---|
472 | CTimer::get("XIOS").suspend() ; |
---|
473 | } |
---|
474 | |
---|
475 | void cxios_xml_tree_add_interpolateaxistoaxis |
---|
476 | (XAxisPtr parent_, XInterpolateAxisPtr * child_, const char * child_id, int child_id_size) |
---|
477 | { |
---|
478 | std::string child_id_str; |
---|
479 | XTransformationAxisPtr tmpChild_; |
---|
480 | CTimer::get("XIOS").resume() ; |
---|
481 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
482 | { |
---|
483 | tmpChild_ = parent_->addTransformation(TRANS_INTERPOLATE_AXIS, child_id_str); |
---|
484 | } |
---|
485 | else |
---|
486 | { |
---|
487 | tmpChild_ = parent_->addTransformation(TRANS_INTERPOLATE_AXIS); |
---|
488 | } |
---|
489 | *child_ = static_cast<XInterpolateAxisPtr>(tmpChild_); |
---|
490 | CTimer::get("XIOS").suspend() ; |
---|
491 | } |
---|
492 | |
---|
493 | void cxios_xml_tree_add_inverseaxistoaxis |
---|
494 | (XAxisPtr parent_, XInverseAxisPtr * child_, const char * child_id, int child_id_size) |
---|
495 | { |
---|
496 | std::string child_id_str; |
---|
497 | XTransformationAxisPtr tmpChild_; |
---|
498 | CTimer::get("XIOS").resume() ; |
---|
499 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
500 | { |
---|
501 | tmpChild_ = parent_->addTransformation(TRANS_INVERSE_AXIS, child_id_str); |
---|
502 | } |
---|
503 | else |
---|
504 | { |
---|
505 | tmpChild_ = parent_->addTransformation(TRANS_INVERSE_AXIS); |
---|
506 | } |
---|
507 | *child_ = static_cast<XInverseAxisPtr>(tmpChild_); |
---|
508 | CTimer::get("XIOS").suspend() ; |
---|
509 | } |
---|
510 | |
---|
511 | void cxios_xml_tree_add_reduceaxistoscalartoscalar |
---|
512 | (XScalarPtr parent_, XReduceAxisToScalarPtr * child_, const char * child_id, int child_id_size) |
---|
513 | { |
---|
514 | std::string child_id_str; |
---|
515 | XTransformationScalarPtr tmpChild_; |
---|
516 | CTimer::get("XIOS").resume() ; |
---|
517 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
518 | { |
---|
519 | tmpChild_ = parent_->addTransformation(TRANS_REDUCE_AXIS_TO_SCALAR, child_id_str); |
---|
520 | } |
---|
521 | else |
---|
522 | { |
---|
523 | tmpChild_ = parent_->addTransformation(TRANS_REDUCE_AXIS_TO_SCALAR); |
---|
524 | } |
---|
525 | *child_ = static_cast<XReduceAxisToScalarPtr>(tmpChild_); |
---|
526 | CTimer::get("XIOS").suspend() ; |
---|
527 | } |
---|
528 | |
---|
529 | // ----------------------- Affichage de l'arborescence ---------------------- |
---|
530 | |
---|
531 | // void cxios_xml_tree_show (const char * filename, int filename_size) |
---|
532 | // { |
---|
533 | // std::string filename_str; |
---|
534 | // try |
---|
535 | // { |
---|
536 | // if (cstr2string(filename, filename_size, filename_str)) |
---|
537 | // xios::CTreeManager::PrintTreeToFile(filename_str); |
---|
538 | // else |
---|
539 | // xios::CTreeManager::PrintTreeToStream(std::clog); |
---|
540 | // } |
---|
541 | // catch (xios::CException & exc) |
---|
542 | // { |
---|
543 | // std::cerr << exc.getMessage() << std::endl; |
---|
544 | // exit (EXIT_FAILURE); |
---|
545 | // } |
---|
546 | // } |
---|
547 | |
---|
548 | |
---|
549 | // ----------------------- Parsing de document xml -------------------------- |
---|
550 | |
---|
551 | // void cxios_xml_parse_file (const char * filename , int filename_size)// |
---|
552 | // { |
---|
553 | // std::string filename_str; |
---|
554 | // if (!cstr2string(filename, filename_size, filename_str)) return; |
---|
555 | // |
---|
556 | // try |
---|
557 | // { |
---|
558 | // xios::CTreeManager::ParseFile(filename_str); |
---|
559 | // } |
---|
560 | // catch (xios::CException & exc) |
---|
561 | // { |
---|
562 | // std::cerr << exc.getMessage() << std::endl; |
---|
563 | // exit (EXIT_FAILURE); |
---|
564 | // } |
---|
565 | // } |
---|
566 | |
---|
567 | // void cxios_xml_parse_string(const char * xmlcontent, int xmlcontent_size) |
---|
568 | // { |
---|
569 | // std::string xmlcontent_str; |
---|
570 | // if (!cstr2string(xmlcontent, xmlcontent_size, xmlcontent_str)) return; |
---|
571 | // |
---|
572 | // try |
---|
573 | // { |
---|
574 | // xios::CTreeManager::ParseString(xmlcontent_str); |
---|
575 | // } |
---|
576 | // catch (xios::CException & exc) |
---|
577 | // { |
---|
578 | // std::cerr << exc.getMessage() << std::endl; |
---|
579 | // exit (EXIT_FAILURE); |
---|
580 | // } |
---|
581 | // } |
---|
582 | |
---|
583 | |
---|
584 | |
---|
585 | } // extern "C" |
---|