Ignore:
Timestamp:
11/02/15 11:46:25 (8 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_array_impl.hpp

    r501 r775  
    77#include "attribute_array.hpp" 
    88 
    9    
     9 
    1010namespace xios 
    1111{ 
     
    4747        inheritedValue.reset() ; 
    4848      } 
    49        
     49 
    5050      template <typename T_numtype, int N_rank> 
    5151      CArray<T_numtype,N_rank> CAttributeArray<T_numtype, N_rank>::getValue(void) const 
     
    6565    { 
    6666      this->set(dynamic_cast<const CAttributeArray<T_numtype,N_rank>& >(attr)) ; 
    67     }  
     67    } 
    6868 
    6969    template <typename T_numtype, int N_rank> 
     
    7171    { 
    7272      this->setValue(attr) ; 
    73     }  
    74      
    75      
     73    } 
     74 
     75 
    7676    template <typename T_numtype, int N_rank> 
    7777    void CAttributeArray<T_numtype,N_rank>::setInheritedValue(const CAttribute& attr) 
    7878    { 
    7979      this->setInheritedValue(dynamic_cast<const CAttributeArray<T_numtype,N_rank>& >(attr)) ; 
    80     }  
     80    } 
    8181 
    8282    template <typename T_numtype, int N_rank> 
    8383    void CAttributeArray<T_numtype,N_rank>::setInheritedValue(const CAttributeArray& attr) 
    8484    { 
    85       if (this->isEmpty() && attr.hasInheritedValue())  
     85      if (this->isEmpty() && attr.hasInheritedValue()) 
    8686      { 
    8787        inheritedValue.resize(attr.shape()) ; 
    8888        inheritedValue=attr ; 
    8989      } 
    90     }  
     90    } 
    9191 
    9292    template <typename T_numtype, int N_rank> 
     
    9595      if (this->isEmpty()) return inheritedValue.copy() ; 
    9696      else return getValue() ; 
    97     }  
    98      
     97    } 
     98 
    9999    template <typename T_numtype, int N_rank> 
    100100    bool CAttributeArray<T_numtype,N_rank>::hasInheritedValue(void) const 
    101101    { 
    102102      return !this->isEmpty() || !inheritedValue.isEmpty() ; 
    103     }  
    104      
     103    } 
     104 
    105105 
    106106    template <typename T_numtype, int N_rank> 
     
    133133      void CAttributeArray<T_numtype, N_rank>::generateCInterface(ostream& oss,const string& className) 
    134134      { 
    135         CInterface::AttributeCInterface<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; 
     135        if (this->isAttributePublic()) 
     136          CInterface::AttributeCInterface<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; 
    136137      } 
    137        
     138 
    138139      template <typename T_numtype, int N_rank> 
    139140      void CAttributeArray<T_numtype, N_rank>::generateFortran2003Interface(ostream& oss,const string& className) 
    140141      { 
    141         CInterface::AttributeFortran2003Interface<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; 
     142        if (this->isAttributePublic()) 
     143          CInterface::AttributeFortran2003Interface<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; 
    142144      } 
    143        
     145 
    144146      template <typename T_numtype, int N_rank> 
    145147      void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceDeclaration_(ostream& oss,const string& className) 
    146148      { 
    147         CInterface::AttributeFortranInterfaceDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()+"_") ; 
     149        if (this->isAttributePublic()) 
     150          CInterface::AttributeFortranInterfaceDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()+"_") ; 
    148151      } 
    149   
     152 
    150153      template <typename T_numtype, int N_rank> 
    151154      void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceBody_(ostream& oss,const string& className) 
    152155      { 
    153         CInterface::AttributeFortranInterfaceBody<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; 
     156        if (this->isAttributePublic()) 
     157          CInterface::AttributeFortranInterfaceBody<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; 
    154158      } 
    155159 
     
    157161      void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceDeclaration(ostream& oss,const string& className) 
    158162      { 
    159         CInterface::AttributeFortranInterfaceDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; 
     163        if (this->isAttributePublic()) 
     164          CInterface::AttributeFortranInterfaceDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; 
    160165      } 
    161        
     166 
    162167      template <typename T_numtype, int N_rank> 
    163168      void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) 
    164169      { 
    165         CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()+"_") ; 
     170        if (this->isAttributePublic()) 
     171          CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()+"_") ; 
    166172      } 
    167   
     173 
    168174      template <typename T_numtype, int N_rank> 
    169175      void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceGetBody_(ostream& oss,const string& className) 
    170176      { 
    171         CInterface::AttributeFortranInterfaceGetBody<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; 
     177        if (this->isAttributePublic()) 
     178          CInterface::AttributeFortranInterfaceGetBody<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; 
    172179      } 
    173180 
     
    175182      void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) 
    176183      { 
    177         CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; 
     184        if (this->isAttributePublic()) 
     185          CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; 
    178186      } 
    179187} // namespace xios 
Note: See TracChangeset for help on using the changeset viewer.