[325] | 1 | /* ************************************************************************** * |
---|
[335] | 2 | * Copyright © IPSL/LSCE, xios, Avril 2010 - Octobre 2011 * |
---|
[325] | 3 | * ************************************************************************** */ |
---|
| 4 | |
---|
| 5 | #include <boost/multi_array.hpp> |
---|
| 6 | #include <boost/shared_ptr.hpp> |
---|
| 7 | |
---|
[591] | 8 | #include "xios.hpp" |
---|
[325] | 9 | |
---|
[352] | 10 | #include "attribute_template.hpp" |
---|
| 11 | #include "object_template.hpp" |
---|
| 12 | #include "group_template.hpp" |
---|
[325] | 13 | |
---|
| 14 | #include "icutil.hpp" |
---|
[347] | 15 | #include "timer.hpp" |
---|
[352] | 16 | #include "context.hpp" |
---|
[891] | 17 | #include "node_type.hpp" |
---|
[325] | 18 | |
---|
| 19 | extern "C" |
---|
| 20 | { |
---|
| 21 | // /////////////////////////////// Définitions ////////////////////////////// // |
---|
| 22 | |
---|
| 23 | // ----------------------- Redéfinition de types ---------------------------- |
---|
| 24 | |
---|
[345] | 25 | typedef xios::CContext * XContextPtr; |
---|
[325] | 26 | |
---|
[345] | 27 | typedef xios::CGrid * XGridPtr; |
---|
| 28 | typedef xios::CGridGroup * XGridGroupPtr; |
---|
[325] | 29 | |
---|
[345] | 30 | typedef xios::CFile * XFilePtr; |
---|
| 31 | typedef xios::CFileGroup * XFileGroupPtr; |
---|
[325] | 32 | |
---|
[345] | 33 | typedef xios::CField * XFieldPtr; |
---|
| 34 | typedef xios::CFieldGroup * XFieldGroupPtr; |
---|
[325] | 35 | |
---|
[345] | 36 | typedef xios::CDomain * XDomainPtr; |
---|
| 37 | typedef xios::CDomainGroup * XDomainGroupPtr; |
---|
[325] | 38 | |
---|
[891] | 39 | typedef xios::CScalar * XScalarPtr; |
---|
| 40 | typedef xios::CScalarGroup * XScalarGroupPtr; |
---|
| 41 | |
---|
[345] | 42 | typedef xios::CAxis * XAxisPtr; |
---|
| 43 | typedef xios::CAxisGroup * XAxisGroupPtr; |
---|
[509] | 44 | |
---|
[472] | 45 | typedef xios::CVariable * XVariablePtr; |
---|
| 46 | typedef xios::CVariableGroup * XVariableGroupPtr; |
---|
[509] | 47 | |
---|
[836] | 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 | |
---|
[891] | 58 | typedef xios::CTransformation<CScalar> * XTransformationScalarPtr; |
---|
| 59 | typedef xios::CReduceAxisToScalar * XReduceAxisToScalarPtr; |
---|
| 60 | |
---|
[325] | 61 | // ----------------------- Ajout d'enfant à un parent ----------------------- |
---|
[509] | 62 | |
---|
[325] | 63 | void cxios_xml_tree_add_field |
---|
| 64 | (XFieldGroupPtr parent_, XFieldPtr * child_, const char * child_id, int child_id_size) |
---|
| 65 | { |
---|
[509] | 66 | std::string child_id_str; |
---|
[347] | 67 | CTimer::get("XIOS").resume() ; |
---|
[325] | 68 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 69 | { |
---|
[347] | 70 | *child_ = parent_->createChild(child_id_str) ; |
---|
[325] | 71 | } |
---|
| 72 | else |
---|
| 73 | { |
---|
[347] | 74 | *child_ = parent_->createChild() ; |
---|
[325] | 75 | } |
---|
[347] | 76 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 77 | } |
---|
[509] | 78 | |
---|
[325] | 79 | void cxios_xml_tree_add_grid |
---|
| 80 | (XGridGroupPtr parent_, XGridPtr * child_, const char * child_id, int child_id_size) |
---|
| 81 | { |
---|
[509] | 82 | std::string child_id_str; |
---|
[347] | 83 | CTimer::get("XIOS").resume() ; |
---|
[325] | 84 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 85 | { |
---|
[347] | 86 | *child_ = parent_->createChild(child_id_str) ; |
---|
[325] | 87 | } |
---|
| 88 | else |
---|
| 89 | { |
---|
[347] | 90 | *child_ = parent_->createChild() ; |
---|
[325] | 91 | } |
---|
[347] | 92 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 93 | } |
---|
[509] | 94 | |
---|
[325] | 95 | void cxios_xml_tree_add_file |
---|
| 96 | (XFileGroupPtr parent_, XFilePtr * child_, const char * child_id, int child_id_size) |
---|
| 97 | { |
---|
[509] | 98 | std::string child_id_str; |
---|
[347] | 99 | CTimer::get("XIOS").resume() ; |
---|
[325] | 100 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 101 | { |
---|
[347] | 102 | *child_ = parent_->createChild(child_id_str) ; |
---|
[325] | 103 | } |
---|
| 104 | else |
---|
| 105 | { |
---|
[347] | 106 | *child_ = parent_->createChild() ; |
---|
[325] | 107 | } |
---|
[347] | 108 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 109 | } |
---|
[509] | 110 | |
---|
[325] | 111 | void cxios_xml_tree_add_axis |
---|
| 112 | (XAxisGroupPtr parent_, XAxisPtr * child_, const char * child_id, int child_id_size) |
---|
| 113 | { |
---|
[509] | 114 | std::string child_id_str; |
---|
[347] | 115 | CTimer::get("XIOS").resume() ; |
---|
[325] | 116 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 117 | { |
---|
[347] | 118 | *child_ = parent_->createChild(child_id_str) ; |
---|
[325] | 119 | } |
---|
| 120 | else |
---|
| 121 | { |
---|
[347] | 122 | *child_ = parent_->createChild() ; |
---|
[325] | 123 | } |
---|
[347] | 124 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 125 | } |
---|
[509] | 126 | |
---|
[891] | 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 | |
---|
[325] | 143 | void cxios_xml_tree_add_domain |
---|
| 144 | (XDomainGroupPtr parent_, XDomainPtr * child_, const char * child_id, int child_id_size) |
---|
| 145 | { |
---|
[347] | 146 | std::string child_id_str; |
---|
| 147 | CTimer::get("XIOS").resume() ; |
---|
[325] | 148 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 149 | { |
---|
[347] | 150 | *child_ = parent_->createChild(child_id_str) ; |
---|
[325] | 151 | } |
---|
| 152 | else |
---|
| 153 | { |
---|
[347] | 154 | *child_ = parent_->createChild() ; |
---|
[325] | 155 | } |
---|
[347] | 156 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 157 | } |
---|
[509] | 158 | |
---|
[325] | 159 | void cxios_xml_tree_add_fieldtofile |
---|
| 160 | (XFilePtr parent_, XFieldPtr * child_, const char * child_id, int child_id_size) |
---|
| 161 | { |
---|
[347] | 162 | std::string child_id_str; |
---|
| 163 | CTimer::get("XIOS").resume() ; |
---|
[509] | 164 | |
---|
[325] | 165 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 166 | { |
---|
[347] | 167 | *child_ = parent_->addField(child_id_str); |
---|
[325] | 168 | } |
---|
| 169 | else |
---|
| 170 | { |
---|
[347] | 171 | *child_ = parent_->addField(); |
---|
[325] | 172 | } |
---|
[347] | 173 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 174 | } |
---|
| 175 | |
---|
[472] | 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() ; |
---|
[509] | 181 | |
---|
[472] | 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 | } |
---|
[509] | 192 | |
---|
[472] | 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() ; |
---|
[509] | 198 | |
---|
[472] | 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() ; |
---|
[509] | 208 | } |
---|
[325] | 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 | { |
---|
[509] | 214 | std::string child_id_str; |
---|
[347] | 215 | CTimer::get("XIOS").resume() ; |
---|
[325] | 216 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 217 | { |
---|
[347] | 218 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
[325] | 219 | } |
---|
| 220 | else |
---|
| 221 | { |
---|
[347] | 222 | *child_ = parent_->createChildGroup() ; |
---|
[325] | 223 | } |
---|
[347] | 224 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 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; |
---|
[347] | 231 | CTimer::get("XIOS").resume() ; |
---|
[325] | 232 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 233 | { |
---|
[347] | 234 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
[325] | 235 | } |
---|
| 236 | else |
---|
| 237 | { |
---|
[347] | 238 | *child_ = parent_->createChildGroup() ; |
---|
[325] | 239 | } |
---|
[347] | 240 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 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; |
---|
[347] | 247 | CTimer::get("XIOS").resume() ; |
---|
[325] | 248 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 249 | { |
---|
[347] | 250 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
[325] | 251 | } |
---|
| 252 | else |
---|
| 253 | { |
---|
[347] | 254 | *child_ = parent_->createChildGroup() ; |
---|
[325] | 255 | } |
---|
[347] | 256 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 257 | } |
---|
| 258 | |
---|
[891] | 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 | |
---|
[325] | 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; |
---|
[347] | 279 | CTimer::get("XIOS").resume() ; |
---|
[325] | 280 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 281 | { |
---|
[347] | 282 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
[325] | 283 | } |
---|
| 284 | else |
---|
| 285 | { |
---|
[347] | 286 | *child_ = parent_->createChildGroup() ; |
---|
[325] | 287 | } |
---|
[347] | 288 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 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; |
---|
[347] | 295 | CTimer::get("XIOS").resume() ; |
---|
[325] | 296 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 297 | { |
---|
[347] | 298 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
[325] | 299 | } |
---|
| 300 | else |
---|
| 301 | { |
---|
[347] | 302 | *child_ = parent_->createChildGroup() ; |
---|
[325] | 303 | } |
---|
[347] | 304 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 305 | } |
---|
| 306 | |
---|
| 307 | void cxios_xml_tree_add_fieldgrouptofile |
---|
| 308 | (XFilePtr parent_, XFieldGroupPtr * child_, const char * child_id, int child_id_size) |
---|
| 309 | { |
---|
[509] | 310 | std::string child_id_str; |
---|
[347] | 311 | CTimer::get("XIOS").resume() ; |
---|
[325] | 312 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 313 | { |
---|
[347] | 314 | *child_ = parent_->addFieldGroup(child_id_str); |
---|
[325] | 315 | } |
---|
| 316 | else |
---|
| 317 | { |
---|
[347] | 318 | *child_ = parent_->addFieldGroup(); |
---|
[325] | 319 | } |
---|
[347] | 320 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 321 | } |
---|
[509] | 322 | |
---|
[472] | 323 | void cxios_xml_tree_add_variablegrouptofile |
---|
| 324 | (XFilePtr parent_, XVariableGroupPtr * child_, const char * child_id, int child_id_size) |
---|
| 325 | { |
---|
[509] | 326 | std::string child_id_str; |
---|
[472] | 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 | } |
---|
[509] | 338 | |
---|
[472] | 339 | void cxios_xml_tree_add_variablegrouptofield |
---|
| 340 | (XFieldPtr parent_, XVariableGroupPtr * child_, const char * child_id, int child_id_size) |
---|
| 341 | { |
---|
[509] | 342 | std::string child_id_str; |
---|
[472] | 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() ; |
---|
[509] | 353 | } |
---|
| 354 | |
---|
[891] | 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 | |
---|
[835] | 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 | } |
---|
[509] | 386 | |
---|
[835] | 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 | |
---|
[836] | 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 | |
---|
[891] | 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 | |
---|
[325] | 529 | // ----------------------- Affichage de l'arborescence ---------------------- |
---|
[509] | 530 | |
---|
| 531 | // void cxios_xml_tree_show (const char * filename, int filename_size) |
---|
[346] | 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 | // } |
---|
[509] | 547 | |
---|
| 548 | |
---|
[325] | 549 | // ----------------------- Parsing de document xml -------------------------- |
---|
[509] | 550 | |
---|
[346] | 551 | // void cxios_xml_parse_file (const char * filename , int filename_size)// |
---|
| 552 | // { |
---|
[509] | 553 | // std::string filename_str; |
---|
[346] | 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 | // } |
---|
[509] | 566 | |
---|
[346] | 567 | // void cxios_xml_parse_string(const char * xmlcontent, int xmlcontent_size) |
---|
| 568 | // { |
---|
[509] | 569 | // std::string xmlcontent_str; |
---|
[346] | 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 | // } |
---|
[325] | 582 | |
---|
| 583 | |
---|
[509] | 584 | |
---|
[325] | 585 | } // extern "C" |
---|