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