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