Ignore:
Timestamp:
02/03/14 14:16:20 (10 years ago)
Author:
ymipsl
Message:

Enhancement : user defined global and field attribute can be output in the netcdfcf file.
A variable child element inclosed into a file element will be output as a global file attribute.
A variable child element inclosed into a field element will be output as a field attribute.

+ variable fortran interface added

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/interface/c/icxml_tree.cpp

    r352 r472  
    2020#include "axis.hpp" 
    2121#include "domain.hpp" 
     22#include "variable.hpp" 
    2223 
    2324extern "C" 
     
    4344   typedef xios::CAxis      * XAxisPtr; 
    4445   typedef xios::CAxisGroup * XAxisGroupPtr; 
    45     
     46  
     47   typedef xios::CVariable      *  XVariablePtr; 
     48   typedef xios::CVariableGroup *  XVariableGroupPtr; 
     49   
    4650   // ----------------------- Ajout d'enfant à un parent ----------------------- 
    4751    
     
    155159   } 
    156160 
     161   void cxios_xml_tree_add_variabletofile 
     162      (XFilePtr parent_, XVariablePtr * child_, const char * child_id, int child_id_size) 
     163   { 
     164      std::string child_id_str; 
     165      CTimer::get("XIOS").resume() ; 
     166  
     167      if (cstr2string(child_id, child_id_size, child_id_str)) 
     168      { 
     169         *child_ = parent_->addVariable(child_id_str); 
     170         parent_->sendAddVariable(child_id_str) ; 
     171      } 
     172      else 
     173      { 
     174         *child_ = parent_->addVariable(); 
     175         parent_->sendAddVariable() ; 
     176      } 
     177      CTimer::get("XIOS").suspend() ; 
     178   } 
     179    
     180    void cxios_xml_tree_add_variabletofield 
     181      (XFieldPtr parent_, XVariablePtr * child_, const char * child_id, int child_id_size) 
     182   { 
     183      std::string child_id_str; 
     184      CTimer::get("XIOS").resume() ; 
     185  
     186      if (cstr2string(child_id, child_id_size, child_id_str)) 
     187      { 
     188         *child_ = parent_->addVariable(child_id_str); 
     189         parent_->sendAddVariable(child_id_str) ; 
     190      } 
     191      else 
     192      { 
     193         *child_ = parent_->addVariable(); 
     194         parent_->sendAddVariable() ; 
     195      } 
     196      CTimer::get("XIOS").suspend() ; 
     197   }   
    157198   // ----------------------- Ajout de groupe à un parent ---------------------- 
    158199 
     
    264305      CTimer::get("XIOS").suspend() ; 
    265306   } 
     307    
     308   void cxios_xml_tree_add_variablegrouptofile 
     309      (XFilePtr parent_, XVariableGroupPtr * 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_->addVariableGroup(child_id_str); 
     316         parent_->sendAddVariableGroup(child_id_str) ; 
     317      } 
     318      else 
     319      { 
     320         *child_ = parent_->addVariableGroup(); 
     321         parent_->sendAddVariableGroup() ; 
     322      } 
     323      CTimer::get("XIOS").suspend() ; 
     324   } 
     325    
     326   void cxios_xml_tree_add_variablegrouptofield 
     327      (XFieldPtr parent_, XVariableGroupPtr * child_, const char * child_id, int child_id_size) 
     328   { 
     329      std::string child_id_str;  
     330      CTimer::get("XIOS").resume() ; 
     331      if (cstr2string(child_id, child_id_size, child_id_str)) 
     332      { 
     333         *child_ = parent_->addVariableGroup(child_id_str); 
     334         parent_->sendAddVariableGroup(child_id_str) ; 
     335      } 
     336      else 
     337      { 
     338         *child_ = parent_->addVariableGroup(); 
     339         parent_->sendAddVariableGroup() ; 
     340      } 
     341      CTimer::get("XIOS").suspend() ; 
     342   }    
    266343    
    267344    
Note: See TracChangeset for help on using the changeset viewer.