Changeset 509 for XIOS


Ignore:
Timestamp:
11/13/14 15:09:14 (9 years ago)
Author:
mhnguyen
Message:

Implementing buffer size auto-detection for mode client -server

+) Process xml tree in client side then send all the information to server
+) Only information enabled fields in enabled files are sent to server
+) Some important change in structure of code which must be refactored

Test
+) On Curie
+) Only mode client-server
+) Passed for all tests

Location:
XIOS/trunk
Files:
43 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/inputs/COMPLETE/context_surface.xml

    r489 r509  
    77    <field id="field_A_srf_K" name="field_A_srf_K" field_ref="field_A_srf" long_name="Champ en degK" unit="degK"> field_A_srf + 273.15 </field> 
    88    <field id="field_A_srf_max" name="field_A_srf_max" field_ref="field_A_srf" long_name="maximum field_A_srf" operation="maximum" /> 
    9     <field id="field_D_srf" name="field_D_srf" long_name="Somme champ A et C" > field_A_srf + field_C_srf </field> 
     9    <field id="field_D_srf" name="field_D_srf" long_name="Somme champ A et C" > field_A_srf + field_A_srf_K </field> 
    1010     
    1111  </field_definition> 
     
    3131        <variable id="my_attribute1" type="string" >surf_att</variable> 
    3232        <variable id="my_attribute2" type="integer" >10</variable> 
    33         <variable id="my_attribute3" type="float" >6.8</variable> 
     33        <variable id="my_attribute3" type="float" >7.8</variable> 
    3434        <variable id="my_attribute4" type="double" >100.201</variable> 
    3535      </field> 
     36      <field field_ref="field_D_srf" /> 
    3637      <field field_ref="field_A_srf_K" /> 
    3738      <field field_ref="field_A_srf" name="field_A_srf_min" operation="minimum" /> 
  • XIOS/trunk/src/attribute_map.cpp

    r501 r509  
    1313      CAttributeMap::~CAttributeMap(void) 
    1414      { /* Ne rien faire de plus */ } 
    15        
     15 
    1616      ///-------------------------------------------------------------- 
    1717 
     
    3030 
    3131      bool CAttributeMap::hasAttribute(const StdString & key) const 
    32       {  
    33          return (this->find(key) != this->end());  
    34       } 
    35        
    36       //--------------------------------------------------------------- 
    37        
     32      { 
     33         return (this->find(key) != this->end()); 
     34      } 
     35 
     36      void CAttributeMap::clearAttribute(const StdString& key) 
     37      { 
     38        if (hasAttribute(key)) this->find(key)->second->reset(); 
     39      } 
     40 
     41      //--------------------------------------------------------------- 
     42 
    3843      void CAttributeMap::setAttribute(const StdString & key, CAttribute * const attr) 
    3944      { 
     
    4752//         this->find(key)->second->setAnyValue(attr->getAnyValue()); 
    4853      } 
    49        
    50       //--------------------------------------------------------------- 
    51        
     54 
     55      //--------------------------------------------------------------- 
     56 
    5257      CAttribute * CAttributeMap::operator[](const StdString & key) 
    5358      { 
     
    5762         return (SuperClassMap::operator[](key)); 
    5863      } 
    59        
    60       //--------------------------------------------------------------- 
    61        
     64 
     65      //--------------------------------------------------------------- 
     66 
    6267      StdString CAttributeMap::toString(void) const 
    6368      { 
    6469         typedef std::pair<StdString, CAttribute*> StdStrAttPair; 
    6570         StdOStringStream oss; 
    66           
     71 
    6772         SuperClassMap::const_iterator it = SuperClassMap::begin(), end = SuperClassMap::end(); 
    6873         for (; it != end; it++) 
     
    7479         return (oss.str()); 
    7580      } 
    76        
    77       //--------------------------------------------------------------- 
    78        
     81 
     82      //--------------------------------------------------------------- 
     83 
    7984      void CAttributeMap::fromString(const StdString & str) 
    80       {  
     85      { 
    8186         ERROR("CAttributeMap::fromString(const StdString & str)", 
    82                << "[ str = " << str << "] Not implemented yet !");  
    83       } 
    84        
     87               << "[ str = " << str << "] Not implemented yet !"); 
     88      } 
     89 
    8590      //--------------------------------------------------------------- 
    8691 
    8792      //StdOStream & operator << (StdOStream & os, const CAttributeMap & attributmap) 
    8893      //{ os << attributmap.toString(); return (os); } 
    89        
    90       //--------------------------------------------------------------- 
    91        
     94 
     95      //--------------------------------------------------------------- 
     96 
    9297      void CAttributeMap::setAttributes(const xml::THashAttributes & attributes) 
    9398      { 
     
    104109         } 
    105110      } 
    106        
    107       //--------------------------------------------------------------- 
    108        
     111 
     112      //--------------------------------------------------------------- 
     113 
     114      /*! 
     115      \brief Set attributes from a specific attributemap, considered parent. 
     116         The child attribute map will insert the attributes of its parent into its current attribute map. 
     117      The existing attributes can be filled with the values of the parent map if they are empty or 
     118      simply replaced by these values depending on choice of user. 
     119      \param [in] _parent Attribute map from which the current map gets attributes. 
     120      \param [in] apply Specify if current attribute map is replaced by the attributes of parent (false) 
     121                    or filled in in case of emptyp (true) 
     122      */ 
    109123      void CAttributeMap::setAttributes(const CAttributeMap * const _parent, bool apply) 
    110124      { 
    111125         typedef std::pair<StdString, CAttribute*> StdStrAttPair; 
    112           
     126 
    113127         SuperClassMap::const_iterator it = _parent->begin(), end = _parent->end(); 
    114128         for (; it != end; it++) 
     
    130144         } 
    131145      } 
    132        
    133       //--------------------------------------------------------------- 
    134 /*       
     146 
     147      //--------------------------------------------------------------- 
     148/* 
    135149      void CAttributeMap::toBinary(StdOStream & os) const 
    136150      { 
    137151         typedef std::pair<StdString, CAttribute*> StdStrAttPair; 
    138152         SuperClassMap::const_iterator it = this->begin(), end = this->end(); 
    139           
     153 
    140154         const StdSize nbatt = SuperClassMap::size(); 
    141155         os.write (reinterpret_cast<const char*>(&nbatt) , sizeof(StdSize)); 
    142           
     156 
    143157         for (; it != end; it++) 
    144158         { 
    145159            const StdString & key   = it->first; 
    146             const CAttribute* value = it->second;             
     160            const CAttribute* value = it->second; 
    147161            const StdSize size = key.size(); 
    148              
     162 
    149163            os.write (reinterpret_cast<const char*>(&size) , sizeof(StdSize)); 
    150164            os.write (key.data(), size * sizeof(char)); 
    151              
     165 
    152166            if (!value->isEmpty()) 
    153167            { 
     
    156170               value->toBinary(os); 
    157171            } 
    158             else  
     172            else 
    159173            { 
    160174               bool b = false; 
     
    163177         } 
    164178      } 
    165        
    166       //--------------------------------------------------------------- 
    167        
     179 
     180      //--------------------------------------------------------------- 
     181 
    168182      void CAttributeMap::fromBinary(StdIStream & is) 
    169183      { 
    170184         StdSize nbatt = 0; 
    171185         is.read (reinterpret_cast<char*>(&nbatt), sizeof(StdSize)); 
    172           
     186 
    173187         for (StdSize i = 0; i < nbatt; i++) 
    174188         { 
     
    178192            StdString key(size, ' '); 
    179193            is.read (const_cast<char *>(key.data()), size * sizeof(char)); 
    180              
     194 
    181195            if (!this->hasAttribute(key)) 
    182196               ERROR("CAttributeMap::fromBinary(StdIStream & is)", 
    183197                     << "[ key = " << key << "] key not found !"); 
    184                                          
     198 
    185199            is.read (reinterpret_cast<char*>(&hasValue), sizeof(bool)); 
    186              
    187             if (hasValue)           
     200 
     201            if (hasValue) 
    188202               this->operator[](key)->fromBinary(is); 
    189203         } 
    190204      } 
    191  */      
     205 */ 
    192206      void CAttributeMap::generateCInterface(ostream& oss, const string& className) 
    193207      { 
     
    208222           it->second->generateFortran2003Interface(oss,className) ; 
    209223           it->second->generateFortran2003InterfaceIsDefined(oss,className) ; 
    210            
     224 
    211225           oss<<iendl<<iendl ; 
    212226         } 
    213       }       
    214   
     227      } 
     228 
    215229      ///-------------------------------------------------------------- 
    216230 
     
    221235         SuperClassMap::const_iterator it ; 
    222236         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    223           
    224          oss2=new ostringstream ; 
    225           
    226          *oss2<<"( "<<className<<"_hdl"  ; 
    227           
    228          for ( it=begin ; it != end; it++)  
     237 
     238         oss2=new ostringstream ; 
     239 
     240         *oss2<<"( "<<className<<"_hdl"  ; 
     241 
     242         for ( it=begin ; it != end; it++) 
    229243         { 
    230244           *oss2<<", "<<it->second->getName()<<"_" ; 
    231            if (oss2->str().size()>90)  
    232            { 
    233              oss<<oss2->str()<<"  &"<<iendl ; 
    234              delete oss2 ; 
    235              oss2=new ostringstream ; 
    236            } 
    237          } 
    238          *oss2<<" )" ; 
    239          oss<<oss2->str()<<iendl ; 
    240          oss<<iendl ; 
    241          delete oss2 ;  
    242           
     245           if (oss2->str().size()>90) 
     246           { 
     247             oss<<oss2->str()<<"  &"<<iendl ; 
     248             delete oss2 ; 
     249             oss2=new ostringstream ; 
     250           } 
     251         } 
     252         *oss2<<" )" ; 
     253         oss<<oss2->str()<<iendl ; 
     254         oss<<iendl ; 
     255         delete oss2 ; 
     256 
    243257         oss<<"IMPLICIT NONE"<<iendl++ ; 
    244258         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 
    245           
     259 
    246260         for (it=begin; it != end; it++) 
    247261         { 
    248262           it->second->generateFortranInterfaceDeclaration_(oss,className) ; 
    249263         } 
    250           
    251          oss<<iendl ; 
    252           
     264 
     265         oss<<iendl ; 
     266 
    253267         for (it=begin; it != end; it++) 
    254268         { 
     
    256270           oss<<iendl ; 
    257271         } 
    258           
     272 
    259273         oss<<iendl--<<iendl-- ; 
    260274         oss<<"END SUBROUTINE xios(set_"<<className<<"_attr_hdl_)"<<iendl ; 
    261           
    262       }       
     275 
     276      } 
    263277 
    264278      void CAttributeMap::generateFortranInterfaceGet_hdl_(ostream& oss, const string& className) 
     
    268282         SuperClassMap::const_iterator it ; 
    269283         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    270           
    271          oss2=new ostringstream ; 
    272           
    273          *oss2<<"( "<<className<<"_hdl"  ; 
    274           
    275          for ( it=begin ; it != end; it++)  
     284 
     285         oss2=new ostringstream ; 
     286 
     287         *oss2<<"( "<<className<<"_hdl"  ; 
     288 
     289         for ( it=begin ; it != end; it++) 
    276290         { 
    277291           *oss2<<", "<<it->second->getName()<<"_" ; 
    278            if (oss2->str().size()>90)  
    279            { 
    280              oss<<oss2->str()<<"  &"<<iendl ; 
    281              delete oss2 ; 
    282              oss2=new ostringstream ; 
    283            } 
    284          } 
    285          *oss2<<" )" ; 
    286          oss<<oss2->str()<<iendl ; 
    287          oss<<iendl ; 
    288          delete oss2 ;  
    289           
     292           if (oss2->str().size()>90) 
     293           { 
     294             oss<<oss2->str()<<"  &"<<iendl ; 
     295             delete oss2 ; 
     296             oss2=new ostringstream ; 
     297           } 
     298         } 
     299         *oss2<<" )" ; 
     300         oss<<oss2->str()<<iendl ; 
     301         oss<<iendl ; 
     302         delete oss2 ; 
     303 
    290304         oss<<"IMPLICIT NONE"<<iendl++ ; 
    291305         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 
    292           
     306 
    293307         for (it=begin; it != end; it++) 
    294308         { 
    295309           it->second->generateFortranInterfaceGetDeclaration_(oss,className) ; 
    296310         } 
    297           
    298          oss<<iendl ; 
    299           
     311 
     312         oss<<iendl ; 
     313 
    300314         for (it=begin; it != end; it++) 
    301315         { 
     
    303317           oss<<iendl ; 
    304318         } 
    305           
     319 
    306320         oss<<iendl--<<iendl-- ; 
    307321         oss<<"END SUBROUTINE xios(get_"<<className<<"_attr_hdl_)"<<iendl ; 
    308           
    309       }      
    310        
     322 
     323      } 
     324 
    311325 
    312326      void CAttributeMap::generateFortranInterfaceIsDefined_hdl_(ostream& oss, const string& className) 
     
    316330         SuperClassMap::const_iterator it ; 
    317331         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    318           
    319          oss2=new ostringstream ; 
    320           
    321          *oss2<<"( "<<className<<"_hdl"  ; 
    322           
    323          for ( it=begin ; it != end; it++)  
     332 
     333         oss2=new ostringstream ; 
     334 
     335         *oss2<<"( "<<className<<"_hdl"  ; 
     336 
     337         for ( it=begin ; it != end; it++) 
    324338         { 
    325339           *oss2<<", "<<it->second->getName()<<"_" ; 
    326            if (oss2->str().size()>90)  
    327            { 
    328              oss<<oss2->str()<<"  &"<<iendl ; 
    329              delete oss2 ; 
    330              oss2=new ostringstream ; 
    331            } 
    332          } 
    333          *oss2<<" )" ; 
    334          oss<<oss2->str()<<iendl ; 
    335          oss<<iendl ; 
    336          delete oss2 ;  
    337           
     340           if (oss2->str().size()>90) 
     341           { 
     342             oss<<oss2->str()<<"  &"<<iendl ; 
     343             delete oss2 ; 
     344             oss2=new ostringstream ; 
     345           } 
     346         } 
     347         *oss2<<" )" ; 
     348         oss<<oss2->str()<<iendl ; 
     349         oss<<iendl ; 
     350         delete oss2 ; 
     351 
    338352         oss<<"IMPLICIT NONE"<<iendl++ ; 
    339353         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 
    340           
     354 
    341355         for (it=begin; it != end; it++) 
    342356         { 
    343357           it->second->generateFortranInterfaceIsDefinedDeclaration_(oss,className) ; 
    344358         } 
    345           
    346          oss<<iendl ; 
    347           
     359 
     360         oss<<iendl ; 
     361 
    348362         for (it=begin; it != end; it++) 
    349363         { 
     
    351365           oss<<iendl ; 
    352366         } 
    353           
     367 
    354368         oss<<iendl--<<iendl-- ; 
    355369         oss<<"END SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl_)"<<iendl ; 
    356           
    357       }       
    358         
     370 
     371      } 
     372 
    359373 
    360374      void CAttributeMap::generateFortranInterface_hdl(ostream& oss, const string& className) 
     
    364378         SuperClassMap::const_iterator it ; 
    365379         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    366           
    367          oss2=new ostringstream ; 
    368          *oss2<<"( "<<className<<"_hdl"  ; 
    369          for ( it=begin ; it != end; it++)  
    370          { 
    371            *oss2<<", "<<it->second->getName() ; 
    372            if (oss2->str().size()>90)  
    373            { 
    374              oss<<oss2->str()<<"  &"<<iendl ; 
    375              delete oss2 ; 
    376              oss2=new ostringstream ; 
    377            } 
    378          } 
    379          *oss2<<" )" ; 
    380          oss<<oss2->str()<<iendl ; 
    381          oss<<iendl ; 
    382          delete oss2 ;  
    383          oss2=new ostringstream ; 
    384           
     380 
     381         oss2=new ostringstream ; 
     382         *oss2<<"( "<<className<<"_hdl"  ; 
     383         for ( it=begin ; it != end; it++) 
     384         { 
     385           *oss2<<", "<<it->second->getName() ; 
     386           if (oss2->str().size()>90) 
     387           { 
     388             oss<<oss2->str()<<"  &"<<iendl ; 
     389             delete oss2 ; 
     390             oss2=new ostringstream ; 
     391           } 
     392         } 
     393         *oss2<<" )" ; 
     394         oss<<oss2->str()<<iendl ; 
     395         oss<<iendl ; 
     396         delete oss2 ; 
     397         oss2=new ostringstream ; 
     398 
    385399         oss<<"IMPLICIT NONE"<<iendl++ ; 
    386400         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 
    387           
     401 
    388402         for (it=begin; it != end; it++) 
    389403         { 
    390404           it->second->generateFortranInterfaceDeclaration(oss,className) ; 
    391405         } 
    392           
    393          oss<<iendl ; 
    394           
     406 
     407         oss<<iendl ; 
     408 
    395409         oss<<"CALL xios(set_"<<className<<"_attr_hdl_)  &"<<iendl ; 
    396           
    397          *oss2<<"( "<<className<<"_hdl"  ; 
    398          for ( it=begin ; it != end; it++)  
    399          { 
    400            *oss2<<", "<<it->second->getName() ; 
    401            if (oss2->str().size()>90)  
     410 
     411         *oss2<<"( "<<className<<"_hdl"  ; 
     412         for ( it=begin ; it != end; it++) 
     413         { 
     414           *oss2<<", "<<it->second->getName() ; 
     415           if (oss2->str().size()>90) 
    402416           { 
    403417             oss<<oss2->str()<<"  &"<<iendl ; 
     
    408422         *oss2<<" )" ; 
    409423         oss<<oss2->str() ; 
    410          delete oss2 ;  
    411           
     424         delete oss2 ; 
     425 
    412426         oss<<iendl--<<iendl-- ; 
    413427         oss<<"END SUBROUTINE xios(set_"<<className<<"_attr_hdl)"<<iendl ; 
    414       }       
    415        
    416   
     428      } 
     429 
     430 
    417431      void CAttributeMap::generateFortranInterfaceGet_hdl(ostream& oss, const string& className) 
    418432      { 
     
    421435         SuperClassMap::const_iterator it ; 
    422436         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    423           
    424          oss2=new ostringstream ; 
    425          *oss2<<"( "<<className<<"_hdl"  ; 
    426          for ( it=begin ; it != end; it++)  
    427          { 
    428            *oss2<<", "<<it->second->getName() ; 
    429            if (oss2->str().size()>90)  
    430            { 
    431              oss<<oss2->str()<<"  &"<<iendl ; 
    432              delete oss2 ; 
    433              oss2=new ostringstream ; 
    434            } 
    435          } 
    436          *oss2<<" )" ; 
    437          oss<<oss2->str()<<iendl ; 
    438          oss<<iendl ; 
    439          delete oss2 ;  
    440          oss2=new ostringstream ; 
    441           
     437 
     438         oss2=new ostringstream ; 
     439         *oss2<<"( "<<className<<"_hdl"  ; 
     440         for ( it=begin ; it != end; it++) 
     441         { 
     442           *oss2<<", "<<it->second->getName() ; 
     443           if (oss2->str().size()>90) 
     444           { 
     445             oss<<oss2->str()<<"  &"<<iendl ; 
     446             delete oss2 ; 
     447             oss2=new ostringstream ; 
     448           } 
     449         } 
     450         *oss2<<" )" ; 
     451         oss<<oss2->str()<<iendl ; 
     452         oss<<iendl ; 
     453         delete oss2 ; 
     454         oss2=new ostringstream ; 
     455 
    442456         oss<<"IMPLICIT NONE"<<iendl++ ; 
    443457         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 
    444           
     458 
    445459         for (it=begin; it != end; it++) 
    446460         { 
    447461           it->second->generateFortranInterfaceGetDeclaration(oss,className) ; 
    448462         } 
    449           
    450          oss<<iendl ; 
    451           
     463 
     464         oss<<iendl ; 
     465 
    452466         oss<<"CALL xios(get_"<<className<<"_attr_hdl_)  &"<<iendl ; 
    453           
    454          *oss2<<"( "<<className<<"_hdl"  ; 
    455          for ( it=begin ; it != end; it++)  
    456          { 
    457            *oss2<<", "<<it->second->getName() ; 
    458            if (oss2->str().size()>90)  
     467 
     468         *oss2<<"( "<<className<<"_hdl"  ; 
     469         for ( it=begin ; it != end; it++) 
     470         { 
     471           *oss2<<", "<<it->second->getName() ; 
     472           if (oss2->str().size()>90) 
    459473           { 
    460474             oss<<oss2->str()<<"  &"<<iendl ; 
     
    465479         *oss2<<" )" ; 
    466480         oss<<oss2->str() ; 
    467          delete oss2 ;  
    468           
     481         delete oss2 ; 
     482 
    469483         oss<<iendl--<<iendl-- ; 
    470484         oss<<"END SUBROUTINE xios(get_"<<className<<"_attr_hdl)"<<iendl ; 
    471       }       
     485      } 
    472486 
    473487 
     
    478492         SuperClassMap::const_iterator it ; 
    479493         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    480           
    481          oss2=new ostringstream ; 
    482          *oss2<<"( "<<className<<"_hdl"  ; 
    483          for ( it=begin ; it != end; it++)  
    484          { 
    485            *oss2<<", "<<it->second->getName() ; 
    486            if (oss2->str().size()>90)  
    487            { 
    488              oss<<oss2->str()<<"  &"<<iendl ; 
    489              delete oss2 ; 
    490              oss2=new ostringstream ; 
    491            } 
    492          } 
    493          *oss2<<" )" ; 
    494          oss<<oss2->str()<<iendl ; 
    495          oss<<iendl ; 
    496          delete oss2 ;  
    497          oss2=new ostringstream ; 
    498           
     494 
     495         oss2=new ostringstream ; 
     496         *oss2<<"( "<<className<<"_hdl"  ; 
     497         for ( it=begin ; it != end; it++) 
     498         { 
     499           *oss2<<", "<<it->second->getName() ; 
     500           if (oss2->str().size()>90) 
     501           { 
     502             oss<<oss2->str()<<"  &"<<iendl ; 
     503             delete oss2 ; 
     504             oss2=new ostringstream ; 
     505           } 
     506         } 
     507         *oss2<<" )" ; 
     508         oss<<oss2->str()<<iendl ; 
     509         oss<<iendl ; 
     510         delete oss2 ; 
     511         oss2=new ostringstream ; 
     512 
    499513         oss<<"IMPLICIT NONE"<<iendl++ ; 
    500514         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 
    501           
     515 
    502516         for (it=begin; it != end; it++) 
    503517         { 
    504518           it->second->generateFortranInterfaceIsDefinedDeclaration(oss,className) ; 
    505519         } 
    506           
    507          oss<<iendl ; 
    508           
     520 
     521         oss<<iendl ; 
     522 
    509523         oss<<"CALL xios(is_defined_"<<className<<"_attr_hdl_)  &"<<iendl ; 
    510           
    511          *oss2<<"( "<<className<<"_hdl"  ; 
    512          for ( it=begin ; it != end; it++)  
    513          { 
    514            *oss2<<", "<<it->second->getName() ; 
    515            if (oss2->str().size()>90)  
     524 
     525         *oss2<<"( "<<className<<"_hdl"  ; 
     526         for ( it=begin ; it != end; it++) 
     527         { 
     528           *oss2<<", "<<it->second->getName() ; 
     529           if (oss2->str().size()>90) 
    516530           { 
    517531             oss<<oss2->str()<<"  &"<<iendl ; 
     
    522536         *oss2<<" )" ; 
    523537         oss<<oss2->str() ; 
    524          delete oss2 ;  
    525           
     538         delete oss2 ; 
     539 
    526540         oss<<iendl--<<iendl-- ; 
    527541         oss<<"END SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl)"<<iendl ; 
    528       }       
    529  
    530        
     542      } 
     543 
     544 
    531545      void CAttributeMap::generateFortranInterface_id(ostream& oss, const string& className) 
    532546      { 
     
    535549         SuperClassMap::const_iterator it ; 
    536550         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    537           
     551 
    538552         oss2=new ostringstream ; 
    539553         *oss2<<"( "<<className<<"_id"  ; 
    540          for ( it=begin ; it != end; it++)  
    541          { 
    542            *oss2<<", "<<it->second->getName() ; 
    543            if (oss2->str().size()>90)  
    544            { 
    545              oss<<oss2->str()<<"  &"<<iendl ; 
    546              delete oss2 ; 
    547              oss2=new ostringstream ; 
    548            } 
    549          } 
    550          *oss2<<" )" ; 
    551          oss<<oss2->str()<<iendl ; 
    552          oss<<iendl ; 
    553          delete oss2 ;  
    554          oss2=new ostringstream ; 
    555           
     554         for ( it=begin ; it != end; it++) 
     555         { 
     556           *oss2<<", "<<it->second->getName() ; 
     557           if (oss2->str().size()>90) 
     558           { 
     559             oss<<oss2->str()<<"  &"<<iendl ; 
     560             delete oss2 ; 
     561             oss2=new ostringstream ; 
     562           } 
     563         } 
     564         *oss2<<" )" ; 
     565         oss<<oss2->str()<<iendl ; 
     566         oss<<iendl ; 
     567         delete oss2 ; 
     568         oss2=new ostringstream ; 
     569 
    556570         oss<<"IMPLICIT NONE"<<iendl++ ; 
    557571 
    558572         oss<<"TYPE(txios("<<className<<"))  :: "<<className<<"_hdl"<<iendl ; 
    559573         oss<<"CHARACTER(LEN=*), INTENT(IN) ::"<<className<<"_id"<<iendl ; 
    560           
     574 
    561575         for (it=begin; it != end; it++) 
    562576         { 
    563577           it->second->generateFortranInterfaceDeclaration(oss,className) ; 
    564578         } 
    565           
    566          oss<<iendl ; 
    567          oss<<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl ;  
     579 
     580         oss<<iendl ; 
     581         oss<<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl ; 
    568582         oss<<"CALL xios(set_"<<className<<"_attr_hdl_)   &"<<iendl ; 
    569583         *oss2<<"( "<<className<<"_hdl"  ; 
    570          for ( it=begin ; it != end; it++)  
    571          { 
    572            *oss2<<", "<<it->second->getName() ; 
    573            if (oss2->str().size()>90)  
     584         for ( it=begin ; it != end; it++) 
     585         { 
     586           *oss2<<", "<<it->second->getName() ; 
     587           if (oss2->str().size()>90) 
    574588           { 
    575589             oss<<oss2->str()<<"  &"<<iendl ; 
     
    580594         *oss2<<" )" ; 
    581595         oss<<oss2->str() ; 
    582          delete oss2 ;  
    583           
     596         delete oss2 ; 
     597 
    584598         oss<<iendl--<<iendl-- ; 
    585599         oss<<"END SUBROUTINE xios(set_"<<className<<"_attr)"<<iendl ; 
    586           
    587       }       
    588        
     600 
     601      } 
     602 
    589603      void CAttributeMap::generateFortranInterfaceGet_id(ostream& oss, const string& className) 
    590604      { 
     
    593607         SuperClassMap::const_iterator it ; 
    594608         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    595           
     609 
    596610         oss2=new ostringstream ; 
    597611         *oss2<<"( "<<className<<"_id"  ; 
    598          for ( it=begin ; it != end; it++)  
    599          { 
    600            *oss2<<", "<<it->second->getName() ; 
    601            if (oss2->str().size()>90)  
    602            { 
    603              oss<<oss2->str()<<"  &"<<iendl ; 
    604              delete oss2 ; 
    605              oss2=new ostringstream ; 
    606            } 
    607          } 
    608          *oss2<<" )" ; 
    609          oss<<oss2->str()<<iendl ; 
    610          oss<<iendl ; 
    611          delete oss2 ;  
    612          oss2=new ostringstream ; 
    613           
     612         for ( it=begin ; it != end; it++) 
     613         { 
     614           *oss2<<", "<<it->second->getName() ; 
     615           if (oss2->str().size()>90) 
     616           { 
     617             oss<<oss2->str()<<"  &"<<iendl ; 
     618             delete oss2 ; 
     619             oss2=new ostringstream ; 
     620           } 
     621         } 
     622         *oss2<<" )" ; 
     623         oss<<oss2->str()<<iendl ; 
     624         oss<<iendl ; 
     625         delete oss2 ; 
     626         oss2=new ostringstream ; 
     627 
    614628         oss<<"IMPLICIT NONE"<<iendl++ ; 
    615629 
    616630         oss<<"TYPE(txios("<<className<<"))  :: "<<className<<"_hdl"<<iendl ; 
    617631         oss<<"CHARACTER(LEN=*), INTENT(IN) ::"<<className<<"_id"<<iendl ; 
    618           
     632 
    619633         for (it=begin; it != end; it++) 
    620634         { 
    621635           it->second->generateFortranInterfaceGetDeclaration(oss,className) ; 
    622636         } 
    623           
    624          oss<<iendl ; 
    625          oss<<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl ;  
     637 
     638         oss<<iendl ; 
     639         oss<<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl ; 
    626640         oss<<"CALL xios(get_"<<className<<"_attr_hdl_)   &"<<iendl ; 
    627641         *oss2<<"( "<<className<<"_hdl"  ; 
    628          for ( it=begin ; it != end; it++)  
    629          { 
    630            *oss2<<", "<<it->second->getName() ; 
    631            if (oss2->str().size()>90)  
     642         for ( it=begin ; it != end; it++) 
     643         { 
     644           *oss2<<", "<<it->second->getName() ; 
     645           if (oss2->str().size()>90) 
    632646           { 
    633647             oss<<oss2->str()<<"  &"<<iendl ; 
     
    638652         *oss2<<" )" ; 
    639653         oss<<oss2->str() ; 
    640          delete oss2 ;  
    641           
     654         delete oss2 ; 
     655 
    642656         oss<<iendl--<<iendl-- ; 
    643657         oss<<"END SUBROUTINE xios(get_"<<className<<"_attr)"<<iendl ; 
    644           
    645       }       
    646        
     658 
     659      } 
     660 
    647661      void CAttributeMap::generateFortranInterfaceIsDefined_id(ostream& oss, const string& className) 
    648662      { 
     
    651665         SuperClassMap::const_iterator it ; 
    652666         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 
    653           
     667 
    654668         oss2=new ostringstream ; 
    655669         *oss2<<"( "<<className<<"_id"  ; 
    656          for ( it=begin ; it != end; it++)  
    657          { 
    658            *oss2<<", "<<it->second->getName() ; 
    659            if (oss2->str().size()>90)  
    660            { 
    661              oss<<oss2->str()<<"  &"<<iendl ; 
    662              delete oss2 ; 
    663              oss2=new ostringstream ; 
    664            } 
    665          } 
    666          *oss2<<" )" ; 
    667          oss<<oss2->str()<<iendl ; 
    668          oss<<iendl ; 
    669          delete oss2 ;  
    670          oss2=new ostringstream ; 
    671           
     670         for ( it=begin ; it != end; it++) 
     671         { 
     672           *oss2<<", "<<it->second->getName() ; 
     673           if (oss2->str().size()>90) 
     674           { 
     675             oss<<oss2->str()<<"  &"<<iendl ; 
     676             delete oss2 ; 
     677             oss2=new ostringstream ; 
     678           } 
     679         } 
     680         *oss2<<" )" ; 
     681         oss<<oss2->str()<<iendl ; 
     682         oss<<iendl ; 
     683         delete oss2 ; 
     684         oss2=new ostringstream ; 
     685 
    672686         oss<<"IMPLICIT NONE"<<iendl++ ; 
    673687 
    674688         oss<<"TYPE(txios("<<className<<"))  :: "<<className<<"_hdl"<<iendl ; 
    675689         oss<<"CHARACTER(LEN=*), INTENT(IN) ::"<<className<<"_id"<<iendl ; 
    676           
     690 
    677691         for (it=begin; it != end; it++) 
    678692         { 
    679693           it->second->generateFortranInterfaceIsDefinedDeclaration(oss,className) ; 
    680694         } 
    681           
    682          oss<<iendl ; 
    683          oss<<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl ;  
     695 
     696         oss<<iendl ; 
     697         oss<<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl ; 
    684698         oss<<"CALL xios(is_defined_"<<className<<"_attr_hdl_)   &"<<iendl ; 
    685699         *oss2<<"( "<<className<<"_hdl"  ; 
    686          for ( it=begin ; it != end; it++)  
    687          { 
    688            *oss2<<", "<<it->second->getName() ; 
    689            if (oss2->str().size()>90)  
     700         for ( it=begin ; it != end; it++) 
     701         { 
     702           *oss2<<", "<<it->second->getName() ; 
     703           if (oss2->str().size()>90) 
    690704           { 
    691705             oss<<oss2->str()<<"  &"<<iendl ; 
     
    696710         *oss2<<" )" ; 
    697711         oss<<oss2->str() ; 
    698          delete oss2 ;  
    699           
     712         delete oss2 ; 
     713 
    700714         oss<<iendl--<<iendl-- ; 
    701715         oss<<"END SUBROUTINE xios(is_defined_"<<className<<"_attr)"<<iendl ; 
    702           
    703       }       
     716 
     717      } 
    704718      ///-------------------------------------------------------------- 
    705    
     719 
    706720 
    707721} // namespace xmlioser 
  • XIOS/trunk/src/attribute_map.hpp

    r501 r509  
    3333            void clearAllAttributes(void); 
    3434 
     35            void clearAttribute(const StdString& key); 
     36 
    3537            /// Destructeur /// 
    3638            virtual ~CAttributeMap(void); 
     
    4345            virtual StdString toString(void) const; 
    4446            virtual void fromString(const StdString & str); 
    45              
     47 
    4648//            virtual void toBinary  (StdOStream & os) const; 
    4749//            virtual void fromBinary(StdIStream & is); 
  • XIOS/trunk/src/buffer_client.cpp

    r501 r509  
    1010namespace xios 
    1111{ 
    12   
     12 
    1313  size_t maxRequestSize=0 ; 
    14    
    15   CClientBuffer::CClientBuffer(MPI_Comm interComm_,int serverRank_) 
     14 
     15  CClientBuffer::CClientBuffer(MPI_Comm interComm_,int serverRank_, StdSize bfSize) 
    1616  { 
    17     bufferSizeByServer=CXios::bufferSize ; 
     17    bufferSizeByServer=bfSize; //CXios::bufferSize ; 
    1818    info(10)<<"bufferSizeByServer "<<bufferSizeByServer<<endl ; 
    1919    interComm=interComm_ ; 
    2020    serverRank=serverRank_ ; 
    21     bufferSize=bufferSizeByServer/2 ; 
     21    bufferSize=bufferSizeByServer/2; //2 ; 
    2222    buffer[0]=new char[bufferSize] ; // transform it with MPI_ALLOC_MEM later 
    2323    buffer[1]=new char[bufferSize] ; 
     
    2727    retBuffer=new CBufferOut(buffer[current],bufferSize) ; 
    2828  } 
    29    
     29 
    3030  CClientBuffer::~CClientBuffer() 
    3131  { 
     
    3434   delete retBuffer ; 
    3535  } 
    36    
     36 
    3737  int CClientBuffer::remain(void) 
    3838  { 
    3939    return bufferSize-count ; 
    4040  } 
    41    
     41 
    4242  bool CClientBuffer::isBufferFree(int size) 
    4343  { 
    4444    if (size>maxRequestSize) maxRequestSize=size ; 
    45      
     45 
    4646    if (size>bufferSize) ERROR("CClientBuffer::hasSpace(int size)", 
    4747                               <<"request size is too big for buffer, increase buffer client size"<<endl 
    4848                               <<"Current buffer_size : "<<CXios::bufferSize<<endl 
    4949                               <<"buffer_size must be > "<<size*2<<endl) 
    50   
     50 
    5151    if (size<=remain()) return true ; 
    5252    else return false ; 
    5353  } 
    54      
    55    
     54 
     55 
    5656  CBufferOut*  CClientBuffer::getBuffer(int size) 
    5757  { 
     
    6868       return NULL ; 
    6969    } 
    70   
    71   }   
    72    
     70 
     71  } 
     72 
    7373  bool CClientBuffer::checkBuffer(void) 
    7474  { 
    7575    MPI_Status status ; 
    7676    int flag ; 
    77      
     77 
    7878    if (pending) 
    7979    { 
     
    9797    return pending ; 
    9898  } 
    99    
     99 
    100100  bool CClientBuffer::hasPendingRequest(void) 
    101101  { 
     
    104104    else return false ; 
    105105  } 
    106      
    107    
    108    
    109 }     
    110      
     106 
     107 
     108 
     109} 
     110 
  • XIOS/trunk/src/buffer_client.hpp

    r501 r509  
    55#include "buffer_out.hpp" 
    66#include "mpi.hpp" 
     7#include "cxios.hpp" 
    78 
    89namespace xios 
    910{ 
    1011  extern size_t maxRequestSize ; 
    11    
     12 
    1213  class CClientBuffer 
    1314  { 
    14      
     15 
    1516    public: 
    16      
    17     CClientBuffer(MPI_Comm intercomm,int serverRank) ; 
     17 
     18    CClientBuffer(MPI_Comm intercomm,int serverRank, StdSize bfSize = CXios::bufferSize) ; 
    1819    ~CClientBuffer() ; 
    1920    bool isBufferFree(int size) ; 
    20     CBufferOut*  getBuffer(int size) ;     
     21    CBufferOut*  getBuffer(int size) ; 
    2122    bool checkBuffer(void) ; 
    2223    bool hasPendingRequest(void) ; 
    23      
     24 
    2425    char* buffer[2] ; 
    2526    int remain(void) ; 
     
    3031    int serverRank ; 
    3132    bool pending ; 
    32      
     33 
    3334    size_t bufferSizeByServer ; 
    34      
     35 
    3536    MPI_Request request ; 
    36      
    37     CBufferOut* retBuffer;     
     37 
     38    CBufferOut* retBuffer; 
    3839    MPI_Comm interComm ; 
    3940  } ; 
  • XIOS/trunk/src/buffer_server.cpp

    r501 r509  
    22#include "exception.hpp" 
    33#include "buffer_server.hpp" 
    4 #include "cxios.hpp" 
     4 
    55 
    66namespace xios 
    77{ 
    88 
    9   CServerBuffer::CServerBuffer(void) 
     9  CServerBuffer::CServerBuffer(StdSize buffSize) 
    1010  { 
    11     bufferSizeByClient=CXios::bufferSize*CXios::bufferServerFactorSize ; 
     11    bufferSizeByClient= buffSize * CXios::bufferServerFactorSize; //::bufferSize*CXios::bufferServerFactorSize ; 
    1212    size=bufferSizeByClient ; 
    1313    first=0 ; 
     
    2121    delete [] buffer ; 
    2222  } 
    23    
     23 
    2424 
    2525  bool CServerBuffer::isBufferFree(size_t count) 
    2626  { 
    2727    bool ret ; 
    28      
     28 
    2929    if (count==0) return true ; 
    30      
     30 
    3131    if (current>first) 
    3232    { 
     
    7272    return ret ; 
    7373  } 
    74    
     74 
    7575 
    7676  void* CServerBuffer::getBuffer(size_t count) 
    7777  { 
    7878    char* ret ; 
    79      
     79 
    8080    if (count==0) return buffer+current ; 
    81      
     81 
    8282    if (current>first) 
    8383    { 
     
    131131    return ret ; 
    132132  } 
    133    
     133 
    134134  void CServerBuffer::freeBuffer(size_t count) 
    135135  { 
    136136    if (count==0) return ; 
    137137 
    138     if (first==end-1)  
     138    if (first==end-1) 
    139139    { 
    140140      first=0 ; 
     
    145145    if (first<=current) 
    146146    { 
    147       if (first+count <current)  
     147      if (first+count <current) 
    148148      { 
    149149        first+=count ; 
     
    154154                 <<"cannot free required size in buffer") ; 
    155155      } 
    156      
     156 
    157157    } 
    158158    else 
     
    168168      } 
    169169    } 
    170   }       
    171         
     170  } 
     171 
    172172} 
  • XIOS/trunk/src/buffer_server.hpp

    r501 r509  
    55#include "buffer.hpp" 
    66#include "mpi.hpp" 
     7#include "cxios.hpp" 
    78 
    89namespace xios 
     
    1112  class CServerBuffer 
    1213  { 
    13      
     14 
    1415    public: 
    15      
    16     CServerBuffer(void) ; 
     16 
     17    CServerBuffer(StdSize bufSize = CXios::bufferSize) ; 
    1718    ~CServerBuffer() ; 
    1819    char* buffer ; 
    19      
     20 
    2021    bool isBufferFree(size_t count) ; 
    2122    void* getBuffer(size_t count) ; 
    2223    void freeBuffer(size_t count) ; 
    23    
     24 
    2425    size_t first ;   // first occupied element 
    2526    size_t current ; // first free element 
     
    2829    size_t bufferSizeByClient ; 
    2930  } ; 
    30    
     31 
    3132 
    3233} 
  • XIOS/trunk/src/context_client.cpp

    r501 r509  
    1717 
    1818 
    19     CContextClient::CContextClient(CContext* parent,MPI_Comm intraComm_, MPI_Comm interComm_) 
     19    CContextClient::CContextClient(CContext* parent,MPI_Comm intraComm_, MPI_Comm interComm_) : mapBufferSize_() 
    2020    { 
    2121      context=parent ; 
     
    2424      MPI_Comm_rank(intraComm,&clientRank) ; 
    2525      MPI_Comm_size(intraComm,&clientSize) ; 
    26        
     26 
    2727      int flag ; 
    2828      MPI_Comm_test_inter(interComm,&flag) ; 
    2929      if (flag) MPI_Comm_remote_size(interComm,&serverSize); 
    3030      else  MPI_Comm_size(interComm,&serverSize) ; 
    31       
     31 
    3232      timeLine=0 ; 
    3333 
     
    3939      list<int>::iterator itServer ; 
    4040      list<int> ranks ; 
    41       list<int> sizes ;   
     41      list<int> sizes ; 
    4242      list<int>::iterator itSize ; 
    43        
     43 
    4444      ranks=event.getRanks() ; 
    4545      if (! event.isEmpty()) 
     
    5151        for(list<int>::iterator it=sizes.begin();it!=sizes.end();it++) *it+=msg.size() ; 
    5252        list<CBufferOut*> buffList=getBuffers(ranks,sizes) ; 
    53        
    54         list<CBufferOut*>::iterator it ;       
     53 
     54        list<CBufferOut*>::iterator it ; 
    5555        for(it=buffList.begin(),itSize=sizes.begin();it!=buffList.end();++it,++itSize) 
    5656        { 
     
    6464      timeLine++ ; 
    6565    } 
    66        
     66 
     67    void CContextClient::sendBufferSizeEvent() 
     68    { 
     69      std::map<int, CClientBuffer*>::iterator it, itE; 
     70      std::map<int, StdSize>::const_iterator itMap = mapBufferSize_.begin(), iteMap = mapBufferSize_.end(); 
     71 
     72      if (itMap == iteMap) 
     73         ERROR("CBufferOut*  CContextClient::sendBufferSizeEvent() ;", 
     74              <<"No information about server buffer, that should not happen..."); 
     75 
     76      for (; itMap != iteMap; ++iteMap) 
     77      { 
     78        if (buffers.end() == buffers.find(itMap->first)) 
     79          newBuffer(itMap->first); 
     80      } 
     81 
     82      CBufferOut* bufOut(NULL); 
     83      itE = buffers.end(); 
     84      for (it = buffers.begin(); it != itE; ++it) 
     85      { 
     86        bufOut = (it->second)->getBuffer(sizeof(StdSize)); 
     87        bufOut->put(mapBufferSize_[it->first]);  // Stupid C++ 
     88        (it->second)->checkBuffer(); 
     89      } 
     90    } 
     91 
    6792    void CContextClient::waitEvent(list<int>& ranks) 
    6893    { 
     
    78103       context->server->eventLoop() ; 
    79104      } 
    80        
     105 
    81106    } 
    82107 
     
    84109    { 
    85110      list<int>::iterator itServer,itSize ; 
    86       list<CClientBuffer*> bufferList ;  
    87       map<int,CClientBuffer*>::iterator it ;  
    88       list<CClientBuffer*>::iterator itBuffer ;  
     111      list<CClientBuffer*> bufferList ; 
     112      map<int,CClientBuffer*>::iterator it ; 
     113      list<CClientBuffer*>::iterator itBuffer ; 
    89114      list<CBufferOut*>  retBuffer ; 
    90115      bool free ; 
    91116 
    92       for(itServer=serverList.begin();itServer!=serverList.end();itServer++)  
     117      for(itServer=serverList.begin();itServer!=serverList.end();itServer++) 
    93118      { 
    94119        it=buffers.find(*itServer) ; 
    95         if (it==buffers.end())  
     120        if (it==buffers.end()) 
    96121        { 
    97122          newBuffer(*itServer) ; 
    98123          it=buffers.find(*itServer) ; 
    99         }          
     124        } 
    100125        bufferList.push_back(it->second) ; 
    101126      } 
     
    118143        retBuffer.push_back((*itBuffer)->getBuffer(*itSize)) ; 
    119144      } 
    120       return retBuffer ;              
    121     
    122    } 
    123       
     145      return retBuffer ; 
     146 
     147   } 
     148 
    124149   void CContextClient::newBuffer(int rank) 
    125150   { 
    126       buffers[rank]=new CClientBuffer(interComm,rank) ; 
    127    }  
     151//     buffers[rank]=new CClientBuffer(interComm,rank); 
     152      buffers[rank]=new CClientBuffer(interComm,rank, mapBufferSize_[rank]) ; 
     153   } 
    128154 
    129155   bool CContextClient::checkBuffers(void) 
     
    133159      for(itBuff=buffers.begin();itBuff!=buffers.end();itBuff++) pending|=itBuff->second->checkBuffer() ; 
    134160      return pending ; 
    135    }  
     161   } 
    136162 
    137163   void CContextClient::releaseBuffers(void) 
     
    139165      map<int,CClientBuffer*>::iterator itBuff ; 
    140166      for(itBuff=buffers.begin();itBuff!=buffers.end();itBuff++) delete itBuff->second ; 
    141    }  
     167   } 
    142168 
    143169   bool CContextClient::checkBuffers(list<int>& ranks) 
     
    147173      for(it=ranks.begin();it!=ranks.end();it++) pending|=buffers[*it]->checkBuffer() ; 
    148174      return pending ; 
    149    }  
     175   } 
     176 
     177   void CContextClient::setBufferSize(const std::map<int, StdSize>& mapSize) 
     178   { 
     179     mapBufferSize_ = mapSize; 
     180     sendBufferSizeEvent(); 
     181   } 
    150182 
    151183   int CContextClient::getServerLeader(void) 
     
    153185     int clientByServer=clientSize/serverSize ; 
    154186     int remain=clientSize%serverSize ; 
    155       
     187 
    156188     if (clientRank<(clientByServer+1)*remain) 
    157189     { 
     
    164196       return remain+rank/clientByServer ; 
    165197     } 
    166    }       
     198   } 
    167199 
    168200   bool CContextClient::isServerLeader(void) 
     
    170202     int clientByServer=clientSize/serverSize ; 
    171203     int remain=clientSize%serverSize ; 
    172       
     204 
    173205     if (clientRank<(clientByServer+1)*remain) 
    174206     { 
     
    182214       if  (rank%clientByServer==0) return true ; 
    183215       else return false ; 
    184      }  
    185    } 
    186       
     216     } 
     217   } 
     218 
    187219   void CContextClient::finalize(void) 
    188220   { 
    189        
     221 
    190222     map<int,CClientBuffer*>::iterator itBuff ; 
    191223     bool stop=true ; 
    192224 
    193      CEventClient event(CContext::GetType(),CContext::EVENT_ID_CONTEXT_FINALIZE) ;    
     225     CEventClient event(CContext::GetType(),CContext::EVENT_ID_CONTEXT_FINALIZE) ; 
    194226     if (isServerLeader()) 
    195227     { 
     
    199231     } 
    200232     else sendEvent(event) ; 
    201   
     233 
    202234     CTimer::get("Blocking time").resume(); 
    203235     while(stop) 
     
    209241     CTimer::get("Blocking time").suspend(); 
    210242     report(0)<< " Memory report : Context <"<<context->getId()<<"> : client side : total memory used for buffer "<<buffers.size()*CXios::bufferSize<<" bytes"<<endl ; 
    211       
     243 
    212244     releaseBuffers() ; 
    213245   } 
    214 }       
     246} 
  • XIOS/trunk/src/context_client.hpp

    r501 r509  
    1111{ 
    1212  class CContext ; 
    13    
     13 
    1414  class CContextClient 
    1515  { 
    16    
     16 
    1717    public: 
    1818    CContextClient(CContext* parent,MPI_Comm intraComm, MPI_Comm interComm) ; 
    1919//    void registerEvent(CEventClient& event) ; 
    2020 
    21 //    list<CBufferOut*> newEvent(CEventClient& event,list<int>& sizes) ;   
     21//    list<CBufferOut*> newEvent(CEventClient& event,list<int>& sizes) ; 
    2222    void sendEvent(CEventClient& event) ; 
    2323 
     
    4141    void waitEvent(list<int>& ranks) ; 
    4242 
     43    void setBufferSize(const std::map<int, StdSize>& mapSize); 
     44    void sendBufferSizeEvent(); 
     45 
    4346    CContext* context ; 
     47 
     48    private: 
     49    std::map<int, StdSize> mapBufferSize_; 
    4450//    bool locked ; 
    45      
     51 
    4652  } ; 
    4753 
  • XIOS/trunk/src/context_server.cpp

    r501 r509  
    3737    scheduled=false ; 
    3838    finished=false ; 
    39      
     39 
    4040    boost::hash<string> hashString ; 
    4141    hashId=hashString(context->getId()) ; 
     
    8080          it=buffers.find(rank) ; 
    8181          if (it==buffers.end()) 
    82             it=(buffers.insert(pair<int,CServerBuffer*>(rank,new CServerBuffer))).first ; 
    83           MPI_Get_count(&status,MPI_CHAR,&count) ; 
    84           if (it->second->isBufferFree(count)) 
    8582          { 
    86             addr=(char*)it->second->getBuffer(count) ; 
    87             MPI_Irecv(addr,count,MPI_CHAR,rank,20,interComm,&pendingRequest[rank]) ; 
    88             bufferRequest[rank]=addr ; 
     83            StdSize buffSize = 0; 
     84            MPI_Recv(&buffSize, 1, MPI_LONG, rank, 20, interComm, &status); 
     85            it=(buffers.insert(pair<int,CServerBuffer*>(rank,new CServerBuffer(buffSize)))).first ; 
     86          } 
     87          else 
     88          { 
     89            MPI_Get_count(&status,MPI_CHAR,&count) ; 
     90            if (it->second->isBufferFree(count)) 
     91            { 
     92              addr=(char*)it->second->getBuffer(count) ; 
     93              MPI_Irecv(addr,count,MPI_CHAR,rank,20,interComm,&pendingRequest[rank]) ; 
     94              bufferRequest[rank]=addr ; 
     95            } 
    8996          } 
    9097        } 
     
    158165    { 
    159166      event=it->second ; 
    160        
     167 
    161168      if (event->isFull()) 
    162169      { 
    163170        if (!scheduled && !CXios::isServer) 
    164171        { 
    165           CServer::eventScheduler->registerEvent(currentTimeLine,hashId) ;   
     172          CServer::eventScheduler->registerEvent(currentTimeLine,hashId) ; 
    166173          scheduled=true ; 
    167174        } 
    168         else if (CXios::isServer || CServer::eventScheduler->queryEvent(currentTimeLine,hashId) )  
     175        else if (CXios::isServer || CServer::eventScheduler->queryEvent(currentTimeLine,hashId) ) 
    169176        { 
    170177         CTimer::get("Process events").resume() ; 
  • XIOS/trunk/src/cxios.cpp

    r506 r509  
    4747  void CXios::initClientSide(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm) 
    4848  { 
    49  
    5049    initialize() ; 
    5150 
     
    7473  } 
    7574 
     75  void CXios::initServer() 
     76  { 
     77    set_new_handler(noMemory); 
     78    std::set<StdString> parseList; 
     79    parseList.insert("xios"); 
     80    xml::CXMLParser::ParseFile(rootFile, parseList); 
     81//    parseFile(rootFile); 
     82    usingOasis=getin<bool>("using_oasis",false) ; 
     83    info.setLevel(getin<int>("info_level",0)) ; 
     84    printInfo2File=getin<bool>("print_file",false); 
     85    bufferSize=getin<size_t>("buffer_size",defaultBufferSize) ; 
     86    bufferServerFactorSize=getin<double>("buffer_server_factor_size",defaultBufferServerFactorSize) ; 
     87    globalComm=MPI_COMM_WORLD ; 
     88 
     89  } 
    7690 
    7791  void CXios::initServerSide(void) 
    7892  { 
    79     initialize(); 
    80  
     93//    initialize(); 
     94    initServer(); 
    8195    isClient=true; 
    8296    isServer=false ; 
  • XIOS/trunk/src/cxios.hpp

    r501 r509  
    5353     static bool isServerSide; 
    5454 
     55     static  void initServer(); 
     56 
    5557  } ; 
    5658 
  • XIOS/trunk/src/generate_interface_impl.hpp

    r501 r509  
    1010 
    1111namespace xios 
    12 {  
     12{ 
    1313  template<> string CInterface::getStrFortranType<int>(void) {return string("INTEGER") ;} 
    1414  template<> string CInterface::getStrFortranType<bool>(void) {return string("LOGICAL") ;} 
    1515  template<> string CInterface::getStrFortranType<double>(void) {return string("REAL") ;} 
    1616  template<> string CInterface::getStrFortranType<float>(void) {return string("REAL") ;} 
    17    
     17 
    1818  template<> string CInterface::getStrFortranKind<int>(void) {return string("") ;} 
    1919  template<> string CInterface::getStrFortranKind<bool>(void) {return string("") ;} 
    2020  template<> string CInterface::getStrFortranKind<double>(void) {return string("(KIND=8)") ;} 
    2121  template<> string CInterface::getStrFortranKind<float>(void) {return string("(KIND=4)") ;} 
    22    
     22 
    2323  template<> string CInterface::getStrFortranKindC<int>(void) {return string("(KIND=C_INT)") ;} 
    2424  template<> string CInterface::getStrFortranKindC<bool>(void) {return string("(KIND=C_BOOL)") ;} 
    2525  template<> string CInterface::getStrFortranKindC<double>(void) {return string("(KIND=C_DOUBLE)") ;} 
    2626  template<> string CInterface::getStrFortranKindC<float>(void) {return string("(KIND=C_FLOAT)") ;} 
    27    
    28   template<> bool CInterface::matchingTypeCFortran<int>(void) { return true ; }  
    29   template<> bool CInterface::matchingTypeCFortran<bool>(void) { return false ;}  
     27 
     28  template<> bool CInterface::matchingTypeCFortran<int>(void) { return true ; } 
     29  template<> bool CInterface::matchingTypeCFortran<bool>(void) { return false ;} 
    3030  template<> bool CInterface::matchingTypeCFortran<double>(void) { return true; } 
    3131  template<> bool CInterface::matchingTypeCFortran<float>(void) { return true; } 
    32    
     32 
    3333 
    3434// ///////////////////////////////////////////////// 
     
    3636// ///////////////////////////////////////////////// 
    3737 
    38    
     38 
    3939  void CInterface::AttributeIsDefinedCInterface(ostream& oss, const string& className,const string& name) 
    4040  { 
     
    4747    oss<<iendl ; 
    4848  } 
    49    
     49 
    5050  template <class T> 
    5151  void CInterface::AttributeCInterface(ostream& oss, const string& className,const string& name) 
    5252  { 
    5353    string typeName=getStrType<T>() ; 
    54   
     54 
    5555    oss<<"void cxios_set_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, "<< typeName<<" "<<name<<")"<<iendl ; 
    5656    oss<<"{"<<iendl ; 
    5757    oss<<"   CTimer::get(\"XIOS\").resume();"<<iendl ; 
    5858    oss<<"  "<<className<<"_hdl->"<<name<<".setValue("<<name<<");"<<iendl ; 
    59     oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ; 
     59//    oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ; 
    6060    oss<<"   CTimer::get(\"XIOS\").suspend();"<<iendl ; 
    6161    oss<<"}"<<iendl ; 
    62      
     62 
    6363    oss<<iendl ; 
    6464    oss<<"void cxios_get_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, "<< typeName<<"* "<<name<<")"<<iendl ; 
     
    6868    oss<<iendl ; 
    6969  } 
    70      
    71    
     70 
     71 
    7272  template<> 
    73   void CInterface::AttributeCInterface<string>(ostream& oss, const string& className,const string& name)   
     73  void CInterface::AttributeCInterface<string>(ostream& oss, const string& className,const string& name) 
    7474  { 
    7575    oss<<"void cxios_set_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, const char * "<<name<<", int "<<name<<"_size)"<<iendl ; 
     
    7979    oss<<"   CTimer::get(\"XIOS\").resume();"<<iendl ; 
    8080    oss<<"  "<<className<<"_hdl->"<<name<<".setValue("<<name<<"_str);"<<iendl ; 
    81     oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ; 
     81//    oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ; 
    8282    oss<<"   CTimer::get(\"XIOS\").suspend();"<<iendl ; 
    8383    oss<<"}"<<iendl ; 
    84      
     84 
    8585    oss<<iendl ; 
    86      
     86 
    8787    oss<<"void cxios_get_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, char * "<<name<<", int "<<name<<"_size)"<<iendl ; 
    8888    oss<<"{"<<iendl ; 
     
    9494    oss<<"}"<<iendl ; 
    9595    oss<<iendl ; 
    96     
     96 
    9797  } 
    9898 
    9999  template<> 
    100   void CInterface::AttributeCInterface<CEnumBase>(ostream& oss, const string& className,const string& name)   
     100  void CInterface::AttributeCInterface<CEnumBase>(ostream& oss, const string& className,const string& name) 
    101101  { 
    102102    oss<<"void cxios_set_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, const char * "<<name<<", int "<<name<<"_size)"<<iendl ; 
     
    106106    oss<<"   CTimer::get(\"XIOS\").resume();"<<iendl ; 
    107107    oss<<"  "<<className<<"_hdl->"<<name<<".fromString("<<name<<"_str);"<<iendl ; 
    108     oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ; 
     108//    oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ; 
    109109    oss<<"   CTimer::get(\"XIOS\").suspend();"<<iendl ; 
    110110    oss<<"}"<<iendl ; 
    111      
     111 
    112112    oss<<iendl ; 
    113      
     113 
    114114    oss<<"void cxios_get_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, char * "<<name<<", int "<<name<<"_size)"<<iendl ; 
    115115    oss<<"{"<<iendl ; 
     
    121121    oss<<"}"<<iendl ; 
    122122    oss<<iendl ; 
    123    
     123 
    124124  } 
    125125//     if (!array_copy(domain_hdl->mask.getValue(), mask, extent1, extent2)) 
     
    139139    oss<<"  std::copy("<<name<<", &("<<name<<"[array_tmp->num_elements()]), array_tmp->data());"<<iendl ;\ 
    140140    oss<<"  "<<className<<"_hdl->"<<name<<".setValue(array_tmp);"<<iendl ;\ 
    141     oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;\ 
     141//    oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;\ 
    142142    oss<<"}"<<iendl ;\ 
    143143    oss<<iendl; \ 
     
    162162    oss<<"  std::copy("<<name<<", &("<<name<<"[array_tmp->num_elements()]), array_tmp->data());"<<iendl ;\ 
    163163    oss<<"  "<<className<<"_hdl->"<<name<<".setValue(array_tmp);"<<iendl ;\ 
    164     oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;\ 
     164//    oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;\ 
    165165    oss<<"}"<<iendl ;\ 
    166166    oss<<iendl; \ 
     
    185185    oss<<"  std::copy("<<name<<", &("<<name<<"[array_tmp->num_elements()]), array_tmp->data());"<<iendl ;\ 
    186186    oss<<"  "<<className<<"_hdl->"<<name<<".setValue(array_tmp);"<<iendl ;\ 
    187     oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;\ 
     187//    oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;\ 
    188188    oss<<"}"<<iendl ;\ 
    189189    oss<<iendl; \ 
     
    202202*/ 
    203203 
    204 #undef macro   
     204#undef macro 
    205205 
    206206// ///////////////////////////////////////////////// 
     
    213213     oss<<"  LOGICAL(kind=C_BOOL) :: cxios_is_defined_"<<className<<"_"<<name<<iendl; 
    214214     oss<<"  INTEGER (kind = C_INTPTR_T), VALUE :: "<<className<<"_hdl"<<iendl ; 
    215      oss<<"END FUNCTION cxios_is_defined_"<<className<<"_"<<name<<iendl ;    
    216    } 
    217     
     215     oss<<"END FUNCTION cxios_is_defined_"<<className<<"_"<<name<<iendl ; 
     216   } 
     217 
    218218   template <class T> 
    219219   void CInterface::AttributeFortran2003Interface(ostream& oss,const string& className,const string& name) 
     
    221221     string fortranType=getStrFortranType<T>() ; 
    222222     string fortranKindC=getStrFortranKindC<T>() ; 
    223       
     223 
    224224     oss<<"SUBROUTINE cxios_set_"<<className<<"_"<<name<<"("<<className<<"_hdl, "<<name<<") BIND(C)"<<iendl ; 
    225225     oss<<"  USE ISO_C_BINDING"<<iendl ; 
     
    227227     oss<<"  "<<fortranType<<" "<<fortranKindC<<"      , VALUE :: "<<name<<iendl ; 
    228228     oss<<"END SUBROUTINE cxios_set_"<<className<<"_"<<name<<iendl ; 
    229      oss<<iendl ;  
     229     oss<<iendl ; 
    230230     oss<<"SUBROUTINE cxios_get_"<<className<<"_"<<name<<"("<<className<<"_hdl, "<<name<<") BIND(C)"<<iendl ; 
    231231     oss<<"  USE ISO_C_BINDING"<<iendl ; 
     
    235235     oss<<iendl ; 
    236236   } 
    237     
    238     
     237 
     238 
    239239   template <> 
    240240   void CInterface::AttributeFortran2003Interface<string>(ostream& oss,const string& className,const string& name) 
    241241   { 
    242            
     242 
    243243     oss<<"SUBROUTINE cxios_set_"<<className<<"_"<<name<<"("<<className<<"_hdl, "<<name<<", "<<name<<"_size) BIND(C)"<<iendl ; 
    244244     oss<<"  USE ISO_C_BINDING"<<iendl ; 
     
    247247     oss<<"  INTEGER  (kind = C_INT)     , VALUE        :: "<<name<<"_size"<<iendl ; 
    248248     oss<<"END SUBROUTINE cxios_set_"<<className<<"_"<<name<<iendl ; 
    249      oss<<iendl ;  
     249     oss<<iendl ; 
    250250     oss<<"SUBROUTINE cxios_get_"<<className<<"_"<<name<<"("<<className<<"_hdl, "<<name<<", "<<name<<"_size) BIND(C)"<<iendl ; 
    251251     oss<<"  USE ISO_C_BINDING"<<iendl ; 
     
    327327     oss<<"END SUBROUTINE cxios_get_"<<className<<"_"<<name<<iendl ; \ 
    328328   } 
    329    
     329 
    330330  macro(bool) 
    331331  macro(double) 
     
    333333 
    334334  #undef macro 
    335 */   
     335*/ 
    336336   template <class T> 
    337337   void CInterface::AttributeFortranInterfaceDeclaration(ostream& oss,const string& className,const string& name) 
     
    347347     if (!matchingTypeCFortran<T>()) oss<<getStrFortranType<T>()<<" "<<getStrFortranKindC<T>()<<" :: "<<name<<"_tmp"<<iendl ; 
    348348   } 
    349     
     349 
    350350   void CInterface::AttributeFortranInterfaceIsDefinedDeclaration(ostream& oss,const string& className,const string& name) 
    351351   { 
     
    353353     oss<<"LOGICAL(KIND=C_BOOL) :: "<<name<<"_tmp"<<iendl ; 
    354354   } 
    355      
     355 
    356356   template <> 
    357357   void CInterface::AttributeFortranInterfaceDeclaration<string>(ostream& oss,const string& className,const string& name) 
     
    359359     oss<<"CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: "<<name<<iendl ; 
    360360   } 
    361     
     361 
    362362   template <> 
    363363   void CInterface::AttributeFortranInterfaceGetDeclaration<string>(ostream& oss,const string& className,const string& name) 
     
    407407     oss<<getStrFortranType<T>()<<" "<<getStrFortranKind<T>() <<" , OPTIONAL, INTENT(OUT) :: "<<name<<"(:,:,:)"<<iendl ; \ 
    408408     if (!matchingTypeCFortran<T>()) oss<<getStrFortranType<T>()<<" "<<getStrFortranKindC<T>() <<" , ALLOCATABLE :: "<<name<<"_tmp(:,:,:)"<<iendl ; \ 
    409    }      
    410     
     409   } 
     410 
    411411  macro(bool) 
    412412  macro(double) 
     
    415415#undef macro 
    416416*/ 
    417     
     417 
    418418   template <class T> 
    419419   void CInterface::AttributeFortranInterfaceBody(ostream& oss,const string& className,const string& name) 
    420420   { 
    421421     string name_tmp=name+"__tmp" ; 
    422       
     422 
    423423     oss<<"IF (PRESENT("<<name<<"_)) THEN"<<iendl ; 
    424      if (!matchingTypeCFortran<T>())  
     424     if (!matchingTypeCFortran<T>()) 
    425425     { 
    426426       oss<<"  "<<name_tmp<<"="<<name<<"_"<<iendl ; 
     
    430430     oss<<"ENDIF"<<iendl ; 
    431431   } 
    432     
     432 
    433433   template <class T> 
    434434   void CInterface::AttributeFortranInterfaceGetBody(ostream& oss,const string& className,const string& name) 
    435435   { 
    436436     string name_tmp=name+"__tmp" ; 
    437       
     437 
    438438     oss<<"IF (PRESENT("<<name<<"_)) THEN"<<iendl ; 
    439      if (!matchingTypeCFortran<T>())  
     439     if (!matchingTypeCFortran<T>()) 
    440440     { 
    441441       oss<<"  CALL cxios_get_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr, "<<name_tmp<<")"<<iendl ; 
     
    449449   { 
    450450     string name_tmp=name+"__tmp" ; 
    451       
     451 
    452452     oss<<"IF (PRESENT("<<name<<"_)) THEN"<<iendl ; 
    453453     oss<<"  "<<name<<"__tmp=cxios_is_defined_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr)"<<iendl ; 
     
    455455     oss<<"ENDIF"<<iendl ; 
    456456   } 
    457       
     457 
    458458   template <> 
    459459   void CInterface::AttributeFortranInterfaceBody<string>(ostream& oss,const string& className,const string& name) 
     
    521521     oss<<"ENDIF"<<iendl ; \ 
    522522   } 
    523    
     523 
    524524  macro(bool) 
    525525  macro(double) 
     
    578578     oss<<"ENDIF"<<iendl ; \ 
    579579   } 
    580       
     580 
    581581  macro(bool) 
    582582  macro(double) 
     
    602602    oss<<"  CArray<"<<typeName<<",1> tmp("<<name<<",shape(extent1),neverDeleteData) ;"<<iendl ;\ 
    603603    oss<<"  "<<className<<"_hdl->"<<name<<".reference(tmp.copy());"<<iendl ;\ 
    604     oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;\ 
     604/*    oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;*/\ 
    605605    oss<<"   CTimer::get(\"XIOS\").suspend();"<<iendl ;\ 
    606606    oss<<"}"<<iendl ;\ 
     
    626626    oss<<"  CArray<"<<typeName<<",2> tmp("<<name<<",shape(extent1,extent2),neverDeleteData) ;"<<iendl ;\ 
    627627    oss<<"  "<<className<<"_hdl->"<<name<<".reference(tmp.copy());"<<iendl ;\ 
    628     oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;\ 
     628    /*oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;*/\ 
    629629    oss<<"   CTimer::get(\"XIOS\").suspend();"<<iendl ;\ 
    630630    oss<<"}"<<iendl ;\ 
     
    650650    oss<<"  CArray<"<<typeName<<",3> tmp("<<name<<",shape(extent1,extent2,extent3),neverDeleteData) ;"<<iendl ;\ 
    651651    oss<<"  "<<className<<"_hdl->"<<name<<".reference(tmp.copy());"<<iendl ;\ 
    652     oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;\ 
     652    /*oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;*/\ 
    653653    oss<<"   CTimer::get(\"XIOS\").suspend();"<<iendl ;\ 
    654654    oss<<"}"<<iendl ;\ 
     
    668668macro(int) 
    669669 
    670 #undef macro   
     670#undef macro 
    671671 
    672672// ///////////////////////////////////////////////// 
     
    675675 
    676676 
    677      
     677 
    678678#define macro(T)\ 
    679679   template <>\ 
     
    748748     oss<<iendl ;\ 
    749749   } 
    750    
     750 
    751751  macro(bool) 
    752752  macro(double) 
    753753  macro(int) 
    754    
     754 
    755755  #undef macro 
    756    
     756 
    757757 
    758758#define macro(T)\ 
     
    796796     oss<<getStrFortranType<T>()<<" "<<getStrFortranKind<T>() <<" , OPTIONAL, INTENT(OUT) :: "<<name<<"(:,:,:)"<<iendl ; \ 
    797797     if (!matchingTypeCFortran<T>()) oss<<getStrFortranType<T>()<<" "<<getStrFortranKindC<T>() <<" , ALLOCATABLE :: "<<name<<"_tmp(:,:,:)"<<iendl ; \ 
    798    }      
    799     
     798   } 
     799 
    800800  macro(bool) 
    801801  macro(double) 
     
    804804#undef macro 
    805805 
    806     
     806 
    807807 
    808808#define macro(T) \ 
     
    854854     oss<<"ENDIF"<<iendl ; \ 
    855855   } 
    856    
     856 
    857857  macro(bool) 
    858858  macro(double) 
     
    909909     oss<<"ENDIF"<<iendl ; \ 
    910910   } 
    911       
     911 
    912912  macro(bool) 
    913913  macro(double) 
  • XIOS/trunk/src/interface/c/icdata.cpp

    r501 r509  
    9292     CTimer::get("XIOS close definition").resume() ; 
    9393     CContext* context = CContext::getCurrent() ; 
     94//     context->setClientServerBuffer(); 
    9495     context->closeDefinition() ; 
    9596     CTimer::get("XIOS close definition").suspend() ; 
     
    257258      { 
    258259        CVariable::get(context->getId(),varIdStr)->setData<double>(data); 
    259         CVariable::get(context->getId(),varIdStr)->sendValue(); 
     260        //CVariable::get(context->getId(),varIdStr)->sendValue(); 
    260261      } 
    261262 
     
    278279      { 
    279280        CVariable::get(context->getId(),varIdStr)->setData<float>(data); 
    280         CVariable::get(context->getId(),varIdStr)->sendValue(); 
     281        //CVariable::get(context->getId(),varIdStr)->sendValue(); 
    281282      } 
    282283 
     
    299300      { 
    300301        CVariable::get(context->getId(),varIdStr)->setData<int>(data); 
    301         CVariable::get(context->getId(),varIdStr)->sendValue(); 
     302        //CVariable::get(context->getId(),varIdStr)->sendValue(); 
    302303      } 
    303304 
     
    321322      { 
    322323        CVariable::get(context->getId(),varIdStr)->setData<bool>(data); 
    323         CVariable::get(context->getId(),varIdStr)->sendValue(); 
     324        //CVariable::get(context->getId(),varIdStr)->sendValue(); 
    324325      } 
    325326 
     
    347348      { 
    348349        CVariable::get(context->getId(),varIdStr)->setData<string>(dataStr); 
    349         CVariable::get(context->getId(),varIdStr)->sendValue(); 
     350        //CVariable::get(context->getId(),varIdStr)->sendValue(); 
    350351      } 
    351352 
  • XIOS/trunk/src/interface/c/icdate.cpp

    r501 r509  
    3131         CDuration dur = {ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second, 0}; 
    3232         xios::CContext* context = CContext::getCurrent() ; 
    33           
    34             context->timestep.setValue(dur.toString()); 
    35             context->sendAttributToServer("timestep") ; 
    36           CTimer::get("XIOS").suspend() ; 
     33         context->timestep.setValue(dur.toString()); 
     34         CTimer::get("XIOS").suspend() ; 
    3735      } 
    3836      catch (xios::CException & exc) 
     
    4240      } 
    4341   } 
    44     
     42 
    4543   void cxios_update_calendar(int step) 
    4644   { 
     
    5149      context->sendUpdateCalendar(step) ; 
    5250      CTimer::get("XIOS").suspend() ; 
    53        
    5451   } 
    5552 
  • XIOS/trunk/src/interface/c/icxml_tree.cpp

    r501 r509  
    4444   typedef xios::CAxis      * XAxisPtr; 
    4545   typedef xios::CAxisGroup * XAxisGroupPtr; 
    46   
     46 
    4747   typedef xios::CVariable      *  XVariablePtr; 
    4848   typedef xios::CVariableGroup *  XVariableGroupPtr; 
    49    
     49 
    5050   // ----------------------- Ajout d'enfant à un parent ----------------------- 
    51     
     51 
    5252   void cxios_xml_tree_add_field 
    5353      (XFieldGroupPtr  parent_, XFieldPtr * child_, const char * child_id, int child_id_size) 
    5454   { 
    55       std::string child_id_str;  
    56       CTimer::get("XIOS").resume() ; 
    57       if (cstr2string(child_id, child_id_size, child_id_str)) 
    58       { 
    59          *child_ = parent_->createChild(child_id_str) ; 
    60          parent_->sendCreateChild(child_id_str) ; 
    61       } 
    62       else 
    63       { 
    64          *child_ = parent_->createChild() ; 
    65          parent_->sendCreateChild() ; 
     55      std::string child_id_str; 
     56      CTimer::get("XIOS").resume() ; 
     57      if (cstr2string(child_id, child_id_size, child_id_str)) 
     58      { 
     59         *child_ = parent_->createChild(child_id_str) ; 
     60      } 
     61      else 
     62      { 
     63         *child_ = parent_->createChild() ; 
    6664      } 
    6765      CTimer::get("XIOS").suspend() ; 
    6866  } 
    69     
     67 
    7068   void cxios_xml_tree_add_grid 
    7169      (XGridGroupPtr   parent_, XGridPtr * child_, const char * child_id, int child_id_size) 
    7270   { 
    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          parent_->sendCreateChild(child_id_str) ; 
    79       } 
    80       else 
    81       { 
    82          *child_ = parent_->createChild() ; 
    83          parent_->sendCreateChild() ; 
    84       } 
    85       CTimer::get("XIOS").suspend() ; 
    86    } 
    87     
     71      std::string child_id_str; 
     72      CTimer::get("XIOS").resume() ; 
     73      if (cstr2string(child_id, child_id_size, child_id_str)) 
     74      { 
     75         *child_ = parent_->createChild(child_id_str) ; 
     76      } 
     77      else 
     78      { 
     79         *child_ = parent_->createChild() ; 
     80      } 
     81      CTimer::get("XIOS").suspend() ; 
     82   } 
     83 
    8884   void cxios_xml_tree_add_file 
    8985      (XFileGroupPtr parent_, XFilePtr * child_, const char * child_id, int child_id_size) 
    9086   { 
    91       std::string child_id_str;  
    92       CTimer::get("XIOS").resume() ; 
    93       if (cstr2string(child_id, child_id_size, child_id_str)) 
    94       { 
    95          *child_ = parent_->createChild(child_id_str) ; 
    96          parent_->sendCreateChild(child_id_str) ; 
    97       } 
    98       else 
    99       { 
    100          *child_ = parent_->createChild() ; 
    101          parent_->sendCreateChild() ; 
    102       } 
    103       CTimer::get("XIOS").suspend() ; 
    104    } 
    105     
     87      std::string child_id_str; 
     88      CTimer::get("XIOS").resume() ; 
     89      if (cstr2string(child_id, child_id_size, child_id_str)) 
     90      { 
     91         *child_ = parent_->createChild(child_id_str) ; 
     92      } 
     93      else 
     94      { 
     95         *child_ = parent_->createChild() ; 
     96      } 
     97      CTimer::get("XIOS").suspend() ; 
     98   } 
     99 
    106100   void cxios_xml_tree_add_axis 
    107101      (XAxisGroupPtr parent_, XAxisPtr * child_, const char * child_id, int child_id_size) 
    108102   { 
    109       std::string child_id_str;  
    110       CTimer::get("XIOS").resume() ; 
    111       if (cstr2string(child_id, child_id_size, child_id_str)) 
    112       { 
    113          *child_ = parent_->createChild(child_id_str) ; 
    114          parent_->sendCreateChild(child_id_str) ; 
    115       } 
    116       else 
    117       { 
    118          *child_ = parent_->createChild() ; 
    119          parent_->sendCreateChild() ; 
    120       } 
    121       CTimer::get("XIOS").suspend() ; 
    122    } 
    123     
     103      std::string child_id_str; 
     104      CTimer::get("XIOS").resume() ; 
     105      if (cstr2string(child_id, child_id_size, child_id_str)) 
     106      { 
     107         *child_ = parent_->createChild(child_id_str) ; 
     108      } 
     109      else 
     110      { 
     111         *child_ = parent_->createChild() ; 
     112      } 
     113      CTimer::get("XIOS").suspend() ; 
     114   } 
     115 
    124116   void cxios_xml_tree_add_domain 
    125117      (XDomainGroupPtr parent_, XDomainPtr * child_, const char * child_id, int child_id_size) 
     
    130122      { 
    131123         *child_ = parent_->createChild(child_id_str) ; 
    132          parent_->sendCreateChild(child_id_str) ; 
    133       } 
    134       else 
    135       { 
    136          *child_ = parent_->createChild() ; 
    137          parent_->sendCreateChild() ; 
    138       } 
    139       CTimer::get("XIOS").suspend() ; 
    140    } 
    141     
     124      } 
     125      else 
     126      { 
     127         *child_ = parent_->createChild() ; 
     128      } 
     129      CTimer::get("XIOS").suspend() ; 
     130   } 
     131 
    142132   void cxios_xml_tree_add_fieldtofile 
    143133      (XFilePtr parent_, XFieldPtr * child_, const char * child_id, int child_id_size) 
     
    145135      std::string child_id_str; 
    146136      CTimer::get("XIOS").resume() ; 
    147   
     137 
    148138      if (cstr2string(child_id, child_id_size, child_id_str)) 
    149139      { 
    150140         *child_ = parent_->addField(child_id_str); 
    151          parent_->sendAddField(child_id_str) ; 
    152141      } 
    153142      else 
    154143      { 
    155144         *child_ = parent_->addField(); 
    156          parent_->sendAddField() ; 
    157145      } 
    158146      CTimer::get("XIOS").suspend() ; 
     
    164152      std::string child_id_str; 
    165153      CTimer::get("XIOS").resume() ; 
    166   
     154 
    167155      if (cstr2string(child_id, child_id_size, child_id_str)) 
    168156      { 
    169157         *child_ = parent_->addVariable(child_id_str); 
    170          parent_->sendAddVariable(child_id_str) ; 
    171158      } 
    172159      else 
    173160      { 
    174161         *child_ = parent_->addVariable(); 
    175          parent_->sendAddVariable() ; 
    176       } 
    177       CTimer::get("XIOS").suspend() ; 
    178    } 
    179     
     162      } 
     163      CTimer::get("XIOS").suspend() ; 
     164   } 
     165 
    180166    void cxios_xml_tree_add_variabletofield 
    181167      (XFieldPtr parent_, XVariablePtr * child_, const char * child_id, int child_id_size) 
     
    183169      std::string child_id_str; 
    184170      CTimer::get("XIOS").resume() ; 
    185   
     171 
    186172      if (cstr2string(child_id, child_id_size, child_id_str)) 
    187173      { 
    188174         *child_ = parent_->addVariable(child_id_str); 
    189          parent_->sendAddVariable(child_id_str) ; 
    190175      } 
    191176      else 
    192177      { 
    193178         *child_ = parent_->addVariable(); 
    194          parent_->sendAddVariable() ; 
    195       } 
    196       CTimer::get("XIOS").suspend() ; 
    197    }   
     179      } 
     180      CTimer::get("XIOS").suspend() ; 
     181   } 
    198182   // ----------------------- Ajout de groupe à un parent ---------------------- 
    199183 
     
    201185      (XFieldGroupPtr  parent_, XFieldGroupPtr * child_, const char * child_id, int child_id_size) 
    202186   { 
    203      std::string child_id_str;  
    204       CTimer::get("XIOS").resume() ; 
    205       if (cstr2string(child_id, child_id_size, child_id_str)) 
    206       { 
    207          *child_ = parent_->createChildGroup(child_id_str) ; 
    208          parent_->sendCreateChildGroup(child_id_str) ; 
    209       } 
    210       else 
    211       { 
    212          *child_ = parent_->createChildGroup() ; 
    213          parent_->sendCreateChildGroup(child_id_str) ; 
     187     std::string child_id_str; 
     188      CTimer::get("XIOS").resume() ; 
     189      if (cstr2string(child_id, child_id_size, child_id_str)) 
     190      { 
     191         *child_ = parent_->createChildGroup(child_id_str) ; 
     192      } 
     193      else 
     194      { 
     195         *child_ = parent_->createChildGroup() ; 
    214196      } 
    215197      CTimer::get("XIOS").suspend() ; 
     
    224206      { 
    225207         *child_ = parent_->createChildGroup(child_id_str) ; 
    226          parent_->sendCreateChildGroup(child_id_str) ; 
    227       } 
    228       else 
    229       { 
    230          *child_ = parent_->createChildGroup() ; 
    231          parent_->sendCreateChildGroup(child_id_str) ; 
     208      } 
     209      else 
     210      { 
     211         *child_ = parent_->createChildGroup() ; 
    232212      } 
    233213      CTimer::get("XIOS").suspend() ; 
     
    242222      { 
    243223         *child_ = parent_->createChildGroup(child_id_str) ; 
    244          parent_->sendCreateChildGroup(child_id_str) ; 
    245       } 
    246       else 
    247       { 
    248          *child_ = parent_->createChildGroup() ; 
    249          parent_->sendCreateChildGroup(child_id_str) ; 
     224      } 
     225      else 
     226      { 
     227         *child_ = parent_->createChildGroup() ; 
    250228      } 
    251229      CTimer::get("XIOS").suspend() ; 
     
    260238      { 
    261239         *child_ = parent_->createChildGroup(child_id_str) ; 
    262          parent_->sendCreateChildGroup(child_id_str) ; 
    263       } 
    264       else 
    265       { 
    266          *child_ = parent_->createChildGroup() ; 
    267          parent_->sendCreateChildGroup(child_id_str) ; 
     240      } 
     241      else 
     242      { 
     243         *child_ = parent_->createChildGroup() ; 
    268244      } 
    269245      CTimer::get("XIOS").suspend() ; 
     
    278254      { 
    279255         *child_ = parent_->createChildGroup(child_id_str) ; 
    280          parent_->sendCreateChildGroup(child_id_str) ; 
    281       } 
    282       else 
    283       { 
    284          *child_ = parent_->createChildGroup() ; 
    285          parent_->sendCreateChildGroup(child_id_str) ; 
     256      } 
     257      else 
     258      { 
     259         *child_ = parent_->createChildGroup() ; 
    286260      } 
    287261      CTimer::get("XIOS").suspend() ; 
     
    291265      (XFilePtr parent_, XFieldGroupPtr * child_, const char * child_id, int child_id_size) 
    292266   { 
    293       std::string child_id_str;  
     267      std::string child_id_str; 
    294268      CTimer::get("XIOS").resume() ; 
    295269      if (cstr2string(child_id, child_id_size, child_id_str)) 
    296270      { 
    297271         *child_ = parent_->addFieldGroup(child_id_str); 
    298          parent_->sendAddFieldGroup(child_id_str) ; 
    299272      } 
    300273      else 
    301274      { 
    302275         *child_ = parent_->addFieldGroup(); 
    303          parent_->sendAddFieldGroup() ; 
    304       } 
    305       CTimer::get("XIOS").suspend() ; 
    306    } 
    307     
     276      } 
     277      CTimer::get("XIOS").suspend() ; 
     278   } 
     279 
    308280   void cxios_xml_tree_add_variablegrouptofile 
    309281      (XFilePtr parent_, XVariableGroupPtr * child_, const char * child_id, int child_id_size) 
    310282   { 
    311       std::string child_id_str;  
     283      std::string child_id_str; 
    312284      CTimer::get("XIOS").resume() ; 
    313285      if (cstr2string(child_id, child_id_size, child_id_str)) 
    314286      { 
    315287         *child_ = parent_->addVariableGroup(child_id_str); 
    316          parent_->sendAddVariableGroup(child_id_str) ; 
    317288      } 
    318289      else 
    319290      { 
    320291         *child_ = parent_->addVariableGroup(); 
    321          parent_->sendAddVariableGroup() ; 
    322       } 
    323       CTimer::get("XIOS").suspend() ; 
    324    } 
    325     
     292      } 
     293      CTimer::get("XIOS").suspend() ; 
     294   } 
     295 
    326296   void cxios_xml_tree_add_variablegrouptofield 
    327297      (XFieldPtr parent_, XVariableGroupPtr * child_, const char * child_id, int child_id_size) 
    328298   { 
    329       std::string child_id_str;  
     299      std::string child_id_str; 
    330300      CTimer::get("XIOS").resume() ; 
    331301      if (cstr2string(child_id, child_id_size, child_id_str)) 
    332302      { 
    333303         *child_ = parent_->addVariableGroup(child_id_str); 
    334          parent_->sendAddVariableGroup(child_id_str) ; 
    335304      } 
    336305      else 
    337306      { 
    338307         *child_ = parent_->addVariableGroup(); 
    339          parent_->sendAddVariableGroup() ; 
    340       } 
    341       CTimer::get("XIOS").suspend() ; 
    342    }    
    343     
    344     
     308      } 
     309      CTimer::get("XIOS").suspend() ; 
     310   } 
     311 
     312 
    345313   // ----------------------- Affichage de l'arborescence ---------------------- 
    346     
    347 //   void cxios_xml_tree_show   (const char * filename, int filename_size)  
     314 
     315//   void cxios_xml_tree_show   (const char * filename, int filename_size) 
    348316//   { 
    349317//      std::string filename_str; 
     
    361329//      } 
    362330//  } 
    363       
    364     
     331 
     332 
    365333   // ----------------------- Parsing de document xml -------------------------- 
    366     
     334 
    367335//   void cxios_xml_parse_file  (const char * filename  , int filename_size)// 
    368336//   { 
    369 //      std::string filename_str;  
     337//      std::string filename_str; 
    370338//      if (!cstr2string(filename, filename_size, filename_str)) return; 
    371339// 
     
    380348//      } 
    381349//   } 
    382     
     350 
    383351//   void cxios_xml_parse_string(const char * xmlcontent, int xmlcontent_size) 
    384352//   { 
    385 //      std::string xmlcontent_str;  
     353//      std::string xmlcontent_str; 
    386354//      if (!cstr2string(xmlcontent, xmlcontent_size, xmlcontent_str)) return; 
    387355// 
     
    396364//      } 
    397365//   } 
    398     
     366 
    399367 
    400368 
  • XIOS/trunk/src/interface/c_attr/icaxis_attr.cpp

    r501 r509  
    2323     CTimer::get("XIOS").resume(); 
    2424    axis_hdl->long_name.setValue(long_name_str); 
    25     axis_hdl->sendAttributToServer(axis_hdl->long_name); 
    2625     CTimer::get("XIOS").suspend(); 
    2726  } 
     
    5049     CTimer::get("XIOS").resume(); 
    5150    axis_hdl->name.setValue(name_str); 
    52     axis_hdl->sendAttributToServer(axis_hdl->name); 
    5351     CTimer::get("XIOS").suspend(); 
    5452  } 
     
    7775     CTimer::get("XIOS").resume(); 
    7876    axis_hdl->positive.fromString(positive_str); 
    79     axis_hdl->sendAttributToServer(axis_hdl->positive); 
    8077     CTimer::get("XIOS").suspend(); 
    8178  } 
     
    10299     CTimer::get("XIOS").resume(); 
    103100    axis_hdl->size.setValue(size); 
    104     axis_hdl->sendAttributToServer(axis_hdl->size); 
    105101     CTimer::get("XIOS").suspend(); 
    106102  } 
     
    126122     CTimer::get("XIOS").resume(); 
    127123    axis_hdl->standard_name.setValue(standard_name_str); 
    128     axis_hdl->sendAttributToServer(axis_hdl->standard_name); 
    129124     CTimer::get("XIOS").suspend(); 
    130125  } 
     
    153148     CTimer::get("XIOS").resume(); 
    154149    axis_hdl->unit.setValue(unit_str); 
    155     axis_hdl->sendAttributToServer(axis_hdl->unit); 
    156150     CTimer::get("XIOS").suspend(); 
    157151  } 
     
    179173    CArray<double,1> tmp(value,shape(extent1),neverDeleteData) ; 
    180174    axis_hdl->value.reference(tmp.copy()); 
    181     axis_hdl->sendAttributToServer(axis_hdl->value); 
    182175     CTimer::get("XIOS").suspend(); 
    183176  } 
     
    204197     CTimer::get("XIOS").resume(); 
    205198    axis_hdl->zoom_begin.setValue(zoom_begin); 
    206     axis_hdl->sendAttributToServer(axis_hdl->zoom_begin); 
    207199     CTimer::get("XIOS").suspend(); 
    208200  } 
     
    226218     CTimer::get("XIOS").resume(); 
    227219    axis_hdl->zoom_end.setValue(zoom_end); 
    228     axis_hdl->sendAttributToServer(axis_hdl->zoom_end); 
    229220     CTimer::get("XIOS").suspend(); 
    230221  } 
     
    248239     CTimer::get("XIOS").resume(); 
    249240    axis_hdl->zoom_size.setValue(zoom_size); 
    250     axis_hdl->sendAttributToServer(axis_hdl->zoom_size); 
    251241     CTimer::get("XIOS").suspend(); 
    252242  } 
  • XIOS/trunk/src/interface/c_attr/icaxisgroup_attr.cpp

    r501 r509  
    2323     CTimer::get("XIOS").resume(); 
    2424    axisgroup_hdl->group_ref.setValue(group_ref_str); 
    25     axisgroup_hdl->sendAttributToServer(axisgroup_hdl->group_ref); 
    2625     CTimer::get("XIOS").suspend(); 
    2726  } 
     
    5049     CTimer::get("XIOS").resume(); 
    5150    axisgroup_hdl->long_name.setValue(long_name_str); 
    52     axisgroup_hdl->sendAttributToServer(axisgroup_hdl->long_name); 
    5351     CTimer::get("XIOS").suspend(); 
    5452  } 
     
    7775     CTimer::get("XIOS").resume(); 
    7876    axisgroup_hdl->name.setValue(name_str); 
    79     axisgroup_hdl->sendAttributToServer(axisgroup_hdl->name); 
    8077     CTimer::get("XIOS").suspend(); 
    8178  } 
     
    104101     CTimer::get("XIOS").resume(); 
    105102    axisgroup_hdl->positive.fromString(positive_str); 
    106     axisgroup_hdl->sendAttributToServer(axisgroup_hdl->positive); 
    107103     CTimer::get("XIOS").suspend(); 
    108104  } 
     
    129125     CTimer::get("XIOS").resume(); 
    130126    axisgroup_hdl->size.setValue(size); 
    131     axisgroup_hdl->sendAttributToServer(axisgroup_hdl->size); 
    132127     CTimer::get("XIOS").suspend(); 
    133128  } 
     
    153148     CTimer::get("XIOS").resume(); 
    154149    axisgroup_hdl->standard_name.setValue(standard_name_str); 
    155     axisgroup_hdl->sendAttributToServer(axisgroup_hdl->standard_name); 
    156150     CTimer::get("XIOS").suspend(); 
    157151  } 
     
    180174     CTimer::get("XIOS").resume(); 
    181175    axisgroup_hdl->unit.setValue(unit_str); 
    182     axisgroup_hdl->sendAttributToServer(axisgroup_hdl->unit); 
    183176     CTimer::get("XIOS").suspend(); 
    184177  } 
     
    206199    CArray<double,1> tmp(value,shape(extent1),neverDeleteData) ; 
    207200    axisgroup_hdl->value.reference(tmp.copy()); 
    208     axisgroup_hdl->sendAttributToServer(axisgroup_hdl->value); 
    209201     CTimer::get("XIOS").suspend(); 
    210202  } 
     
    231223     CTimer::get("XIOS").resume(); 
    232224    axisgroup_hdl->zoom_begin.setValue(zoom_begin); 
    233     axisgroup_hdl->sendAttributToServer(axisgroup_hdl->zoom_begin); 
    234225     CTimer::get("XIOS").suspend(); 
    235226  } 
     
    253244     CTimer::get("XIOS").resume(); 
    254245    axisgroup_hdl->zoom_end.setValue(zoom_end); 
    255     axisgroup_hdl->sendAttributToServer(axisgroup_hdl->zoom_end); 
    256246     CTimer::get("XIOS").suspend(); 
    257247  } 
     
    275265     CTimer::get("XIOS").resume(); 
    276266    axisgroup_hdl->zoom_size.setValue(zoom_size); 
    277     axisgroup_hdl->sendAttributToServer(axisgroup_hdl->zoom_size); 
    278267     CTimer::get("XIOS").suspend(); 
    279268  } 
  • XIOS/trunk/src/interface/c_attr/iccontext_attr.cpp

    r501 r509  
    2323     CTimer::get("XIOS").resume(); 
    2424    context_hdl->calendar_type.setValue(calendar_type_str); 
    25     context_hdl->sendAttributToServer(context_hdl->calendar_type); 
    2625     CTimer::get("XIOS").suspend(); 
    2726  } 
     
    5049     CTimer::get("XIOS").resume(); 
    5150    context_hdl->output_dir.setValue(output_dir_str); 
    52     context_hdl->sendAttributToServer(context_hdl->output_dir); 
    5351     CTimer::get("XIOS").suspend(); 
    5452  } 
     
    7775     CTimer::get("XIOS").resume(); 
    7876    context_hdl->start_date.setValue(start_date_str); 
    79     context_hdl->sendAttributToServer(context_hdl->start_date); 
    8077     CTimer::get("XIOS").suspend(); 
    8178  } 
     
    104101     CTimer::get("XIOS").resume(); 
    105102    context_hdl->time_origin.setValue(time_origin_str); 
    106     context_hdl->sendAttributToServer(context_hdl->time_origin); 
    107103     CTimer::get("XIOS").suspend(); 
    108104  } 
     
    131127     CTimer::get("XIOS").resume(); 
    132128    context_hdl->timestep.setValue(timestep_str); 
    133     context_hdl->sendAttributToServer(context_hdl->timestep); 
    134129     CTimer::get("XIOS").suspend(); 
    135130  } 
  • XIOS/trunk/src/interface/c_attr/icdomain_attr.cpp

    r501 r509  
    2222    CArray<double,2> tmp(bounds_lat,shape(extent1,extent2),neverDeleteData) ; 
    2323    domain_hdl->bounds_lat.reference(tmp.copy()); 
    24     domain_hdl->sendAttributToServer(domain_hdl->bounds_lat); 
    2524     CTimer::get("XIOS").suspend(); 
    2625  } 
     
    4847    CArray<double,2> tmp(bounds_lon,shape(extent1,extent2),neverDeleteData) ; 
    4948    domain_hdl->bounds_lon.reference(tmp.copy()); 
    50     domain_hdl->sendAttributToServer(domain_hdl->bounds_lon); 
    5149     CTimer::get("XIOS").suspend(); 
    5250  } 
     
    7371     CTimer::get("XIOS").resume(); 
    7472    domain_hdl->data_dim.setValue(data_dim); 
    75     domain_hdl->sendAttributToServer(domain_hdl->data_dim); 
    7673     CTimer::get("XIOS").suspend(); 
    7774  } 
     
    9693    CArray<int,1> tmp(data_i_index,shape(extent1),neverDeleteData) ; 
    9794    domain_hdl->data_i_index.reference(tmp.copy()); 
    98     domain_hdl->sendAttributToServer(domain_hdl->data_i_index); 
    9995     CTimer::get("XIOS").suspend(); 
    10096  } 
     
    121117     CTimer::get("XIOS").resume(); 
    122118    domain_hdl->data_ibegin.setValue(data_ibegin); 
    123     domain_hdl->sendAttributToServer(domain_hdl->data_ibegin); 
    124119     CTimer::get("XIOS").suspend(); 
    125120  } 
     
    144139    CArray<int,1> tmp(data_j_index,shape(extent1),neverDeleteData) ; 
    145140    domain_hdl->data_j_index.reference(tmp.copy()); 
    146     domain_hdl->sendAttributToServer(domain_hdl->data_j_index); 
    147141     CTimer::get("XIOS").suspend(); 
    148142  } 
     
    169163     CTimer::get("XIOS").resume(); 
    170164    domain_hdl->data_jbegin.setValue(data_jbegin); 
    171     domain_hdl->sendAttributToServer(domain_hdl->data_jbegin); 
    172165     CTimer::get("XIOS").suspend(); 
    173166  } 
     
    191184     CTimer::get("XIOS").resume(); 
    192185    domain_hdl->data_n_index.setValue(data_n_index); 
    193     domain_hdl->sendAttributToServer(domain_hdl->data_n_index); 
    194186     CTimer::get("XIOS").suspend(); 
    195187  } 
     
    213205     CTimer::get("XIOS").resume(); 
    214206    domain_hdl->data_ni.setValue(data_ni); 
    215     domain_hdl->sendAttributToServer(domain_hdl->data_ni); 
    216207     CTimer::get("XIOS").suspend(); 
    217208  } 
     
    235226     CTimer::get("XIOS").resume(); 
    236227    domain_hdl->data_nj.setValue(data_nj); 
    237     domain_hdl->sendAttributToServer(domain_hdl->data_nj); 
    238228     CTimer::get("XIOS").suspend(); 
    239229  } 
     
    259249     CTimer::get("XIOS").resume(); 
    260250    domain_hdl->domain_group_ref.setValue(domain_group_ref_str); 
    261     domain_hdl->sendAttributToServer(domain_hdl->domain_group_ref); 
    262251     CTimer::get("XIOS").suspend(); 
    263252  } 
     
    285274    CArray<int,2> tmp(i_index,shape(extent1,extent2),neverDeleteData) ; 
    286275    domain_hdl->i_index.reference(tmp.copy()); 
    287     domain_hdl->sendAttributToServer(domain_hdl->i_index); 
    288276     CTimer::get("XIOS").suspend(); 
    289277  } 
     
    310298     CTimer::get("XIOS").resume(); 
    311299    domain_hdl->ibegin.setValue(ibegin); 
    312     domain_hdl->sendAttributToServer(domain_hdl->ibegin); 
    313300     CTimer::get("XIOS").suspend(); 
    314301  } 
     
    332319     CTimer::get("XIOS").resume(); 
    333320    domain_hdl->iend.setValue(iend); 
    334     domain_hdl->sendAttributToServer(domain_hdl->iend); 
    335321     CTimer::get("XIOS").suspend(); 
    336322  } 
     
    355341    CArray<int,2> tmp(j_index,shape(extent1,extent2),neverDeleteData) ; 
    356342    domain_hdl->j_index.reference(tmp.copy()); 
    357     domain_hdl->sendAttributToServer(domain_hdl->j_index); 
    358343     CTimer::get("XIOS").suspend(); 
    359344  } 
     
    380365     CTimer::get("XIOS").resume(); 
    381366    domain_hdl->jbegin.setValue(jbegin); 
    382     domain_hdl->sendAttributToServer(domain_hdl->jbegin); 
    383367     CTimer::get("XIOS").suspend(); 
    384368  } 
     
    402386     CTimer::get("XIOS").resume(); 
    403387    domain_hdl->jend.setValue(jend); 
    404     domain_hdl->sendAttributToServer(domain_hdl->jend); 
    405388     CTimer::get("XIOS").suspend(); 
    406389  } 
     
    425408    CArray<double,1> tmp(latvalue,shape(extent1),neverDeleteData) ; 
    426409    domain_hdl->latvalue.reference(tmp.copy()); 
    427     domain_hdl->sendAttributToServer(domain_hdl->latvalue); 
    428410     CTimer::get("XIOS").suspend(); 
    429411  } 
     
    452434     CTimer::get("XIOS").resume(); 
    453435    domain_hdl->long_name.setValue(long_name_str); 
    454     domain_hdl->sendAttributToServer(domain_hdl->long_name); 
    455436     CTimer::get("XIOS").suspend(); 
    456437  } 
     
    478459    CArray<double,1> tmp(lonvalue,shape(extent1),neverDeleteData) ; 
    479460    domain_hdl->lonvalue.reference(tmp.copy()); 
    480     domain_hdl->sendAttributToServer(domain_hdl->lonvalue); 
    481461     CTimer::get("XIOS").suspend(); 
    482462  } 
     
    504484    CArray<bool,2> tmp(mask,shape(extent1,extent2),neverDeleteData) ; 
    505485    domain_hdl->mask.reference(tmp.copy()); 
    506     domain_hdl->sendAttributToServer(domain_hdl->mask); 
    507486     CTimer::get("XIOS").suspend(); 
    508487  } 
     
    531510     CTimer::get("XIOS").resume(); 
    532511    domain_hdl->name.setValue(name_str); 
    533     domain_hdl->sendAttributToServer(domain_hdl->name); 
    534512     CTimer::get("XIOS").suspend(); 
    535513  } 
     
    556534     CTimer::get("XIOS").resume(); 
    557535    domain_hdl->ni.setValue(ni); 
    558     domain_hdl->sendAttributToServer(domain_hdl->ni); 
    559536     CTimer::get("XIOS").suspend(); 
    560537  } 
     
    578555     CTimer::get("XIOS").resume(); 
    579556    domain_hdl->ni_glo.setValue(ni_glo); 
    580     domain_hdl->sendAttributToServer(domain_hdl->ni_glo); 
    581557     CTimer::get("XIOS").suspend(); 
    582558  } 
     
    600576     CTimer::get("XIOS").resume(); 
    601577    domain_hdl->nj.setValue(nj); 
    602     domain_hdl->sendAttributToServer(domain_hdl->nj); 
    603578     CTimer::get("XIOS").suspend(); 
    604579  } 
     
    622597     CTimer::get("XIOS").resume(); 
    623598    domain_hdl->nj_glo.setValue(nj_glo); 
    624     domain_hdl->sendAttributToServer(domain_hdl->nj_glo); 
    625599     CTimer::get("XIOS").suspend(); 
    626600  } 
     
    644618     CTimer::get("XIOS").resume(); 
    645619    domain_hdl->nvertex.setValue(nvertex); 
    646     domain_hdl->sendAttributToServer(domain_hdl->nvertex); 
    647620     CTimer::get("XIOS").suspend(); 
    648621  } 
     
    668641     CTimer::get("XIOS").resume(); 
    669642    domain_hdl->standard_name.setValue(standard_name_str); 
    670     domain_hdl->sendAttributToServer(domain_hdl->standard_name); 
    671643     CTimer::get("XIOS").suspend(); 
    672644  } 
     
    695667     CTimer::get("XIOS").resume(); 
    696668    domain_hdl->type.fromString(type_str); 
    697     domain_hdl->sendAttributToServer(domain_hdl->type); 
    698669     CTimer::get("XIOS").suspend(); 
    699670  } 
     
    720691     CTimer::get("XIOS").resume(); 
    721692    domain_hdl->zoom_ibegin.setValue(zoom_ibegin); 
    722     domain_hdl->sendAttributToServer(domain_hdl->zoom_ibegin); 
    723693     CTimer::get("XIOS").suspend(); 
    724694  } 
     
    742712     CTimer::get("XIOS").resume(); 
    743713    domain_hdl->zoom_ibegin_loc.setValue(zoom_ibegin_loc); 
    744     domain_hdl->sendAttributToServer(domain_hdl->zoom_ibegin_loc); 
    745714     CTimer::get("XIOS").suspend(); 
    746715  } 
     
    764733     CTimer::get("XIOS").resume(); 
    765734    domain_hdl->zoom_jbegin.setValue(zoom_jbegin); 
    766     domain_hdl->sendAttributToServer(domain_hdl->zoom_jbegin); 
    767735     CTimer::get("XIOS").suspend(); 
    768736  } 
     
    786754     CTimer::get("XIOS").resume(); 
    787755    domain_hdl->zoom_jbegin_loc.setValue(zoom_jbegin_loc); 
    788     domain_hdl->sendAttributToServer(domain_hdl->zoom_jbegin_loc); 
    789756     CTimer::get("XIOS").suspend(); 
    790757  } 
     
    808775     CTimer::get("XIOS").resume(); 
    809776    domain_hdl->zoom_ni.setValue(zoom_ni); 
    810     domain_hdl->sendAttributToServer(domain_hdl->zoom_ni); 
    811777     CTimer::get("XIOS").suspend(); 
    812778  } 
     
    830796     CTimer::get("XIOS").resume(); 
    831797    domain_hdl->zoom_ni_loc.setValue(zoom_ni_loc); 
    832     domain_hdl->sendAttributToServer(domain_hdl->zoom_ni_loc); 
    833798     CTimer::get("XIOS").suspend(); 
    834799  } 
     
    852817     CTimer::get("XIOS").resume(); 
    853818    domain_hdl->zoom_nj.setValue(zoom_nj); 
    854     domain_hdl->sendAttributToServer(domain_hdl->zoom_nj); 
    855819     CTimer::get("XIOS").suspend(); 
    856820  } 
     
    874838     CTimer::get("XIOS").resume(); 
    875839    domain_hdl->zoom_nj_loc.setValue(zoom_nj_loc); 
    876     domain_hdl->sendAttributToServer(domain_hdl->zoom_nj_loc); 
    877840     CTimer::get("XIOS").suspend(); 
    878841  } 
  • XIOS/trunk/src/interface/c_attr/icdomaingroup_attr.cpp

    r501 r509  
    2222    CArray<double,2> tmp(bounds_lat,shape(extent1,extent2),neverDeleteData) ; 
    2323    domaingroup_hdl->bounds_lat.reference(tmp.copy()); 
    24     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->bounds_lat); 
    2524     CTimer::get("XIOS").suspend(); 
    2625  } 
     
    4847    CArray<double,2> tmp(bounds_lon,shape(extent1,extent2),neverDeleteData) ; 
    4948    domaingroup_hdl->bounds_lon.reference(tmp.copy()); 
    50     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->bounds_lon); 
    5149     CTimer::get("XIOS").suspend(); 
    5250  } 
     
    7371     CTimer::get("XIOS").resume(); 
    7472    domaingroup_hdl->data_dim.setValue(data_dim); 
    75     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_dim); 
    7673     CTimer::get("XIOS").suspend(); 
    7774  } 
     
    9693    CArray<int,1> tmp(data_i_index,shape(extent1),neverDeleteData) ; 
    9794    domaingroup_hdl->data_i_index.reference(tmp.copy()); 
    98     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_i_index); 
    9995     CTimer::get("XIOS").suspend(); 
    10096  } 
     
    121117     CTimer::get("XIOS").resume(); 
    122118    domaingroup_hdl->data_ibegin.setValue(data_ibegin); 
    123     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_ibegin); 
    124119     CTimer::get("XIOS").suspend(); 
    125120  } 
     
    144139    CArray<int,1> tmp(data_j_index,shape(extent1),neverDeleteData) ; 
    145140    domaingroup_hdl->data_j_index.reference(tmp.copy()); 
    146     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_j_index); 
    147141     CTimer::get("XIOS").suspend(); 
    148142  } 
     
    169163     CTimer::get("XIOS").resume(); 
    170164    domaingroup_hdl->data_jbegin.setValue(data_jbegin); 
    171     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_jbegin); 
    172165     CTimer::get("XIOS").suspend(); 
    173166  } 
     
    191184     CTimer::get("XIOS").resume(); 
    192185    domaingroup_hdl->data_n_index.setValue(data_n_index); 
    193     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_n_index); 
    194186     CTimer::get("XIOS").suspend(); 
    195187  } 
     
    213205     CTimer::get("XIOS").resume(); 
    214206    domaingroup_hdl->data_ni.setValue(data_ni); 
    215     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_ni); 
    216207     CTimer::get("XIOS").suspend(); 
    217208  } 
     
    235226     CTimer::get("XIOS").resume(); 
    236227    domaingroup_hdl->data_nj.setValue(data_nj); 
    237     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_nj); 
    238228     CTimer::get("XIOS").suspend(); 
    239229  } 
     
    259249     CTimer::get("XIOS").resume(); 
    260250    domaingroup_hdl->domain_group_ref.setValue(domain_group_ref_str); 
    261     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->domain_group_ref); 
    262251     CTimer::get("XIOS").suspend(); 
    263252  } 
     
    286275     CTimer::get("XIOS").resume(); 
    287276    domaingroup_hdl->group_ref.setValue(group_ref_str); 
    288     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->group_ref); 
    289277     CTimer::get("XIOS").suspend(); 
    290278  } 
     
    312300    CArray<int,2> tmp(i_index,shape(extent1,extent2),neverDeleteData) ; 
    313301    domaingroup_hdl->i_index.reference(tmp.copy()); 
    314     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->i_index); 
    315302     CTimer::get("XIOS").suspend(); 
    316303  } 
     
    337324     CTimer::get("XIOS").resume(); 
    338325    domaingroup_hdl->ibegin.setValue(ibegin); 
    339     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->ibegin); 
    340326     CTimer::get("XIOS").suspend(); 
    341327  } 
     
    359345     CTimer::get("XIOS").resume(); 
    360346    domaingroup_hdl->iend.setValue(iend); 
    361     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->iend); 
    362347     CTimer::get("XIOS").suspend(); 
    363348  } 
     
    382367    CArray<int,2> tmp(j_index,shape(extent1,extent2),neverDeleteData) ; 
    383368    domaingroup_hdl->j_index.reference(tmp.copy()); 
    384     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->j_index); 
    385369     CTimer::get("XIOS").suspend(); 
    386370  } 
     
    407391     CTimer::get("XIOS").resume(); 
    408392    domaingroup_hdl->jbegin.setValue(jbegin); 
    409     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->jbegin); 
    410393     CTimer::get("XIOS").suspend(); 
    411394  } 
     
    429412     CTimer::get("XIOS").resume(); 
    430413    domaingroup_hdl->jend.setValue(jend); 
    431     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->jend); 
    432414     CTimer::get("XIOS").suspend(); 
    433415  } 
     
    452434    CArray<double,1> tmp(latvalue,shape(extent1),neverDeleteData) ; 
    453435    domaingroup_hdl->latvalue.reference(tmp.copy()); 
    454     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->latvalue); 
    455436     CTimer::get("XIOS").suspend(); 
    456437  } 
     
    479460     CTimer::get("XIOS").resume(); 
    480461    domaingroup_hdl->long_name.setValue(long_name_str); 
    481     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->long_name); 
    482462     CTimer::get("XIOS").suspend(); 
    483463  } 
     
    505485    CArray<double,1> tmp(lonvalue,shape(extent1),neverDeleteData) ; 
    506486    domaingroup_hdl->lonvalue.reference(tmp.copy()); 
    507     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->lonvalue); 
    508487     CTimer::get("XIOS").suspend(); 
    509488  } 
     
    531510    CArray<bool,2> tmp(mask,shape(extent1,extent2),neverDeleteData) ; 
    532511    domaingroup_hdl->mask.reference(tmp.copy()); 
    533     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->mask); 
    534512     CTimer::get("XIOS").suspend(); 
    535513  } 
     
    558536     CTimer::get("XIOS").resume(); 
    559537    domaingroup_hdl->name.setValue(name_str); 
    560     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->name); 
    561538     CTimer::get("XIOS").suspend(); 
    562539  } 
     
    583560     CTimer::get("XIOS").resume(); 
    584561    domaingroup_hdl->ni.setValue(ni); 
    585     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->ni); 
    586562     CTimer::get("XIOS").suspend(); 
    587563  } 
     
    605581     CTimer::get("XIOS").resume(); 
    606582    domaingroup_hdl->ni_glo.setValue(ni_glo); 
    607     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->ni_glo); 
    608583     CTimer::get("XIOS").suspend(); 
    609584  } 
     
    627602     CTimer::get("XIOS").resume(); 
    628603    domaingroup_hdl->nj.setValue(nj); 
    629     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->nj); 
    630604     CTimer::get("XIOS").suspend(); 
    631605  } 
     
    649623     CTimer::get("XIOS").resume(); 
    650624    domaingroup_hdl->nj_glo.setValue(nj_glo); 
    651     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->nj_glo); 
    652625     CTimer::get("XIOS").suspend(); 
    653626  } 
     
    671644     CTimer::get("XIOS").resume(); 
    672645    domaingroup_hdl->nvertex.setValue(nvertex); 
    673     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->nvertex); 
    674646     CTimer::get("XIOS").suspend(); 
    675647  } 
     
    695667     CTimer::get("XIOS").resume(); 
    696668    domaingroup_hdl->standard_name.setValue(standard_name_str); 
    697     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->standard_name); 
    698669     CTimer::get("XIOS").suspend(); 
    699670  } 
     
    722693     CTimer::get("XIOS").resume(); 
    723694    domaingroup_hdl->type.fromString(type_str); 
    724     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->type); 
    725695     CTimer::get("XIOS").suspend(); 
    726696  } 
     
    747717     CTimer::get("XIOS").resume(); 
    748718    domaingroup_hdl->zoom_ibegin.setValue(zoom_ibegin); 
    749     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ibegin); 
    750719     CTimer::get("XIOS").suspend(); 
    751720  } 
     
    769738     CTimer::get("XIOS").resume(); 
    770739    domaingroup_hdl->zoom_ibegin_loc.setValue(zoom_ibegin_loc); 
    771     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ibegin_loc); 
    772740     CTimer::get("XIOS").suspend(); 
    773741  } 
     
    791759     CTimer::get("XIOS").resume(); 
    792760    domaingroup_hdl->zoom_jbegin.setValue(zoom_jbegin); 
    793     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_jbegin); 
    794761     CTimer::get("XIOS").suspend(); 
    795762  } 
     
    813780     CTimer::get("XIOS").resume(); 
    814781    domaingroup_hdl->zoom_jbegin_loc.setValue(zoom_jbegin_loc); 
    815     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_jbegin_loc); 
    816782     CTimer::get("XIOS").suspend(); 
    817783  } 
     
    835801     CTimer::get("XIOS").resume(); 
    836802    domaingroup_hdl->zoom_ni.setValue(zoom_ni); 
    837     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ni); 
    838803     CTimer::get("XIOS").suspend(); 
    839804  } 
     
    857822     CTimer::get("XIOS").resume(); 
    858823    domaingroup_hdl->zoom_ni_loc.setValue(zoom_ni_loc); 
    859     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_ni_loc); 
    860824     CTimer::get("XIOS").suspend(); 
    861825  } 
     
    879843     CTimer::get("XIOS").resume(); 
    880844    domaingroup_hdl->zoom_nj.setValue(zoom_nj); 
    881     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_nj); 
    882845     CTimer::get("XIOS").suspend(); 
    883846  } 
     
    901864     CTimer::get("XIOS").resume(); 
    902865    domaingroup_hdl->zoom_nj_loc.setValue(zoom_nj_loc); 
    903     domaingroup_hdl->sendAttributToServer(domaingroup_hdl->zoom_nj_loc); 
    904866     CTimer::get("XIOS").suspend(); 
    905867  } 
  • XIOS/trunk/src/interface/c_attr/icfield_attr.cpp

    r501 r509  
    2121     CTimer::get("XIOS").resume(); 
    2222    field_hdl->add_offset.setValue(add_offset); 
    23     field_hdl->sendAttributToServer(field_hdl->add_offset); 
    2423     CTimer::get("XIOS").suspend(); 
    2524  } 
     
    4544     CTimer::get("XIOS").resume(); 
    4645    field_hdl->axis_ref.setValue(axis_ref_str); 
    47     field_hdl->sendAttributToServer(field_hdl->axis_ref); 
    4846     CTimer::get("XIOS").suspend(); 
    4947  } 
     
    7068     CTimer::get("XIOS").resume(); 
    7169    field_hdl->default_value.setValue(default_value); 
    72     field_hdl->sendAttributToServer(field_hdl->default_value); 
    7370     CTimer::get("XIOS").suspend(); 
    7471  } 
     
    9289     CTimer::get("XIOS").resume(); 
    9390    field_hdl->detect_missing_value.setValue(detect_missing_value); 
    94     field_hdl->sendAttributToServer(field_hdl->detect_missing_value); 
    9591     CTimer::get("XIOS").suspend(); 
    9692  } 
     
    116112     CTimer::get("XIOS").resume(); 
    117113    field_hdl->domain_ref.setValue(domain_ref_str); 
    118     field_hdl->sendAttributToServer(field_hdl->domain_ref); 
    119114     CTimer::get("XIOS").suspend(); 
    120115  } 
     
    141136     CTimer::get("XIOS").resume(); 
    142137    field_hdl->enabled.setValue(enabled); 
    143     field_hdl->sendAttributToServer(field_hdl->enabled); 
    144138     CTimer::get("XIOS").suspend(); 
    145139  } 
     
    165159     CTimer::get("XIOS").resume(); 
    166160    field_hdl->field_ref.setValue(field_ref_str); 
    167     field_hdl->sendAttributToServer(field_hdl->field_ref); 
    168161     CTimer::get("XIOS").suspend(); 
    169162  } 
     
    192185     CTimer::get("XIOS").resume(); 
    193186    field_hdl->freq_offset.setValue(freq_offset_str); 
    194     field_hdl->sendAttributToServer(field_hdl->freq_offset); 
    195187     CTimer::get("XIOS").suspend(); 
    196188  } 
     
    219211     CTimer::get("XIOS").resume(); 
    220212    field_hdl->freq_op.setValue(freq_op_str); 
    221     field_hdl->sendAttributToServer(field_hdl->freq_op); 
    222213     CTimer::get("XIOS").suspend(); 
    223214  } 
     
    246237     CTimer::get("XIOS").resume(); 
    247238    field_hdl->grid_ref.setValue(grid_ref_str); 
    248     field_hdl->sendAttributToServer(field_hdl->grid_ref); 
    249239     CTimer::get("XIOS").suspend(); 
    250240  } 
     
    271261     CTimer::get("XIOS").resume(); 
    272262    field_hdl->level.setValue(level); 
    273     field_hdl->sendAttributToServer(field_hdl->level); 
    274263     CTimer::get("XIOS").suspend(); 
    275264  } 
     
    295284     CTimer::get("XIOS").resume(); 
    296285    field_hdl->long_name.setValue(long_name_str); 
    297     field_hdl->sendAttributToServer(field_hdl->long_name); 
    298286     CTimer::get("XIOS").suspend(); 
    299287  } 
     
    322310     CTimer::get("XIOS").resume(); 
    323311    field_hdl->name.setValue(name_str); 
    324     field_hdl->sendAttributToServer(field_hdl->name); 
    325312     CTimer::get("XIOS").suspend(); 
    326313  } 
     
    349336     CTimer::get("XIOS").resume(); 
    350337    field_hdl->operation.setValue(operation_str); 
    351     field_hdl->sendAttributToServer(field_hdl->operation); 
    352338     CTimer::get("XIOS").suspend(); 
    353339  } 
     
    374360     CTimer::get("XIOS").resume(); 
    375361    field_hdl->prec.setValue(prec); 
    376     field_hdl->sendAttributToServer(field_hdl->prec); 
    377362     CTimer::get("XIOS").suspend(); 
    378363  } 
     
    396381     CTimer::get("XIOS").resume(); 
    397382    field_hdl->scale_factor.setValue(scale_factor); 
    398     field_hdl->sendAttributToServer(field_hdl->scale_factor); 
    399383     CTimer::get("XIOS").suspend(); 
    400384  } 
     
    420404     CTimer::get("XIOS").resume(); 
    421405    field_hdl->standard_name.setValue(standard_name_str); 
    422     field_hdl->sendAttributToServer(field_hdl->standard_name); 
    423406     CTimer::get("XIOS").suspend(); 
    424407  } 
     
    447430     CTimer::get("XIOS").resume(); 
    448431    field_hdl->unit.setValue(unit_str); 
    449     field_hdl->sendAttributToServer(field_hdl->unit); 
    450432     CTimer::get("XIOS").suspend(); 
    451433  } 
     
    472454     CTimer::get("XIOS").resume(); 
    473455    field_hdl->valid_max.setValue(valid_max); 
    474     field_hdl->sendAttributToServer(field_hdl->valid_max); 
    475456     CTimer::get("XIOS").suspend(); 
    476457  } 
     
    494475     CTimer::get("XIOS").resume(); 
    495476    field_hdl->valid_min.setValue(valid_min); 
    496     field_hdl->sendAttributToServer(field_hdl->valid_min); 
    497477     CTimer::get("XIOS").suspend(); 
    498478  } 
  • XIOS/trunk/src/interface/c_attr/icfieldgroup_attr.cpp

    r501 r509  
    2121     CTimer::get("XIOS").resume(); 
    2222    fieldgroup_hdl->add_offset.setValue(add_offset); 
    23     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->add_offset); 
    2423     CTimer::get("XIOS").suspend(); 
    2524  } 
     
    4544     CTimer::get("XIOS").resume(); 
    4645    fieldgroup_hdl->axis_ref.setValue(axis_ref_str); 
    47     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->axis_ref); 
    4846     CTimer::get("XIOS").suspend(); 
    4947  } 
     
    7068     CTimer::get("XIOS").resume(); 
    7169    fieldgroup_hdl->default_value.setValue(default_value); 
    72     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->default_value); 
    7370     CTimer::get("XIOS").suspend(); 
    7471  } 
     
    9289     CTimer::get("XIOS").resume(); 
    9390    fieldgroup_hdl->detect_missing_value.setValue(detect_missing_value); 
    94     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->detect_missing_value); 
    9591     CTimer::get("XIOS").suspend(); 
    9692  } 
     
    116112     CTimer::get("XIOS").resume(); 
    117113    fieldgroup_hdl->domain_ref.setValue(domain_ref_str); 
    118     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->domain_ref); 
    119114     CTimer::get("XIOS").suspend(); 
    120115  } 
     
    141136     CTimer::get("XIOS").resume(); 
    142137    fieldgroup_hdl->enabled.setValue(enabled); 
    143     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->enabled); 
    144138     CTimer::get("XIOS").suspend(); 
    145139  } 
     
    165159     CTimer::get("XIOS").resume(); 
    166160    fieldgroup_hdl->field_ref.setValue(field_ref_str); 
    167     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->field_ref); 
    168161     CTimer::get("XIOS").suspend(); 
    169162  } 
     
    192185     CTimer::get("XIOS").resume(); 
    193186    fieldgroup_hdl->freq_offset.setValue(freq_offset_str); 
    194     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->freq_offset); 
    195187     CTimer::get("XIOS").suspend(); 
    196188  } 
     
    219211     CTimer::get("XIOS").resume(); 
    220212    fieldgroup_hdl->freq_op.setValue(freq_op_str); 
    221     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->freq_op); 
    222213     CTimer::get("XIOS").suspend(); 
    223214  } 
     
    246237     CTimer::get("XIOS").resume(); 
    247238    fieldgroup_hdl->grid_ref.setValue(grid_ref_str); 
    248     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->grid_ref); 
    249239     CTimer::get("XIOS").suspend(); 
    250240  } 
     
    273263     CTimer::get("XIOS").resume(); 
    274264    fieldgroup_hdl->group_ref.setValue(group_ref_str); 
    275     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->group_ref); 
    276265     CTimer::get("XIOS").suspend(); 
    277266  } 
     
    298287     CTimer::get("XIOS").resume(); 
    299288    fieldgroup_hdl->level.setValue(level); 
    300     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->level); 
    301289     CTimer::get("XIOS").suspend(); 
    302290  } 
     
    322310     CTimer::get("XIOS").resume(); 
    323311    fieldgroup_hdl->long_name.setValue(long_name_str); 
    324     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->long_name); 
    325312     CTimer::get("XIOS").suspend(); 
    326313  } 
     
    349336     CTimer::get("XIOS").resume(); 
    350337    fieldgroup_hdl->name.setValue(name_str); 
    351     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->name); 
    352338     CTimer::get("XIOS").suspend(); 
    353339  } 
     
    376362     CTimer::get("XIOS").resume(); 
    377363    fieldgroup_hdl->operation.setValue(operation_str); 
    378     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->operation); 
    379364     CTimer::get("XIOS").suspend(); 
    380365  } 
     
    401386     CTimer::get("XIOS").resume(); 
    402387    fieldgroup_hdl->prec.setValue(prec); 
    403     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->prec); 
    404388     CTimer::get("XIOS").suspend(); 
    405389  } 
     
    423407     CTimer::get("XIOS").resume(); 
    424408    fieldgroup_hdl->scale_factor.setValue(scale_factor); 
    425     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->scale_factor); 
    426409     CTimer::get("XIOS").suspend(); 
    427410  } 
     
    447430     CTimer::get("XIOS").resume(); 
    448431    fieldgroup_hdl->standard_name.setValue(standard_name_str); 
    449     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->standard_name); 
    450432     CTimer::get("XIOS").suspend(); 
    451433  } 
     
    474456     CTimer::get("XIOS").resume(); 
    475457    fieldgroup_hdl->unit.setValue(unit_str); 
    476     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->unit); 
    477458     CTimer::get("XIOS").suspend(); 
    478459  } 
     
    499480     CTimer::get("XIOS").resume(); 
    500481    fieldgroup_hdl->valid_max.setValue(valid_max); 
    501     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->valid_max); 
    502482     CTimer::get("XIOS").suspend(); 
    503483  } 
     
    521501     CTimer::get("XIOS").resume(); 
    522502    fieldgroup_hdl->valid_min.setValue(valid_min); 
    523     fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->valid_min); 
    524503     CTimer::get("XIOS").suspend(); 
    525504  } 
  • XIOS/trunk/src/interface/c_attr/icfile_attr.cpp

    r501 r509  
    2323     CTimer::get("XIOS").resume(); 
    2424    file_hdl->description.setValue(description_str); 
    25     file_hdl->sendAttributToServer(file_hdl->description); 
    2625     CTimer::get("XIOS").suspend(); 
    2726  } 
     
    4847     CTimer::get("XIOS").resume(); 
    4948    file_hdl->enabled.setValue(enabled); 
    50     file_hdl->sendAttributToServer(file_hdl->enabled); 
    5149     CTimer::get("XIOS").suspend(); 
    5250  } 
     
    7068     CTimer::get("XIOS").resume(); 
    7169    file_hdl->min_digits.setValue(min_digits); 
    72     file_hdl->sendAttributToServer(file_hdl->min_digits); 
    7370     CTimer::get("XIOS").suspend(); 
    7471  } 
     
    9491     CTimer::get("XIOS").resume(); 
    9592    file_hdl->name.setValue(name_str); 
    96     file_hdl->sendAttributToServer(file_hdl->name); 
    9793     CTimer::get("XIOS").suspend(); 
    9894  } 
     
    121117     CTimer::get("XIOS").resume(); 
    122118    file_hdl->name_suffix.setValue(name_suffix_str); 
    123     file_hdl->sendAttributToServer(file_hdl->name_suffix); 
    124119     CTimer::get("XIOS").suspend(); 
    125120  } 
     
    148143     CTimer::get("XIOS").resume(); 
    149144    file_hdl->output_freq.setValue(output_freq_str); 
    150     file_hdl->sendAttributToServer(file_hdl->output_freq); 
    151145     CTimer::get("XIOS").suspend(); 
    152146  } 
     
    173167     CTimer::get("XIOS").resume(); 
    174168    file_hdl->output_level.setValue(output_level); 
    175     file_hdl->sendAttributToServer(file_hdl->output_level); 
    176169     CTimer::get("XIOS").suspend(); 
    177170  } 
     
    197190     CTimer::get("XIOS").resume(); 
    198191    file_hdl->par_access.setValue(par_access_str); 
    199     file_hdl->sendAttributToServer(file_hdl->par_access); 
    200192     CTimer::get("XIOS").suspend(); 
    201193  } 
     
    224216     CTimer::get("XIOS").resume(); 
    225217    file_hdl->split_freq.setValue(split_freq_str); 
    226     file_hdl->sendAttributToServer(file_hdl->split_freq); 
    227218     CTimer::get("XIOS").suspend(); 
    228219  } 
     
    251242     CTimer::get("XIOS").resume(); 
    252243    file_hdl->split_freq_format.setValue(split_freq_format_str); 
    253     file_hdl->sendAttributToServer(file_hdl->split_freq_format); 
    254244     CTimer::get("XIOS").suspend(); 
    255245  } 
     
    278268     CTimer::get("XIOS").resume(); 
    279269    file_hdl->sync_freq.setValue(sync_freq_str); 
    280     file_hdl->sendAttributToServer(file_hdl->sync_freq); 
    281270     CTimer::get("XIOS").suspend(); 
    282271  } 
     
    305294     CTimer::get("XIOS").resume(); 
    306295    file_hdl->type.fromString(type_str); 
    307     file_hdl->sendAttributToServer(file_hdl->type); 
    308296     CTimer::get("XIOS").suspend(); 
    309297  } 
  • XIOS/trunk/src/interface/c_attr/icfilegroup_attr.cpp

    r501 r509  
    2323     CTimer::get("XIOS").resume(); 
    2424    filegroup_hdl->description.setValue(description_str); 
    25     filegroup_hdl->sendAttributToServer(filegroup_hdl->description); 
    2625     CTimer::get("XIOS").suspend(); 
    2726  } 
     
    4847     CTimer::get("XIOS").resume(); 
    4948    filegroup_hdl->enabled.setValue(enabled); 
    50     filegroup_hdl->sendAttributToServer(filegroup_hdl->enabled); 
    5149     CTimer::get("XIOS").suspend(); 
    5250  } 
     
    7270     CTimer::get("XIOS").resume(); 
    7371    filegroup_hdl->group_ref.setValue(group_ref_str); 
    74     filegroup_hdl->sendAttributToServer(filegroup_hdl->group_ref); 
    7572     CTimer::get("XIOS").suspend(); 
    7673  } 
     
    9794     CTimer::get("XIOS").resume(); 
    9895    filegroup_hdl->min_digits.setValue(min_digits); 
    99     filegroup_hdl->sendAttributToServer(filegroup_hdl->min_digits); 
    10096     CTimer::get("XIOS").suspend(); 
    10197  } 
     
    121117     CTimer::get("XIOS").resume(); 
    122118    filegroup_hdl->name.setValue(name_str); 
    123     filegroup_hdl->sendAttributToServer(filegroup_hdl->name); 
    124119     CTimer::get("XIOS").suspend(); 
    125120  } 
     
    148143     CTimer::get("XIOS").resume(); 
    149144    filegroup_hdl->name_suffix.setValue(name_suffix_str); 
    150     filegroup_hdl->sendAttributToServer(filegroup_hdl->name_suffix); 
    151145     CTimer::get("XIOS").suspend(); 
    152146  } 
     
    175169     CTimer::get("XIOS").resume(); 
    176170    filegroup_hdl->output_freq.setValue(output_freq_str); 
    177     filegroup_hdl->sendAttributToServer(filegroup_hdl->output_freq); 
    178171     CTimer::get("XIOS").suspend(); 
    179172  } 
     
    200193     CTimer::get("XIOS").resume(); 
    201194    filegroup_hdl->output_level.setValue(output_level); 
    202     filegroup_hdl->sendAttributToServer(filegroup_hdl->output_level); 
    203195     CTimer::get("XIOS").suspend(); 
    204196  } 
     
    224216     CTimer::get("XIOS").resume(); 
    225217    filegroup_hdl->par_access.setValue(par_access_str); 
    226     filegroup_hdl->sendAttributToServer(filegroup_hdl->par_access); 
    227218     CTimer::get("XIOS").suspend(); 
    228219  } 
     
    251242     CTimer::get("XIOS").resume(); 
    252243    filegroup_hdl->split_freq.setValue(split_freq_str); 
    253     filegroup_hdl->sendAttributToServer(filegroup_hdl->split_freq); 
    254244     CTimer::get("XIOS").suspend(); 
    255245  } 
     
    278268     CTimer::get("XIOS").resume(); 
    279269    filegroup_hdl->split_freq_format.setValue(split_freq_format_str); 
    280     filegroup_hdl->sendAttributToServer(filegroup_hdl->split_freq_format); 
    281270     CTimer::get("XIOS").suspend(); 
    282271  } 
     
    305294     CTimer::get("XIOS").resume(); 
    306295    filegroup_hdl->sync_freq.setValue(sync_freq_str); 
    307     filegroup_hdl->sendAttributToServer(filegroup_hdl->sync_freq); 
    308296     CTimer::get("XIOS").suspend(); 
    309297  } 
     
    332320     CTimer::get("XIOS").resume(); 
    333321    filegroup_hdl->type.fromString(type_str); 
    334     filegroup_hdl->sendAttributToServer(filegroup_hdl->type); 
    335322     CTimer::get("XIOS").suspend(); 
    336323  } 
  • XIOS/trunk/src/interface/c_attr/icgrid_attr.cpp

    r501 r509  
    2323     CTimer::get("XIOS").resume(); 
    2424    grid_hdl->axis_ref.setValue(axis_ref_str); 
    25     grid_hdl->sendAttributToServer(grid_hdl->axis_ref); 
    2625     CTimer::get("XIOS").suspend(); 
    2726  } 
     
    5049     CTimer::get("XIOS").resume(); 
    5150    grid_hdl->description.setValue(description_str); 
    52     grid_hdl->sendAttributToServer(grid_hdl->description); 
    5351     CTimer::get("XIOS").suspend(); 
    5452  } 
     
    7775     CTimer::get("XIOS").resume(); 
    7876    grid_hdl->domain_ref.setValue(domain_ref_str); 
    79     grid_hdl->sendAttributToServer(grid_hdl->domain_ref); 
    8077     CTimer::get("XIOS").suspend(); 
    8178  } 
     
    103100    CArray<bool,3> tmp(mask,shape(extent1,extent2,extent3),neverDeleteData) ; 
    104101    grid_hdl->mask.reference(tmp.copy()); 
    105     grid_hdl->sendAttributToServer(grid_hdl->mask); 
    106102     CTimer::get("XIOS").suspend(); 
    107103  } 
     
    130126     CTimer::get("XIOS").resume(); 
    131127    grid_hdl->name.setValue(name_str); 
    132     grid_hdl->sendAttributToServer(grid_hdl->name); 
    133128     CTimer::get("XIOS").suspend(); 
    134129  } 
  • XIOS/trunk/src/interface/c_attr/icgridgroup_attr.cpp

    r501 r509  
    2323     CTimer::get("XIOS").resume(); 
    2424    gridgroup_hdl->axis_ref.setValue(axis_ref_str); 
    25     gridgroup_hdl->sendAttributToServer(gridgroup_hdl->axis_ref); 
    2625     CTimer::get("XIOS").suspend(); 
    2726  } 
     
    5049     CTimer::get("XIOS").resume(); 
    5150    gridgroup_hdl->description.setValue(description_str); 
    52     gridgroup_hdl->sendAttributToServer(gridgroup_hdl->description); 
    5351     CTimer::get("XIOS").suspend(); 
    5452  } 
     
    7775     CTimer::get("XIOS").resume(); 
    7876    gridgroup_hdl->domain_ref.setValue(domain_ref_str); 
    79     gridgroup_hdl->sendAttributToServer(gridgroup_hdl->domain_ref); 
    8077     CTimer::get("XIOS").suspend(); 
    8178  } 
     
    104101     CTimer::get("XIOS").resume(); 
    105102    gridgroup_hdl->group_ref.setValue(group_ref_str); 
    106     gridgroup_hdl->sendAttributToServer(gridgroup_hdl->group_ref); 
    107103     CTimer::get("XIOS").suspend(); 
    108104  } 
     
    130126    CArray<bool,3> tmp(mask,shape(extent1,extent2,extent3),neverDeleteData) ; 
    131127    gridgroup_hdl->mask.reference(tmp.copy()); 
    132     gridgroup_hdl->sendAttributToServer(gridgroup_hdl->mask); 
    133128     CTimer::get("XIOS").suspend(); 
    134129  } 
     
    157152     CTimer::get("XIOS").resume(); 
    158153    gridgroup_hdl->name.setValue(name_str); 
    159     gridgroup_hdl->sendAttributToServer(gridgroup_hdl->name); 
    160154     CTimer::get("XIOS").suspend(); 
    161155  } 
  • XIOS/trunk/src/interface/c_attr/icvariable_attr.cpp

    r501 r509  
    2323     CTimer::get("XIOS").resume(); 
    2424    variable_hdl->name.setValue(name_str); 
    25     variable_hdl->sendAttributToServer(variable_hdl->name); 
    2625     CTimer::get("XIOS").suspend(); 
    2726  } 
     
    5049     CTimer::get("XIOS").resume(); 
    5150    variable_hdl->type.setValue(type_str); 
    52     variable_hdl->sendAttributToServer(variable_hdl->type); 
    5351     CTimer::get("XIOS").suspend(); 
    5452  } 
  • XIOS/trunk/src/interface/c_attr/icvariablegroup_attr.cpp

    r501 r509  
    2323     CTimer::get("XIOS").resume(); 
    2424    variablegroup_hdl->group_ref.setValue(group_ref_str); 
    25     variablegroup_hdl->sendAttributToServer(variablegroup_hdl->group_ref); 
    2625     CTimer::get("XIOS").suspend(); 
    2726  } 
     
    5049     CTimer::get("XIOS").resume(); 
    5150    variablegroup_hdl->name.setValue(name_str); 
    52     variablegroup_hdl->sendAttributToServer(variablegroup_hdl->name); 
    5351     CTimer::get("XIOS").suspend(); 
    5452  } 
     
    7775     CTimer::get("XIOS").resume(); 
    7876    variablegroup_hdl->type.setValue(type_str); 
    79     variablegroup_hdl->sendAttributToServer(variablegroup_hdl->type); 
    8077     CTimer::get("XIOS").suspend(); 
    8178  } 
  • XIOS/trunk/src/node/context.cpp

    r501 r509  
    1616 
    1717namespace xios { 
    18    
     18 
    1919  shared_ptr<CContextGroup> CContext::root ; 
    20     
     20 
    2121   /// ////////////////////// Définitions ////////////////////// /// 
    2222 
    2323   CContext::CContext(void) 
    2424      : CObjectTemplate<CContext>(), CContextAttributes() 
    25       , calendar(),hasClient(false),hasServer(false) 
     25      , calendar(),hasClient(false),hasServer(false), isPostProcessed(false), dataSize_() 
    2626   { /* Ne rien faire de plus */ } 
    2727 
    2828   CContext::CContext(const StdString & id) 
    2929      : CObjectTemplate<CContext>(id), CContextAttributes() 
    30       , calendar(),hasClient(false),hasServer(false) 
     30      , calendar(),hasClient(false),hasServer(false), isPostProcessed(false), dataSize_() 
    3131   { /* Ne rien faire de plus */ } 
    3232 
    3333   CContext::~CContext(void) 
    34    {  
     34   { 
    3535     if (hasClient) delete client ; 
    3636     if (hasServer) delete server ; 
     
    3838 
    3939   //---------------------------------------------------------------- 
    40  
     40   //! Get name of context 
    4141   StdString CContext::GetName(void)   { return (StdString("context")); } 
    4242   StdString CContext::GetDefName(void){ return (CContext::GetName()); } 
     
    4444 
    4545   //---------------------------------------------------------------- 
    46  
     46   /*! 
     47   \brief Get context group (context root) 
     48   \return Context root 
     49   */ 
    4750   CContextGroup* CContext::getRoot(void) 
    48    {   
     51   { 
    4952      if (root.get()==NULL) root=shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName())) ; 
    50       return root.get();  
    51    } 
    52     
    53  
    54    //---------------------------------------------------------------- 
    55  
     53      return root.get(); 
     54   } 
     55 
     56 
     57   //---------------------------------------------------------------- 
     58   /*! 
     59   \brief Get calendar of a context 
     60   \return Calendar 
     61   */ 
    5662   boost::shared_ptr<CCalendar> CContext::getCalendar(void) const 
    5763   { 
    5864      return (this->calendar); 
    5965   } 
    60     
    61    //---------------------------------------------------------------- 
    62     
     66 
     67   //---------------------------------------------------------------- 
     68   /*! 
     69   \brief Set a context with a calendar 
     70   \param[in] newCalendar new calendar 
     71   */ 
    6372   void CContext::setCalendar(boost::shared_ptr<CCalendar> newCalendar) 
    6473   { 
     
    6776      start_date.setValue(this->calendar->getInitDate().toString()); 
    6877   } 
    69     
    70    //---------------------------------------------------------------- 
    71  
     78 
     79   //---------------------------------------------------------------- 
     80   //! Process all information of calendar 
    7281   void CContext::solveCalendar(void) 
    7382   { 
     
    97106            << "The calendar is not defined !"); 
    98107   } 
    99     
    100    //---------------------------------------------------------------- 
    101  
     108 
     109   //---------------------------------------------------------------- 
     110   /*! 
     111   \brief Parse xml file and write information into context object 
     112   \param [in] node xmld node corresponding in xml file 
     113   */ 
    102114   void CContext::parse(xml::CXMLNode & node) 
    103115   { 
     
    135147 
    136148            if (attributes.end() != attributes.find("id")) 
    137             { DEBUG(<< "Definition node has an id," 
    138                     << "it will not be taking account !"); } 
     149            { 
     150              DEBUG(<< "Definition node has an id," 
     151                    << "it will not be taking account !"); 
     152            } 
    139153 
    140154#define DECLARE_NODE(Name_, name_)    \ 
     
    155169 
    156170   //---------------------------------------------------------------- 
    157  
     171   //! Show tree structure of context 
    158172   void CContext::ShowTree(StdOStream & out) 
    159173   { 
     
    166180      out << "<? xml version=\"1.0\" ?>" << std::endl; 
    167181      out << "<"  << xml::CXMLNode::GetRootName() << " >" << std::endl; 
    168        
     182 
    169183      for (; it != end; it++) 
    170184      { 
    171          CContext* context = *it;          
    172          CContext::setCurrent(context->getId());          
     185         CContext* context = *it; 
     186         CContext::setCurrent(context->getId()); 
    173187         out << *context << std::endl; 
    174188      } 
    175        
     189 
    176190      out << "</" << xml::CXMLNode::GetRootName() << " >" << std::endl; 
    177       CContext::setCurrent(currentContextId);   
    178    } 
    179     
    180  
    181    //---------------------------------------------------------------- 
    182  
     191      CContext::setCurrent(currentContextId); 
     192   } 
     193 
     194 
     195   //---------------------------------------------------------------- 
     196 
     197   //! Convert context object into string (to print) 
    183198   StdString CContext::toString(void) const 
    184199   { 
     
    209224   //---------------------------------------------------------------- 
    210225 
     226   /*! 
     227   \brief Find all inheritace among objects in a context. 
     228   \param [in] apply (true) write attributes of parent into ones of child if they are empty 
     229                     (false) write attributes of parent into a new container of child 
     230   \param [in] parent unused 
     231   */ 
    211232   void CContext::solveDescInheritance(bool apply, const CAttributeMap * const UNUSED(parent)) 
    212233   { 
     
    220241   //---------------------------------------------------------------- 
    221242 
     243   //! Verify if all root definition in the context have child. 
    222244   bool CContext::hasChild(void) const 
    223245   { 
     
    230252} 
    231253 
    232    //---------------------------------------------------------------- 
    233  
    234    void CContext::solveFieldRefInheritance(bool apply) 
    235    { 
    236       if (!this->hasId()) return; 
    237       vector<CField*> allField = CField::getAll() ; 
    238 //              = CObjectTemplate<CField>::GetAllVectobject(this->getId()); 
    239       std::vector<CField*>::iterator  
    240          it = allField.begin(), end = allField.end(); 
    241              
    242       for (; it != end; it++) 
    243       { 
    244          CField* field = *it; 
    245          field->solveRefInheritance(apply); 
    246       } 
    247    } 
     254//   //---------------------------------------------------------------- 
     255// 
     256//   void CContext::solveFieldRefInheritance(bool apply) 
     257//   { 
     258//      if (!this->hasId()) return; 
     259//      vector<CField*> allField = CField::getAll() ; 
     260////              = CObjectTemplate<CField>::GetAllVectobject(this->getId()); 
     261//      std::vector<CField*>::iterator 
     262//         it = allField.begin(), end = allField.end(); 
     263// 
     264//      for (; it != end; it++) 
     265//      { 
     266//         CField* field = *it; 
     267//         field->solveRefInheritance(apply); 
     268//      } 
     269//   } 
    248270 
    249271   //---------------------------------------------------------------- 
     
    256278   } 
    257279   ///--------------------------------------------------------------- 
    258     
     280 
     281   //! Initialize client side 
    259282   void CContext::initClient(MPI_Comm intraComm, MPI_Comm interComm) 
    260283   { 
    261284     hasClient=true ; 
    262285     client = new CContextClient(this,intraComm, interComm) ; 
    263    }  
    264  
     286   } 
     287 
     288   void CContext::setClientServerBuffer() 
     289   { 
     290     if (hasClient) 
     291     { 
     292       client->setBufferSize(getDataSize()); 
     293     } 
     294   } 
     295 
     296   //! Verify whether a context is initialized 
    265297   bool CContext::isInitialized(void) 
    266298   { 
    267299     return hasClient ; 
    268300   } 
    269      
     301 
     302   //! Initialize server 
    270303   void CContext::initServer(MPI_Comm intraComm,MPI_Comm interComm) 
    271304   { 
    272305     hasServer=true ; 
    273306     server = new CContextServer(this,intraComm,interComm) ; 
    274    }  
    275  
     307   } 
     308 
     309   //! Server side: Put server into a loop in order to listen message from client 
    276310   bool CContext::eventLoop(void) 
    277311   { 
    278312     return server->eventLoop() ; 
    279    }  
    280     
     313   } 
     314 
     315   //! Terminate a context 
    281316   void CContext::finalize(void) 
    282317   { 
     
    290325      } 
    291326   } 
    292         
    293         
    294   
    295     
     327 
     328   /*! 
     329   \brief Close all the context defintion and do processing data 
     330      After everything is well defined on client side, they will be processed and sent to server 
     331   From the version 2.0, sever and client work no more on the same database. Moreover, client(s) will send 
     332   all necessary information to server, from which each server can build its own database. 
     333   Because the role of server is to write out field data on a specific netcdf file, 
     334   the only information that it needs is the enabled files 
     335   and the active fields (fields will be written onto active files) 
     336   */ 
    296337   void CContext::closeDefinition(void) 
    297338   { 
    298       if (hasClient && !hasServer) sendCloseDefinition() ; 
    299        
    300       solveCalendar();          
    301           
    302       // Résolution des héritages pour le context actuel. 
    303       this->solveAllInheritance(); 
    304  
    305       //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 
    306       this->findEnabledFiles(); 
    307  
    308          
    309       this->processEnabledFiles() ; 
    310  
    311 /*         
     339     if (hasClient && !hasServer) 
     340     { 
     341       // After xml is parsed, there are some more works with post processing 
     342       postProcessing(); 
     343 
     344       setClientServerBuffer(); 
     345 
     346      // Send all attributes of current context to server 
     347      this->sendAllAttributesToServer(); 
     348 
     349      // We have enough information to send to server 
     350      // First of all, send all enabled files 
     351       sendEnabledFiles(); 
     352 
     353      // Then, send all enabled fields 
     354       sendEnabledFields(); 
     355 
     356      // After that, send all grid (if any) 
     357       sendRefGrid(); 
     358 
     359      // At last, we have all info of domain and axis, then send them 
     360       sendRefDomainsAxis(); 
     361    } 
     362 
     363    // Now tell server that it can process all messages from client 
     364    if (hasClient && !hasServer) this->sendCloseDefinition(); 
     365 
     366    // We have a xml tree on the server side and now, it should be also processed 
     367    if (hasClient && !hasServer) sendPostProcessing(); 
     368 
     369    // There are some processings that should be done after all of above. For example: check mask or index 
     370    if (hasClient && !hasServer) 
     371    { 
     372      this->solveAllRefOfEnabledFields(true); 
     373      this->buildAllExpressionOfEnabledFields(); 
     374    } 
     375 
     376//      if (hasClient) 
     377//      { 
     378//        //solveCalendar(); 
     379// 
     380//        // Résolution des héritages pour le context actuel. 
     381////        this->solveAllInheritance(); 
     382// 
     383// 
     384////        //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 
     385////        this->findEnabledFiles(); 
     386// 
     387//        this->processEnabledFiles() ; 
     388// 
     389//        this->solveAllGridRef(); 
     390//      } 
     391 
     392 
     393 
     394 
     395//      solveCalendar(); 
     396// 
     397//      // Résolution des héritages pour le context actuel. 
     398//      this->solveAllInheritance(); 
     399// 
     400//      //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 
     401//      this->findEnabledFiles(); 
     402// 
     403// 
     404//      this->processEnabledFiles() ; 
     405 
     406/* 
    312407      //Recherche des champs à sortir (enable à true + niveau de sortie correct) 
    313408      // pour chaque fichier précédemment listé. 
     
    324419*/ 
    325420      // Nettoyage de l'arborescence 
    326       CleanTree(); 
     421      if (hasClient && !hasServer) CleanTree(); // Only on client side?? 
     422//      if (hasClient) CleanTree(); 
    327423      if (hasClient) sendCreateFileHeader() ; 
    328424   } 
    329     
     425 
    330426   void CContext::findAllEnabledFields(void) 
    331427   { 
     
    333429     (void)this->enabledFiles[i]->getEnabledFields(); 
    334430   } 
    335     
    336     void CContext::processEnabledFiles(void) 
    337    { 
    338      for (unsigned int i = 0; i < this->enabledFiles.size(); i++) 
    339      this->enabledFiles[i]->processEnabledFile(); 
    340    } 
    341    
    342  
    343    void CContext::solveAllGridRef(void) 
    344    { 
    345      for (unsigned int i = 0; i < this->enabledFiles.size(); i++) 
    346      this->enabledFiles[i]->solveEFGridRef(); 
    347    } 
    348  
    349    void CContext::solveAllOperation(void) 
    350    { 
    351       for (unsigned int i = 0; i < this->enabledFiles.size(); i++) 
    352       this->enabledFiles[i]->solveEFOperation(); 
    353    } 
    354  
    355    void CContext::solveAllExpression(void) 
    356    { 
    357       for (unsigned int i = 0; i < this->enabledFiles.size(); i++) 
    358       this->enabledFiles[i]->solveEFExpression(); 
    359    } 
    360     
     431 
     432//    void CContext::processEnabledFiles(void) 
     433//   { 
     434//     for (unsigned int i = 0; i < this->enabledFiles.size(); i++) 
     435//     this->enabledFiles[i]->processEnabledFile(); 
     436//   } 
     437 
     438 
     439   void CContext::solveAllRefOfEnabledFields(bool sendToServer) 
     440   { 
     441     int size = this->enabledFiles.size(); 
     442     for (int i = 0; i < size; ++i) 
     443     { 
     444       this->enabledFiles[i]->solveAllRefOfEnabledFields(sendToServer); 
     445     } 
     446   } 
     447 
     448   void CContext::buildAllExpressionOfEnabledFields() 
     449   { 
     450     int size = this->enabledFiles.size(); 
     451     for (int i = 0; i < size; ++i) 
     452     { 
     453       this->enabledFiles[i]->buildAllExpressionOfEnabledFields(); 
     454     } 
     455   } 
     456 
     457//   void CContext::solveAllGridRef(void) 
     458//   { 
     459//     for (unsigned int i = 0; i < this->enabledFiles.size(); i++) 
     460//     this->enabledFiles[i]->solveEFGridRef(); 
     461//   } 
     462// 
     463//   void CContext::solveAllOperation(void) 
     464//   { 
     465//      for (unsigned int i = 0; i < this->enabledFiles.size(); i++) 
     466//      this->enabledFiles[i]->solveEFOperation(); 
     467//   } 
     468// 
     469//   void CContext::solveAllExpression(void) 
     470//   { 
     471//      for (unsigned int i = 0; i < this->enabledFiles.size(); i++) 
     472//      this->enabledFiles[i]->solveEFExpression(); 
     473//   } 
     474 
    361475   void CContext::solveAllInheritance(bool apply) 
    362476   { 
     
    368482      const vector<CFile*> allFiles=CFile::getAll() ; 
    369483 
     484     if (hasClient && !hasServer) 
    370485      for (unsigned int i = 0; i < allFiles.size(); i++) 
    371486         allFiles[i]->solveFieldRefInheritance(apply); 
     
    383498         } 
    384499         else enabledFiles.push_back(allFiles[i]); // otherwise true by default 
    385                 
     500 
    386501 
    387502      if (enabledFiles.size() == 0) 
     
    394509     std::vector<CFile*>::const_iterator 
    395510            it = this->enabledFiles.begin(), end = this->enabledFiles.end(); 
    396           
     511 
    397512     for (; it != end; it++) 
    398513     { 
     
    401516     } 
    402517   } 
    403     
     518 
     519   /*! 
     520   \brief Dispatch event received from client 
     521      Whenever a message is received in buffer of server, it will be processed depending on 
     522   its event type. A new event type should be added in the switch list to make sure 
     523   it processed on server side. 
     524   \param [in] event: Received message 
     525   */ 
    404526   bool CContext::dispatchEvent(CEventServer& event) 
    405527   { 
    406        
     528 
    407529      if (SuperClass::dispatchEvent(event)) return true ; 
    408530      else 
     
    422544             return true ; 
    423545             break ; 
     546           case EVENT_ID_POST_PROCESS: 
     547             recvPostProcessing(event) ; 
     548             return true ; 
     549             break ; 
    424550           default : 
    425551             ERROR("bool CContext::dispatchEvent(CEventServer& event)", 
     
    429555      } 
    430556   } 
    431     
     557 
     558   //! Client side: Send a message to server to make it close 
    432559   void CContext::sendCloseDefinition(void) 
    433560   { 
    434  
    435      CEventClient event(getType(),EVENT_ID_CLOSE_DEFINITION) ;    
     561     CEventClient event(getType(),EVENT_ID_CLOSE_DEFINITION) ; 
    436562     if (client->isServerLeader()) 
    437563     { 
     
    443569     else client->sendEvent(event) ; 
    444570   } 
    445     
     571 
     572   //! Server side: Receive a message of client announcing a context close 
    446573   void CContext::recvCloseDefinition(CEventServer& event) 
    447574   { 
    448        
     575 
    449576      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    450577      string id; 
    451578      *buffer>>id ; 
    452       get(id)->closeDefinition() ; 
    453    } 
    454     
     579      get(id)->closeDefinition(); 
     580   } 
     581 
     582   //! Client side: Send a message to update calendar in each time step 
    455583   void CContext::sendUpdateCalendar(int step) 
    456584   { 
    457585     if (!hasServer) 
    458586     { 
    459        CEventClient event(getType(),EVENT_ID_UPDATE_CALENDAR) ;    
     587       CEventClient event(getType(),EVENT_ID_UPDATE_CALENDAR) ; 
    460588       if (client->isServerLeader()) 
    461589       { 
     
    468596     } 
    469597   } 
    470     
     598 
     599   //! Server side: Receive a message of client annoucing calendar update 
    471600   void CContext::recvUpdateCalendar(CEventServer& event) 
    472601   { 
    473        
     602 
    474603      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    475604      string id; 
     
    477606      get(id)->recvUpdateCalendar(*buffer) ; 
    478607   } 
    479     
     608 
     609   //! Server side: Receive a message of client annoucing calendar update 
    480610   void CContext::recvUpdateCalendar(CBufferIn& buffer) 
    481611   { 
     
    484614      updateCalendar(step) ; 
    485615   } 
    486     
     616 
     617   //! Client side: Send a message to create header part of netcdf file 
    487618   void CContext::sendCreateFileHeader(void) 
    488619   { 
    489  
    490      CEventClient event(getType(),EVENT_ID_CREATE_FILE_HEADER) ;    
     620     CEventClient event(getType(),EVENT_ID_CREATE_FILE_HEADER) ; 
    491621     if (client->isServerLeader()) 
    492622     { 
     
    498628     else client->sendEvent(event) ; 
    499629   } 
    500     
     630 
     631   //! Server side: Receive a message of client annoucing the creation of header part of netcdf file 
    501632   void CContext::recvCreateFileHeader(CEventServer& event) 
    502633   { 
    503        
    504634      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    505635      string id; 
     
    507637      get(id)->recvCreateFileHeader(*buffer) ; 
    508638   } 
    509     
     639 
     640   //! Server side: Receive a message of client annoucing the creation of header part of netcdf file 
    510641   void CContext::recvCreateFileHeader(CBufferIn& buffer) 
    511642   { 
    512643      createFileHeader() ; 
    513644   } 
    514     
     645 
     646   //! Client side: Send a message to do some post processing on server 
     647   void CContext::sendPostProcessing() 
     648   { 
     649     if (!hasServer) 
     650     { 
     651       CEventClient event(getType(),EVENT_ID_POST_PROCESS) ; 
     652       if (client->isServerLeader()) 
     653       { 
     654         CMessage msg ; 
     655         msg<<this->getId(); 
     656         event.push(client->getServerLeader(),1,msg) ; 
     657         client->sendEvent(event) ; 
     658       } 
     659       else client->sendEvent(event) ; 
     660     } 
     661   } 
     662 
     663   //! Server side: Receive a message to do some post processing 
     664   void CContext::recvPostProcessing(CEventServer& event) 
     665   { 
     666      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     667      string id; 
     668      *buffer>>id; 
     669      get(id)->recvPostProcessing(*buffer); 
     670   } 
     671 
     672   //! Server side: Receive a message to do some post processing 
     673   void CContext::recvPostProcessing(CBufferIn& buffer) 
     674   { 
     675      postProcessing(); 
     676   } 
     677 
     678   /*! 
     679   \brief Do some simple post processings after parsing xml file 
     680      After the xml file (iodef.xml) is parsed, it is necessary to build all relations among 
     681   created object, e.g: inhertance among fields, domain, axis. After that, all fiels as well as their parents (reference fields), 
     682   which will be written out into netcdf files, are processed 
     683   */ 
     684   void CContext::postProcessing() 
     685   { 
     686     if (isPostProcessed) return; 
     687 
     688     this->solveCalendar(); 
     689 
     690     // Solve calendar for both side: client and server 
     691      this->solveCalendar(); 
     692 
     693      // Find all inheritance in xml structure 
     694      this->solveAllInheritance(); 
     695 
     696      //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 
     697      this->findEnabledFiles(); 
     698 
     699      // Find all enabled fields of each file 
     700      this->findAllEnabledFields(); 
     701 
     702      // Search and rebuild all reference object of enabled fields 
     703      this->solveAllRefOfEnabledFields(false); 
     704      isPostProcessed = true; 
     705   } 
     706 
     707   std::map<int, StdSize>& CContext::getDataSize() 
     708   { 
     709     std::set<StdString> domainIds; 
     710 
     711     // Find all reference domain and axis of all active fields 
     712     int numEnabledFiles = this->enabledFiles.size(); 
     713     for (int i = 0; i < numEnabledFiles; ++i) 
     714     { 
     715       std::vector<CField*> enabledFields = this->enabledFiles[i]->getEnabledFields(); 
     716       int numEnabledFields = enabledFields.size(); 
     717       for (int j = 0; j < numEnabledFields; ++j) 
     718       { 
     719         const std::pair<StdString, StdString>& prDomAxisId = enabledFields[j]->getDomainAxisIds(); 
     720         const std::map<int, StdSize> mapSize = enabledFields[j]->getGridDataSize(); 
     721         if (dataSize_.empty()) 
     722         { 
     723           dataSize_ = mapSize; 
     724           domainIds.insert(prDomAxisId.first); 
     725         } 
     726         else 
     727         { 
     728           if (domainIds.find(prDomAxisId.first) == domainIds.end()) 
     729           { 
     730             std::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end(); 
     731             for (; it != itE; ++it) 
     732             { 
     733               if (0 < dataSize_.count(it->first)) dataSize_[it->first] += it->second; 
     734               else dataSize_.insert(make_pair(it->first, it->second)); 
     735             } 
     736           } 
     737 
     738         } 
     739 
     740       } 
     741     } 
     742 
     743     return dataSize_; 
     744   } 
     745 
     746   //! Client side: Send infomation of active files (files are enabled to write out) 
     747   void CContext::sendEnabledFiles() 
     748   { 
     749     int size = this->enabledFiles.size(); 
     750 
     751     // In a context, each type has a root definition, e.g: axis, domain, field. 
     752     // Every object must be a child of one of these root definition. In this case 
     753     // all new file objects created on server must be children of the root "file_definition" 
     754     StdString fileDefRoot("file_definition"); 
     755     CFileGroup* cfgrpPtr = CFileGroup::get(fileDefRoot); 
     756 
     757     for (int i = 0; i < size; ++i) 
     758     { 
     759       cfgrpPtr->sendCreateChild(this->enabledFiles[i]->getId()); 
     760       this->enabledFiles[i]->sendAllAttributesToServer(); 
     761       this->enabledFiles[i]->sendAddAllVariables(); 
     762     } 
     763   } 
     764 
     765   //! Client side: Send information of active fields (ones are written onto files) 
     766   void CContext::sendEnabledFields() 
     767   { 
     768     int size = this->enabledFiles.size(); 
     769     for (int i = 0; i < size; ++i) 
     770     { 
     771       this->enabledFiles[i]->sendEnabledFields(); 
     772     } 
     773   } 
     774 
     775   //! Client side: Send information of reference grid of active fields 
     776   void CContext::sendRefGrid() 
     777   { 
     778     std::set<StdString> gridIds; 
     779     int sizeFile = this->enabledFiles.size(); 
     780     CFile* filePtr(NULL); 
     781 
     782     // Firstly, find all reference grids of all active fields 
     783     for (int i = 0; i < sizeFile; ++i) 
     784     { 
     785       filePtr = this->enabledFiles[i]; 
     786       std::vector<CField*> enabledFields = filePtr->getEnabledFields(); 
     787       int sizeField = enabledFields.size(); 
     788       for (int numField = 0; numField < sizeField; ++numField) 
     789       { 
     790         if (0 != enabledFields[numField]->getRelGrid()) 
     791           gridIds.insert(CGrid::get(enabledFields[numField]->getRelGrid())->getId()); 
     792       } 
     793     } 
     794 
     795     // Create all reference grids on server side 
     796     StdString gridDefRoot("grid_definition"); 
     797     CGridGroup* gridPtr = CGridGroup::get(gridDefRoot); 
     798     std::set<StdString>::const_iterator it, itE = gridIds.end(); 
     799     for (it = gridIds.begin(); it != itE; ++it) 
     800     { 
     801       gridPtr->sendCreateChild(*it); 
     802       CGrid::get(*it)->sendAllAttributesToServer(); 
     803     } 
     804   } 
     805 
     806 
     807   //! Client side: Send information of reference domain and axis of active fields 
     808   void CContext::sendRefDomainsAxis() 
     809   { 
     810     std::set<StdString> domainIds; 
     811     std::set<StdString> axisIds; 
     812 
     813     // Find all reference domain and axis of all active fields 
     814     int numEnabledFiles = this->enabledFiles.size(); 
     815     for (int i = 0; i < numEnabledFiles; ++i) 
     816     { 
     817       std::vector<CField*> enabledFields = this->enabledFiles[i]->getEnabledFields(); 
     818       int numEnabledFields = enabledFields.size(); 
     819       for (int j = 0; j < numEnabledFields; ++j) 
     820       { 
     821         const std::pair<StdString, StdString>& prDomAxisId = enabledFields[j]->getDomainAxisIds(); 
     822         domainIds.insert(prDomAxisId.first); 
     823         axisIds.insert(prDomAxisId.second); 
     824       } 
     825     } 
     826 
     827     // Create all reference axis on server side 
     828     std::set<StdString>::iterator itDom, itAxis; 
     829     std::set<StdString>::const_iterator itE; 
     830 
     831     StdString axiDefRoot("axis_definition"); 
     832     CAxisGroup* axisPtr = CAxisGroup::get(axiDefRoot); 
     833     itE = axisIds.end(); 
     834     for (itAxis = axisIds.begin(); itAxis != itE; ++itAxis) 
     835     { 
     836       axisPtr->sendCreateChild(*itAxis); 
     837       CAxis::get(*itAxis)->sendAllAttributesToServer(); 
     838     } 
     839 
     840     // Create all reference domains on server side 
     841     StdString domDefRoot("domain_definition"); 
     842     CDomainGroup* domPtr = CDomainGroup::get(domDefRoot); 
     843     itE = domainIds.end(); 
     844     for (itDom = domainIds.begin(); itDom != itE; ++itDom) 
     845     { 
     846       domPtr->sendCreateChild(*itDom); 
     847       CDomain::get(*itDom)->sendAllAttributesToServer(); 
     848     } 
     849   } 
     850 
     851   //! Update calendar in each time step 
    515852   void CContext::updateCalendar(int step) 
    516853   { 
     
    519856      info(50)<<"updateCalendar : after : "<<calendar->getCurrentDate()<<endl ; 
    520857   } 
    521   
     858 
     859   //! Server side: Create header of netcdf file 
    522860   void CContext::createFileHeader(void ) 
    523861   { 
    524862      vector<CFile*>::const_iterator it ; 
    525           
     863 
    526864      for (it=enabledFiles.begin(); it != enabledFiles.end(); it++) 
    527865      { 
    528866         (*it)->initFile(); 
    529867      } 
    530    }  
    531     
     868   } 
     869 
     870   //! Get current context 
    532871   CContext* CContext::getCurrent(void) 
    533872   { 
    534873     return CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()).get() ; 
    535874   } 
    536     
     875 
     876   /*! 
     877   \brief Set context with an id be the current context 
     878   \param [in] id identity of context to be set to current 
     879   */ 
    537880   void CContext::setCurrent(const string& id) 
    538881   { 
     
    540883     CGroupFactory::SetCurrentContextId(id); 
    541884   } 
    542     
     885 
     886  /*! 
     887  \brief Create a context with specific id 
     888  \param [in] id identity of new context 
     889  \return pointer to the new context or already-existed one with identity id 
     890  */ 
    543891  CContext* CContext::create(const StdString& id) 
    544892  { 
    545893    CContext::setCurrent(id) ; 
    546   
     894 
    547895    bool hasctxt = CContext::has(id); 
    548896    CContext* context = CObjectFactory::CreateObject<CContext>(id).get(); 
  • XIOS/trunk/src/node/context.hpp

    r501 r509  
    1818   class CContextClient ; 
    1919   class CContextServer ; 
    20     
    21     
     20 
     21 
    2222   /// ////////////////////// Déclarations ////////////////////// /// 
    2323   class CContextGroup; 
     
    3333 
    3434   ///-------------------------------------------------------------- 
    35  
     35  /*! 
     36  \class CContext 
     37   This class corresponds to the concrete presentation of context in xml file and in play an essential role in XIOS 
     38   Each object of this class contains all root definition of elements: files, fiels, domains, axis, etc, ... from which 
     39   we can have access to each element. 
     40   In fact, every thing must a be inside a particuliar context. After the xml file (iodef.xml) is parsed, 
     41   object of the class is created and its contains all information of other elements in the xml file. 
     42  */ 
    3643   class CContext 
    3744      : public CObjectTemplate<CContext> 
     
    4249         { 
    4350           EVENT_ID_CLOSE_DEFINITION,EVENT_ID_UPDATE_CALENDAR, 
    44            EVENT_ID_CREATE_FILE_HEADER,EVENT_ID_CONTEXT_FINALIZE 
     51           EVENT_ID_CREATE_FILE_HEADER,EVENT_ID_CONTEXT_FINALIZE, 
     52           EVENT_ID_POST_PROCESS 
    4553         } ; 
    46           
     54 
    4755         /// typedef /// 
    4856         typedef CObjectTemplate<CContext>   SuperClass; 
     
    7078 
    7179      public : 
    72        
     80 
    7381         /// Mutateurs /// 
    7482         void setCalendar(boost::shared_ptr<CCalendar> newCalendar); 
    75        
     83 
    7684         /// Accesseurs /// 
    7785         boost::shared_ptr<CCalendar>      getCalendar(void) const; 
    7886 
    79          /// Accesseurs statiques /// 
    80          static StdString GetName(void); 
    81          static StdString GetDefName(void);          
    82          static ENodeType GetType(void);          
    83  
    84          static CContextGroup* GetContextGroup(void); 
    85  
    86       public : 
    87  
    88          /// Traitements /// 
    89          virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); 
    90          void solveFieldRefInheritance(bool apply); 
    91          void solveCalendar(void); 
    92  
    93          /// Autres méthodes statiques /// 
    94          static void ShowTree(StdOStream & out = std::clog); 
    95          static void CleanTree(void); 
    96  
    97          /// Test /// 
    98          virtual bool hasChild(void) const; 
    99  
     87      public : 
     88         // Initialize server or client 
     89         void initServer(MPI_Comm intraComm, MPI_Comm interComm) ; 
     90         void initClient(MPI_Comm intraComm, MPI_Comm interComm) ; 
     91         bool isInitialized(void) ; 
     92 
     93         // Put sever or client into loop state 
    10094         bool eventLoop(void) ; 
    10195         bool serverLoop(void) ; 
    10296         void clientLoop(void) ; 
    103          void initServer(MPI_Comm intraComm, MPI_Comm interComm) ; 
    104          void initClient(MPI_Comm intraComm, MPI_Comm interComm) ; 
    105          bool isInitialized(void) ; 
    106          CContextServer* server ; 
    107          CContextClient* client ; 
    108          bool hasClient ; 
    109          bool hasServer ; 
     97 
     98         // Process all information of calendar 
     99         void solveCalendar(void); 
     100 
     101         // Finalize a context 
    110102         void finalize(void) ; 
    111103         void closeDefinition(void) ; 
     104 
     105         // Some functions to process context 
    112106         void findAllEnabledFields(void); 
    113107         void processEnabledFiles(void) ; 
    114          void solveAllGridRef(void); 
    115          void solveAllOperation(void); 
    116          void solveAllExpression(void); 
    117108         void solveAllInheritance(bool apply=true) ; 
    118109         void findEnabledFiles(void); 
     
    120111         void updateCalendar(int step) ; 
    121112         void createFileHeader(void ) ; 
    122       // dispatch event 
    123          static bool dispatchEvent(CEventServer& event) ; 
     113         void solveAllRefOfEnabledFields(bool sendToServer); 
     114         void buildAllExpressionOfEnabledFields(); 
     115         void postProcessing(); 
     116 
     117         std::map<int, StdSize>& getDataSize(); 
     118         void setClientServerBuffer(); 
     119 
     120         // Send context close definition 
    124121         void sendCloseDefinition(void) ; 
     122         // There are something to send on closing context defintion 
    125123         void sendUpdateCalendar(int step) ; 
    126124         void sendCreateFileHeader(void) ; 
     125         void sendEnabledFiles(); 
     126         void sendEnabledFields(); 
     127         void sendRefDomainsAxis(); 
     128         void sendRefGrid(); 
     129         void sendPostProcessing(); 
     130 
     131         // Client side: Receive and process messages 
    127132         static void recvUpdateCalendar(CEventServer& event) ; 
    128133         void recvUpdateCalendar(CBufferIn& buffer) ; 
     
    130135         static void recvCreateFileHeader(CEventServer& event) ; 
    131136         void recvCreateFileHeader(CBufferIn& buffer) ; 
    132          static CContext* getCurrent(void) ; 
    133          static CContextGroup* getRoot(void) ; 
    134          static void setCurrent(const string& id) ; 
    135          static CContext* create(const string& id = "") ; 
    136           
    137       public : 
    138        
    139          /// Autres /// 
     137         static void recvSolveInheritanceContext(CEventServer& event); 
     138         void recvSolveInheritanceContext(CBufferIn& buffer); 
     139         static void recvPostProcessing(CEventServer& event); 
     140         void recvPostProcessing(CBufferIn& buffer); 
     141 
     142         // dispatch event 
     143         static bool dispatchEvent(CEventServer& event) ; 
     144 
     145      public: 
     146        // Get current context 
     147        static CContext* getCurrent(void); 
     148 
     149        // Get context root 
     150        static CContextGroup* getRoot(void); 
     151 
     152        // Set current context 
     153        static void setCurrent(const string& id); 
     154 
     155        // Create new context 
     156        static CContext* create(const string& id = ""); 
     157 
     158        /// Accesseurs statiques /// 
     159        static StdString GetName(void); 
     160        static StdString GetDefName(void); 
     161        static ENodeType GetType(void); 
     162 
     163        static CContextGroup* GetContextGroup(void); 
     164 
     165        // Some functions to visualize structure of current context 
     166        static void ShowTree(StdOStream & out = std::clog); 
     167        static void CleanTree(void); 
     168 
     169      public : 
     170         // Parse xml node and write all info into context 
    140171         virtual void parse(xml::CXMLNode & node); 
    141172 
     173         // Visualize a context 
    142174         virtual StdString toString(void) const; 
    143 //         virtual void toBinary  (StdOStream & os) const; 
    144 //         virtual void fromBinary(StdIStream & is); 
    145           
    146       public : 
    147        
    148          boost::shared_ptr<CCalendar>      calendar; 
    149   
     175 
     176 
     177         // Solve all inheritance relation in current context 
     178         virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); 
     179 
     180         // Verify if all root definition in a context have children 
     181         virtual bool hasChild(void) const; 
     182 
     183      public : 
     184         // Calendar of context 
     185         boost::shared_ptr<CCalendar>   calendar; 
     186 
     187         // List of all enabled files (files on which fields are written) 
    150188         std::vector<CFile*> enabledFiles; 
     189 
     190         // Context root 
    151191         static shared_ptr<CContextGroup> root ; 
    152192 
     193         // Determine context on client or not 
     194         bool hasClient ; 
     195 
     196         // Determine context on server or not 
     197         bool hasServer ; 
     198 
     199         // Concrete context server 
     200         CContextServer* server ; 
     201 
     202         // Concrete contex client 
     203         CContextClient* client ; 
     204 
     205      private: 
     206         bool isPostProcessed; 
     207         std::map<int, StdSize> dataSize_; 
     208 
     209 
     210      public: // Some function maybe removed in the near future 
     211        // virtual void toBinary  (StdOStream & os) const; 
     212        // virtual void fromBinary(StdIStream & is); 
     213        // void solveAllGridRef(void); 
     214        // void solveAllOperation(void); 
     215        // void solveAllExpression(void); 
     216        // void solveFieldRefInheritance(bool apply); 
    153217 
    154218   }; // class CContext 
  • XIOS/trunk/src/node/domain.cpp

    r501 r509  
    1616 
    1717namespace xios { 
    18     
     18 
    1919   /// ////////////////////// Définitions ////////////////////// /// 
    2020 
    2121   CDomain::CDomain(void) 
    2222      : CObjectTemplate<CDomain>(), CDomainAttributes() 
    23       , isChecked(false),  relFiles() 
     23      , isChecked(false), relFiles(), isClientChecked(false) 
    2424   { /* Ne rien faire de plus */ } 
    2525 
    2626   CDomain::CDomain(const StdString & id) 
    2727      : CObjectTemplate<CDomain>(id), CDomainAttributes() 
    28       , isChecked(false), relFiles() 
     28      , isChecked(false), relFiles(), isClientChecked(false) 
    2929         { /* Ne rien faire de plus */ } 
    3030 
    3131   CDomain::~CDomain(void) 
    32    {  
     32   { 
    3333   } 
    3434 
     
    3737   const std::set<StdString> & CDomain::getRelFiles(void) const 
    3838   { 
    39       return (this->relFiles);  
    40    } 
    41  
    42    //---------------------------------------------------------------- 
    43     
     39      return (this->relFiles); 
     40   } 
     41 
     42   //---------------------------------------------------------------- 
     43 
    4444   bool CDomain::hasZoom(void) const 
    4545   { 
    46       return ((this->zoom_ni.getValue() != this->ni_glo.getValue()) &&  
     46      return ((this->zoom_ni.getValue() != this->ni_glo.getValue()) && 
    4747              (this->zoom_nj.getValue() != this->nj_glo.getValue())); 
    4848   } 
    49     
    50    //---------------------------------------------------------------- 
    51     
     49 
     50   //---------------------------------------------------------------- 
     51 
    5252   bool CDomain::isEmpty(void) const 
    5353   { 
    54       return ((this->zoom_ni_srv == 0) ||  
     54      return ((this->zoom_ni_srv == 0) || 
    5555              (this->zoom_nj_srv == 0)); 
    5656   } 
     
    8686               << "[ Id = " << this->getId() << " ] " 
    8787               << "The global domain is badly defined," 
    88                << " check the \'ni_glo\'  value !")  
     88               << " check the \'ni_glo\'  value !") 
    8989         } 
    9090         nj_glo=ni_glo ; 
     
    111111         ibegin=1 ; 
    112112         iend=1 ; 
    113           
     113 
    114114      } 
    115115      else if ((ni_glo.isEmpty() || ni_glo.getValue() <= 0 ) || 
     
    119119               << "[ Id = " << this->getId() << " ] " 
    120120               << "The global domain is badly defined," 
    121                << " check the \'ni_glo\' et \'nj_glo\' values !")  
     121               << " check the \'ni_glo\' et \'nj_glo\' values !") 
    122122      } 
    123123      checkLocalIDomain() ; 
    124124      checkLocalJDomain() ; 
    125        
     125 
    126126     if (i_index.isEmpty()) 
    127127     { 
    128128       i_index.resize(ni,nj) ; 
    129129       for(int j=0;j<nj;j++) 
    130          for(int i=0;i<ni;i++) i_index(i,j)=i ;    
     130         for(int i=0;i<ni;i++) i_index(i,j)=i ; 
    131131     } 
    132       
     132 
    133133     if (j_index.isEmpty()) 
    134134     { 
    135135        j_index.resize(ni,nj) ; 
    136136        for(int j=0;j<nj;j++) 
    137          for(int i=0;i<ni;i++) j_index(i,j)=j ;    
     137         for(int i=0;i<ni;i++) j_index(i,j)=j ; 
    138138     } 
    139   
     139 
    140140   } 
    141141 
     
    211211               << "Domain is wrong defined," 
    212212               << " Check the values : nj, nj_glo, jbegin, jend") ; 
    213                 
     213 
    214214     ibegin_client=ibegin ; iend_client=iend ; ni_client=ni ; 
    215215     jbegin_client=jbegin ; jend_client=jend ; nj_client=nj ; 
     
    221221   { 
    222222      using namespace std; 
    223        
     223 
    224224      int ibegin_mask = 0, 
    225225          jbegin_mask = 0, 
    226226          iend_mask = iend.getValue() - ibegin.getValue(), 
    227227          jend_mask = jend.getValue() - jbegin.getValue(); 
    228        
     228 
    229229      if (!zoom_ibegin.isEmpty()) 
    230230      { 
    231231         int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1; 
    232232         int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 
    233           
     233 
    234234         ibegin_mask = max (ibegin.getValue(), zoom_ibegin.getValue()); 
    235235         jbegin_mask = max (jbegin.getValue(), zoom_jbegin.getValue()); 
    236236         iend_mask   = min (iend.getValue(), zoom_iend); 
    237237         jend_mask   = min (jend.getValue(), zoom_jend); 
    238                   
     238 
    239239         ibegin_mask -= ibegin.getValue(); 
    240240         jbegin_mask -= jbegin.getValue(); 
     
    242242         jend_mask   -= jbegin.getValue(); 
    243243      } 
    244        
     244 
    245245 
    246246      if (!mask.isEmpty()) 
     
    251251                  <<"the mask has not the same size than the local domain"<<endl 
    252252                   <<"Local size is "<<ni<<"x"<<nj<<endl 
    253                   <<"Mask size is "<<mask.extent(0)<<"x"<<mask.extent(1));                  
     253                  <<"Mask size is "<<mask.extent(0)<<"x"<<mask.extent(1)); 
    254254         for (int i = 0; i < ni; i++) 
    255255         { 
     
    283283 
    284284   void CDomain::checkDomainData(void) 
    285    {      
     285   { 
    286286      if (!data_dim.isEmpty() && 
    287287         !(data_dim.getValue() == 1 || data_dim.getValue() == 2)) 
     
    378378            data_i_index.resize(dni) ; 
    379379            data_j_index.resize(dni) ; 
    380              
     380 
    381381            data_n_index.setValue(dni); 
    382              
     382 
    383383            for(int count = 0, j = 0; j  < data_nj.getValue(); j++) 
    384384            { 
     
    394394 
    395395   //---------------------------------------------------------------- 
    396     
     396 
    397397   void CDomain::completeLonLatClient(void) 
    398398   { 
     
    402402      CArray<double,2> bounds_lon_temp(nvertex,ni*nj) ; 
    403403      CArray<double,2> bounds_lat_temp(nvertex,ni*nj) ; 
    404        
     404 
    405405      if (type.isEmpty()) 
    406406      { 
    407         if ( lonvalue.numElements() == ni*nj && latvalue.numElements() == ni*nj )  
     407        if ( lonvalue.numElements() == ni*nj && latvalue.numElements() == ni*nj ) 
    408408        { 
    409409          type.setValue(type_attr::curvilinear) ; 
    410410          isCurvilinear=true ; 
    411411        } 
    412         else if ( lonvalue.numElements() == ni && latvalue.numElements() == nj )  
     412        else if ( lonvalue.numElements() == ni && latvalue.numElements() == nj ) 
    413413        { 
    414414          type.setValue(type_attr::regular) ; 
     
    429429      { 
    430430        for(j=0;j<nj;j++) 
    431           for(i=0;i<ni;i++)  
     431          for(i=0;i<ni;i++) 
    432432          { 
    433433            k=j*ni+i ; 
     
    436436            if (hasBounds) 
    437437            { 
    438               for(int n=0;n<nvertex;n++)  
     438              for(int n=0;n<nvertex;n++) 
    439439              { 
    440440                bounds_lon_temp(n,k)=bounds_lon(n,i) ; 
     
    444444          } 
    445445      } 
    446           
     446 
    447447      StdSize dm = zoom_ni_client * zoom_nj_client; 
    448448 
    449449      lonvalue.resize(dm); 
    450450      latvalue.resize(dm); 
    451           
     451 
    452452      for (int i = 0; i < zoom_ni_client; i++) 
    453453      { 
    454454        for (int j = 0; j < zoom_nj_client; j++) 
    455455        { 
    456           lonvalue(i + j * zoom_ni_client) = lonvalue_temp( (i + zoom_ibegin_client-ibegin) + (j + zoom_jbegin_client -jbegin)*ni );  
     456          lonvalue(i + j * zoom_ni_client) = lonvalue_temp( (i + zoom_ibegin_client-ibegin) + (j + zoom_jbegin_client -jbegin)*ni ); 
    457457          latvalue(i + j * zoom_ni_client) = latvalue_temp( (i + zoom_ibegin_client - ibegin)+(j + zoom_jbegin_client - jbegin)*ni ); 
    458458          if (hasBounds) 
    459459          { 
    460             for(int n=0;n<nvertex;n++)  
     460            for(int n=0;n<nvertex;n++) 
    461461            { 
    462               bounds_lon(n,i + j * zoom_ni_client) = bounds_lon_temp( n, (i + zoom_ibegin_client - ibegin) + (j + zoom_jbegin_client -jbegin)*ni );  
     462              bounds_lon(n,i + j * zoom_ni_client) = bounds_lon_temp( n, (i + zoom_ibegin_client - ibegin) + (j + zoom_jbegin_client -jbegin)*ni ); 
    463463              bounds_lat(n,i + j * zoom_ni_client) = bounds_lat_temp( n, (i + zoom_ibegin_client - ibegin)+(j + zoom_jbegin_client -jbegin)*ni ); 
    464464            } 
     
    467467      } 
    468468    } 
    469   
     469 
    470470 
    471471   //---------------------------------------------------------------- 
     
    487487            int zoom_iend = zoom_ibegin + zoom_ni - 1; 
    488488            int zoom_jend = zoom_jbegin + zoom_nj - 1; 
    489                  
     489 
    490490            if (zoom_ibegin < 1  || zoom_jbegin < 1 || zoom_iend > ni_glo || zoom_jend > nj_glo) 
    491491               ERROR("CDomain::checkZoom(void)", 
     
    496496      else 
    497497      { 
    498          zoom_ni = ni_glo;  
     498         zoom_ni = ni_glo; 
    499499         zoom_nj = nj_glo; 
    500500         zoom_ibegin = 1; 
    501501         zoom_jbegin = 1; 
    502502      } 
    503        
     503 
    504504      // compute client zoom indices 
    505505 
     
    510510      if (zoom_ni_client<0) zoom_ni_client=0 ; 
    511511 
    512      
     512 
    513513      int zoom_jend=zoom_jbegin+zoom_nj-1 ; 
    514514      zoom_jbegin_client = jbegin_client > zoom_jbegin ? jbegin_client : zoom_jbegin ; 
     
    518518 
    519519   } 
    520     
     520 
    521521   void CDomain::checkBounds(void) 
    522522   { 
     
    524524     { 
    525525       hasBounds=true ; 
    526         
     526 
    527527     } 
    528      else  
     528     else 
    529529     { 
    530530       hasBounds=false; 
     
    532532     } 
    533533   } 
    534              
    535    //---------------------------------------------------------------- 
    536  
    537    void CDomain::checkAttributes(void) 
    538    { 
    539       if (this->isChecked) return; 
    540       CContext* context=CContext::getCurrent() ; 
     534 
     535   //---------------------------------------------------------------- 
     536   // Divide function checkAttributes into 2 seperate ones 
     537   // This function only checks all attributes of current domain 
     538   void CDomain::checkAttributesOnClient() 
     539   { 
     540     if (this->isClientChecked) return; 
     541     CContext* context=CContext::getCurrent(); 
    541542 
    542543      this->checkDomain(); 
    543544      this->checkZoom(); 
    544545      this->checkBounds(); 
    545        
     546 
    546547      if (context->hasClient) 
    547548      { // CÃŽté client uniquement 
     
    550551         this->checkCompression(); 
    551552         this->completeLonLatClient(); 
     553         this->computeConnectedServer() ; 
    552554      } 
    553555      else 
     
    556558// ne sert plus //   this->completeLonLatServer(); 
    557559      } 
    558      
     560 
     561      this->isClientChecked = true; 
     562   } 
     563 
     564   // Send all checked attributes to server 
     565   void CDomain::sendCheckedAttributes() 
     566   { 
     567     if (!this->isClientChecked) checkAttributesOnClient(); 
     568     CContext* context=CContext::getCurrent() ; 
     569 
     570     if (this->isChecked) return; 
     571     if (context->hasClient) 
     572     { 
     573       sendServerAttribut() ; 
     574       sendLonLat() ; 
     575     } 
     576 
     577     this->isChecked = true; 
     578   } 
     579 
     580   void CDomain::checkAttributes(void) 
     581   { 
     582      if (this->isChecked) return; 
     583      CContext* context=CContext::getCurrent() ; 
     584 
     585      this->checkDomain(); 
     586      this->checkZoom(); 
     587      this->checkBounds(); 
     588 
     589      if (context->hasClient) 
     590      { // CÃŽté client uniquement 
     591         this->checkMask(); 
     592         this->checkDomainData(); 
     593         this->checkCompression(); 
     594         this->completeLonLatClient(); 
     595      } 
     596      else 
     597      { // CÃŽté serveur uniquement 
     598//         if (!this->isEmpty()) 
     599// ne sert plus //   this->completeLonLatServer(); 
     600      } 
     601 
    559602      if (context->hasClient) 
    560603      { 
     
    563606        sendLonLat() ; 
    564607      } 
    565        
     608 
    566609      this->isChecked = true; 
    567610   } 
    568     
     611 
    569612  void CDomain::sendServerAttribut(void) 
    570613  { 
     
    572615    int ibegin_srv=1 ; 
    573616    int iend_srv=ni_glo.getValue() ; 
    574       
     617 
    575618    int nj_srv ; 
    576619    int jbegin_srv ; 
    577620    int jend_srv ; 
    578      
     621 
    579622    CContext* context=CContext::getCurrent() ; 
    580623    CContextClient* client=context->client ; 
    581624    int nbServer=client->serverSize ; 
    582625    int serverRank=client->getServerLeader() ; 
    583      
     626 
    584627    jend_srv=0 ; 
    585628    for(int i=0;i<=serverRank;i++) 
     
    590633      jend_srv=jbegin_srv+nj_srv-1 ; 
    591634    } 
    592      
    593      CEventClient event(getType(),EVENT_ID_SERVER_ATTRIBUT) ;    
     635 
     636     CEventClient event(getType(),EVENT_ID_SERVER_ATTRIBUT) ; 
    594637     if (client->isServerLeader()) 
    595638     { 
     
    606649  { 
    607650    int i,j,i_ind,j_ind ; 
    608      
     651 
    609652    ibegin_client=ibegin ; iend_client=iend ; ni_client=ni ; 
    610653    jbegin_client=jbegin ; jend_client=jend ; nj_client=nj ; 
    611       
     654 
    612655    CContext* context = CContext::getCurrent() ; 
    613656    CContextClient* client=context->client ; 
     
    617660    int zoom_iend=zoom_ibegin+zoom_ni-1 ; 
    618661    int zoom_jend=zoom_jbegin+zoom_nj-1 ; 
    619      
     662 
    620663    int blockSize=nj_glo/nbServer ; 
    621664    int ns=nj_glo%nbServer ; 
    622665    int pos=ns*(blockSize+1) ; 
    623666    int serverNum ; 
    624      
     667 
    625668    mapConnectedServer.resize(ni,nj) ; 
    626669    vector<int> nbData(nbServer,0) ; 
    627670    vector<int> indServer(nbServer,-1) ; 
    628671    vector<bool> IsConnected(nbServer,false) ; 
    629      
     672 
    630673    for(j=0;j<nj;j++) 
    631674      for(i=0;i<ni;i++) 
     
    633676        i_ind=ibegin+i_index(i,j)-1 ; 
    634677        j_ind=jbegin+j_index(i,j)-1 ; 
    635          
     678 
    636679        if (j_ind<pos) serverNum=j_ind/(blockSize+1) ; 
    637680        else serverNum=ns+(j_ind-pos)/blockSize ; 
    638681        IsConnected[serverNum]=true ; 
    639                  
     682 
    640683        if (i_ind >= zoom_ibegin-1 && i_ind <= zoom_iend-1 && j_ind >= zoom_jbegin-1 && j_ind <= zoom_jend-1) 
    641684        { 
     
    647690 
    648691 
    649     for(serverNum=0 ; serverNum<nbServer ; serverNum++)  
     692    for(serverNum=0 ; serverNum<nbServer ; serverNum++) 
    650693      if (IsConnected[serverNum]) 
    651694      { 
     
    655698        nbDataSrv.push_back(nbData[serverNum]) ; 
    656699      } 
    657       
     700 
    658701     i_indSrv.resize(connectedServer.size()) ; 
    659702     j_indSrv.resize(connectedServer.size()) ; 
    660703 
    661704     for(j=0;j<nj;j++) 
    662       for(i=0;i<ni;i++)  
     705      for(i=0;i<ni;i++) 
    663706      { 
    664707        if (mapConnectedServer(i,j)>=0) 
     
    670713        } 
    671714      } 
    672            
     715 
    673716    int nbConnectedServer=connectedServer.size() ; 
    674717 
     
    677720    int* sendBuff=new int[nbConnectedServer] ; 
    678721    valarray<int> nbClient(0,client->serverSize) ; 
    679      
     722 
    680723    for(int n=0;n<nbConnectedServer;n++) sendBuff[n]=connectedServer[n] ; 
    681      
     724 
    682725    // get connected server for everybody 
    683726    MPI_Allgather(&nbConnectedServer,1,MPI_INT,recvCount,1,MPI_INT,client->intraComm) ; 
    684      
     727 
    685728    displ[0]=0 ; 
    686729    for(int n=1;n<client->clientSize;n++) displ[n]=displ[n-1]+recvCount[n-1] ; 
    687730    int recvSize=displ[client->clientSize-1]+recvCount[client->clientSize-1] ; 
    688731    int* recvBuff=new int[recvSize] ; 
    689   
    690      
     732 
     733 
    691734    MPI_Allgatherv(sendBuff,nbConnectedServer,MPI_INT,recvBuff,recvCount,displ,MPI_INT,client->intraComm) ; 
    692735    for(int n=0;n<recvSize;n++) nbClient[recvBuff[n]]++ ; 
    693      
     736 
    694737    for(int n=0;n<nbConnectedServer;n++) nbSenders.push_back(nbClient[connectedServer[n]]) ; 
    695     
     738 
    696739    delete [] recvCount ; 
    697740    delete [] displ ; 
     
    708751    // send lon lat for each connected server 
    709752    CEventClient event(getType(),EVENT_ID_LON_LAT) ; 
    710      
    711     list<shared_ptr<CMessage> > list_msg ;     
     753 
     754    list<shared_ptr<CMessage> > list_msg ; 
    712755    list< CArray<int,1>* > list_indi,list_indj ; 
    713756    list< CArray<double,1>* >list_lon,list_lat ; 
     
    723766      CArray<double,2> boundslon(nvertex,nbData) ; 
    724767      CArray<double,2> boundslat(nvertex,nbData) ; 
    725        
    726       for(n=0;n<nbData;n++)  
     768 
     769      for(n=0;n<nbData;n++) 
    727770      { 
    728771        i=i_indSrv[ns][n] ; 
    729772        j=j_indSrv[ns][n] ; 
    730773        ind=(i-(zoom_ibegin_client-1))+(j-(zoom_jbegin_client-1))*zoom_ni_client ; 
    731          
     774 
    732775        lon(n)=lonvalue(ind) ; 
    733776        lat(n)=latvalue(ind) ; 
     
    743786        indj(n)=jbegin+j_index(i-ibegin+1,j-jbegin+1)-1  ; 
    744787      } 
    745      
     788 
    746789      list_indi.push_back(new CArray<int,1>(indi.copy())) ; 
    747790      list_indj.push_back(new CArray<int,1>(indj.copy())) ; 
     
    761804 
    762805    client->sendEvent(event) ; 
    763      
    764      
     806 
     807 
    765808    for(list<CArray<int,1>* >::iterator it=list_indi.begin();it!=list_indi.end();it++) delete *it; 
    766809    for(list<CArray<int,1>* >::iterator it=list_indj.begin();it!=list_indj.end();it++) delete *it; 
     
    768811    for(list<CArray<double,1>* >::iterator it=list_lat.begin();it!=list_lat.end();it++)   delete *it; 
    769812    if (hasBounds) for(list<CArray<double,2>* >::iterator it=list_boundslon.begin();it!=list_boundslon.end();it++)   delete *it; 
    770     if (hasBounds) for(list<CArray<double,2>* >::iterator it=list_boundslat.begin();it!=list_boundslat.end();it++)   delete *it;     
    771      
     813    if (hasBounds) for(list<CArray<double,2>* >::iterator it=list_boundslat.begin();it!=list_boundslat.end();it++)   delete *it; 
     814 
    772815  } 
    773    
    774    
     816 
     817 
    775818  bool CDomain::dispatchEvent(CEventServer& event) 
    776819   { 
    777        
     820 
    778821      if (SuperClass::dispatchEvent(event)) return true ; 
    779822      else 
     
    796839      } 
    797840   } 
    798     
     841 
    799842  void CDomain::recvServerAttribut(CEventServer& event) 
    800843  { 
     
    804847    get(domainId)->recvServerAttribut(*buffer) ; 
    805848  } 
    806    
     849 
    807850  void CDomain::recvServerAttribut(CBufferIn& buffer) 
    808851  { 
     
    811854 
    812855     buffer>>ni_srv>>ibegin_srv>>iend_srv>>nj_srv>>jbegin_srv>>jend_srv; 
    813       
    814      
     856 
     857 
    815858    zoom_ibegin_srv = zoom_ibegin.getValue() > ibegin_srv ? zoom_ibegin.getValue() : ibegin_srv ; 
    816859    zoom_iend_srv = zoom_iend < iend_srv ? zoom_iend : iend_srv ; 
    817860    zoom_ni_srv=zoom_iend_srv-zoom_ibegin_srv+1 ; 
    818        
     861 
    819862    zoom_jbegin_srv = zoom_jbegin.getValue() > jbegin_srv ? zoom_jbegin.getValue() : jbegin_srv ; 
    820863    zoom_jend_srv = zoom_jend < jend_srv ? zoom_jend : jend_srv ; 
    821864    zoom_nj_srv=zoom_jend_srv-zoom_jbegin_srv+1 ; 
    822865 
    823     if (zoom_ni_srv<=0 || zoom_nj_srv<=0)  
     866    if (zoom_ni_srv<=0 || zoom_nj_srv<=0) 
    824867    { 
    825868      zoom_ibegin_srv=1 ; zoom_iend_srv=0 ; zoom_ni_srv=0 ; 
     
    830873    latvalue_srv.resize(zoom_ni_srv*zoom_nj_srv) ; 
    831874    latvalue_srv = 0. ; 
    832     if (hasBounds)  
     875    if (hasBounds) 
    833876    { 
    834877      bounds_lon_srv.resize(nvertex,zoom_ni_srv*zoom_nj_srv) ; 
     
    838881    } 
    839882  } 
    840      
     883 
    841884  void CDomain::recvLonLat(CEventServer& event) 
    842885  { 
     
    850893    } 
    851894  } 
    852    
     895 
    853896  void CDomain::recvLonLat(CBufferIn& buffer) 
    854897  { 
     
    859902    CArray<double,2> boundslon ; 
    860903    CArray<double,2> boundslat ; 
    861      
     904 
    862905    int type_int ; 
    863906    buffer>>type_int>>isCurvilinear>>indi>>indj>>lon>>lat ; 
     
    872915      lonvalue_srv(ind_srv)=lon(ind) ; 
    873916      latvalue_srv(ind_srv)=lat(ind) ; 
    874       if (hasBounds)  
    875       { 
    876         for(int nv=0;nv<nvertex;nv++)  
     917      if (hasBounds) 
     918      { 
     919        for(int nv=0;nv<nvertex;nv++) 
    877920        { 
    878921          bounds_lon_srv(nv,ind_srv)=boundslon(nv,ind) ; 
     
    883926  } 
    884927   //---------------------------------------------------------------- 
    885     
    886     
    887     
     928 
     929 
     930 
    888931   ///--------------------------------------------------------------- 
    889932 
  • XIOS/trunk/src/node/domain.hpp

    r501 r509  
    1515 
    1616namespace xios { 
    17     
     17 
    1818   /// ////////////////////// Déclarations ////////////////////// /// 
    1919 
     
    3939           EVENT_ID_SERVER_ATTRIBUT, EVENT_ID_LON_LAT 
    4040         } ; 
    41           
     41 
    4242         /// typedef /// 
    4343         typedef CObjectTemplate<CDomain>   SuperClass; 
     
    5858         void checkAttributes(void); 
    5959 
     60         void checkAttributesOnClient(); 
     61 
     62         void sendCheckedAttributes(); 
     63 
    6064      private : 
    6165 
     
    6872         void checkDomainData(void); 
    6973         void checkCompression(void); 
    70           
     74 
    7175         void checkZoom(void); 
    7276         void checkBounds(void); 
     
    7478 
    7579      public : 
    76        
     80 
    7781         /// Autres /// 
    7882 
     
    8488         bool hasZoom(void) const; 
    8589         bool isEmpty(void) const; 
    86           
    87           
     90 
     91 
    8892         int ni_client,ibegin_client,iend_client ; 
    8993         int zoom_ni_client,zoom_ibegin_client,zoom_iend_client ; 
     
    100104         CArray<double, 1> lonvalue_srv, latvalue_srv ; 
    101105         CArray<double, 2> bounds_lon_srv, bounds_lat_srv ; 
    102           
    103           
    104         vector<int> connectedServer ; // list of connected server  
     106 
     107 
     108        vector<int> connectedServer ; // list of connected server 
    105109        vector<int> nbSenders ; // for each communication with a server, number of communicating client 
    106         vector<int> nbDataSrv ; // size of data to send to each server  
     110        vector<int> nbDataSrv ; // size of data to send to each server 
    107111        vector< vector<int> > i_indSrv ; // for each server, i global index to send 
    108112        vector< vector<int> > j_indSrv ; // for each server, j global index to send 
    109         
     113 
    110114        CArray<int,2> mapConnectedServer ;  // (ni,nj) => mapped to connected server number, -1 if no server is target 
    111                 
     115 
    112116//        vector<int> ib_srv, ie_srv, in_srv ; 
    113117//        vector<int> jb_srv, je_srv, jn_srv ; 
    114           
     118 
    115119      public : 
    116        
     120 
    117121         /// Mutateur /// 
    118122         void addRelFile(const StdString & filename); 
     
    126130         void recvLonLat(CBufferIn& buffer) ; 
    127131         void recvServerAttribut(CBufferIn& buffer) ; 
    128           
     132 
    129133         /// Destructeur /// 
    130134         virtual ~CDomain(void); 
     
    133137         static StdString GetName(void); 
    134138         static StdString GetDefName(void); 
    135           
     139 
    136140         static ENodeType GetType(void); 
    137141 
     
    144148         bool isChecked; 
    145149         std::set<StdString> relFiles; 
     150         bool isClientChecked; // Verify whether all attributes of domain on the client side is good 
    146151 
    147152   }; // class CDomain 
  • XIOS/trunk/src/node/field.cpp

    r501 r509  
    1414 
    1515namespace xios{ 
    16     
     16 
    1717   /// ////////////////////// Définitions ////////////////////// /// 
    1818 
     
    2626      , foperation(), hasInstantData(false), hasExpression(false) 
    2727      , active(false) , hasOutputFile(false),hasFieldOut(false), slotUpdateDate(NULL) 
    28       , processed(false) 
     28      , processed(false), domAxisIds_("",""), areAllReferenceSolved(false), areAllExpressionBuilt(false) 
    2929      { setVirtualVariableGroup() ; } 
    3030 
     
    3838      , foperation(), hasInstantData(false), hasExpression(false) 
    3939      , active(false), hasOutputFile(false), hasFieldOut(false), slotUpdateDate(NULL) 
    40       , processed(false) 
     40      , processed(false), domAxisIds_("",""), areAllReferenceSolved(false), areAllExpressionBuilt(false) 
    4141   { setVirtualVariableGroup() ; } 
    4242 
     
    4848      if (hasExpression) delete expression ; 
    4949      if (slotUpdateDate!=NULL) delete slotUpdateDate ; 
    50          
     50 
    5151   } 
    5252 
     
    5555 
    5656   void CField::setVirtualVariableGroup(CVariableGroup* newVVariableGroup) 
    57    {  
    58       this->vVariableGroup = newVVariableGroup;  
    59    } 
    60   
     57   { 
     58      this->vVariableGroup = newVVariableGroup; 
     59   } 
     60 
    6161   void CField::setVirtualVariableGroup(void) 
    6262   { 
    6363      this->setVirtualVariableGroup(CVariableGroup::create()); 
    6464   } 
    65    
     65 
    6666   CVariableGroup* CField::getVirtualVariableGroup(void) const 
    6767   { 
     
    6969   } 
    7070 
    71   
     71 
    7272   std::vector<CVariable*> CField::getAllVariables(void) const 
    7373   { 
    7474      return (this->vVariableGroup->getAllChildren()); 
    7575   } 
    76     
     76 
    7777   void CField::solveDescInheritance(bool apply, const CAttributeMap * const parent) 
    7878   { 
     
    8888   { 
    8989      const CDate opeDate      = *last_operation + freq_operation; 
    90       const CDate writeDate    = *last_Write     + freq_write;  
    91        
     90      const CDate writeDate    = *last_Write     + freq_write; 
     91 
    9292      if (opeDate <= currDate) 
    9393      { 
     
    9595         { 
    9696            this->data.resize(this->grid->storeIndex[0] ->numElements()); 
    97          }   
     97         } 
    9898         CArray<double,1> input(data.numElements()) ; 
    99          this->grid->inputFieldServer(storedClient, input);           
     99         this->grid->inputFieldServer(storedClient, input); 
    100100         (*this->foperation)(input); 
    101101         *last_operation = currDate; 
     
    106106         this->incrementNStep(); 
    107107         *last_Write = writeDate; 
    108          return (true);         
     108         return (true); 
    109109      } 
    110110      return (false); 
    111111   } 
    112     
     112 
    113113   bool CField::dispatchEvent(CEventServer& event) 
    114114  { 
    115       
     115 
    116116    if (SuperClass::dispatchEvent(event)) return true ; 
    117117    else 
     
    128128             return true ; 
    129129             break ; 
    130           
     130 
    131131           case EVENT_ID_ADD_VARIABLE_GROUP : 
    132132             recvAddVariableGroup(event) ; 
    133133             return true ; 
    134              break ;  
    135   
     134             break ; 
     135 
    136136        default : 
    137137          ERROR("bool CField::dispatchEvent(CEventServer& event)",<<"Unknown Event") ; 
     
    140140    } 
    141141  } 
    142    
     142 
    143143  void CField::sendUpdateData(void) 
    144144  { 
    145145    CContext* context = CContext::getCurrent() ; 
    146146    CContextClient* client=context->client ; 
    147      
     147 
    148148    CEventClient event(getType(),EVENT_ID_UPDATE_DATA) ; 
    149      
     149 
    150150    map<int,CArray<int, 1>* >::iterator it ; 
    151151    list<shared_ptr<CMessage> > list_msg ; 
    152152    list< CArray<double,1>* > list_data ; 
    153      
     153 
    154154    for(it=grid->storeIndex_toSrv.begin();it!=grid->storeIndex_toSrv.end();it++) 
    155155    { 
     
    157157      CArray<int,1>& index = *(it->second) ; 
    158158      CArray<double,1> data_tmp(index.numElements()) ; 
    159        
     159 
    160160      for(int n=0;n<data_tmp.numElements();n++) data_tmp(n)=data(index(n)) ; 
    161161      list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 
     
    165165    } 
    166166    client->sendEvent(event) ; 
    167      
     167 
    168168    for(list< CArray<double,1>* >::iterator it=list_data.begin();it!=list_data.end();it++) delete *it ; 
    169169  } 
    170    
     170 
    171171  void CField::recvUpdateData(CEventServer& event) 
    172172  { 
    173173    vector<int> ranks ; 
    174174    vector<CBufferIn*> buffers ; 
    175        
     175 
    176176    list<CEventServer::SSubEvent>::iterator it ; 
    177177    string fieldId ; 
     
    185185      buffers.push_back(buffer) ; 
    186186    } 
    187     get(fieldId)->recvUpdateData(ranks,buffers) ;    
    188   } 
    189    
     187    get(fieldId)->recvUpdateData(ranks,buffers) ; 
     188  } 
     189 
    190190  void  CField::recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers) 
    191191  { 
    192      
     192 
    193193    if (data_srv.empty()) 
    194194    { 
     
    205205    const CDate & currDate = context->getCalendar()->getCurrentDate(); 
    206206    const CDate opeDate      = *last_operation_srv + freq_operation_srv; 
    207     const CDate writeDate    = *last_Write_srv     + freq_write_srv;  
    208      
    209  
    210      
     207    const CDate writeDate    = *last_Write_srv     + freq_write_srv; 
     208 
     209 
     210 
    211211    if (opeDate <= currDate) 
    212212    { 
     
    219219      *last_operation_srv = currDate; 
    220220    } 
    221       
     221 
    222222    if (writeDate < (currDate + freq_operation_srv)) 
    223223    { 
     
    226226        this->foperation_srv[ranks[n]]->final(); 
    227227      } 
    228        
     228 
    229229      *last_Write_srv = writeDate; 
    230230      writeField() ; 
     
    232232    } 
    233233  } 
    234    
     234 
    235235  void CField::writeField(void) 
    236236  { 
     
    246246 
    247247   void CField::setRelFile(CFile* _file) 
    248    {  
     248   { 
    249249      this->file = _file; 
    250       hasOutputFile=true ;  
     250      hasOutputFile=true ; 
    251251   } 
    252252 
     
    260260 
    261261   CGrid* CField::getRelGrid(void) const 
    262    {  
    263       return (this->grid);  
     262   { 
     263      return (this->grid); 
    264264   } 
    265265 
     
    267267 
    268268   CFile* CField::getRelFile(void) const 
    269    {  
     269   { 
    270270      return (this->file); 
    271271   } 
    272     
     272 
    273273   StdSize CField::getNStep(void) const 
    274274   { 
    275275      return (this->nstep); 
    276276   } 
    277     
     277 
    278278   void CField::incrementNStep(void) 
    279279   { 
    280280      this->nstep++; 
    281281   } 
    282   
     282 
    283283   void CField::resetNStep(void) 
    284284   { 
     
    288288   //---------------------------------------------------------------- 
    289289 
     290   /*! 
     291   \brief Get pointer to direct field to which the current field refers. 
     292   */ 
    290293   CField* CField::getDirectFieldReference(void) const 
    291294   { 
     
    304307 
    305308   CField* CField::getBaseFieldReference(void) const 
    306    {  
    307       return (baseRefObject);  
    308    } 
    309  
    310    //---------------------------------------------------------------- 
    311  
    312    const std::vector<CField*>& CField::getAllReference(void) const  
    313    {  
     309   { 
     310      return (baseRefObject); 
     311   } 
     312 
     313   //---------------------------------------------------------------- 
     314 
     315   const std::vector<CField*>& CField::getAllReference(void) const 
     316   { 
    314317      return (refObject); 
    315318   } 
     
    318321 
    319322   const StdString & CField::getBaseFieldId(void) const 
    320    {  
     323   { 
    321324      return (this->getBaseFieldReference()->getId()); 
    322325   } 
    323     
    324    //---------------------------------------------------------------- 
    325     
     326 
     327   //---------------------------------------------------------------- 
     328 
    326329   const CDuration & CField::getFreqOperation(void) const 
    327330   { 
    328331      return (this->freq_operation); 
    329332   } 
    330     
     333 
    331334   //---------------------------------------------------------------- 
    332335   const CDuration & CField::getFreqWrite(void) const 
     
    334337      return (this->freq_write); 
    335338   } 
    336     
    337    //---------------------------------------------------------------- 
    338           
     339 
     340   //---------------------------------------------------------------- 
     341 
    339342   boost::shared_ptr<func::CFunctor> CField::getFieldOperation(void) const 
    340343   { 
     
    345348 
    346349   bool CField::hasDirectFieldReference(void) const 
    347    {  
    348      return (!this->field_ref.isEmpty());  
    349    } 
    350     
     350   { 
     351     return (!this->field_ref.isEmpty()); 
     352   } 
     353 
    351354   bool CField::isActive(void) const 
    352    {  
    353       return (!this->refObject.empty());  
    354    } 
    355    //---------------------------------------------------------------- 
    356     
     355   { 
     356      return (!this->refObject.empty()); 
     357   } 
     358   //---------------------------------------------------------------- 
     359 
    357360   CArray<double, 1> CField::getData(void) const 
    358361   { 
     
    376379   //---------------------------------------------------------------- 
    377380 
    378    void CField::processEnabledField(void) 
    379    { 
    380       if (!processed) 
    381       { 
    382         processed=true ; 
    383         solveRefInheritance(true) ; 
    384         solveBaseReference() ; 
    385         solveOperation() ; 
    386         solveGridReference() ; 
    387        
    388         if (hasDirectFieldReference()) baseRefObject->processEnabledField() ; 
    389         buildExpression();  
    390         active=true; 
    391       } 
    392     } 
    393  
     381//   void CField::processEnabledField(void) 
     382//   { 
     383//      if (!processed) 
     384//      { 
     385//        processed=true ; 
     386//        solveRefInheritance(true) ; 
     387//        solveBaseReference() ; 
     388//        solveOperation() ; 
     389//        solveGridReference() ; 
     390// 
     391//        if (hasDirectFieldReference()) baseRefObject->processEnabledField() ; 
     392//        buildExpression(); 
     393//        active=true; 
     394//      } 
     395//    } 
     396 
     397   void CField::solveAllReferenceEnabledField(bool doSending2Sever) 
     398   { 
     399     CContext* context = CContext::getCurrent(); 
     400     if (!areAllReferenceSolved) 
     401     { 
     402        areAllReferenceSolved = true; 
     403        if (!context->hasServer) 
     404        { 
     405          solveRefInheritance(true); 
     406          solveBaseReference(); 
     407        } 
     408 
     409        solveOperation(); 
     410        solveGridReference(); 
     411     } 
     412     solveGridDomainAxisRef(doSending2Sever); 
     413     solveCheckMaskIndex(doSending2Sever); 
     414   } 
     415 
     416   std::map<int, StdSize> CField::getGridDataSize() 
     417   { 
     418     return grid->getConnectedServerDataSize(); 
     419   } 
     420 
     421   void CField::buildAllExpressionEnabledField() 
     422   { 
     423     if (!areAllReferenceSolved) solveAllReferenceEnabledField(true); 
     424     if (!areAllExpressionBuilt) 
     425     { 
     426       areAllExpressionBuilt = true; 
     427//       solveCheckMaskIndex(true); 
     428//       solveCheckMaskIndex(); 
     429       if (hasDirectFieldReference()) baseRefObject->buildAllExpressionEnabledField(); 
     430       buildExpression(); 
     431       active=true; 
     432     } 
     433   } 
     434 
     435   /*! 
     436   \brief Searching for all reference of a field 
     437   If a field refers to (an)other field(s), we will search for all its referenced parents. 
     438   Moreover, if any father, direct or indirect (e.g: two levels up), has non-empty attributes, 
     439   all its attributes will be added to the current field 
     440   \param [in] apply Flag to specify whether current field uses attributes of its father 
     441               in case the attribute is empty (true) or its attributes are replaced by ones of its father (false) 
     442   */ 
    394443   void CField::solveRefInheritance(bool apply) 
    395444   { 
     
    397446      CField* refer_sptr; 
    398447      CField * refer_ptr = this; 
    399       
     448 
    400449      while (refer_ptr->hasDirectFieldReference()) 
    401450      { 
     
    413462         sset.insert(refer_ptr); 
    414463      } 
    415        
     464   } 
     465 
     466 
     467   /*! 
     468   \brief Only on SERVER side. Remove all field_ref from current field 
     469   On creating a new field on server side, redundant "field_ref" is still kept in the attribute list 
     470   of the current field. This function removes this from current field 
     471   */ 
     472   void CField::removeRefInheritance() 
     473   { 
     474     if (this->field_ref.isEmpty()) return; 
     475     this->clearAttribute("field_ref"); 
    416476   } 
    417477 
     
    421481      CField* refer_sptr; 
    422482      CField * refer_ptr = this; 
    423        
     483 
    424484      if (this->hasDirectFieldReference())  baseRefObject = getDirectFieldReference(); 
    425485      else  baseRefObject = CField::get(this); 
    426        
     486 
    427487      while (refer_ptr->hasDirectFieldReference()) 
    428488      { 
     
    439499         sset.insert(refer_ptr); 
    440500      } 
    441        
     501 
    442502      if (hasDirectFieldReference()) baseRefObject->addReference(this) ; 
    443503   } 
    444     
     504 
    445505   //---------------------------------------------------------------- 
    446506 
     
    448508   { 
    449509      using namespace func; 
    450        
     510 
    451511      if (!hasOutputFile && !hasFieldOut) return ; 
    452        
     512 
    453513      StdString id ; 
    454514      if (hasId()) id=getId(); 
    455515      else if (!name.isEmpty()) id=name ; 
    456516      else if (hasDirectFieldReference()) id=baseRefObject->getId() ; 
    457        
     517 
    458518      CContext* context = CContext::getCurrent(); 
    459        
     519 
    460520      if (freq_op.isEmpty()) freq_op=string("1ts") ; 
    461        
     521 
    462522      if (operation.isEmpty() ) 
    463523      { 
     
    466526               << "Impossible to define an operation for this field !"); 
    467527      } 
    468        
     528 
    469529      CDuration freq_offset_ = NoneDu; 
    470530      if (!freq_offset.isEmpty()) 
     
    475535      { 
    476536         freq_offset.setValue(NoneDu.toString()); 
    477       }   
     537      } 
    478538 
    479539//      if (CXIOSManager::GetStatus() == CXIOSManager::LOC_SERVER) 
    480540      if (context->hasServer) 
    481541      { 
    482          if (hasOutputFile)  
     542         if (hasOutputFile) 
    483543         { 
    484544           this->freq_operation_srv =CDuration::FromString(this->file->output_freq.getValue()); 
     
    493553//         this->foperation_srv     = 
    494554//             boost::shared_ptr<func::CFunctor>(new CInstant(this->data_srv)); 
    495               
    496          if (hasOutputFile)  
     555 
     556         if (hasOutputFile) 
    497557         { 
    498            const CDuration toffset = this->freq_operation_srv - freq_offset_ - context->getCalendar()->getTimeStep();  
     558           const CDuration toffset = this->freq_operation_srv - freq_offset_ - context->getCalendar()->getTimeStep(); 
    499559           *this->last_operation_srv   = *this->last_operation_srv - toffset; 
    500560         } 
    501561      } 
    502        
     562 
    503563//      if (context->hasClient) 
    504 //      {                   
     564//      { 
    505565         this->freq_operation = CDuration::FromString(freq_op.getValue()); 
    506566         if (hasOutputFile) this->freq_write     = CDuration::FromString(this->file->output_freq.getValue()); 
    507          if (hasFieldOut)  
     567         if (hasFieldOut) 
    508568         { 
    509569           this->freq_write = CDuration::FromString(this->fieldOut->freq_op.getValue()); 
     
    513573         this->last_operation = boost::shared_ptr<CDate> 
    514574                        (new CDate(context->getCalendar()->getInitDate())); 
    515                          
    516          const CDuration toffset = this->freq_operation - freq_offset_ - context->getCalendar()->getTimeStep();  
    517          *this->last_operation   = *this->last_operation - toffset;   
    518        
     575 
     576         const CDuration toffset = this->freq_operation - freq_offset_ - context->getCalendar()->getTimeStep(); 
     577         *this->last_operation   = *this->last_operation - toffset; 
     578 
    519579        if (operation.get()=="once") isOnceOperation=true ; 
    520580        else isOnceOperation=false; 
    521581        isFirstOperation=true; 
    522          
    523            
     582 
     583 
    524584#define DECLARE_FUNCTOR(MType, mtype)              \ 
    525585   if  (operation.getValue().compare(#mtype) == 0) \ 
     
    537597      return;                                      \ 
    538598   } 
    539     
     599 
    540600#include "functor_type.conf" 
    541           
     601 
    542602         ERROR("CField::solveOperation(void)", 
    543603               << "[ operation = " << operation.getValue() << "]" 
    544604               << "The operation is not defined !"); 
    545605//      } 
    546        
    547  
    548    } 
    549     
     606 
     607 
     608   } 
     609 
    550610   //---------------------------------------------------------------- 
    551611/* 
     
    598658                  << grid_ref.getValue() << "\' is wrong"); 
    599659      } 
    600        
     660 
    601661      if (grid_ref.isEmpty() &&  domain_ref.isEmpty()) 
    602662      { 
     
    605665 
    606666     } 
    607       
     667 
    608668     CType<string> goodDomain ; 
    609669     CType<string> goodAxis ; 
     
    615675     if (!domain_ref.isEmpty()) goodDomain=domain_ref ; 
    616676     if (!axis_ref.isEmpty()) goodAxis=axis_ref ; 
    617       
    618       
    619      if (goodDomain.isEmpty())  
     677 
     678 
     679     if (goodDomain.isEmpty()) 
    620680     { 
    621681       ERROR("CField::solveGridReference(void)", << "The horizontal domain for this field is not defined"); 
    622682     } 
    623      else  
     683     else 
    624684     { 
    625685       if (CDomain::has(goodDomain)) domain = CDomain::get(goodDomain) ; 
    626686       else ERROR("CField::solveGridReference(void)",<< "Reference to the domain \'"<<goodDomain.get() << "\' is wrong") ; 
    627687     } 
    628   
     688 
    629689     if (!goodAxis.isEmpty()) 
    630690     { 
     
    632692       else  ERROR("CField::solveGridReference(void)", << "Reference to the axis \'" 
    633693                  << goodAxis.get() <<"\' is wrong") ; 
    634      }  
    635      
     694     } 
     695 
    636696     bool nothingToDo=false ; 
    637       
     697 
    638698     if (!grid_ref.isEmpty()) 
    639699     { 
    640700       if (!grid->domain_ref.isEmpty() && goodDomain.get() == grid->domain_ref.get()) 
    641701         if (goodAxis.isEmpty()) nothingToDo=true ; 
    642          else if (!grid->axis_ref.isEmpty())  
     702         else if (!grid->axis_ref.isEmpty()) 
    643703                 if (grid->axis_ref.get()==goodAxis.get()) nothingToDo=true ; 
    644704     } 
    645       
     705 
    646706     if (!nothingToDo) 
    647707     { 
     
    655715         this->grid = CGrid::createGrid(domain) ; 
    656716         this->grid_ref.setValue(this->grid->getId()); 
    657        }     
     717       } 
    658718     } 
    659719 
    660      grid->solveReference() ; 
    661  
    662    } 
    663  
     720//     grid->solveReference() ; 
     721//     grid->solveDomainAxisRef(); 
     722//     grid->checkMaskIndex(); 
     723   } 
     724 
     725   void CField::solveGridDomainAxisRef(bool checkAtt) 
     726   { 
     727     grid->solveDomainAxisRef(checkAtt); 
     728   } 
     729 
     730   void CField::solveCheckMaskIndex(bool doSendingIndex) 
     731   { 
     732     grid->checkMaskIndex(doSendingIndex); 
     733   } 
    664734 
    665735   ///------------------------------------------------------------------- 
     
    680750 
    681751      std::vector<CField*> allChildren  = group->getAllChildren(); 
    682       std::vector<CField*>::iterator  
     752      std::vector<CField*>::iterator 
    683753         it = allChildren.begin(), end = allChildren.end(); 
    684        
     754 
    685755      for (; it != end; it++) 
    686756      { 
    687757         CField* child = *it; 
    688758         if (child->hasId()) owner->createChild()->field_ref.setValue(child->getId()) ; 
    689              
    690       } 
    691    } 
    692     
     759 
     760      } 
     761   } 
     762 
    693763   void CField::scaleFactorAddOffset(double scaleFactor, double addOffset) 
    694764   { 
     
    696766     for(it=data_srv.begin();it!=data_srv.end();it++) *it->second = (*it->second -addOffset) * 1./scaleFactor  ; 
    697767   } 
    698     
     768 
    699769   void CField::outputField(CArray<double,3>& fieldOut) 
    700770   { 
     
    702772      for(it=data_srv.begin();it!=data_srv.end();it++) 
    703773         grid->outputField(it->first,*it->second, fieldOut) ; 
    704        
    705    } 
    706     
     774 
     775   } 
     776 
    707777   void CField::outputField(CArray<double,2>& fieldOut) 
    708778   { 
     
    719789   { 
    720790      SuperClass::parse(node); 
    721       if (! node.getContent(this->content))  
     791      if (! node.getContent(this->content)) 
    722792      { 
    723793        if (node.goToChildElement()) 
     
    731801      } 
    732802    } 
    733      
     803 
    734804  CArray<double,1>* CField::getInstantData(void) 
    735805  { 
    736     if (!hasInstantData)  
     806    if (!hasInstantData) 
    737807    { 
    738808      instantData.resize(grid->storeIndex_client.numElements()) ; 
     
    741811    return &instantData ; 
    742812  } 
    743    
     813 
    744814  void CField::addReference(CField* field) 
    745815  { 
    746816    refObject.push_back(field) ; 
    747817  } 
    748    
     818 
    749819  void CField::addDependency(CField* field, int slotId) 
    750820  { 
    751821    fieldDependency.push_back(pair<CField*,int>(field,slotId)) ; 
    752822  } 
    753    
     823 
    754824  void CField::buildExpression(void) 
    755825  { 
    756     if (content.size() > 0)  
     826    if (content.size() > 0) 
    757827    { 
    758828      CSimpleNodeExpr* simpleExpr=parseExpr(content+'\0') ; 
     
    762832      map<string,CField*> associatedInstantFieldIds ; 
    763833      expression->getInstantFieldIds(instantFieldIds) ; 
    764       for (set<string>::iterator it=instantFieldIds.begin() ; it!=instantFieldIds.end();++it)  
    765       { 
    766         if (*it!="this")  
     834      for (set<string>::iterator it=instantFieldIds.begin() ; it!=instantFieldIds.end();++it) 
     835      { 
     836        if (*it!="this") 
    767837        { 
    768           if (CField::has(*it))  
     838          if (CField::has(*it)) 
    769839          { 
    770840            CField* field=CField::get(*it) ; 
    771             field->processEnabledField() ; 
     841//            field->processEnabledField() ; 
     842            field->buildAllExpressionEnabledField(); 
    772843            associatedInstantFieldIds[*it]=field ; 
    773844          } 
     
    775846        } 
    776847      } 
    777        
     848 
    778849      set<string> averageFieldIds ; 
    779850      map<string,CField*> associatedAverageFieldIds ; 
    780851 
    781852      expression->getAverageFieldIds(averageFieldIds) ; 
    782       for (set<string>::iterator it=averageFieldIds.begin() ; it!=averageFieldIds.end();++it)  
    783       {       
    784         if (CField::has(*it))  
     853      for (set<string>::iterator it=averageFieldIds.begin() ; it!=averageFieldIds.end();++it) 
     854      { 
     855        if (CField::has(*it)) 
    785856        { 
    786857           CFieldGroup* root=CFieldGroup::get("field_definition") ; 
     
    791862           averageField->fieldOut=instantField ; 
    792863           instantField->freq_op=freq_op ; 
    793            averageField-> processEnabledField() ; 
     864//           averageField-> processEnabledField() ; 
     865           averageField->buildAllExpressionEnabledField(); 
    794866           instantField->SuperClassAttribute::setAttributes(averageField, true); 
    795867           instantField->field_ref.reset() ; 
    796868           instantField->operation.reset() ; 
    797869 
    798            instantField-> processEnabledField() ; 
     870//           instantField-> processEnabledField() ; 
     871           instantField->buildAllExpressionEnabledField(); 
    799872           associatedAverageFieldIds[*it]=instantField  ; 
    800873        } 
     
    810883      expression->getFields(fields) ; 
    811884      for (set<CField*>::iterator it=fields.begin() ; it!=fields.end();++it,++slotId) (*it)->addDependency(this,slotId) ; 
    812       hasExpression=true;  
    813     } 
    814   } 
    815    
     885      hasExpression=true; 
     886    } 
     887  } 
     888 
    816889  void CField::resetSlots(void) 
    817890  { 
    818891    for(vector<bool>::iterator it=slots.begin();it!=slots.end();++it) *it=false ; 
    819892  } 
    820    
     893 
    821894  bool CField::slotsFull(void) 
    822895  { 
     
    826899  } 
    827900 
    828    
     901 
    829902  void CField::setSlot(int slotId) 
    830903  { 
    831904    CContext* context = CContext::getCurrent() ; 
    832905    const CDate & currDate = context->getCalendar()->getCurrentDate(); 
    833     if (slotUpdateDate==NULL || currDate!=*slotUpdateDate)  
     906    if (slotUpdateDate==NULL || currDate!=*slotUpdateDate) 
    834907    { 
    835908      resetSlots() ; 
     
    841914    { 
    842915      CArray<double,1> expr(expression->compute()) ; 
    843        
    844       if (hasInstantData)  
     916 
     917      if (hasInstantData) 
    845918      { 
    846919        instantData=expr ; 
    847         for(list< pair<CField *,int> >::iterator it=fieldDependency.begin(); it!=fieldDependency.end(); ++it)   
     920        for(list< pair<CField *,int> >::iterator it=fieldDependency.begin(); it!=fieldDependency.end(); ++it) 
    848921          if (it->first!=this) it->first->setSlot(it->second) ; 
    849922      } 
    850        
     923 
    851924      if (hasOutputFile) updateDataFromExpression(expr) ; 
    852        
    853     } 
    854   } 
    855  
    856  
     925 
     926    } 
     927  } 
     928 
     929   /*! 
     930     This function retrieves Id of corresponding domain_ref and axis_ref (if any) 
     931   of a field. In some cases, only domain exists but axis doesn't 
     932   \return pair of Domain and Axis id 
     933   */ 
     934   const std::pair<StdString,StdString>& CField::getDomainAxisIds() 
     935   { 
     936     CGrid* cgPtr = getRelGrid(); 
     937     if (NULL != cgPtr) 
     938     { 
     939       if (NULL != cgPtr->getRelDomain()) domAxisIds_.first = cgPtr->getRelDomain()->getId(); 
     940       if (NULL != cgPtr->getRelAxis()) domAxisIds_.second = cgPtr->getRelAxis()->getId(); 
     941     } 
     942 
     943     return (domAxisIds_); 
     944   } 
    857945 
    858946   CVariable* CField::addVariable(const string& id) 
     
    867955 
    868956 
     957   void CField::sendAddAllVariables() 
     958   { 
     959     if (!getAllVariables().empty()) 
     960     { 
     961       // Firstly, it's necessary to add virtual variable group 
     962       sendAddVariableGroup(getVirtualVariableGroup()->getId()); 
     963 
     964       // Okie, now we can add to this variable group 
     965       std::vector<CVariable*> allVar = getAllVariables(); 
     966       std::vector<CVariable*>::const_iterator it = allVar.begin(); 
     967       std::vector<CVariable*>::const_iterator itE = allVar.end(); 
     968 
     969       for (; it != itE; ++it) 
     970       { 
     971         std::cout << "Variable Fields " << (*it)->getId() << std::endl; 
     972         this->sendAddVariable((*it)->getId()); 
     973         (*it)->sendAllAttributesToServer(); 
     974         (*it)->sendValue(); 
     975       } 
     976     } 
     977   } 
     978 
    869979   void CField::sendAddVariable(const string& id) 
    870980   { 
    871981    CContext* context=CContext::getCurrent() ; 
    872      
     982 
    873983    if (! context->hasServer ) 
    874984    { 
    875985       CContextClient* client=context->client ; 
    876986 
    877        CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE) ;    
     987       CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE) ; 
    878988       if (client->isServerLeader()) 
    879989       { 
     
    886996       else client->sendEvent(event) ; 
    887997    } 
    888        
    889    } 
    890   
    891     
     998 
     999   } 
     1000 
     1001 
    8921002   void CField::sendAddVariableGroup(const string& id) 
    8931003   { 
     
    8971007       CContextClient* client=context->client ; 
    8981008 
    899        CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE_GROUP) ;    
     1009       CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE_GROUP) ; 
    9001010       if (client->isServerLeader()) 
    9011011       { 
     
    9081018       else client->sendEvent(event) ; 
    9091019    } 
    910        
    911    } 
    912     
     1020 
     1021   } 
     1022 
    9131023   void CField::recvAddVariable(CEventServer& event) 
    9141024   { 
    915        
     1025 
    9161026      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    9171027      string id; 
     
    9191029      get(id)->recvAddVariable(*buffer) ; 
    9201030   } 
    921     
    922     
     1031 
     1032 
    9231033   void CField::recvAddVariable(CBufferIn& buffer) 
    9241034   { 
     
    9301040   void CField::recvAddVariableGroup(CEventServer& event) 
    9311041   { 
    932        
     1042 
    9331043      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    9341044      string id; 
     
    9361046      get(id)->recvAddVariableGroup(*buffer) ; 
    9371047   } 
    938     
    939     
     1048 
     1049 
    9401050   void CField::recvAddVariableGroup(CBufferIn& buffer) 
    9411051   { 
     
    9471057 
    9481058 
    949    
     1059 
    9501060} // namespace xios 
  • XIOS/trunk/src/node/field.hpp

    r501 r509  
    1818 
    1919namespace xios { 
    20     
     20 
    2121   /// ////////////////////// Déclarations ////////////////////// /// 
    2222 
     
    5656           EVENT_ID_UPDATE_DATA, EVENT_ID_ADD_VARIABLE, EVENT_ID_ADD_VARIABLE_GROUP 
    5757         } ; 
    58           
     58 
    5959         /// Constructeurs /// 
    6060         CField(void); 
     
    8383 
    8484         boost::shared_ptr<func::CFunctor> getFieldOperation(void) const; 
    85           
     85 
    8686         CArray<double, 1> getData(void) const; 
    8787 
     
    9595         template <int N> bool updateData(const CArray<double, N>&   data); 
    9696         bool updateDataFromExpression(const CArray<double, 1>&   data); 
    97          void setDataFromExpression(const CArray<double, 1>& _data) ;          
    98           
     97         void setDataFromExpression(const CArray<double, 1>& _data) ; 
     98 
    9999         bool updateDataServer 
    100100               (const CDate & currDate, 
    101101                const std::deque< CArray<double, 1>* > storedClient); 
    102   
     102 
     103         std::map<int, StdSize> getGridDataSize(); 
     104 
    103105       public : 
    104106 
     
    116118         void solveGridReference(void); 
    117119         void solveOperation(void); 
     120         void solveCheckMaskIndex(bool doSendingIndex); 
     121         void solveAllReferenceEnabledField(bool doSending2Sever); 
     122         void buildAllExpressionEnabledField(); 
     123         void solveGridDomainAxisRef(bool checkAtt); 
     124         void removeRefInheritance();  // Remove all reference of current field (it refers to itself) 
    118125 
    119126//         virtual void fromBinary(StdIStream & is); 
     
    125132         static StdString GetName(void); 
    126133         static StdString GetDefName(void); 
    127           
     134 
    128135         static ENodeType GetType(void); 
    129           
     136 
    130137        template <int N> void setData(const CArray<double, N>& _data) ; 
    131138        static bool dispatchEvent(CEventServer& event) ; 
     
    139146        void parse(xml::CXMLNode & node) ; 
    140147        CArray<double,1>* getInstantData(void)  ; 
    141          
     148 
    142149        void setVirtualVariableGroup(CVariableGroup* newVVariableGroup); 
    143150        void setVirtualVariableGroup(void); 
     
    145152        vector<CVariable*> getAllVariables(void) const; 
    146153        virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); 
    147   
     154 
    148155        CVariable* addVariable(const string& id="") ; 
    149156        CVariableGroup* addVariableGroup(const string& id="") ; 
     
    154161        static void recvAddVariableGroup(CEventServer& event) ; 
    155162        void recvAddVariableGroup(CBufferIn& buffer) ; 
    156         
     163        void sendAddAllVariables(); 
     164 
     165 
     166        const std::pair<StdString, StdString>& getDomainAxisIds(); 
    157167      public : 
    158168 
    159169         /// Propriétés privées /// 
    160170         CVariableGroup* vVariableGroup ; 
    161                   
     171 
    162172         std::vector<CField*> refObject; 
    163173         CField* baseRefObject; 
     
    172182         boost::shared_ptr<CDate>    last_Write, last_operation; 
    173183         boost::shared_ptr<CDate>    lastlast_Write_srv,last_Write_srv, last_operation_srv; 
    174           
     184 
    175185         boost::shared_ptr<func::CFunctor> foperation; 
    176186         map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; 
    177           
     187 
    178188         CArray<double, 1> data; 
    179189         CArray<double, 1> instantData; 
     
    183193         bool isFirstOperation ; 
    184194         string content ; 
    185           
     195 
    186196         list< pair<CField *,int> > fieldDependency ; 
    187197         void buildExpression(void) ; 
     
    195205         void setSlot(int slotId); 
    196206         bool processed ; 
     207         bool areAllReferenceSolved; 
     208         bool areAllExpressionBuilt; 
     209         std::pair<StdString,StdString> domAxisIds_; 
    197210 
    198211   }; // class CField 
  • XIOS/trunk/src/node/file.cpp

    r501 r509  
    1818 
    1919namespace xios { 
    20     
     20 
    2121   /// ////////////////////// Définitions ////////////////////// /// 
    2222 
     
    2424      : CObjectTemplate<CFile>(), CFileAttributes() 
    2525      , vFieldGroup(), data_out(), enabledFields(), fileComm(MPI_COMM_NULL) 
    26    {  
     26   { 
    2727     setVirtualFieldGroup() ; 
    2828     setVirtualVariableGroup() ; 
     
    3232      : CObjectTemplate<CFile>(id), CFileAttributes() 
    3333      , vFieldGroup(), data_out(), enabledFields(), fileComm(MPI_COMM_NULL) 
    34     {  
     34    { 
    3535      setVirtualFieldGroup() ; 
    3636      setVirtualVariableGroup() ; 
     
    4141 
    4242   ///--------------------------------------------------------------- 
    43  
     43  //! Get name of file 
    4444   StdString CFile::GetName(void)   { return (StdString("file")); } 
    4545   StdString CFile::GetDefName(void){ return (CFile::GetName()); } 
     
    4747 
    4848   //---------------------------------------------------------------- 
    49  
     49   /*! 
     50   \brief Get data that will be written out. 
     51   Each enabled file in xml represents a physical netcdf file. 
     52   This function allows to access to data to be written out into netcdf file 
     53   \return data written out. 
     54   */ 
    5055   boost::shared_ptr<CDataOutput> CFile::getDataOutput(void) const 
    5156   { 
     
    5358   } 
    5459 
     60   /*! 
     61   \brief Get virtual field group 
     62      In each file, there always exists a field group which is the ancestor of all 
     63   fields in the file. This is considered be virtual because it is created automatically during 
     64   file initialization and it normally doesn't appear on xml file 
     65   \return Pointer to field group 
     66   */ 
    5567   CFieldGroup* CFile::getVirtualFieldGroup(void) const 
    5668   { 
     
    5870   } 
    5971 
     72   /*! 
     73   \brief Get virtual variable group 
     74      In each file, there always exists a variable group which is the ancestor of all 
     75   variable in the file. This is considered be virtual because it is created automatically during 
     76   file initialization and it normally doesn't appear on xml file 
     77   \return Pointer to variable group 
     78   */ 
    6079   CVariableGroup* CFile::getVirtualVariableGroup(void) const 
    6180   { 
     
    6382   } 
    6483 
     84   //! Get all fields of a file 
    6585   std::vector<CField*> CFile::getAllFields(void) const 
    6686   { 
    6787      return (this->vFieldGroup->getAllChildren()); 
    6888   } 
    69   
     89 
     90   //! Get all variables of a file 
    7091   std::vector<CVariable*> CFile::getAllVariables(void) const 
    7192   { 
     
    7495 
    7596   //---------------------------------------------------------------- 
    76  
    77    std::vector<CField*> CFile::getEnabledFields(int default_outputlevel,  
     97   /*! 
     98   \brief Get all enabled fields of file 
     99      A field is considered to be enabled if it fullfil these conditions: it is enabled, inside a enabled file 
     100   and its own level is not larger than file output level. 
     101   \param [in] default_outputlevel default value output level of file 
     102   \param [in] default_level default value level of field 
     103   \param [in] default_enabled flag determine by default if field is enabled 
     104   \return Vector of pointers of enabled fields 
     105   */ 
     106   std::vector<CField*> CFile::getEnabledFields(int default_outputlevel, 
    78107                                                int default_level, 
    79108                                                bool default_enabled) 
     
    88117 
    89118      std::vector<CField*> newEnabledFields; 
    90        
     119 
    91120      for ( it = this->enabledFields.begin() ; it != this->enabledFields.end(); it++ ) 
    92121      { 
     
    112141//            { it--; this->enabledFields.erase(it+1); continue; } 
    113142         } 
    114   
     143 
    115144//         CField* field_tmp=(*it).get() ; 
    116145//         shared_ptr<CField> sptfield=*it ; 
     
    130159 
    131160   //---------------------------------------------------------------- 
    132  
     161   //! Change virtual field group to a new one 
    133162   void CFile::setVirtualFieldGroup(CFieldGroup* newVFieldGroup) 
    134    {  
    135       this->vFieldGroup = newVFieldGroup;  
    136    } 
    137  
     163   { 
     164      this->vFieldGroup = newVFieldGroup; 
     165   } 
     166 
     167   //! Change virtual variable group to new one 
    138168   void CFile::setVirtualVariableGroup(CVariableGroup* newVVariableGroup) 
    139    {  
    140       this->vVariableGroup = newVVariableGroup;  
    141    } 
    142  
    143    //---------------------------------------------------------------- 
    144  
     169   { 
     170      this->vVariableGroup = newVVariableGroup; 
     171   } 
     172 
     173   //---------------------------------------------------------------- 
     174   //! Create virtual field group, which is done normally on initializing file 
    145175   void CFile::setVirtualFieldGroup(void) 
    146176   { 
     
    148178   } 
    149179 
     180   //! Create virtual variable group, which is done normally on initializing file 
    150181   void CFile::setVirtualVariableGroup(void) 
    151182   { 
     
    168199      return false ; 
    169200    } 
    170      
     201 
     202   //! Initialize a file in order to write into it 
    171203   void CFile::initFile(void) 
    172204   { 
     
    174206      CDate& currentDate=context->calendar->getCurrentDate() ; 
    175207      CContextServer* server=context->server ; 
    176              
     208 
    177209      if (! sync_freq.isEmpty()) syncFreq = CDuration::FromString(sync_freq.getValue()); 
    178210      if (! split_freq.isEmpty()) splitFreq = CDuration::FromString(split_freq.getValue()); 
     
    194226      nbDomain=setDomain.size() ; 
    195227 
    196       // create sub communicator for file   
     228      // create sub communicator for file 
    197229      int color=allDomainEmpty?0:1 ; 
    198230      MPI_Comm_split(server->intraComm,color,server->intraCommRank,&fileComm) ; 
    199231      if (allDomainEmpty) MPI_Comm_free(&fileComm) ; 
    200232      // 
    201        
    202     } 
    203      
     233 
     234    } 
     235 
     236    //! Verify state of a file 
    204237    void CFile::checkFile(void) 
    205238    { 
     
    208241      checkSplit() ; 
    209242    } 
    210        
    211       
     243 
     244 
     245    /*! 
     246    \brief Verify if synchronisation should be done 
     247        If syn option is enabled, syn frequence and current time will be used to 
     248    calculate the moment to syn file(s) 
     249    \return True if it is the moment to synchronize file, otherwise false 
     250    */ 
    212251   bool CFile::checkSync(void) 
    213252   { 
     
    225264      return false ; 
    226265    } 
    227      
    228      
     266 
     267    /*! 
     268    \brief Verify if splitting should be done 
     269        If split option is enabled, split frequence and current time will be used to 
     270    calculate the moment to split file 
     271    \return True if it is the moment to split file, otherwise false 
     272    */ 
    229273    bool CFile::checkSplit(void) 
    230274    { 
     
    235279        if (currentDate > *lastSplit+splitFreq) 
    236280        { 
    237           *lastSplit=*lastSplit+splitFreq ;     
     281          *lastSplit=*lastSplit+splitFreq ; 
    238282          std::vector<CField*>::iterator it, end = this->enabledFields.end(); 
    239283          for (it = this->enabledFields.begin() ;it != end; it++)  (*it)->resetNStep() ; 
     
    244288      return false ; 
    245289    } 
    246      
     290 
     291   /*! 
     292   \brief Create header of netcdf file 
     293   There are some information to fill in header of each netcdf. 
     294   */ 
    247295   void CFile::createHeader(void) 
    248296   { 
    249297      CContext* context = CContext::getCurrent() ; 
    250298      CContextServer* server=context->server ; 
    251       
     299 
    252300      if (!allDomainEmpty) 
    253301      { 
     
    273321           oss<<"_"<<lastSplit->getStr(splitFormat)<<"-"<< (*lastSplit+(splitFreq-1*Second)).getStr(splitFormat); 
    274322         } 
    275             
     323 
    276324         bool multifile=true ; 
    277325         if (!type.isEmpty()) 
     
    280328           else if (type==type_attr::multiple_file) multifile=true ; 
    281329 
    282          }  
     330         } 
    283331#ifndef USING_NETCDF_PAR 
    284332         if (!multifile) 
     
    288336          } 
    289337#endif 
    290          if (multifile)  
     338         if (multifile) 
    291339         { 
    292340            int commSize, commRank ; 
    293341            MPI_Comm_size(fileComm,&commSize) ; 
    294342            MPI_Comm_rank(fileComm,&commRank) ; 
    295              
    296             if (server->intraCommSize > 1)  
     343 
     344            if (server->intraCommSize > 1) 
    297345            { 
    298346              oss << "_"  ; 
    299347              int width=0 ; int n=commSize-1 ; 
    300348              while(n != 0) { n=n/10 ; width++ ;} 
    301               if (!min_digits.isEmpty())  
     349              if (!min_digits.isEmpty()) 
    302350                if (width<min_digits) width=min_digits ; 
    303351              oss.width(width) ; 
     
    314362           if (par_access.getValue()=="independent") isCollective=false ; 
    315363           else if (par_access.getValue()=="collective") isCollective=true ; 
    316            else  
     364           else 
    317365           { 
    318366             ERROR("void Context::createDataOutput(void)", 
     
    332380         } 
    333381         this->data_out->writeTimeDimension(); 
    334           
     382 
    335383         for (it = this->enabledFields.begin() ;it != end; it++) 
    336384         { 
     
    338386            this->data_out->writeField(field); 
    339387         } 
    340           
     388 
    341389         vector<CVariable*> listVars = getAllVariables() ; 
    342390         for (vector<CVariable*>::iterator it = listVars.begin() ;it != listVars.end(); it++) this-> data_out-> writeAttribute(*it) ; 
    343           
     391 
    344392         this->data_out->definition_end(); 
    345393      } 
    346394   } 
    347395 
     396   //! Close file 
    348397   void CFile::close(void) 
    349398   { 
     
    351400     delete lastSplit ; 
    352401     if (!allDomainEmpty) 
    353        if (isOpen)  
     402       if (isOpen) 
    354403       { 
    355404         this->data_out->closeFile(); 
     
    359408   //---------------------------------------------------------------- 
    360409 
     410   /*! 
     411   \brief Parse xml file and write information into file object 
     412   \param [in] node xmld node corresponding in xml file 
     413   */ 
    361414   void CFile::parse(xml::CXMLNode & node) 
    362415   { 
    363416      SuperClass::parse(node); 
    364        
     417 
    365418      if (node.goToChildElement()) 
    366419      { 
     
    376429   //---------------------------------------------------------------- 
    377430 
     431   /*! 
     432   \brief Represent a file in form of string with all its info 
     433   \return String 
     434   */ 
    378435   StdString CFile::toString(void) const 
    379436   { 
     
    391448 
    392449   //---------------------------------------------------------------- 
    393     
     450 
     451   /*! 
     452   \brief Find all inheritace among objects in a file. 
     453   \param [in] apply (true) write attributes of parent into ones of child if they are empty 
     454                     (false) write attributes of parent into a new container of child 
     455   \param [in] parent 
     456   */ 
    394457   void CFile::solveDescInheritance(bool apply, const CAttributeMap * const parent) 
    395458   { 
    396459      SuperClassAttribute::setAttributes(parent,apply); 
    397       this->getVirtualFieldGroup()->solveDescInheritance(apply, NULL);  
     460      this->getVirtualFieldGroup()->solveDescInheritance(apply, NULL); 
    398461      this->getVirtualVariableGroup()->solveDescInheritance(apply, NULL); 
    399462   } 
     
    401464   //---------------------------------------------------------------- 
    402465 
    403    void CFile::processEnabledFile(void) 
    404    { 
    405      if (output_freq.isEmpty()) ERROR("void CFile::processEnabledFile(void)", 
    406                                        <<"File attribute <<output_freq>> is undefined");  
    407      solveFieldRefInheritance(true) ; 
    408      getEnabledFields() ; 
    409      processEnabledFields() ; 
    410    } 
    411     
    412    void CFile::processEnabledFields(void) 
    413    { 
    414       for (unsigned int i = 0; i < this->enabledFields.size(); i++) 
    415       { 
    416         this->enabledFields[i]->processEnabledField() ; 
    417       } 
    418     } 
    419      
     466//   void CFile::processEnabledFile(void) 
     467//   { 
     468//     if (output_freq.isEmpty()) ERROR("void CFile::processEnabledFile(void)", 
     469//                                       <<"File attribute <<output_freq>> is undefined"); 
     470//     solveFieldRefInheritance(true) ; 
     471//     getEnabledFields() ; 
     472//     processEnabledFields() ; 
     473//   } 
     474 
     475//   void CFile::processEnabledFields(void) 
     476//   { 
     477//      for (unsigned int i = 0; i < this->enabledFields.size(); i++) 
     478//      { 
     479//        this->enabledFields[i]->processEnabledField() ; 
     480//      } 
     481//   } 
     482 
     483   /*! 
     484   \brief Resolve all reference of active fields. 
     485      In order to know exactly which data each active field has, a search for all its 
     486   reference to find its parents or/and its base reference object must be done. Moreover 
     487   during this search, there are some information that can only be sent to server AFTER 
     488   all information of active fields are created on server side, e.g: checking mask or index 
     489   \param [in] sendToServer: Send all info to server (true) or only a part of it (false) 
     490   */ 
     491   void CFile::solveAllRefOfEnabledFields(bool sendToServer) 
     492   { 
     493     int size = this->enabledFields.size(); 
     494     for (int i = 0; i < size; ++i) 
     495     { 
     496       this->enabledFields[i]->solveAllReferenceEnabledField(sendToServer); 
     497     } 
     498   } 
     499 
     500   /*! 
     501   \brief Contruct all expression related to active fields. 
     502      Each field can do some expressions which appear on the xml file, and itself can be 
     503   a result of an expression among some other fields. This function builds all possible expression 
     504   relating to active fields. 
     505   */ 
     506   void CFile::buildAllExpressionOfEnabledFields() 
     507   { 
     508     int size = this->enabledFields.size(); 
     509     for (int i = 0; i < size; ++i) 
     510     { 
     511       this->enabledFields[i]->buildAllExpressionEnabledField(); 
     512     } 
     513   } 
     514 
    420515   void CFile::solveFieldRefInheritance(bool apply) 
    421516   { 
     
    441536         this->enabledFields[i]->solveOperation(); 
    442537   } 
    443   
     538 
    444539   void CFile::solveEFExpression(void) 
    445540   { 
    446541      for (unsigned int i = 0; i < this->enabledFields.size(); i++) 
    447542         this->enabledFields[i]->buildExpression(); 
    448    }    
    449   
    450  
     543   } 
     544 
     545   /*! 
     546   \brief Add a field into file. 
     547      A field is added into file and it will be written out if the file is enabled and 
     548   level of this field is smaller than level_output. A new field won't be created if one 
     549   with id has already existed 
     550   \param [in] id String identity of new field 
     551   \return Pointer to added (or already existed) field 
     552   */ 
    451553   CField* CFile::addField(const string& id) 
    452554   { 
     
    454556   } 
    455557 
     558   /*! 
     559   \brief Add a field group into file. 
     560      A field group is added into file and it will play a role as parents for fields. 
     561   A new field group won't be created if one with id has already existed 
     562   \param [in] id String identity of new field group 
     563   \return Pointer to added (or already existed) field group 
     564   */ 
    456565   CFieldGroup* CFile::addFieldGroup(const string& id) 
    457566   { 
    458567     return vFieldGroup->createChildGroup(id) ; 
    459568   } 
    460   
     569 
     570   /*! 
     571   \brief Add a variable into file. 
     572      A variable is added into file and if one with id has already existed, pointer to 
     573   it will be returned. 
     574      Variable as long as attributes are information container of file. 
     575   However, whereas attributes are "fixed" information, variables provides a more flexible way to user 
     576   to fill in (extra) information for a file. 
     577   \param [in] id String identity of new variable 
     578   \return Pointer to added (or already existed) variable 
     579   */ 
    461580   CVariable* CFile::addVariable(const string& id) 
    462581   { 
     
    464583   } 
    465584 
     585   /*! 
     586   \brief Add a variable group into file. 
     587      A variable group is added into file and it will play a role as parents for variables. 
     588   A new variable group won't be created if one with id has already existed 
     589   \param [in] id String identity of new variable group 
     590   \return Pointer to added (or already existed) variable group 
     591   */ 
    466592   CVariableGroup* CFile::addVariableGroup(const string& id) 
    467593   { 
    468594     return vVariableGroup->createChildGroup(id) ; 
    469595   } 
    470     
    471    
     596 
     597   /*! 
     598   \brief Send a message to create a field on server side 
     599   \param[in] id String identity of field that will be created on server 
     600   */ 
    472601   void CFile::sendAddField(const string& id) 
    473602   { 
    474603    CContext* context=CContext::getCurrent() ; 
    475      
     604 
    476605    if (! context->hasServer ) 
    477606    { 
    478607       CContextClient* client=context->client ; 
    479608 
    480        CEventClient event(this->getType(),EVENT_ID_ADD_FIELD) ;    
     609       CEventClient event(this->getType(),EVENT_ID_ADD_FIELD) ; 
    481610       if (client->isServerLeader()) 
    482611       { 
     
    489618       else client->sendEvent(event) ; 
    490619    } 
    491        
    492    } 
    493     
     620 
     621   } 
     622 
     623   /*! 
     624   \brief Send a message to create a field group on server side 
     625   \param[in] id String identity of field group that will be created on server 
     626   */ 
    494627   void CFile::sendAddFieldGroup(const string& id) 
    495628   { 
     
    499632       CContextClient* client=context->client ; 
    500633 
    501        CEventClient event(this->getType(),EVENT_ID_ADD_FIELD_GROUP) ;    
     634       CEventClient event(this->getType(),EVENT_ID_ADD_FIELD_GROUP) ; 
    502635       if (client->isServerLeader()) 
    503636       { 
     
    510643       else client->sendEvent(event) ; 
    511644    } 
    512        
    513    } 
    514     
     645 
     646   } 
     647 
     648   /*! 
     649   \brief Receive a message annoucing the creation of a field on server side 
     650   \param[in] event Received event 
     651   */ 
    515652   void CFile::recvAddField(CEventServer& event) 
    516653   { 
    517        
     654 
    518655      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    519656      string id; 
     
    521658      get(id)->recvAddField(*buffer) ; 
    522659   } 
    523     
    524     
     660 
     661   /*! 
     662   \brief Receive a message annoucing the creation of a field on server side 
     663   \param[in] buffer Buffer containing message 
     664   */ 
    525665   void CFile::recvAddField(CBufferIn& buffer) 
    526666   { 
     
    530670   } 
    531671 
     672   /*! 
     673   \brief Receive a message annoucing the creation of a field group on server side 
     674   \param[in] event Received event 
     675   */ 
    532676   void CFile::recvAddFieldGroup(CEventServer& event) 
    533677   { 
    534        
     678 
    535679      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    536680      string id; 
     
    538682      get(id)->recvAddFieldGroup(*buffer) ; 
    539683   } 
    540     
    541     
     684 
     685   /*! 
     686   \brief Receive a message annoucing the creation of a field group on server side 
     687   \param[in] buffer Buffer containing message 
     688   */ 
    542689   void CFile::recvAddFieldGroup(CBufferIn& buffer) 
    543690   { 
     
    546693      addFieldGroup(id) ; 
    547694   } 
    548     
    549  
    550  
    551  
    552  
    553  
    554  
    555  
    556  
    557  
    558  
     695 
     696   /*! 
     697   \brief Send messages to duplicate all variables on server side 
     698      Because each variable has also its attributes. So first thing to do is replicate 
     699   all these attributes on server side. Because variable can have a value, the second thing 
     700   is to duplicate this value on server, too. 
     701   */ 
     702   void CFile::sendAddAllVariables() 
     703   { 
     704     if (!getAllVariables().empty()) 
     705     { 
     706       // Firstly, it's necessary to add virtual variable group 
     707       sendAddVariableGroup(getVirtualVariableGroup()->getId()); 
     708 
     709       // Okie, now we can add to this variable group 
     710       std::vector<CVariable*> allVar = getAllVariables(); 
     711       std::vector<CVariable*>::const_iterator it = allVar.begin(); 
     712       std::vector<CVariable*>::const_iterator itE = allVar.end(); 
     713 
     714       for (; it != itE; ++it) 
     715       { 
     716         std::cout << "Variable Files " << (*it)->getId() << std::endl; 
     717         this->sendAddVariable((*it)->getId()); 
     718         (*it)->sendAllAttributesToServer(); 
     719         (*it)->sendValue(); 
     720       } 
     721     } 
     722   } 
     723 
     724   /*! 
     725   \brief Send a message to create a variable on server side 
     726      A variable always belongs to a variable group 
     727   \param[in] id String identity of variable that will be created on server 
     728   */ 
    559729   void CFile::sendAddVariable(const string& id) 
    560730   { 
    561731    CContext* context=CContext::getCurrent() ; 
    562      
     732 
    563733    if (! context->hasServer ) 
    564734    { 
    565735       CContextClient* client=context->client ; 
    566736 
    567        CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE) ;    
     737       CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE) ; 
    568738       if (client->isServerLeader()) 
    569739       { 
     
    576746       else client->sendEvent(event) ; 
    577747    } 
    578        
    579    } 
    580     
     748 
     749   } 
     750 
     751   /*! 
     752   \brief Send a message to create a variable group on server side 
     753   \param[in] id String identity of variable group that will be created on server 
     754   */ 
    581755   void CFile::sendAddVariableGroup(const string& id) 
    582756   { 
     
    586760       CContextClient* client=context->client ; 
    587761 
    588        CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE_GROUP) ;    
     762       CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE_GROUP) ; 
    589763       if (client->isServerLeader()) 
    590764       { 
     
    597771       else client->sendEvent(event) ; 
    598772    } 
    599        
    600    } 
    601     
     773 
     774   } 
     775 
     776   /*! 
     777   \brief Receive a message annoucing the creation of a variable on server side 
     778   \param[in] event Received event 
     779   */ 
    602780   void CFile::recvAddVariable(CEventServer& event) 
    603781   { 
    604        
     782 
    605783      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    606784      string id; 
     
    608786      get(id)->recvAddVariable(*buffer) ; 
    609787   } 
    610     
    611     
     788 
     789   /*! 
     790   \brief Receive a message annoucing the creation of a variable on server side 
     791   \param[in] buffer Buffer containing message 
     792   */ 
    612793   void CFile::recvAddVariable(CBufferIn& buffer) 
    613794   { 
     
    617798   } 
    618799 
     800   /*! 
     801   \brief Receive a message annoucing the creation of a variable group on server side 
     802   \param[in] event Received event 
     803   */ 
    619804   void CFile::recvAddVariableGroup(CEventServer& event) 
    620805   { 
    621        
     806 
    622807      CBufferIn* buffer=event.subEvents.begin()->buffer; 
    623808      string id; 
     
    625810      get(id)->recvAddVariableGroup(*buffer) ; 
    626811   } 
    627     
    628     
     812 
     813   /*! 
     814   \brief Receive a message annoucing the creation of a variable group on server side 
     815   \param[in] buffer Buffer containing message 
     816   */ 
    629817   void CFile::recvAddVariableGroup(CBufferIn& buffer) 
    630818   { 
     
    634822   } 
    635823 
    636  
    637  
    638  
    639  
     824   /*! 
     825     \brief Sending all active (enabled) fields from client to server. 
     826   Each field is identified uniquely by its string identity. Not only should we 
     827   send the id to server but also we need to send ids of reference domain and reference axis. 
     828   With these two id, it's easier to make reference to grid where all data should be written. 
     829   Remark: This function must be called AFTER all active (enabled) files have been created on the server side 
     830   */ 
     831   void CFile::sendEnabledFields() 
     832   { 
     833     int size = this->enabledFields.size(); 
     834     CField* fieldPtr(0); 
     835     for (int i = 0; i < size; ++i) 
     836     { 
     837       fieldPtr = this->enabledFields[i]; 
     838       if (fieldPtr->name.isEmpty()) fieldPtr->name.setValue(fieldPtr->getBaseFieldReference()->getId()); 
     839       std::cout << "Enabled Fields " << i << " " << CField::get(fieldPtr)->getId() << std::endl; 
     840       this->sendAddField(fieldPtr->getId()); 
     841       fieldPtr->sendAllAttributesToServer(); 
     842       fieldPtr->sendAddAllVariables(); 
     843     } 
     844   } 
     845 
     846   /*! 
     847   \brief Dispatch event received from client 
     848      Whenever a message is received in buffer of server, it will be processed depending on 
     849   its event type. A new event type should be added in the switch list to make sure 
     850   it processed on server side. 
     851   \param [in] event: Received message 
     852   */ 
    640853   bool CFile::dispatchEvent(CEventServer& event) 
    641854   { 
     
    649862             return true ; 
    650863             break ; 
    651           
     864 
    652865           case EVENT_ID_ADD_FIELD_GROUP : 
    653866             recvAddFieldGroup(event) ; 
    654867             return true ; 
    655              break ;        
    656   
     868             break ; 
     869 
    657870            case EVENT_ID_ADD_VARIABLE : 
    658871             recvAddVariable(event) ; 
    659872             return true ; 
    660873             break ; 
    661           
     874 
    662875           case EVENT_ID_ADD_VARIABLE_GROUP : 
    663876             recvAddVariableGroup(event) ; 
    664877             return true ; 
    665              break ;                
     878             break ; 
    666879           default : 
    667880              ERROR("bool CFile::dispatchEvent(CEventServer& event)", <<"Unknown Event") ; 
     
    670883      } 
    671884   } 
    672     
    673     
    674     
    675     
     885 
     886 
     887 
     888 
    676889   ///--------------------------------------------------------------- 
    677890 
  • XIOS/trunk/src/node/file.hpp

    r501 r509  
    1515 
    1616namespace xios { 
    17     
     17 
    1818   /// ////////////////////// Déclarations ////////////////////// /// 
    1919 
     
    3131   ///-------------------------------------------------------------- 
    3232 
     33   /*! 
     34   \class CFile 
     35   This class corresponds to file component of the xml. 
     36   The class contains all the nessceary information to write data into a netcdf file: The most important thing 
     37   is the field(s) which will be written into file. Besides, there are some options to write 
     38   data into file, e.g: writting into only one file or multiple file; splitting a running into several files. 
     39   Moreover, there are some other attributes of netcdf file which are also stored in this class 
     40   */ 
    3341   class CFile 
    3442      : public CObjectTemplate<CFile> 
     
    3846         typedef CObjectTemplate<CFile>   SuperClass; 
    3947         typedef CFileAttributes SuperClassAttribute; 
    40        
     48 
    4149      public : 
    4250         enum EEventId 
    4351         { 
    44            EVENT_ID_ADD_FIELD=0,EVENT_ID_ADD_FIELD_GROUP, EVENT_ID_ADD_VARIABLE,EVENT_ID_ADD_VARIABLE_GROUP 
     52           EVENT_ID_ADD_FIELD=0,EVENT_ID_ADD_FIELD_GROUP, EVENT_ID_ADD_VARIABLE, 
     53           EVENT_ID_ADD_VARIABLE_GROUP, EVENT_ID_CREATE_ENABLED_FIELDS 
    4554         } ; 
    46           
     55 
    4756         typedef CFileAttributes RelAttributes; 
    4857         typedef CFileGroup      RelGroup; 
     
    5463         CFile(const CFile * const file); // Not implemented yet. 
    5564 
     65         /// Destructeur /// 
     66         virtual ~CFile(void); 
     67 
     68      public: 
    5669         /// Accesseurs /// 
    5770         boost::shared_ptr<CDataOutput> getDataOutput(void) const; 
     
    6679 
    6780      public : 
    68  
    69          /// Mutateurs /// 
    70          void setVirtualFieldGroup(CFieldGroup* newVFieldGroup); 
    71          void setVirtualFieldGroup(void); 
    72          void setVirtualVariableGroup(CVariableGroup* newVVariableGroup); 
    73          void setVirtualVariableGroup(void); 
    74          void processEnabledFile(void) ; 
    75          void processEnabledFields(void) ; 
    76          void createHeader(void); 
    77          void close(void) ; 
    78           
    79          /// Traitements /// 
    80          virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); 
    81          void solveFieldRefInheritance(bool apply); 
    82          void solveEFGridRef(void); 
    83          void solveEFOperation(void); 
    84          void solveEFExpression(void); 
    85  
    86          /// Destructeur /// 
    87          virtual ~CFile(void); 
    88  
    89          /// Autres /// 
    90          virtual void parse(xml::CXMLNode & node); 
    91          virtual StdString toString(void) const; 
    92           
    93 //         virtual void toBinary  (StdOStream & os) const; 
    94 //         virtual void fromBinary(StdIStream & is); 
    95  
    96          /// Accesseurs statiques /// 
    97          static StdString GetName(void); 
    98          static StdString GetDefName(void); 
    99           
    100          static ENodeType GetType(void); 
    101           
    102          bool allDomainEmpty ; 
    103          CField* addField(const string& id="") ; 
    104          CFieldGroup* addFieldGroup(const string& id="") ; 
    105          CVariable* addVariable(const string& id="") ; 
    106          CVariableGroup* addVariableGroup(const string& id="") ; 
    107          void sendAddField(const string& id="") ; 
    108          void sendAddFieldGroup(const string& id="") ; 
    109          static void recvAddField(CEventServer& event) ; 
    110          void recvAddField(CBufferIn& buffer) ; 
    111          static void recvAddFieldGroup(CEventServer& event) ; 
    112          void recvAddFieldGroup(CBufferIn& buffer) ; 
    113           
    114          void sendAddVariable(const string& id="") ; 
    115          void sendAddVariableGroup(const string& id="") ; 
    116          static void recvAddVariable(CEventServer& event) ; 
    117          void recvAddVariable(CBufferIn& buffer) ; 
    118          static void recvAddVariableGroup(CEventServer& event) ; 
    119          void recvAddVariableGroup(CBufferIn& buffer) ; 
    120          static bool dispatchEvent(CEventServer& event) ; 
    121           
     81         // Some functions to verify state of file 
    12282         bool isSyncTime(void) ; 
    12383         bool checkSplit(void) ; 
     
    12585         void checkFile(void) ; 
    12686         void initFile(void) ; 
     87 
     88         /// Mutateurs /// 
     89         // Set some root definitions in a file 
     90         void setVirtualFieldGroup(CFieldGroup* newVFieldGroup); 
     91         void setVirtualFieldGroup(void); 
     92         void setVirtualVariableGroup(CVariableGroup* newVVariableGroup); 
     93         void setVirtualVariableGroup(void); 
     94 
     95         void createHeader(void); 
     96         void close(void) ; 
     97 
     98         // Some processing on file 
     99         void solveFieldRefInheritance(bool apply); 
     100         void solveEFGridRef(void); 
     101         void solveEFOperation(void); 
     102         void solveEFExpression(void); 
     103         void processEnabledFile(void) ; 
     104         void processEnabledFields(void) ; 
     105         void solveAllRefOfEnabledFields(bool sendToServer); 
     106         void buildAllExpressionOfEnabledFields(); 
     107 
     108         // Add component into file 
     109         CField* addField(const string& id="") ; 
     110         CFieldGroup* addFieldGroup(const string& id="") ; 
     111         CVariable* addVariable(const string& id="") ; 
     112         CVariableGroup* addVariableGroup(const string& id="") ; 
     113 
     114         // Send info to serever 
     115         void sendEnabledFields(); 
     116         void sendAddField(const string& id="") ; 
     117         void sendAddFieldGroup(const string& id="") ; 
     118         void sendAddAllVariables(); 
     119         void sendAddVariable(const string& id="") ; 
     120         void sendAddVariableGroup(const string& id="") ; 
     121 
     122         // Receive info from client 
     123         static void recvAddField(CEventServer& event) ; 
     124         void recvAddField(CBufferIn& buffer) ; 
     125         static void recvAddFieldGroup(CEventServer& event) ; 
     126         void recvAddFieldGroup(CBufferIn& buffer) ; 
     127         static void recvAddVariable(CEventServer& event) ; 
     128         void recvAddVariable(CBufferIn& buffer) ; 
     129         static void recvAddVariableGroup(CEventServer& event) ; 
     130         void recvAddVariableGroup(CBufferIn& buffer) ; 
     131 
     132         // Dispatch event 
     133         static bool dispatchEvent(CEventServer& event) ; 
     134 
     135      public: 
     136         /// Accesseurs statiques /// 
     137         static StdString GetName(void); 
     138         static StdString GetDefName(void); 
     139 
     140         static ENodeType GetType(void); 
     141      public: 
     142         /// Traitements /// 
     143         virtual void solveDescInheritance(bool apply, const CAttributeMap * const parent = 0); 
     144 
     145          /// Autres /// 
     146         virtual void parse(xml::CXMLNode & node); 
     147         virtual StdString toString(void) const; 
     148      public: 
     149 
    127150         CDate* lastSync ; 
    128151         CDate* lastSplit ; 
     
    132155         int nbDomain ; 
    133156         bool isOpen ; 
     157         bool allDomainEmpty ; 
    134158         MPI_Comm fileComm ; 
     159 
    135160      private : 
    136  
    137161         /// Propriétés privées /// 
    138162         CFieldGroup* vFieldGroup; 
     
    140164         boost::shared_ptr<CDataOutput> data_out; 
    141165         std::vector<CField*> enabledFields; 
     166 
     167      public: 
     168        //         virtual void toBinary  (StdOStream & os) const; 
     169        //         virtual void fromBinary(StdIStream & is); 
    142170 
    143171   }; // class CFile 
  • XIOS/trunk/src/node/grid.cpp

    r501 r509  
    1919   CGrid::CGrid(void) 
    2020      : CObjectTemplate<CGrid>(), CGridAttributes() 
    21       , withAxis(false), isChecked(false), axis(), domain() 
    22       , storeIndex(1), out_i_index(1), out_j_index(1), out_l_index(1) 
     21      , withAxis(false), isChecked(false), isDomainAxisChecked(false), axis(), domain() 
     22      , storeIndex(1), out_i_index(1), out_j_index(1), out_l_index(1), isDomConServerComputed_(false) 
    2323   { /* Ne rien faire de plus */ } 
    2424 
    2525   CGrid::CGrid(const StdString & id) 
    2626      : CObjectTemplate<CGrid>(id), CGridAttributes() 
    27       , withAxis(false), isChecked(false), axis(), domain() 
    28       , storeIndex(1), out_i_index(1), out_j_index(1), out_l_index(1) 
     27      , withAxis(false), isChecked(false), isDomainAxisChecked(false), axis(), domain() 
     28      , storeIndex(1), out_i_index(1), out_j_index(1), out_l_index(1), isDomConServerComputed_(false) 
    2929   { /* Ne rien faire de plus */ } 
    3030 
    3131   CGrid::~CGrid(void) 
    32    {  
     32   { 
    3333 //     this->axis.reset() ; 
    3434//      this->domain.reset() ; 
    3535    deque< CArray<int, 1>* >::iterator it ; 
    36      
     36 
    3737    for(deque< CArray<int,1>* >::iterator it=storeIndex.begin(); it!=storeIndex.end();it++)  delete *it ; 
    3838    for(deque< CArray<int,1>* >::iterator it=out_i_index.begin();it!=out_i_index.end();it++) delete *it ; 
     
    5555 
    5656   const std::deque< CArray<int,1>* > & CGrid::getStoreIndex(void) const 
    57    {  
     57   { 
    5858      return (this->storeIndex ); 
    5959   } 
     
    6262 
    6363   const std::deque< CArray<int,1>* > & CGrid::getOutIIndex(void)  const 
    64    {  
    65       return (this->out_i_index );  
     64   { 
     65      return (this->out_i_index ); 
    6666   } 
    6767 
     
    6969 
    7070   const std::deque< CArray<int,1>* > & CGrid::getOutJIndex(void)  const 
    71    {  
    72       return (this->out_j_index );  
     71   { 
     72      return (this->out_j_index ); 
    7373   } 
    7474 
     
    7676 
    7777   const std::deque< CArray<int,1>* > & CGrid::getOutLIndex(void)  const 
    78    {  
    79       return (this->out_l_index );  
     78   { 
     79      return (this->out_l_index ); 
    8080   } 
    8181 
     
    8383 
    8484   const CAxis*   CGrid::getRelAxis  (void) const 
    85    {  
    86       return (this->axis );  
     85   { 
     86      return (this->axis ); 
    8787   } 
    8888 
     
    9090 
    9191   const CDomain* CGrid::getRelDomain(void) const 
    92    {  
    93       return (this->domain );  
    94    } 
    95  
    96    //--------------------------------------------------------------- 
    97  
    98    bool CGrid::hasAxis(void) const  
    99    {  
    100       return (this->withAxis);  
     92   { 
     93      return (this->domain ); 
     94   } 
     95 
     96   //--------------------------------------------------------------- 
     97 
     98   bool CGrid::hasAxis(void) const 
     99   { 
     100      return (this->withAxis); 
    101101   } 
    102102 
     
    122122*/ 
    123123   //--------------------------------------------------------------- 
    124     
     124 
    125125/* 
    126126   StdSize CGrid::getLocalSize(void) const 
     
    147147   //--------------------------------------------------------------- 
    148148 
    149 /*    
     149/* 
    150150   StdSize CGrid::getGlobalSize(void) const 
    151151   { 
     
    166166   } 
    167167 
    168    //--------------------------------------------------------------- 
    169  
    170    void CGrid::solveReference(void) 
    171    { 
    172       if (this->isChecked) return; 
    173       CContext* context = CContext::getCurrent() ; 
    174       CContextClient* client=context->client ; 
    175        
    176       this->solveDomainRef() ; 
    177       this->solveAxisRef() ; 
    178          
    179       if (context->hasClient) 
    180       { 
    181          checkMask() ; 
    182          this->computeIndex() ; 
    183  
    184          this->storeIndex.push_front(new CArray<int,1>() ); 
    185          this->out_i_index.push_front(new CArray<int,1>()); 
    186          this->out_j_index.push_front(new CArray<int,1>()); 
    187          this->out_l_index.push_front(new CArray<int,1>()); 
    188       } 
     168   std::map<int, StdSize> CGrid::getConnectedServerDataSize() 
     169   { 
     170     std::map<int, StdSize> ret; 
     171     std::map<int, int>::const_iterator it = domConnectedServerSide_.begin(), 
     172                                       itE = domConnectedServerSide_.end(); 
     173     StdSize retVal = StdSize(0.0); 
     174     for (; it != itE; ++it) 
     175     { 
     176       retVal = it->second; 
     177       if (this->withAxis) retVal *= this->axis->size.getValue(); 
     178       retVal *= sizeof(double); 
     179       ret.insert(make_pair(it->first, retVal)); 
     180     } 
     181     return ret; 
     182   } 
     183 
     184 
     185   //--------------------------------------------------------------- 
     186 
     187//   void CGrid::solveReference(void) 
     188//   { 
     189//      if (this->isChecked) return; 
     190//      CContext* context = CContext::getCurrent() ; 
     191//      CContextClient* client=context->client ; 
     192// 
     193//      this->solveDomainRef() ; 
     194//      this->solveAxisRef() ; 
     195// 
     196//      if (context->hasClient) 
     197//      { 
     198//         checkMask() ; 
     199//         this->computeIndex() ; 
     200// 
     201//         this->storeIndex.push_front(new CArray<int,1>() ); 
     202//         this->out_i_index.push_front(new CArray<int,1>()); 
     203//         this->out_j_index.push_front(new CArray<int,1>()); 
     204//         this->out_l_index.push_front(new CArray<int,1>()); 
     205//      } 
     206////      this->computeIndexServer(); 
     207//      this->isChecked = true; 
     208//   } 
     209 
     210   void CGrid::solveDomainAxisRef(bool areAttributesChecked) 
     211   { 
     212     if (this->isDomainAxisChecked) return; 
     213 
     214     this->solveDomainRef(areAttributesChecked); 
     215     this->solveAxisRef(areAttributesChecked); 
     216 
     217     this->isDomainAxisChecked = areAttributesChecked; 
     218   } 
     219 
     220   void CGrid::checkMaskIndex(bool doSendingIndex) 
     221   { 
     222     CContext* context = CContext::getCurrent() ; 
     223     CContextClient* client=context->client ; 
     224 
     225     if (context->hasClient) 
     226      if (this->isChecked && doSendingIndex) sendIndex(); 
     227 
     228     if (this->isChecked) return; 
     229 
     230     if (context->hasClient) 
     231     { 
     232        checkMask() ; 
     233        this->computeIndex() ; 
     234 
     235        this->storeIndex.push_front(new CArray<int,1>() ); 
     236        this->out_i_index.push_front(new CArray<int,1>()); 
     237        this->out_j_index.push_front(new CArray<int,1>()); 
     238        this->out_l_index.push_front(new CArray<int,1>()); 
     239     } 
    189240//      this->computeIndexServer(); 
    190       this->isChecked = true; 
     241     this->isChecked = true; 
    191242   } 
    192243 
     
    206257             (mask.extent(2) != nlu)) 
    207258             ERROR("CGrid::checkAttributes(void)", 
    208                   <<"The mask has not the same size than the local grid"<<endl  
     259                  <<"The mask has not the same size than the local grid"<<endl 
    209260                  <<"Local size is "<<niu<<"x"<<nju<<"x"<<nlu<<endl 
    210261                  <<"Mask size is "<<mask.extent(0)<<"x"<<mask.extent(1)<<"x"<<mask.extent(2)); 
    211262      } 
    212       else  
     263      else 
    213264      { 
    214265        mask.resize(niu,nju,nlu) ; 
    215266        mask=true  ; 
    216267      } 
    217       
     268 
    218269      CArray<bool,2>& domainMask = domain->mask ; 
    219270      for (int l=0; l < nlu ; l++) 
    220271        for (int j=0; j < nju ; j++) 
    221272          for(int i=0; i<niu ; i++) mask(i,j,l) = mask(i,j,l) && domainMask(i,j) ; 
    222          
    223        
    224    } 
    225     
    226    //--------------------------------------------------------------- 
    227  
    228    void CGrid::solveDomainRef(void) 
     273 
     274 
     275   } 
     276 
     277   //--------------------------------------------------------------- 
     278 
     279//   void CGrid::solveDomainRef(void) 
     280//   { 
     281//      if (!domain_ref.isEmpty()) 
     282//      { 
     283//         if (CDomain::has(domain_ref.getValue())) 
     284//         { 
     285//            this->domain = CDomain::get(domain_ref.getValue()) ; 
     286//            domain->checkAttributes() ; 
     287//         } 
     288//         else ERROR("CGrid::solveDomainRef(void)", 
     289//                     << "Wrong domain reference") ; 
     290//      } 
     291//      else ERROR("CGrid::solveDomainRef(void)", 
     292//                  << "Domain reference is not defined") ; 
     293//   } 
     294// 
     295//   //--------------------------------------------------------------- 
     296// 
     297//   void CGrid::solveAxisRef(void) 
     298//   { 
     299//      if (!axis_ref.isEmpty()) 
     300//      { 
     301//         this->withAxis = true ; 
     302//         if (CAxis::get(axis_ref.getValue())) 
     303//         { 
     304//            this->axis = CAxis::get(axis_ref.getValue()) ; 
     305//            axis->checkAttributes() ; 
     306//         } 
     307//         else ERROR("CGrid::solveAxisRef(void)", 
     308//                    << "Wrong axis reference") ; 
     309//      } 
     310//      else withAxis = false ; 
     311//   } 
     312 
     313 
     314   void CGrid::solveDomainRef(bool sendAtt) 
    229315   { 
    230316      if (!domain_ref.isEmpty()) 
     
    233319         { 
    234320            this->domain = CDomain::get(domain_ref.getValue()) ; 
    235             domain->checkAttributes() ; 
     321            if (sendAtt) domain->sendCheckedAttributes(); 
     322            else domain->checkAttributesOnClient() ; 
    236323         } 
    237324         else ERROR("CGrid::solveDomainRef(void)", 
     
    244331   //--------------------------------------------------------------- 
    245332 
    246    void CGrid::solveAxisRef(void) 
     333   void CGrid::solveAxisRef(bool checkAtt) 
    247334   { 
    248335      if (!axis_ref.isEmpty()) 
     
    263350 
    264351   void CGrid::computeIndex(void) 
    265    {     
    266     
     352   { 
     353 
    267354      const int ni   = domain->ni.getValue() , 
    268355                nj   = domain->nj.getValue() , 
     
    280367      CArray<int,1> data_i_index = domain->data_i_index ; 
    281368      CArray<int,1> data_j_index = domain->data_j_index ; 
    282        
     369 
    283370 
    284371      int indexCount = 0; 
     
    302389         } 
    303390      } 
    304        
     391 
    305392      storeIndex[0]  = new CArray<int,1>(indexCount) ; 
    306393      out_i_index[0] = new CArray<int,1>(indexCount) ; 
    307394      out_j_index[0] = new CArray<int,1>(indexCount) ; 
    308395      out_l_index[0] = new CArray<int,1>(indexCount) ; 
    309        
     396 
    310397      storeIndex_client.resize(indexCount) ; 
    311398      out_i_client.resize(indexCount) ; 
    312399      out_j_client.resize(indexCount) ; 
    313400      out_l_client.resize(indexCount) ; 
    314        
    315        
     401 
     402 
    316403      for(int count = 0, indexCount = 0,  l = 0; l < size; l++) 
    317404      { 
     
    334421               (*out_i_index[0])(indexCount) = i ; 
    335422               (*out_j_index[0])(indexCount) = j ; 
    336                 
     423 
    337424               storeIndex_client(indexCount) = count ; 
    338425               out_i_client(indexCount)=i+domain->ibegin_client-1 ; 
     
    343430         } 
    344431      } 
    345       sendIndex() ; 
     432      computeDomConServer(); 
     433//      sendIndex() ; 
    346434 
    347435 
     
    370458   //---------------------------------------------------------------- 
    371459 
    372    void CGrid::outputField(int rank, const CArray<double, 1>& stored,  CArray<double, 3>& field)  
     460   void CGrid::outputField(int rank, const CArray<double, 1>& stored,  CArray<double, 3>& field) 
    373461   { 
    374462      CArray<int,1>& out_i=*out_i_fromClient[rank] ; 
    375463      CArray<int,1>& out_j=*out_j_fromClient[rank] ; 
    376464      CArray<int,1>& out_l=*out_l_fromClient[rank] ; 
    377        
     465 
    378466      for(StdSize n = 0; n < stored.numElements(); n++) 
    379467         field(out_i(n), out_j(n), out_l(n)) = stored(n) ; 
    380468   } 
    381469 
    382    void CGrid::outputField(int rank, const CArray<double, 1>& stored,  CArray<double, 2>& field)  
     470   void CGrid::outputField(int rank, const CArray<double, 1>& stored,  CArray<double, 2>& field) 
    383471   { 
    384472      CArray<int,1>& out_i=*out_i_fromClient[rank] ; 
    385473      CArray<int,1>& out_j=*out_j_fromClient[rank] ; 
    386        
     474 
    387475      for(StdSize n = 0; n < stored.numElements(); n++) 
    388476         field(out_i(n), out_j(n)) = stored(n) ;   } 
     
    393481   { 
    394482      CArray<int,1>& out_i=*out_i_fromClient[rank] ; 
    395   
     483 
    396484      for(StdSize n = 0; n < stored.numElements(); n++) 
    397485         field(out_i(n)) = stored(n) ; 
     
    399487 
    400488   //---------------------------------------------------------------- 
    401    
     489 
    402490 
    403491   void CGrid::storeField_arr 
     
    409497      for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client(i)] ; 
    410498   } 
    411     
    412    //--------------------------------------------------------------- 
     499 
     500   //--------------------------------------------------------------- 
     501 
     502//  void CGrid::sendIndex(void) 
     503//  { 
     504//    CContext* context = CContext::getCurrent() ; 
     505//    CContextClient* client=context->client ; 
     506// 
     507//    CEventClient event(getType(),EVENT_ID_INDEX) ; 
     508//    int rank ; 
     509//    list<shared_ptr<CMessage> > list_msg ; 
     510//    list< CArray<int,1>* > list_out_i,list_out_j,list_out_l ; 
     511// 
     512//    for(int ns=0;ns<domain->connectedServer.size();ns++) 
     513//    { 
     514//       rank=domain->connectedServer[ns] ; 
     515// 
     516//       int i,j ; 
     517//       int nb=0 ; 
     518//       for(int k=0;k<storeIndex_client.numElements();k++) 
     519//       { 
     520//         i=out_i_client(k)- domain->ibegin +1; 
     521//         j=out_j_client(k)- domain->jbegin +1; 
     522//         if (domain->mapConnectedServer(i,j)==ns)  nb++ ; 
     523//       } 
     524// 
     525//       CArray<int,1> storeIndex(nb) ; 
     526//       CArray<int,1> out_i(nb) ; 
     527//       CArray<int,1> out_j(nb) ; 
     528//       CArray<int,1> out_l(nb) ; 
     529// 
     530// 
     531//       nb=0 ; 
     532//       for(int k=0;k<storeIndex_client.numElements();k++) 
     533//       { 
     534//         i=out_i_client(k)- domain->ibegin +1 ; 
     535//         j=out_j_client(k)- domain->jbegin +1 ; 
     536//         if (domain->mapConnectedServer(i,j)==ns) 
     537//         { 
     538//            storeIndex(nb)=k ; 
     539//            out_i(nb)=domain->i_index(i,j) + domain->ibegin-1; 
     540//            out_j(nb)=domain->j_index(i,j) + domain->jbegin-1; 
     541//            out_l(nb)=out_l_client(k) ; 
     542//            nb++ ; 
     543//         } 
     544//       } 
     545// 
     546//       storeIndex_toSrv.insert( pair<int,CArray<int,1>* >(rank,new CArray<int,1>(storeIndex) )) ; 
     547//       nbSenders.insert(pair<int,int>(rank,domain->nbSenders[ns])) ; 
     548//       list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 
     549//       list_out_i.push_back(new CArray<int,1>(out_i)) ; 
     550//       list_out_j.push_back(new CArray<int,1>(out_j)) ; 
     551//       list_out_l.push_back(new CArray<int,1>(out_l)) ; 
     552// 
     553//       *list_msg.back()<<getId()<<*list_out_i.back()<<*list_out_j.back()<<*list_out_l.back() ; 
     554//       event.push(rank,domain->nbSenders[ns],*list_msg.back()) ; 
     555//    } 
     556//    client->sendEvent(event) ; 
     557// 
     558//    for(list<CArray<int,1>* >::iterator it=list_out_i.begin();it!=list_out_i.end();it++) delete *it ; 
     559//    for(list<CArray<int,1>* >::iterator it=list_out_j.begin();it!=list_out_j.end();it++) delete *it ; 
     560//    for(list<CArray<int,1>* >::iterator it=list_out_l.begin();it!=list_out_l.end();it++) delete *it ; 
     561// 
     562//  } 
     563 
     564  void CGrid::computeDomConServer() 
     565  { 
     566    if (!isDomConServerComputed_) 
     567    { 
     568      for(int ns=0;ns<domain->connectedServer.size(); ++ns) 
     569      { 
     570         int rank=domain->connectedServer[ns] ; 
     571 
     572         int i,j ; 
     573         int nb=0 ; 
     574         for(int k=0;k<storeIndex_client.numElements();++k) 
     575         { 
     576           i=out_i_client(k)- domain->ibegin +1; 
     577           j=out_j_client(k)- domain->jbegin +1; 
     578           if (domain->mapConnectedServer(i,j)==ns)  ++nb ; 
     579         } 
     580 
     581         domConnectedServerSide_.insert(std::make_pair(rank, nb)); 
     582      } 
     583      isDomConServerComputed_ = true; 
     584    } 
     585  } 
     586 
     587 
     588  std::map<int, int> CGrid::getDomConServerSide() 
     589  { 
     590    return domConnectedServerSide_; 
     591  } 
    413592 
    414593  void CGrid::sendIndex(void) 
     
    416595    CContext* context = CContext::getCurrent() ; 
    417596    CContextClient* client=context->client ; 
    418      
     597 
    419598    CEventClient event(getType(),EVENT_ID_INDEX) ; 
    420599    int rank ; 
    421600    list<shared_ptr<CMessage> > list_msg ; 
    422601    list< CArray<int,1>* > list_out_i,list_out_j,list_out_l ; 
    423       
     602 
     603    if (!isDomConServerComputed_) computeDomConServer(); 
     604 
    424605    for(int ns=0;ns<domain->connectedServer.size();ns++) 
    425606    { 
    426607       rank=domain->connectedServer[ns] ; 
    427         
    428        int i,j ; 
    429        int nb=0 ; 
    430        for(int k=0;k<storeIndex_client.numElements();k++) 
    431        { 
    432          i=out_i_client(k)- domain->ibegin +1; 
    433          j=out_j_client(k)- domain->jbegin +1; 
    434          if (domain->mapConnectedServer(i,j)==ns)  nb++ ; 
    435        } 
    436         
     608 
     609       int nb = domConnectedServerSide_.find(rank)->second; 
    437610       CArray<int,1> storeIndex(nb) ; 
    438611       CArray<int,1> out_i(nb) ; 
    439612       CArray<int,1> out_j(nb) ; 
    440613       CArray<int,1> out_l(nb) ; 
    441   
    442         
     614 
     615       int i, j; 
    443616       nb=0 ; 
    444617       for(int k=0;k<storeIndex_client.numElements();k++) 
     
    450623            storeIndex(nb)=k ; 
    451624            out_i(nb)=domain->i_index(i,j) + domain->ibegin-1; 
    452             out_j(nb)=domain->j_index(i,j) + domain->jbegin-1;  
     625            out_j(nb)=domain->j_index(i,j) + domain->jbegin-1; 
    453626            out_l(nb)=out_l_client(k) ; 
    454627            nb++ ; 
    455628         } 
    456629       } 
    457         
     630 
    458631       storeIndex_toSrv.insert( pair<int,CArray<int,1>* >(rank,new CArray<int,1>(storeIndex) )) ; 
    459632       nbSenders.insert(pair<int,int>(rank,domain->nbSenders[ns])) ; 
     
    471644    for(list<CArray<int,1>* >::iterator it=list_out_j.begin();it!=list_out_j.end();it++) delete *it ; 
    472645    for(list<CArray<int,1>* >::iterator it=list_out_l.begin();it!=list_out_l.end();it++) delete *it ; 
    473      
     646 
    474647  } 
    475    
     648 
    476649  void CGrid::recvIndex(CEventServer& event) 
    477650  { 
     
    486659    } 
    487660  } 
    488    
     661 
    489662  void CGrid::recvIndex(int rank, CBufferIn& buffer) 
    490663  { 
     
    492665    CArray<int,1> out_j ; 
    493666    CArray<int,1> out_l ; 
    494      
     667 
    495668    buffer>>out_i>>out_j>>out_l ; 
    496      
     669 
    497670    out_i -= domain->zoom_ibegin_srv-1 ; 
    498671    out_j -= domain->zoom_jbegin_srv-1 ; 
    499      
     672 
    500673    out_i_fromClient.insert(pair< int,CArray<int,1>* >(rank,new CArray<int,1>(out_i) )) ; 
    501674    out_j_fromClient.insert(pair< int,CArray<int,1>* >(rank,new CArray<int,1>(out_j) )) ; 
     
    505678  bool CGrid::dispatchEvent(CEventServer& event) 
    506679  { 
    507       
     680 
    508681    if (SuperClass::dispatchEvent(event)) return true ; 
    509682    else 
     
    515688          return true ; 
    516689          break ; 
    517   
     690 
    518691        default : 
    519692          ERROR("bool CDomain::dispatchEvent(CEventServer& event)", 
     
    532705                << "Data from clients are missing!") ; 
    533706      storedServer.resize(storeIndex[0]->numElements()); 
    534           
     707 
    535708      for (StdSize i = 0, n = 0; i < storedClient.size(); i++) 
    536709         for (StdSize j = 0; j < storedClient[i]->numElements(); j++) 
     
    543716     int nb=index.numElements() ; 
    544717     fieldOut.resize(nb) ; 
    545       
     718 
    546719     for(int k=0;k<nb;k++) fieldOut(k)=fieldIn(index(k)) ; 
    547720    } 
  • XIOS/trunk/src/node/grid.hpp

    r501 r509  
    1313 
    1414namespace xios { 
    15     
     15 
    1616   /// ////////////////////// Déclarations ////////////////////// /// 
    1717 
     
    4646           EVENT_ID_INDEX 
    4747         } ; 
    48           
     48 
    4949         /// Constructeurs /// 
    5050         CGrid(void); 
     
    5454 
    5555         /// Traitements /// 
    56          void solveReference(void); 
     56//         void solveReference(void); 
     57 
     58         void solveDomainAxisRef(bool areAttributesChecked); 
     59 
     60         void checkMaskIndex(bool doCalculateIndex); 
    5761 
    5862 //        virtual void toBinary  (StdOStream & os) const; 
     
    7478 
    7579         StdSize getDimension(void) const; 
    76           
     80 
    7781//         StdSize getLocalSize(void) const; 
    7882//         StdSize getGlobalSize(void) const; 
     
    8488         template <int n> 
    8589            void inputField(const CArray<double,n>& field, CArray<double,1>& stored) const; 
    86              
     90 
    8791         void inputFieldServer(const std::deque< CArray<double, 1>* > storedClient, 
    8892                               CArray<double, 1>&  storedServer) const; 
     
    9094         void outputField(int rank, const CArray<double,1>& stored,  CArray<double,3>& field)  ; 
    9195         void outputField(int rank, const CArray<double,1>& stored,  CArray<double,2>& field)  ; 
    92          void outputField(int rank, const CArray<double,1>& stored,  CArray<double,1>& field)  ;  
    93     
     96         void outputField(int rank, const CArray<double,1>& stored,  CArray<double,1>& field)  ; 
     97 
    9498         /// Destructeur /// 
    9599         virtual ~CGrid(void); 
     
    100104         static StdString GetName(void); 
    101105         static StdString GetDefName(void); 
    102           
     106 
    103107         static ENodeType GetType(void); 
    104108 
     
    115119         void computeIndexServer(void); 
    116120         void computeIndex(void); 
    117          void solveDomainRef(void); 
    118          void solveAxisRef(void); 
     121//         void solveDomainRef(void);  //TODO temporarily comment 
     122//         void solveAxisRef(void);   // TODO: temporarily comment 
     123 
     124         void solveDomainRef(bool checkAtt); 
     125         void solveAxisRef(bool checkAtt); 
    119126 
    120127         static bool dispatchEvent(CEventServer& event) ; 
     
    123130         void recvIndex(int rank, CBufferIn& buffer) ; 
    124131         void sendIndex(void) ; 
    125           
     132 
     133         void computeDomConServer(); 
     134         std::map<int, int> getDomConServerSide(); 
     135         std::map<int, StdSize> getConnectedServerDataSize(); 
    126136      public: 
    127137 
     
    129139         bool withAxis ; 
    130140         bool isChecked; 
     141         bool isDomainAxisChecked; 
    131142 
    132143         CAxis*   axis ; 
     
    137148         std::deque< CArray<int, 1>* > out_j_index ; 
    138149         std::deque< CArray<int, 1>* > out_l_index ; 
    139           
     150 
    140151        CArray<int, 1>  storeIndex_client ; 
    141152        CArray<int, 1>  out_i_client ; 
    142153        CArray<int, 1>  out_j_client ; 
    143154        CArray<int, 1>  out_l_client ; 
    144           
     155 
    145156         map<int, CArray<int, 1>* >  storeIndex_toSrv ; 
    146157         map<int,int> nbSenders ; 
     
    148159//         std::deque<ARRAY(int, 1)> out_j_toSrv ; 
    149160//         std::deque<ARRAY(int, 1)> out_l_toSrv ; 
    150           
     161 
    151162         map<int, CArray<int, 1>* > out_i_fromClient ; 
    152163         map<int, CArray<int, 1>* > out_j_fromClient ; 
    153164         map<int, CArray<int, 1>* > out_l_fromClient ; 
    154165         void checkMask(void) ; 
     166 
     167         std::map<int, int> domConnectedServerSide_; 
     168         bool isDomConServerComputed_; 
    155169   }; // class CGrid 
    156170 
  • XIOS/trunk/src/object_template.hpp

    r501 r509  
    2626         typedef CObject SuperClass; 
    2727         typedef T DerivedType; 
    28           
     28 
    2929         enum EEventId 
    3030         { 
     
    4242         virtual string getName(void) const ; 
    4343         virtual void parse(xml::CXMLNode & node); 
    44           
     44 
    4545         /// Accesseurs /// 
    4646         ENodeType getType(void) const; 
     
    5656         void sendAttributToServer(const string& id); 
    5757         void sendAttributToServer(CAttribute& attr) ; 
     58         void sendAllAttributesToServer(); 
    5859         static void recvAttributFromClient(CEventServer& event) ; 
    5960         static bool dispatchEvent(CEventServer& event) ; 
     
    6566         /// Destructeur /// 
    6667         virtual ~CObjectTemplate(void); 
    67           
     68 
    6869         static bool has(const string& id) ; 
    6970         static bool has(const string& contextId, const string& id) ; 
     
    7475         shared_ptr<T> getShared(void) ; 
    7576         static shared_ptr<T> getShared(const T* ptr) ; 
    76           
     77 
    7778         static T* create(const string& id=string("")) ; 
    7879         static const vector<T*> getAll() ; 
    7980         static const vector<T*> getAll(const string& contextId) ; 
    80          
     81 
    8182         void generateCInterface(ostream& oss) ; 
    8283         void generateFortran2003Interface(ostream& oss) ; 
    8384         void generateFortranInterface(ostream& oss) ; 
    84           
     85 
    8586      protected : 
    8687 
     
    9798         static xios_map<StdString, 
    9899                xios_map<StdString, 
    99                 boost::shared_ptr<DerivedType> > > AllMapObj;  
     100                boost::shared_ptr<DerivedType> > > AllMapObj; 
    100101         static xios_map<StdString, 
    101102                std::vector<boost::shared_ptr<DerivedType> > > AllVectObj; 
    102                  
     103 
    103104         static xios_map< StdString, long int > GenId ; 
    104105 
  • XIOS/trunk/src/object_template_impl.hpp

    r501 r509  
    5555      ERROR("CObjectTemplate<T> construtor 3", << "Not completly implemented yet !"); 
    5656   } 
    57     
     57 
    5858   template <class T> 
    5959      CObjectTemplate<T>::~CObjectTemplate(void) 
     
    6565      std::vector<boost::shared_ptr<T> > & 
    6666         CObjectTemplate<T>::GetAllVectobject(const StdString & contextId) 
    67    {  
    68       return (CObjectTemplate<T>::AllVectObj[contextId]);  
    69    } 
    70     
    71    //--------------------------------------------------------------- 
    72     
     67   { 
     68      return (CObjectTemplate<T>::AllVectObj[contextId]); 
     69   } 
     70 
     71   //--------------------------------------------------------------- 
     72 
    7373   template <class T> 
    7474      StdString CObjectTemplate<T>::toString(void) const 
     
    8484   template <class T> 
    8585      void CObjectTemplate<T>::fromString(const StdString & str) 
    86    {  
     86   { 
    8787      ERROR("CObjectTemplate<T>::fromString(str)", 
    88             << "[ str = " << str << "] Not implemented yet !");  
    89    } 
    90     
    91    //--------------------------------------------------------------- 
    92  
    93 /*    
     88            << "[ str = " << str << "] Not implemented yet !"); 
     89   } 
     90 
     91   //--------------------------------------------------------------- 
     92 
     93/* 
    9494   template <class T> 
    9595      void CObjectTemplate<T>::toBinary(StdOStream & os) const 
    9696   { 
    97       SuperClassMap::toBinary(os);     
    98    } 
    99        
     97      SuperClassMap::toBinary(os); 
     98   } 
     99 
    100100   template <class T> 
    101101      void CObjectTemplate<T>::fromBinary(StdIStream & is) 
    102102   { 
    103       SuperClassMap::fromBinary(is);  
     103      SuperClassMap::fromBinary(is); 
    104104   } 
    105105*/ 
     
    121121      return (T::GetType()); 
    122122   } 
    123    
     123 
    124124   template <class T> 
    125125   string CObjectTemplate<T>::getName(void) const 
     
    127127      return (T::GetName()); 
    128128   } 
    129    
     129 
    130130   //--------------------------------------------------------------- 
    131131 
    132132   template <class T> 
    133133      bool CObjectTemplate<T>::hasChild(void) const 
    134    {  
    135       return (false);  
     134   { 
     135      return (false); 
    136136   } 
    137137 
     
    140140   template <class T> 
    141141      void CObjectTemplate<T>::solveDescInheritance(bool apply, const CAttributeMap * const parent) 
    142    {  
    143       SuperClassMap::setAttributes(parent, apply);  
     142   { 
     143      SuperClassMap::setAttributes(parent, apply); 
    144144   } 
    145145 
     
    160160   } 
    161161 
     162   template<typename T> 
     163   void CObjectTemplate<T>::sendAllAttributesToServer() 
     164   { 
     165     CAttributeMap& attrMap = *this; 
     166     CAttributeMap::const_iterator it = attrMap.begin(), itE = attrMap.end(); 
     167     for (; it != itE; ++it) 
     168     { 
     169       if (!(it->second)->isEmpty()) sendAttributToServer(*(it->second)); 
     170     } 
     171 
     172   } 
     173 
    162174   template <class T> 
    163175   void CObjectTemplate<T>::sendAttributToServer(const string& id) 
     
    172184  { 
    173185    CContext* context=CContext::getCurrent() ; 
    174      
     186 
    175187    if (!context->hasServer) 
    176188    { 
    177189       CContextClient* client=context->client ; 
    178190 
    179        CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE) ;    
     191       CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE) ; 
    180192       if (client->isServerLeader()) 
    181193       { 
     
    189201       else client->sendEvent(event) ; 
    190202    } 
    191        
     203 
    192204  } 
    193     
     205 
    194206  template <class T> 
    195207  void CObjectTemplate<T>::recvAttributFromClient(CEventServer& event) 
    196208  { 
    197        
     209 
    198210    CBufferIn* buffer=event.subEvents.begin()->buffer; 
    199211    string id,attrId; 
     
    220232           return true ; 
    221233           break ; 
    222         
     234 
    223235         default : 
    224236         return false ; 
     
    227239      } 
    228240   } 
    229     
     241 
    230242   template <typename T> 
    231243   bool CObjectTemplate<T>::has(const string & id) 
     
    251263     return CObjectFactory::GetObject<T>(ptr).get() ; 
    252264   } 
    253     
     265 
    254266   template <typename T> 
    255267   shared_ptr<T> CObjectTemplate<T>::getShared(const T* ptr) 
     
    263275     return CObjectFactory::GetObject<T>((T*)this) ; 
    264276   } 
    265     
     277 
    266278   template <typename T> 
    267279   const vector<T*> CObjectTemplate<T>::getAll() 
     
    269281     const vector< shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(); 
    270282     vector<T*> vect ; 
    271      
     283 
    272284     typename vector<shared_ptr<T> >::const_iterator it; 
    273285     for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()) ; 
     
    280292     const vector< shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(id); 
    281293     vector<T*> vect ; 
    282      
     294 
    283295     typename vector<shared_ptr<T> >::const_iterator it; 
    284296     for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()) ; 
     
    303315    return CObjectFactory::GetObject<T>((T*)this).get() ; 
    304316  } 
    305    
     317 
    306318   template <typename T> 
    307319   void CObjectTemplate<T>::generateCInterface(ostream& oss) 
     
    310322     int found=className.find_first_of("_") ; 
    311323     if (found!=string::npos) className.replace(found,1,0,'x') ; 
    312       
     324 
    313325     oss<<"/* ************************************************************************** *"<<iendl ; 
    314326     oss<<" *               Interface auto generated - do not modify                   *"<<iendl ; 
     
    340352     int found=className.find_first_of("_") ; 
    341353     if (found!=string::npos) className.replace(found,1,0,'x') ; 
    342       
     354 
    343355     oss<<"! * ************************************************************************** *"<<iendl ; 
    344356     oss<<"! *               Interface auto generated - do not modify                     *"<<iendl ; 
     
    349361     oss<<iendl ; 
    350362     oss<<"INTERFACE ! Do not call directly / interface FORTRAN 2003 <-> C99"<<iendl++ ; 
    351      oss<<iendl ;    
     363     oss<<iendl ; 
    352364     oss<<iendl ; 
    353365     SuperClassMap::generateFortran2003Interface(oss,className) ; 
     
    356368     oss<<"END MODULE "<<className<<"_interface_attr"<<iendl ; 
    357369   } 
    358    
     370 
    359371   template <typename T> 
    360372   void CObjectTemplate<T>::generateFortranInterface(ostream& oss) 
     
    366378     found=superClassName.find("_group") ; 
    367379     if (found!=string::npos) superClassName.erase(found,6) ; 
    368       
     380 
    369381     oss<<"! * ************************************************************************** *"<<iendl ; 
    370382     oss<<"! *               Interface auto generated - do not modify                     *"<<iendl ; 
     
    398410     SuperClassMap::generateFortranInterfaceIsDefined_hdl(oss,className) ; 
    399411     oss<<iendl ; 
    400      SuperClassMap::generateFortranInterfaceIsDefined_hdl_(oss,className) ;      
     412     SuperClassMap::generateFortranInterfaceIsDefined_hdl_(oss,className) ; 
    401413     oss<<iendl-- ; 
    402414     oss<<"END MODULE i"<<className<<"_attr"<<iendl ; 
  • XIOS/trunk/src/xml_parser.cpp

    r501 r509  
    1313      /// ////////////////////// Définitions ////////////////////// /// 
    1414 
    15       void CXMLParser::ParseFile(const StdString & filename) 
     15      void CXMLParser::ParseFile(const StdString & filename, const std::set<StdString>& parseContextList) 
    1616      { 
    1717         StdIFStream ifs ( filename.c_str() , StdIFStream::in ); 
     
    2020                  <<endl<< "Can not open <"<<filename<<"> file" ); 
    2121 
    22          CXMLParser::ParseStream(ifs, filename); 
     22         CXMLParser::ParseStream(ifs, filename, parseContextList); 
    2323      } 
    2424 
     
    2626      { 
    2727         StdIStringStream iss ( xmlContent /*, StdIStringStream::in*/ ); 
    28          CXMLParser::ParseStream(iss,"string"); 
     28         std::set<StdString> contxtList; 
     29         CXMLParser::ParseStream(iss,"string", contxtList); 
    2930      } 
    3031 
    31       void CXMLParser::ParseStream(StdIStream & stream, const string& fluxId) 
     32      void CXMLParser::ParseStream(StdIStream & stream, const string& fluxId, const std::set<StdString>& parseContextList) 
    3233      { 
    3334         if (!stream.good()) 
     
    5051                     << node.getElementName() << "\')!"); 
    5152 
     53            std::set<StdString>::iterator it; 
     54            std::set<StdString>::const_iterator itE = parseContextList.end(); 
     55            bool isParseAll = (parseContextList.empty()); 
    5256            if (node.goToChildElement()) 
    5357            { 
     
    5559               { 
    5660                  CContextGroup* group_context = CContext::getRoot() ; 
    57   
     61 
    5862                  attributes = node.getAttributes(); 
    5963 
    6064                  if (attributes.end() == attributes.find("id")) 
    61                   {   
     65                  { 
    6266                     DEBUG("The context will not be processed because it is not identified (missing id)"); 
    63                      continue;  
     67                     continue; 
    6468                  } 
    6569 
     
    6973 
    7074                  if(hasctxt) 
    71                   {   
     75                  { 
    7276                     DEBUG("The context will not be processed because it exist an other context with the same id" ); 
    73                      continue;  
     77                     continue; 
    7478                  } 
    7579 
    76                   CContext* context = CContext::create(attributes["id"]); 
     80                  if (isParseAll) 
     81                  { 
     82                    CContext* context = CContext::create(attributes["id"]); 
    7783//                  if (!hasctxt)  group_context->addChild(context); 
    78                   context->parse(node); 
     84                    context->parse(node); 
    7985 
    80                   attributes.clear(); 
     86                    attributes.clear(); 
     87                  } 
     88                  else 
     89                  { 
     90                    it = parseContextList.find(attributes["id"]); 
     91                    if (itE != it) 
     92                    { 
     93                      CContext* context = CContext::create(*it); 
     94  //                  if (!hasctxt)  group_context->addChild(context); 
     95                      context->parse(node); 
    8196 
     97                      attributes.clear(); 
     98                    } 
     99                  } 
    82100               } while (node.goToNextElement()); 
    83101            } 
     
    93111            const char* line; 
    94112            const char* endLine; 
    95              
     113 
    96114            for(const char* i=content;i<content+pos; ++i, ++columnNumber) if (*i=='\n') { lineNumber++ ; line=i ; columnNumber=0 ;} 
    97115            for(endLine=content+pos; *endLine!='\n' && *endLine!='\0' ; ++endLine) ; 
    98116            string strLine(line,endLine-line) ; 
    99                    
     117 
    100118            ERROR("CXMLParser::ParseStream(StdIStream & stream)", << endl 
    101119                  << "Error is occuring when parsing XML flux from <"<<fluxId<<"> at character "<< pos<<" line "<<lineNumber<<" column "<< columnNumber<< endl 
  • XIOS/trunk/src/xml_parser.hpp

    r501 r509  
    1717         public : 
    1818 
    19             static void ParseFile(const StdString & filename); 
     19            static void ParseFile(const StdString & filename, const std::set<StdString>& parseList = std::set<StdString>()); 
    2020            static void ParseString(const StdString & xmlContent); 
    21             static void ParseStream(StdIStream & stream, const string& fluxId); 
     21            static void ParseStream(StdIStream & stream, const string& fluxId, const std::set<StdString>& parseList); 
    2222            template <class T> 
    2323               static void ParseInclude(StdIStream & stream, const string& fluxId, T & object); 
Note: See TracChangeset for help on using the changeset viewer.