Ignore:
Timestamp:
11/02/15 11:46:25 (9 years ago)
Author:
mhnguyen
Message:

Implementing the reading of attributes of an axis from a file

+) 3d grid can be read directly from a file
+) Clean some redundant codes
+) Add new attribute declaration that allows to output only desired attributes

Test
+) On Curie
+) test_remap passes and result is correct

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/attribute_template_impl.hpp

    r591 r775  
    88#include "attribute_template.hpp" 
    99 
    10    
     10 
    1111namespace xios 
    1212{ 
     
    5454      template <class T> 
    5555      CAttributeTemplate<T>::~CAttributeTemplate(void) 
    56       {  
     56      { 
    5757//         this->CType<T>::reset() ; 
    5858//         this->clear(); 
     
    108108    { 
    109109      this->set(dynamic_cast<const CAttributeTemplate<T>& >(attr)) ; 
    110     }  
     110    } 
    111111 
    112112   template <class T> 
     
    114114    { 
    115115      CType<T>::set(attr) ; 
    116     }  
     116    } 
    117117 
    118118    template <class T> 
     
    120120    { 
    121121      this->setInheritedValue(dynamic_cast<const CAttributeTemplate<T>& >(attr)) ; 
    122     }  
     122    } 
    123123 
    124124    template <class T> 
     
    126126    { 
    127127      if (this->isEmpty() && attr.hasInheritedValue()) inheritedValue.set(attr.getInheritedValue()) ; 
    128     }  
     128    } 
    129129 
    130130    template <class T> 
     
    133133      if (this->isEmpty()) return inheritedValue.get() ; 
    134134      else return getValue() ; 
    135     }  
    136      
     135    } 
     136 
    137137    template <class T> 
    138138    bool CAttributeTemplate<T>::hasInheritedValue(void) const 
    139139    { 
    140140      return !this->isEmpty() || !inheritedValue.isEmpty() ; 
    141     }  
    142      
     141    } 
     142 
    143143      //--------------------------------------------------------------- 
    144144 
     
    188188      { 
    189189         return CType<T>::toBuffer(buffer) ; 
    190 /*          
     190/* 
    191191         if (isEmpty()) return buffer.put(true) ; 
    192192         else 
     
    205205      { 
    206206        return CType<T>::fromBuffer(buffer) ; 
    207 /*         
     207/* 
    208208        bool empty ; 
    209209        bool ret=true ; 
    210210        ret&=buffer.get(empty) ; 
    211         if (empty)  
     211        if (empty) 
    212212        { 
    213213          clear() ; 
     
    230230      template <class T> 
    231231      size_t CAttributeTemplate<T>::size(void) const 
    232       {  
     232      { 
    233233        return CType<T>::size() ;*/ 
    234 /*         
     234/* 
    235235        if (isEmpty()) return sizeof(bool) ; 
    236236        else 
     
    245245      void CAttributeTemplate<T>::generateCInterface(ostream& oss,const string& className) 
    246246      { 
    247         CInterface::AttributeCInterface<T>(oss, className, this->getName()) ; 
     247        if (this->isAttributePublic()) 
     248          CInterface::AttributeCInterface<T>(oss, className, this->getName()) ; 
    248249//        CInterface::AttributeIsDefinedCInterface(oss, className, this->getName()) ; 
    249250      } 
    250        
     251 
    251252      template <typename T> 
    252253      void CAttributeTemplate<T>::generateFortran2003Interface(ostream& oss,const string& className) 
    253254      { 
    254         CInterface::AttributeFortran2003Interface<T>(oss, className, this->getName()) ; 
     255        if (this->isAttributePublic()) 
     256          CInterface::AttributeFortran2003Interface<T>(oss, className, this->getName()) ; 
    255257//        CInterface::AttributeIsDefinedFortran2003Interface(oss, className, this->getName()) ; 
    256258      } 
    257        
     259 
    258260      template <typename T> 
    259261      void CAttributeTemplate<T>::generateFortranInterfaceDeclaration_(ostream& oss,const string& className) 
    260262      { 
    261         CInterface::AttributeFortranInterfaceDeclaration<T>(oss, className, this->getName()+"_") ; 
    262       } 
    263   
     263        if (this->isAttributePublic()) 
     264          CInterface::AttributeFortranInterfaceDeclaration<T>(oss, className, this->getName()+"_") ; 
     265      } 
     266 
    264267      template <typename T> 
    265268      void CAttributeTemplate<T>::generateFortranInterfaceBody_(ostream& oss,const string& className) 
    266269      { 
    267         CInterface::AttributeFortranInterfaceBody<T>(oss, className, this->getName()) ; 
     270        if (this->isAttributePublic()) 
     271          CInterface::AttributeFortranInterfaceBody<T>(oss, className, this->getName()) ; 
    268272      } 
    269273 
     
    271275      void CAttributeTemplate<T>::generateFortranInterfaceDeclaration(ostream& oss,const string& className) 
    272276      { 
    273         CInterface::AttributeFortranInterfaceDeclaration<T>(oss, className, this->getName()) ; 
    274       } 
    275        
     277        if (this->isAttributePublic()) 
     278          CInterface::AttributeFortranInterfaceDeclaration<T>(oss, className, this->getName()) ; 
     279      } 
     280 
    276281      template <typename T> 
    277282      void CAttributeTemplate<T>::generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) 
    278283      { 
    279         CInterface::AttributeFortranInterfaceGetDeclaration<T>(oss, className, this->getName()+"_") ; 
    280       } 
    281   
    282   
     284        if (this->isAttributePublic()) 
     285          CInterface::AttributeFortranInterfaceGetDeclaration<T>(oss, className, this->getName()+"_") ; 
     286      } 
     287 
     288 
    283289      template <typename T> 
    284290      void CAttributeTemplate<T>::generateFortranInterfaceGetBody_(ostream& oss,const string& className) 
    285291      { 
    286         CInterface::AttributeFortranInterfaceGetBody<T>(oss, className, this->getName()) ; 
     292        if (this->isAttributePublic()) 
     293          CInterface::AttributeFortranInterfaceGetBody<T>(oss, className, this->getName()) ; 
    287294      } 
    288295 
     
    290297      void CAttributeTemplate<T>::generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) 
    291298      { 
    292         CInterface::AttributeFortranInterfaceGetDeclaration<T>(oss, className, this->getName()) ; 
    293       } 
    294  
    295   
    296 /*       
    297       //--------------------------------------------------------------- 
    298  
    299       // Spécialisations des templates pour la fonction [toString]  
     299        if (this->isAttributePublic()) 
     300          CInterface::AttributeFortranInterfaceGetDeclaration<T>(oss, className, this->getName()) ; 
     301      } 
     302 
     303 
     304/* 
     305      //--------------------------------------------------------------- 
     306 
     307      // Spécialisations des templates pour la fonction [toString] 
    300308 
    301309      template <> 
     
    304312      //--------------------------------------------------------------- 
    305313 
    306       // Spécialisations des templates pour la fonction [fromString]  
     314      // Spécialisations des templates pour la fonction [fromString] 
    307315 
    308316      template <> // Chaîne de caractÚres. 
     
    333341      template <> // Booléen 
    334342         void CAttributeTemplate<bool>::toBinary(StdOStream & os) const; 
    335           
     343 
    336344      template <> // Double 
    337345         void CAttributeTemplate<double>::toBinary(StdOStream & os) const; 
     
    349357      template <> // Booléen 
    350358         void CAttributeTemplate<bool>::fromBinary(StdIStream & is); 
    351           
     359 
    352360      template <> // Double 
    353361         void CAttributeTemplate<double>::fromBinary(StdIStream & is); 
    354362 
    355363      ///-------------------------------------------------------------- 
    356 */       
     364*/ 
    357365} // namespace xios 
    358366 
Note: See TracChangeset for help on using the changeset viewer.