[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; |
---|
[934] | 52 | typedef xios::CComputeConnectivityDomain * XComputeConnectivityDomainPtr; |
---|
[836] | 53 | |
---|
| 54 | typedef xios::CTransformation<CAxis> * XTransformationAxisPtr; |
---|
| 55 | typedef xios::CZoomAxis * XZoomAxisPtr; |
---|
| 56 | typedef xios::CInterpolateAxis * XInterpolateAxisPtr; |
---|
| 57 | typedef xios::CInverseAxis * XInverseAxisPtr; |
---|
| 58 | |
---|
[891] | 59 | typedef xios::CTransformation<CScalar> * XTransformationScalarPtr; |
---|
| 60 | typedef xios::CReduceAxisToScalar * XReduceAxisToScalarPtr; |
---|
| 61 | |
---|
[325] | 62 | // ----------------------- Ajout d'enfant à un parent ----------------------- |
---|
[509] | 63 | |
---|
[325] | 64 | void cxios_xml_tree_add_field |
---|
| 65 | (XFieldGroupPtr parent_, XFieldPtr * child_, const char * child_id, int child_id_size) |
---|
| 66 | { |
---|
[509] | 67 | std::string child_id_str; |
---|
[347] | 68 | CTimer::get("XIOS").resume() ; |
---|
[325] | 69 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 70 | { |
---|
[347] | 71 | *child_ = parent_->createChild(child_id_str) ; |
---|
[325] | 72 | } |
---|
| 73 | else |
---|
| 74 | { |
---|
[347] | 75 | *child_ = parent_->createChild() ; |
---|
[325] | 76 | } |
---|
[347] | 77 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 78 | } |
---|
[509] | 79 | |
---|
[325] | 80 | void cxios_xml_tree_add_grid |
---|
| 81 | (XGridGroupPtr parent_, XGridPtr * child_, const char * child_id, int child_id_size) |
---|
| 82 | { |
---|
[509] | 83 | std::string child_id_str; |
---|
[347] | 84 | CTimer::get("XIOS").resume() ; |
---|
[325] | 85 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 86 | { |
---|
[347] | 87 | *child_ = parent_->createChild(child_id_str) ; |
---|
[325] | 88 | } |
---|
| 89 | else |
---|
| 90 | { |
---|
[347] | 91 | *child_ = parent_->createChild() ; |
---|
[325] | 92 | } |
---|
[347] | 93 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 94 | } |
---|
[509] | 95 | |
---|
[325] | 96 | void cxios_xml_tree_add_file |
---|
| 97 | (XFileGroupPtr parent_, XFilePtr * child_, const char * child_id, int child_id_size) |
---|
| 98 | { |
---|
[509] | 99 | std::string child_id_str; |
---|
[347] | 100 | CTimer::get("XIOS").resume() ; |
---|
[325] | 101 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 102 | { |
---|
[347] | 103 | *child_ = parent_->createChild(child_id_str) ; |
---|
[325] | 104 | } |
---|
| 105 | else |
---|
| 106 | { |
---|
[347] | 107 | *child_ = parent_->createChild() ; |
---|
[325] | 108 | } |
---|
[347] | 109 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 110 | } |
---|
[509] | 111 | |
---|
[325] | 112 | void cxios_xml_tree_add_axis |
---|
| 113 | (XAxisGroupPtr parent_, XAxisPtr * child_, const char * child_id, int child_id_size) |
---|
| 114 | { |
---|
[509] | 115 | std::string child_id_str; |
---|
[347] | 116 | CTimer::get("XIOS").resume() ; |
---|
[325] | 117 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 118 | { |
---|
[347] | 119 | *child_ = parent_->createChild(child_id_str) ; |
---|
[325] | 120 | } |
---|
| 121 | else |
---|
| 122 | { |
---|
[347] | 123 | *child_ = parent_->createChild() ; |
---|
[325] | 124 | } |
---|
[347] | 125 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 126 | } |
---|
[509] | 127 | |
---|
[891] | 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 | |
---|
[325] | 144 | void cxios_xml_tree_add_domain |
---|
| 145 | (XDomainGroupPtr parent_, XDomainPtr * child_, const char * child_id, int child_id_size) |
---|
| 146 | { |
---|
[347] | 147 | std::string child_id_str; |
---|
| 148 | CTimer::get("XIOS").resume() ; |
---|
[325] | 149 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 150 | { |
---|
[347] | 151 | *child_ = parent_->createChild(child_id_str) ; |
---|
[325] | 152 | } |
---|
| 153 | else |
---|
| 154 | { |
---|
[347] | 155 | *child_ = parent_->createChild() ; |
---|
[325] | 156 | } |
---|
[347] | 157 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 158 | } |
---|
[509] | 159 | |
---|
[325] | 160 | void cxios_xml_tree_add_fieldtofile |
---|
| 161 | (XFilePtr parent_, XFieldPtr * child_, const char * child_id, int child_id_size) |
---|
| 162 | { |
---|
[347] | 163 | std::string child_id_str; |
---|
| 164 | CTimer::get("XIOS").resume() ; |
---|
[509] | 165 | |
---|
[325] | 166 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 167 | { |
---|
[347] | 168 | *child_ = parent_->addField(child_id_str); |
---|
[325] | 169 | } |
---|
| 170 | else |
---|
| 171 | { |
---|
[347] | 172 | *child_ = parent_->addField(); |
---|
[325] | 173 | } |
---|
[347] | 174 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 175 | } |
---|
| 176 | |
---|
[472] | 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() ; |
---|
[509] | 182 | |
---|
[472] | 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 | } |
---|
[509] | 193 | |
---|
[472] | 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() ; |
---|
[509] | 199 | |
---|
[472] | 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() ; |
---|
[509] | 209 | } |
---|
[325] | 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 | { |
---|
[509] | 215 | std::string child_id_str; |
---|
[347] | 216 | CTimer::get("XIOS").resume() ; |
---|
[325] | 217 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 218 | { |
---|
[347] | 219 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
[325] | 220 | } |
---|
| 221 | else |
---|
| 222 | { |
---|
[347] | 223 | *child_ = parent_->createChildGroup() ; |
---|
[325] | 224 | } |
---|
[347] | 225 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 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; |
---|
[347] | 232 | CTimer::get("XIOS").resume() ; |
---|
[325] | 233 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 234 | { |
---|
[347] | 235 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
[325] | 236 | } |
---|
| 237 | else |
---|
| 238 | { |
---|
[347] | 239 | *child_ = parent_->createChildGroup() ; |
---|
[325] | 240 | } |
---|
[347] | 241 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 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; |
---|
[347] | 248 | CTimer::get("XIOS").resume() ; |
---|
[325] | 249 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 250 | { |
---|
[347] | 251 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
[325] | 252 | } |
---|
| 253 | else |
---|
| 254 | { |
---|
[347] | 255 | *child_ = parent_->createChildGroup() ; |
---|
[325] | 256 | } |
---|
[347] | 257 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 258 | } |
---|
| 259 | |
---|
[891] | 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 | |
---|
[325] | 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; |
---|
[347] | 280 | CTimer::get("XIOS").resume() ; |
---|
[325] | 281 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 282 | { |
---|
[347] | 283 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
[325] | 284 | } |
---|
| 285 | else |
---|
| 286 | { |
---|
[347] | 287 | *child_ = parent_->createChildGroup() ; |
---|
[325] | 288 | } |
---|
[347] | 289 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 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; |
---|
[347] | 296 | CTimer::get("XIOS").resume() ; |
---|
[325] | 297 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 298 | { |
---|
[347] | 299 | *child_ = parent_->createChildGroup(child_id_str) ; |
---|
[325] | 300 | } |
---|
| 301 | else |
---|
| 302 | { |
---|
[347] | 303 | *child_ = parent_->createChildGroup() ; |
---|
[325] | 304 | } |
---|
[347] | 305 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 306 | } |
---|
| 307 | |
---|
| 308 | void cxios_xml_tree_add_fieldgrouptofile |
---|
| 309 | (XFilePtr parent_, XFieldGroupPtr * child_, const char * child_id, int child_id_size) |
---|
| 310 | { |
---|
[509] | 311 | std::string child_id_str; |
---|
[347] | 312 | CTimer::get("XIOS").resume() ; |
---|
[325] | 313 | if (cstr2string(child_id, child_id_size, child_id_str)) |
---|
| 314 | { |
---|
[347] | 315 | *child_ = parent_->addFieldGroup(child_id_str); |
---|
[325] | 316 | } |
---|
| 317 | else |
---|
| 318 | { |
---|
[347] | 319 | *child_ = parent_->addFieldGroup(); |
---|
[325] | 320 | } |
---|
[347] | 321 | CTimer::get("XIOS").suspend() ; |
---|
[325] | 322 | } |
---|
[509] | 323 | |
---|
[472] | 324 | void cxios_xml_tree_add_variablegrouptofile |
---|
| 325 | (XFilePtr parent_, XVariableGroupPtr * child_, const char * child_id, int child_id_size) |
---|
| 326 | { |
---|
[509] | 327 | std::string child_id_str; |
---|
[472] | 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 | } |
---|
[509] | 339 | |
---|
[472] | 340 | void cxios_xml_tree_add_variablegrouptofield |
---|
| 341 | (XFieldPtr parent_, XVariableGroupPtr * child_, const char * child_id, int child_id_size) |
---|
| 342 | { |
---|
[509] | 343 | std::string child_id_str; |
---|
[472] | 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() ; |
---|
[509] | 354 | } |
---|
| 355 | |
---|
[891] | 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 | |
---|
[835] | 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 | } |
---|
[509] | 387 | |
---|
[835] | 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 | |
---|
[836] | 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 | |
---|
[934] | 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 | |
---|
[836] | 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 | |
---|
[891] | 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 | |
---|
[325] | 548 | // ----------------------- Affichage de l'arborescence ---------------------- |
---|
[509] | 549 | |
---|
| 550 | // void cxios_xml_tree_show (const char * filename, int filename_size) |
---|
[346] | 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 | // } |
---|
[509] | 566 | |
---|
| 567 | |
---|
[325] | 568 | // ----------------------- Parsing de document xml -------------------------- |
---|
[509] | 569 | |
---|
[346] | 570 | // void cxios_xml_parse_file (const char * filename , int filename_size)// |
---|
| 571 | // { |
---|
[509] | 572 | // std::string filename_str; |
---|
[346] | 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 | // } |
---|
[509] | 585 | |
---|
[346] | 586 | // void cxios_xml_parse_string(const char * xmlcontent, int xmlcontent_size) |
---|
| 587 | // { |
---|
[509] | 588 | // std::string xmlcontent_str; |
---|
[346] | 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 | // } |
---|
[325] | 601 | |
---|
| 602 | |
---|
[509] | 603 | |
---|
[325] | 604 | } // extern "C" |
---|