Changeset 369


Ignore:
Timestamp:
10/16/12 13:04:44 (12 years ago)
Author:
ymipsl
Message:

Major Update

  • redesign Type and attribute manipulation
  • add enumerate type and attribute
  • use blitz class array instead of boost class array

YM

Location:
XIOS/trunk/src
Files:
11 added
3 deleted
88 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/attribute.cpp

    r345 r369  
    77      CAttribute::CAttribute(const StdString & id) 
    88         : CObject(id), CBaseType() 
    9          , value() 
     9//         , value() 
    1010      { /* Ne rien faire de plus */ } 
    11  
     11/* 
    1212      CAttribute::CAttribute(const CAttribute & attribut) 
    1313         : CObject(attribut.getId()),CBaseType() 
    1414      {  
    15          this->value = attribut.getAnyValue();  
     15 //        this->value = attribut.getAnyValue();  
    1616      } 
    17        
     17*/       
    1818      CAttribute::~CAttribute(void) 
    1919      { /* Ne rien faire de plus */ } 
    2020       
    2121      ///-------------------------------------------------------------- 
    22  
     22/* 
    2323      const boost::any & CAttribute::getAnyValue(void) const 
    2424      {  
     
    4343         return (this->value.empty());  
    4444      } 
    45  
     45*/ 
    4646      const StdString & CAttribute::getName(void) const 
    4747      {  
     
    5252      ///-------------------------------------------------------------- 
    5353 
    54        
     54 
    5555      CMessage& operator<<(CMessage& msg,CAttribute& type) 
    5656      { 
     
    6161     CMessage& operator<<(CMessage& msg, const CAttribute&  type) 
    6262     { 
    63        msg.push(*type.duplicate()) ; 
     63//       msg.push(*type.clone()) ; 
    6464       return msg ; 
    6565     } 
  • XIOS/trunk/src/attribute.hpp

    r352 r369  
    1616{ 
    1717      /// ////////////////////// Déclarations ////////////////////// /// 
    18       class CAttribute : public CObject, public CBaseType 
     18      class CAttribute : public CObject, public virtual CBaseType 
    1919      { 
    2020            typedef CObject SuperClass; 
     
    2424            /// Constructeurs /// 
    2525            explicit CAttribute(const StdString & id); 
    26             CAttribute(const CAttribute & attribut); 
    27             CAttribute(const CAttribute * const attribut); // Not implemented. 
     26//            CAttribute(const CAttribute & attribut); 
     27//            CAttribute(const CAttribute * const attribut); // Not implemented. 
    2828 
    2929            /// Accesseurs /// 
    3030            const StdString & getName(void) const; 
    31             const boost::any & getAnyValue(void) const; 
    32             template <typename T> inline T getValue(void) const; 
    33             template <typename T> inline T* getRef(void); 
     31//            const boost::any & getAnyValue(void) const; 
     32//            template <typename T> inline T getValue(void) const; 
     33//            template <typename T> inline T* getRef(void); 
    3434 
    35             /// Mutateurs /// 
    36             template <typename T> inline void setValue(const T & value); 
    37             void setAnyValue(const boost::any & value); 
    38             void clear(void); 
     35//            /// Mutateurs /// 
     36//            template <typename T> inline void setValue(const T & value); 
     37//            void setAnyValue(const boost::any & value); 
     38//            void clear(void); 
    3939 
    4040            /// Test /// 
    41             bool isEmpty(void) const; 
    42             template <typename T> inline bool isType(void) const; 
    43  
     41//            bool isEmpty(void) const; 
     42//            template <typename T> inline bool isType(void) const; 
     43            virtual void set(const CAttribute& ) =0 ; 
    4444            /// Destructeur /// 
    4545            virtual ~CAttribute(void); 
     
    4949            virtual void fromString(const StdString & str) = 0; 
    5050 
    51             virtual void toBinary  (StdOStream & os) const = 0; 
    52             virtual void fromBinary(StdIStream & is) = 0; 
     51//            virtual void toBinary  (StdOStream & os) const = 0; 
     52//            virtual void fromBinary(StdIStream & is) = 0; 
     53 
    5354            virtual void generateCInterface(ostream& oss, const string& className) = 0 ; 
    5455            virtual void generateFortran2003Interface(ostream& oss, const string& className) = 0 ; 
     
    6566 
    6667            /// Constructeurs /// 
    67             CAttribute(void);  // Not implemented. 
     68//            CAttribute(void);  // Not implemented. 
    6869 
    6970            /// Propriété /// 
    70             boost::any value; 
     71//            boost::any value; 
    7172 
    7273      }; // class CAttribute 
    7374 
    7475      /// ////////////////////// Définitions ////////////////////// /// 
     76/* 
    7577      template <typename T> 
    7678         T CAttribute::getValue(void) const 
     
    9698         return (this->value.type() == typeid(T));  
    9799      } 
    98  
     100*/ 
    99101  
    100102   CMessage& operator<<(CMessage& msg,CAttribute& type) ; 
     
    103105   CBufferOut& operator<<(CBufferOut& buffer,CAttribute& type) ; 
    104106   CBufferIn& operator>>(CBufferIn& buffer, CAttribute&  type) ; 
     107 
    105108} 
    106109  // namespace xios 
  • XIOS/trunk/src/attribute_map.cpp

    r345 r369  
    2323         { 
    2424            const StdStrAttPair & att = *it; 
    25             if (!att.second->isEmpty()) 
    26                att.second->clear(); 
     25            att.second->reset(); 
    2726         } 
    2827      } 
     
    4544            ERROR("CAttributeMap::setAttribute(key, attr)", 
    4645                   << "[ key = " << key << "] attr is null !"); 
    47          this->find(key)->second->setAnyValue(attr->getAnyValue()); 
     46         this->find(key)->second->set(*attr) ; 
     47//         this->find(key)->second->setAnyValue(attr->getAnyValue()); 
    4848      } 
    4949       
     
    127127       
    128128      //--------------------------------------------------------------- 
    129        
     129/*       
    130130      void CAttributeMap::toBinary(StdOStream & os) const 
    131131      { 
     
    184184         } 
    185185      } 
    186        
     186 */      
    187187      void CAttributeMap::generateCInterface(ostream& oss, const string& className) 
    188188      { 
     
    204204         } 
    205205      }       
    206        
     206  
    207207      ///-------------------------------------------------------------- 
    208208 
  • XIOS/trunk/src/attribute_map.hpp

    r345 r369  
    4444            virtual void fromString(const StdString & str); 
    4545             
    46             virtual void toBinary  (StdOStream & os) const; 
    47             virtual void fromBinary(StdIStream & is); 
     46//            virtual void toBinary  (StdOStream & os) const; 
     47//            virtual void fromBinary(StdIStream & is); 
    4848            virtual void generateCInterface(ostream& oss, const string& className) ; 
    4949            virtual void generateFortran2003Interface(ostream& oss, const string& className) ; 
  • XIOS/trunk/src/attribute_template.hpp

    r354 r369  
    88#include "xmlioserver_spl.hpp" 
    99#include "exception.hpp" 
    10 #include "array.hpp" 
    1110#include "attribute.hpp" 
    1211#include "buffer_in.hpp" 
    1312#include "buffer_out.hpp" 
     13#include "type.hpp" 
    1414 
    1515 
     
    1818      /// ////////////////////// Déclarations ////////////////////// /// 
    1919      template <class T> 
    20          class CAttributeTemplate : public CAttribute 
     20         class CAttributeTemplate : public CAttribute, public CType<T> 
    2121      { 
    2222            typedef CAttribute SuperClass; 
     
    3434            CAttributeTemplate(const StdString & id, const ValueType & value, 
    3535                               xios_map<StdString, CAttribute*> & umap); 
    36             CAttributeTemplate(const CAttribute & attribut) throw (CException); 
    37             CAttributeTemplate(const CAttribute * const attribut); // Not implemented. 
     36//            CAttributeTemplate(const CAttribute & attribut) throw (CException); 
     37//            CAttributeTemplate(const CAttribute * const attribut); // Not implemented. 
    3838 
    3939          public : 
     
    4141            /// Accesseur /// 
    4242            ValueType getValue(void) const; 
    43             ValueType* getRef(void) ; 
     43//            ValueType* getRef(void) ; 
    4444 
    4545            /// Mutateurs /// 
    4646            void setValue(const ValueType & value); 
    47  
     47             
     48            void set(const CAttribute& attr) ; 
     49            void set(const CAttributeTemplate& attr) ; 
     50             
    4851            /// Destructeur /// 
    49             virtual ~CAttributeTemplate(void); 
     52            virtual ~CAttributeTemplate(void) { } 
    5053 
    5154            /// Operateur /// 
    52             ValueType operator=(const ValueType & value); 
     55            CAttributeTemplate& operator=(const ValueType & value); 
    5356 
    5457            /// Autre /// 
    55             virtual StdString toString(void) const; 
    56             virtual void fromString(const StdString & str); 
     58            virtual StdString toString(void) const { return _toString();} 
     59            virtual void fromString(const StdString & str) { _fromString(str);} 
     60//            virtual CAttributeTemplate* clone() const {} 
     61//            virtual void toBinary  (StdOStream & os) const; 
     62//            virtual void fromBinary(StdIStream & is);             
    5763 
    58             virtual void toBinary  (StdOStream & os) const; 
    59             virtual void fromBinary(StdIStream & is);             
    60  
    61             virtual bool toBuffer  (CBufferOut& buffer) const; 
    62             virtual bool fromBuffer(CBufferIn& buffer) ; 
    63             virtual size_t size(void) const; 
     64            virtual bool toBuffer  (CBufferOut& buffer) const { return _toBuffer(buffer);}  
     65            virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); }  
     66//            virtual size_t size(void) const; 
    6467            virtual void generateCInterface(ostream& oss,const string& className) ; 
    6568            virtual void generateFortran2003Interface(ostream& oss,const string& className) ; 
     
    7578 
    7679            /// Constructeurs /// 
    77             CAttributeTemplate(void); // Not implemented. 
    78  
     80//            CAttributeTemplate(void); // Not implemented. 
     81         private : 
     82          StdString _toString(void) const; 
     83          void _fromString(const StdString & str); 
     84          bool _toBuffer  (CBufferOut& buffer) const; 
     85          bool _fromBuffer(CBufferIn& buffer) ; 
    7986      }; // class CAttribute     
    8087       
  • XIOS/trunk/src/attribute_template_decl.cpp

    r352 r369  
    99  template class CAttributeTemplate<bool> ; 
    1010  template class CAttributeTemplate<string> ; 
    11   template class CAttributeTemplate< ARRAY(double,1) > ; 
    12   template class CAttributeTemplate< ARRAY(int,1) > ; 
    13   template class CAttributeTemplate< ARRAY(bool,2) > ;} 
     11} 
  • XIOS/trunk/src/attribute_template_impl.hpp

    r352 r369  
    22#define __XMLIO_CAttributeTemplate_impl__ 
    33 
    4 #include "array.hpp" 
    54#include "type.hpp" 
    65#include "buffer_in.hpp" 
     
    2524         this->setValue(value); 
    2625      } 
    27  
     26/* 
    2827      template <class T> 
    2928         CAttributeTemplate<T>::CAttributeTemplate(const CAttribute & attribut) 
     
    3433            ERROR("CAttributeTemplate", << "Invalid instantiation !"); 
    3534      } 
    36  
     35*/ 
    3736      template <class T> 
    3837         CAttributeTemplate<T>::CAttributeTemplate(const StdString & id, 
     
    5251         umap.insert(umap.end(), std::make_pair(id, this)); 
    5352      } 
    54  
    55       template <class T> 
    56          CAttributeTemplate<T>::~CAttributeTemplate(void) 
     53/* 
     54      template <class T> 
     55      CAttributeTemplate<T>::~CAttributeTemplate(void) 
    5756      {  
    58          this->clear(); 
    59       } 
    60  
     57//         this->CType<T>::reset() ; 
     58//         this->clear(); 
     59      } 
     60*/ 
    6161      ///-------------------------------------------------------------- 
    6262 
     
    6464         T CAttributeTemplate<T>::getValue(void) const 
    6565      { 
     66         return CType<T>::get() ; 
     67/* 
    6668         if (SuperClass::isEmpty()) 
    6769         { 
     
    7173          } 
    7274         return (SuperClass::getValue<T>()); 
    73       } 
    74  
     75*/ 
     76      } 
     77 
     78/* 
    7579      template <class T> 
    7680         T* CAttributeTemplate<T>::getRef(void) 
     
    8488         return (SuperClass::getRef<T>()); 
    8589      } 
     90*/ 
    8691 
    8792      template <class T> 
    8893         void CAttributeTemplate<T>::setValue(const T & value) 
    8994      { 
    90          SuperClass::setValue<T>(value); 
    91       } 
    92  
    93       //--------------------------------------------------------------- 
    94  
    95       template <class T> 
    96          T CAttributeTemplate<T>::operator=(const T & value) 
     95         CType<T>::set(value) ; 
     96//         SuperClass::setValue<T>(value); 
     97      } 
     98 
     99    template <class T> 
     100    void CAttributeTemplate<T>::set(const CAttribute& attr) 
     101    { 
     102      this->set(dynamic_cast<const CAttributeTemplate<T>& >(attr)) ; 
     103    }  
     104 
     105   template <class T> 
     106    void CAttributeTemplate<T>::set(const CAttributeTemplate& attr) 
     107    { 
     108      CType<T>::set(attr) ; 
     109    }  
     110 
     111      //--------------------------------------------------------------- 
     112 
     113      template <class T> 
     114         CAttributeTemplate<T>& CAttributeTemplate<T>::operator=(const T & value) 
    97115      { 
    98116         this->setValue(value); 
    99          return (this->getValue()); 
    100       } 
    101  
    102       //--------------------------------------------------------------- 
    103  
    104       template <class T> 
    105          StdString CAttributeTemplate<T>::toString(void) const 
     117//         return (this->getValue()); 
     118         return *this; 
     119      } 
     120 
     121      //--------------------------------------------------------------- 
     122 
     123      template <class T> 
     124         StdString CAttributeTemplate<T>::_toString(void) const 
    106125      { 
    107126         StdOStringStream oss; 
    108          if (!this->isEmpty() && this->hasId()) 
    109             oss << this->getName() << "=\"" << this->getValue() << "\""; 
     127         if (!CType<T>::isEmpty() && this->hasId()) 
     128            oss << this->getName() << "=\"" << CType<T>::toString() << "\""; 
    110129         return (oss.str()); 
    111130      } 
    112131 
    113132      template <class T> 
    114          void CAttributeTemplate<T>::fromString(const StdString & str) 
    115       { 
    116          ERROR("CAttributeTemplate<T>::fromString(const StdString & str)", 
    117                << "[ str = " << str << " ] Not implemented yet !"); 
    118       } 
    119  
    120       //--------------------------------------------------------------- 
    121  
     133         void CAttributeTemplate<T>::_fromString(const StdString & str) 
     134      { 
     135        CType<T>::fromString(str) ; 
     136      } 
     137 
     138      //--------------------------------------------------------------- 
     139/* 
    122140      template <class T> 
    123141         void CAttributeTemplate<T>::toBinary (StdOStream & os) const 
     
    133151         this->setValue(value); 
    134152      } 
    135  
    136       template <class T> 
    137          bool CAttributeTemplate<T>::toBuffer (CBufferOut& buffer) const 
    138       { 
     153*/ 
     154      template <class T> 
     155         bool CAttributeTemplate<T>::_toBuffer (CBufferOut& buffer) const 
     156      { 
     157         return CType<T>::toBuffer(buffer) ; 
     158/*          
    139159         if (isEmpty()) return buffer.put(true) ; 
    140160         else 
     
    146166           return ret ; 
    147167         } 
    148       } 
    149  
    150       template <class T> 
    151       bool CAttributeTemplate<T>::fromBuffer(CBufferIn& buffer) 
    152       { 
     168*/ 
     169      } 
     170 
     171      template <class T> 
     172      bool CAttributeTemplate<T>::_fromBuffer(CBufferIn& buffer) 
     173      { 
     174        return CType<T>::fromBuffer(buffer) ; 
     175/*         
    153176        bool empty ; 
    154177        bool ret=true ; 
     
    170193          return val.fromBuffer(buffer) ; 
    171194        } 
    172       } 
    173  
     195*/ 
     196      } 
     197/* 
    174198      template <class T> 
    175199      size_t CAttributeTemplate<T>::size(void) const 
    176       { 
     200      {  
     201        return CType<T>::size() ;*/ 
     202/*         
    177203        if (isEmpty()) return sizeof(bool) ; 
    178204        else 
     
    181207          return val.size()+sizeof(bool) ; 
    182208        } 
    183       } 
     209*/ 
     210 /*     }*/ 
    184211 
    185212      template <typename T> 
     
    231258      } 
    232259  
    233        
    234       //--------------------------------------------------------------- 
    235  
    236       /** Spécialisations des templates pour la fonction [toString] **/ 
     260/*       
     261      //--------------------------------------------------------------- 
     262 
     263      // Spécialisations des templates pour la fonction [toString]  
    237264 
    238265      template <> 
     
    241268      //--------------------------------------------------------------- 
    242269 
    243       /** Spécialisations des templates pour la fonction [fromString] **/ 
     270      // Spécialisations des templates pour la fonction [fromString]  
    244271 
    245272      template <> // Chaîne de caractÚres. 
     
    260287      //--------------------------------------------------------------- 
    261288 
    262       /** Spécialisations des templates pour la fonction [toBinary] **/ 
     289      // Spécialisations des templates pour la fonction [toBinary] // 
    263290 
    264291      template <> // Chaîne de caractÚres. 
     
    276303      //--------------------------------------------------------------- 
    277304 
    278       /** Spécialisations des templates pour la fonction [fromBinary] **/ 
     305      // Spécialisations des templates pour la fonction [fromBinary] // 
    279306 
    280307      template <> // Chaîne de caractÚres. 
     
    291318 
    292319      ///-------------------------------------------------------------- 
     320*/       
    293321} // namespace xios 
    294322 
  • XIOS/trunk/src/attribute_template_specialisation.hpp

    r352 r369  
    66namespace xios 
    77{ 
     8/* 
    89      /// ////////////////////// Définitions ////////////////////// /// 
    910 
    10       /** Spécialisations des templates pour la fonction [toString] **/ 
     11      /// Spécialisations des templates pour la fonction [toString] /// 
    1112       
    1213      template <> 
     
    2627      //--------------------------------------------------------------- 
    2728 
    28       /** Spécialisations des templates pour la fonction [fromString] **/ 
     29      /// Spécialisations des templates pour la fonction [fromString] /// 
    2930 
    3031      template <> // Chaîne de caractÚres. 
     
    143144      //--------------------------------------------------------------- 
    144145 
    145       /** Spécialisations des templates pour la fonction [toBinary] **/ 
     146      /// Spécialisations des templates pour la fonction [toBinary] /// 
    146147 
    147148      template <> // Chaîne de caractÚres. 
     
    177178      //--------------------------------------------------------------- 
    178179 
    179       /** Spécialisations des templates pour la fonction [fromBinary] **/ 
     180      /// Spécialisations des templates pour la fonction [fromBinary] /// 
    180181 
    181182      template <> // Chaîne de caractÚres. 
     
    212213         this->setValue(value); 
    213214      } 
    214  
    215215      ///-------------------------------------------------------------- 
     216*/ 
    216217} // namespace xios 
  • XIOS/trunk/src/config/axis_attribute.conf

    r351 r369  
    99DECLARE_ATTRIBUTE(int,       zoom_end) 
    1010DECLARE_ATTRIBUTE(int,       zoom_size) 
    11 DECLARE_ATTRIBUTE(ARRAY(double, 1), value) 
     11DECLARE_ARRAY(double, 1, value) 
    1212 
    1313 
  • XIOS/trunk/src/config/domain_attribute.conf

    r219 r369  
    2222 
    2323/* LOCAL */ 
    24 DECLARE_ATTRIBUTE(ARRAY(bool, 2) , mask) 
     24DECLARE_ARRAY(bool, 2 , mask) 
    2525 
    2626/* GLOBAL */ 
     
    4747/* LOCAL */ 
    4848DECLARE_ATTRIBUTE(int             , data_n_index) 
    49 DECLARE_ATTRIBUTE(ARRAY(int, 1)  , data_i_index) 
    50 DECLARE_ATTRIBUTE(ARRAY(int, 1)   , data_j_index) 
     49DECLARE_ARRAY(int, 1 , data_i_index) 
     50DECLARE_ARRAY(int, 1, data_j_index) 
    5151 
    5252/* LOCAL */ 
    53 DECLARE_ATTRIBUTE(ARRAY(double, 1), lonvalue) 
    54 DECLARE_ATTRIBUTE(ARRAY(double, 1), latvalue) 
     53DECLARE_ARRAY(double, 1, lonvalue) 
     54DECLARE_ARRAY(double, 1, latvalue) 
    5555 
  • XIOS/trunk/src/config/field_attribute.conf

    r266 r369  
    1616DECLARE_ATTRIBUTE(StdString, axis_ref) 
    1717DECLARE_ATTRIBUTE(StdString, grid_ref) 
    18 //DECLARE_ATTRIBUTE(StdString, zoom_ref) 
    1918DECLARE_ATTRIBUTE(StdString, field_ref) 
    2019 
  • XIOS/trunk/src/config/file_attribute.conf

    r335 r369  
    99DECLARE_ATTRIBUTE(StdString, split_freq) 
    1010DECLARE_ATTRIBUTE(bool,      enabled) 
    11 DECLARE_ATTRIBUTE(StdString,      type) 
     11DECLARE_ENUM2(type,one_file,multiple_file) 
    1212DECLARE_ATTRIBUTE(StdString,      par_access) 
    1313 
  • XIOS/trunk/src/declare_attribute.hpp

    r219 r369  
    55 
    66#define DECLARE_ATTRIBUTE(type, name)                             \ 
    7    class name##att : public CAttributeTemplate<type>{             \ 
     7   class name##_attr : public CAttributeTemplate<type>            \ 
     8   {                                                              \ 
    89      public :                                                    \ 
    9          name##att(void)                                          \ 
     10         name##_attr(void)                                          \ 
    1011            : CAttributeTemplate<type>                            \ 
    1112            (#name, *CAttributeMap::Current)                      \ 
     
    1314         type operator=(const type & value)                       \ 
    1415         { return (CAttributeTemplate<type>::operator=(value)); } \ 
    15          virtual ~name##att(void)                                 \ 
     16         virtual ~name##_attr(void)                                 \ 
    1617         { /* Ne rien faire de plus */ }                          \ 
    1718   } name; 
    1819 
    19 #define DECLARE_ATTRIBUTE_DEF(type, name, def)                     \ 
    20    class name##att : public CAttributeTemplate<type>{              \ 
    21       public :                                                     \ 
    22          name##att(void)                                           \ 
    23             : CAttributeTemplate<type>                             \ 
    24             (#name, def, *CAttributeMap::Current)                  \ 
    25          { /* Ne rien faire de plus */ }                           \ 
    26          type operator=(const type & value)                        \ 
    27          { return (CAttributeTemplate<type>::operator=(value)); }  \ 
    28          virtual ~name##att(void)                                  \ 
    29          { /* Ne rien faire de plus */ }                           \ 
     20#define DECLARE_ARRAY(T_num, T_rank, name)                        \ 
     21   class name##_attr : public CAttributeArray<T_num, T_rank>      \ 
     22   {                                                              \ 
     23      public :                                                    \ 
     24         name##_attr(void) : CAttributeArray<T_num, T_rank> (#name, *CAttributeMap::Current) {} \ 
     25         virtual ~name##_attr(void) {}                            \ 
    3026   } name; 
     27    
     28#define DECLARE_CLASS_ENUM(name)                                   \ 
     29   class name##_attr : public CAttributeEnum<Enum_##name>          \ 
     30   {                                                              \ 
     31      public :                                                    \ 
     32         name##_attr(void) : CAttributeEnum<Enum_##name>(#name, *CAttributeMap::Current) { } \ 
     33         virtual ~name##_attr(void) {}                           \ 
     34   } name; 
     35    
     36#define DECLARE_ENUM2(name,arg1,arg2)                             \ 
     37   class Enum_##name                                              \ 
     38   {                                                              \ 
     39     public:                                                      \ 
     40     enum t_enum { arg1=0, arg2} ;                                \ 
     41     const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2 } ; return enumStr ; }   \ 
     42     int getSize(void) const { return 2 ; }                       \ 
     43   } ;                                                            \ 
     44   DECLARE_CLASS_ENUM(name) 
     45    
     46#define DECLARE_ENUM3(name,arg1,arg2,arg3)                             \ 
     47   class Enum_##name                                              \ 
     48   {                                                              \ 
     49     public:                                                      \ 
     50     enum t_enum { arg1=0, arg2, arg3} ;                                \ 
     51     const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3 } ; return enumStr ; }   \ 
     52     int getSize(void) const { return 3 ; }                       \ 
     53   } ;                                                            \ 
     54   DECLARE_CLASS_ENUM(name) 
     55 
     56#define DECLARE_ENUM4(name,arg1,arg2,arg3,arg4)                             \ 
     57   class Enum_##name                                              \ 
     58   {                                                              \ 
     59     public:                                                      \ 
     60     enum t_enum { arg1=0, arg2, arg3,arg4} ;                                \ 
     61     const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4 } ; return enumStr ; }   \ 
     62     int getSize(void) const { return 4 ; }                       \ 
     63   } ;                                                            \ 
     64   DECLARE_CLASS_ENUM(name) 
     65 
     66#define DECLARE_ENUM5(name,arg1,arg2,arg3,arg4,arg5)                             \ 
     67   class Enum_##name                                              \ 
     68   {                                                              \ 
     69     public:                                                      \ 
     70     enum t_enum { arg1=0, arg2, arg3,arg4,arg5} ;                                \ 
     71     const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5 } ; return enumStr ; }   \ 
     72     int getSize(void) const { return 5 ; }                       \ 
     73   } ;                                                            \ 
     74   DECLARE_CLASS_ENUM(name) 
     75 
     76#define DECLARE_ENUM6(name,arg1,arg2,arg3,arg4,arg5,arg6)                             \ 
     77   class Enum_##name                                              \ 
     78   {                                                              \ 
     79     public:                                                      \ 
     80     enum t_enum { arg1=0, arg2, arg3,arg4,arg5,arg6} ;                                \ 
     81     const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5,#arg6 } ; return enumStr ; }   \ 
     82     int getSize(void) const { return 6 ; }                       \ 
     83   } ;                                                            \ 
     84   DECLARE_CLASS_ENUM(name) 
     85 
     86#define DECLARE_ENUM7(name,arg1,arg2,arg3,arg4,arg5,arg6,arg7)                             \ 
     87   class Enum_##name                                              \ 
     88   {                                                              \ 
     89     public:                                                      \ 
     90     enum t_enum { arg1=0, arg2, arg3,arg4,arg5,arg6,arg7} ;                                \ 
     91     const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5,#arg6,#arg7 } ; return enumStr ; }   \ 
     92     int getSize(void) const { return 7 ; }                       \ 
     93   } ;                                                            \ 
     94   DECLARE_CLASS_ENUM(name) 
     95 
     96#define DECLARE_ENUM8(name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)                             \ 
     97   class Enum_##name                                              \ 
     98   {                                                              \ 
     99     public:                                                      \ 
     100     enum t_enum { arg1=0, arg2, arg3,arg4,arg5,arg6,arg7,arg8} ;                                \ 
     101     const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5,#arg6,#arg7,#arg8 } ; return enumStr ; }   \ 
     102     int getSize(void) const { return 8 ; }                       \ 
     103   } ;                                                            \ 
     104   DECLARE_CLASS_ENUM(name) 
     105 
     106  #define DECLARE_ENUM9(name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)                             \ 
     107   class Enum_##name                                              \ 
     108   {                                                              \ 
     109     public:                                                      \ 
     110     enum t_enum { arg1=0, arg2, arg3,arg4,arg5,arg6,arg7,arg8,arg9} ;                                \ 
     111     const char** getStr(void) const { static const char * enumStr[] = { #arg1, #arg2, #arg3,#arg4,#arg5,#arg6,#arg7,#arg8,#arg9 } ; return enumStr ; }   \ 
     112     int getSize(void) const { return 8 ; }                       \ 
     113   } ;                                                            \ 
     114   DECLARE_CLASS_ENUM(name)  
     115 
    31116 
    32117#define BEGIN_DECLARE_ATTRIBUTE_MAP(type)                  \ 
    33    class type##Attributes : public virtual CAttributeMap { \ 
     118   class type##Attributes : public virtual CAttributeMap   \ 
     119   {                                                       \ 
    34120      public : 
    35121 
  • XIOS/trunk/src/functor.cpp

    r335 r369  
    11#include "functor.hpp" 
     2#include "array_new.hpp" 
    23 
    34namespace xios 
     
    78      /// ////////////////////// Définitions ////////////////////// /// 
    89 
    9       CFunctor::CFunctor(const StdString & id, ARRAY(double, 1) doutput) 
     10      CFunctor::CFunctor(const StdString & id, CArray<double, 1>& doutput) 
    1011         : SuperClass(id), doutput(doutput), nbcall(0) 
    1112      { /* Ne rien faire de plus */  } 
     
    1617      //--------------------------------------------------------------- 
    1718 
    18       ARRAY(double, 1) CFunctor::getDataOutput(void) const 
     19      CArray<double,1> CFunctor::getDataOutput(void) const 
    1920      {  
    2021         return (this->doutput); 
     
    3738      //--------------------------------------------------------------- 
    3839 
    39       ARRAY(double, 1) CFunctor::operator ()(const ARRAY(double, 1) dinput) 
     40      CArray<double,1> CFunctor::operator ()(const CArray<double,1>& dinput) 
    4041      { 
    4142         this->nbcall++; 
    42          if (dinput->size() != this->doutput->size()) 
     43         if (dinput.numElements() != this->doutput.numElements()) 
    4344            ERROR("CFunctor::operator ()(dinput)", 
    44                    << "[ input size = "  << dinput->size() 
    45                    << ", output size = " << this->doutput->size() << " ]" 
     45                   << "[ input size = "  << dinput.numElements() 
     46                   << ", output size = " << this->doutput.numElements() << " ]" 
    4647                   << " size of input array !=  size of output array !"); 
    4748         this->apply(dinput, this->doutput); 
  • XIOS/trunk/src/functor.hpp

    r352 r369  
    55#include "xmlioserver_spl.hpp" 
    66#include "exception.hpp" 
    7 #include "array.hpp" 
     7#include "array_new.hpp" 
    88 
    99namespace xios 
     
    1616         /// Définition de type /// 
    1717         typedef CObject SuperClass; 
    18          typedef ARRAY(double, 1) DoubleArray; 
    1918 
    2019         public : 
    2120 
    2221            /// Accesseurs /// 
    23             DoubleArray getDataOutput(void) const; 
     22            CArray<double,1> getDataOutput(void) const; 
    2423            /// Opérateur /// 
    25             DoubleArray operator ()(const DoubleArray dinput); 
     24            CArray<double,1> operator ()(const CArray<double,1>& dinput); 
    2625 
    2726            /// Destructeur /// 
     
    3433 
    3534            /// Traitement /// 
    36             virtual void apply(const DoubleArray dinput, DoubleArray doutput) = 0; 
     35            virtual void apply(const CArray<double,1>& dinput, CArray<double,1>& doutput) = 0; 
    3736 
    3837            /// Autres /// 
     
    4241            /// Constructeurs /// 
    4342            CFunctor(void);                             // Not implemented. 
    44             CFunctor(const StdString & id, DoubleArray doutput); 
     43            CFunctor(const StdString & id, CArray<double,1>& doutput); 
    4544            CFunctor(const CFunctor & functor);         // Not implemented. 
    4645            CFunctor(const CFunctor * const functor);   // Not implemented. 
    4746 
    48          private : 
    49  
     47         protected : 
    5048            /// Propriétés privées /// 
    51             DoubleArray doutput; 
    52              
    53          protected : 
     49            CArray<double,1>& doutput; 
    5450            /// Propriétés protégées ///    
    5551            int nbcall;             
  • XIOS/trunk/src/functor/average.cpp

    r335 r369  
    11#include "average.hpp" 
     2#include "array_new.hpp" 
    23 
    34namespace xios 
     
    78      /// ////////////////////// Définitions ////////////////////// /// 
    89 
    9       CAverage::CAverage(DoubleArray doutput) 
     10      CAverage::CAverage(CArray<double,1>& doutput) 
    1011         : SuperClass(StdString("average"), doutput) 
    11       { /* Ne rien faire de plus */ } 
     12      { doutput.dumpStructureInformation(cout) ;/* Ne rien faire de plus */ } 
    1213 
    1314      CAverage::~CAverage(void) 
     
    1617      //--------------------------------------------------------------- 
    1718 
    18       void CAverage::apply(const DoubleArray _dinput, 
    19                                  DoubleArray _doutput) 
     19      void CAverage::apply(const CArray<double,1>& _dinput, 
     20                                 CArray<double,1>& _doutput) 
    2021      { 
     22/* 
    2123         const double * it1  = _dinput->data(), 
    2224                      * end1 = _dinput->data() + _dinput->num_elements();  
     
    2527              for (; it1 != end1; it1++, it++) *it  = *it1; 
    2628         else for (; it1 != end1; it1++, it++) *it += *it1;                
     29*/ 
     30        if (this->nbcall == 1) _doutput=_dinput ; 
     31        else _doutput+=_dinput ; 
     32       
    2733      } 
    2834       
    2935      void CAverage::final(void) 
    3036      { 
    31           double * it1  = this->getDataOutput()->data(), 
     37/*          double * it1  = this->getDataOutput()->data(), 
    3238                 * end1 = this->getDataOutput()->data() + this->getDataOutput()->num_elements(); 
    3339          for (; it1 != end1; it1++) *it1 /= this->nbcall; 
    3440          this->nbcall = 0;                                                    
     41*/ 
     42        doutput/=this->nbcall;  
     43        this->nbcall = 0;  
    3544      } 
    3645   } // namespace func 
  • XIOS/trunk/src/functor/average.hpp

    r335 r369  
    44/// xmlioserver headers /// 
    55#include "functor.hpp" 
     6#include "array_new.hpp" 
    67 
    78namespace xios 
     
    1415         /// Définition de type /// 
    1516         typedef CFunctor SuperClass; 
    16          typedef ARRAY(double, 1) DoubleArray; 
    1717 
    1818         public : 
     
    2121            //CAverage(void);                             // Not implemented. 
    2222            //CAverage(const CFunData & data); 
    23             CAverage(DoubleArray doutput); 
     23            CAverage(CArray<double,1>& doutput); 
    2424            //CAverage(const CAverage & average);         // Not implemented. 
    2525            //CAverage(const CAverage * const average);   // Not implemented. 
    2626 
    2727            /// Traitement /// 
    28             virtual void apply(const DoubleArray dinput, DoubleArray doutput); 
     28            virtual void apply(const CArray<double,1>& dinput, CArray<double,1>& doutput); 
    2929            virtual void final(void) ; 
    3030             
  • XIOS/trunk/src/functor/instant.cpp

    r335 r369  
    11#include "instant.hpp" 
     2#include "array_new.hpp" 
    23 
    34namespace xios 
     
    78      /// ////////////////////// Définitions ////////////////////// /// 
    89 
    9       CInstant::CInstant(DoubleArray doutput) 
     10      CInstant::CInstant(CArray<double,1>& doutput) 
    1011         : SuperClass(StdString("instant"), doutput) 
    1112      { /* Ne rien faire de plus */ } 
     
    1617      //--------------------------------------------------------------- 
    1718 
    18       void CInstant::apply(const DoubleArray _dinput, 
    19                                  DoubleArray _doutput) 
     19      void CInstant::apply(const CArray<double,1>& _dinput, 
     20                                 CArray<double,1>& _doutput) 
    2021      { 
    21          const double * it1  = _dinput->data(), 
     22/*               const double * it1  = _dinput->data(), 
    2223                      * end1 = _dinput->data() + _dinput->num_elements(); 
    2324         double * it   = _doutput->data(); 
    24          for (; it1 != end1; it1++, it++) *it  = *it1; 
     25         for (; it1 != end1; it1++, it++) *it  = *it1;*/ 
     26        _doutput=_dinput ; 
    2527      } 
    2628 
  • XIOS/trunk/src/functor/instant.hpp

    r335 r369  
    44/// xios headers /// 
    55#include "functor.hpp" 
     6#include "array_new.hpp" 
    67 
    78namespace xios 
     
    1415         /// Définition de type /// 
    1516         typedef CFunctor SuperClass; 
    16          typedef ARRAY(double, 1) DoubleArray; 
    1717 
    1818         public : 
     
    2121            //CInstant(void);                             // Not implemented. 
    2222            //CInstant(const CFunData & data); 
    23             CInstant(DoubleArray doutput); 
     23            CInstant(CArray<double,1>& doutput); 
    2424            //CInstant(const CInstant & instant);         // Not implemented. 
    2525            //CInstant(const CInstant * const instant);   // Not implemented. 
    2626 
    2727            /// Traitement /// 
    28             virtual void apply(const DoubleArray dinput, DoubleArray doutput); 
     28            virtual void apply(const CArray<double,1>& dinput, CArray<double,1>& doutput); 
    2929 
    3030            /// Destructeur /// 
  • XIOS/trunk/src/functor/maximum.cpp

    r335 r369  
    11#include "maximum.hpp" 
    2 #include <algorithm> 
     2#include "array_new.hpp" 
     3 
    34 
    45 
     
    910      /// ////////////////////// Définitions ////////////////////// /// 
    1011 
    11       CMaximum::CMaximum(DoubleArray doutput) 
     12      CMaximum::CMaximum(CArray<double,1>& doutput) 
    1213         : SuperClass(StdString("maximum"), doutput) 
    1314      { /* Ne rien faire de plus */ } 
     
    1819      //--------------------------------------------------------------- 
    1920 
    20       void CMaximum::apply(const DoubleArray _dinput, 
    21                                  DoubleArray _doutput) 
     21      void CMaximum::apply(const CArray<double,1>& _dinput, 
     22                                 CArray<double,1>& _doutput) 
    2223      { 
    23          const double * it1  = _dinput->data(), 
    24                       * end1 = _dinput->data() + _dinput->num_elements(); 
    25                double * it   = _doutput->data(); 
    26          if (this->nbcall == 1) 
    27               for (; it1 != end1; it1++, it++) *it = *it1; 
     24        const double * it1  = _dinput.dataFirst(), 
     25                     * end1 = _dinput.dataFirst() + _dinput.numElements(); 
     26              double * it   = _doutput.dataFirst(); 
     27         if (this->nbcall == 1) for (; it1 != end1; it1++, it++) *it = *it1; 
    2828         else for (; it1 != end1; it1++, it++) *it = std::max(*it1, *it); 
    2929 
    30          it1  = _dinput->data(), 
    31          end1 = _dinput->data() + _dinput->num_elements(); 
    32          it  = _doutput->data(); 
    33          double sum=0 ; 
    34          for (; it1 != end1; it1++, it++) sum+=*it; 
     30 
    3531      } 
    3632 
  • XIOS/trunk/src/functor/maximum.hpp

    r335 r369  
    44/// xios headers /// 
    55#include "functor.hpp" 
     6#include "array_new.hpp" 
    67 
    78namespace xios 
     
    1415         /// Définition de type /// 
    1516         typedef CFunctor SuperClass; 
    16          typedef ARRAY(double, 1) DoubleArray; 
    1717 
    1818         public : 
     
    2121            //CMaximum(void);                             // Not implemented. 
    2222            //CMaximum(const CFunData & data); 
    23             CMaximum(DoubleArray doutput); 
     23            CMaximum(CArray<double,1>& doutput); 
    2424            //CMaximum(const CMaximum & Maximum);         // Not implemented. 
    2525            //CMaximum(const CMaximum * const Maximum);   // Not implemented. 
    2626 
    2727            /// Traitement /// 
    28             virtual void apply(const DoubleArray dinput, DoubleArray doutput); 
     28            virtual void apply(const CArray<double,1>& dinput, CArray<double,1>& doutput); 
    2929 
    3030            /// Destructeur /// 
  • XIOS/trunk/src/functor/minimum.cpp

    r335 r369  
    11#include "minimum.hpp" 
     2#include "array_new.hpp" 
     3#include <algorithm> 
    24 
    35namespace xios 
     
    79      /// ////////////////////// Définitions ////////////////////// /// 
    810 
    9       CMinimum::CMinimum(DoubleArray doutput) 
     11      CMinimum::CMinimum(CArray<double,1>& doutput) 
    1012         : SuperClass(StdString("minimum"), doutput) 
    1113      { /* Ne rien faire de plus */ } 
     
    1618      //--------------------------------------------------------------- 
    1719 
    18       void CMinimum::apply(const DoubleArray _dinput, 
    19                                  DoubleArray _doutput) 
     20      void CMinimum::apply(const CArray<double,1>& _dinput, 
     21                                 CArray<double,1>& _doutput) 
    2022      { 
    21          const double * it1  = _dinput->data(), 
    22                       * end1 = _dinput->data() + _dinput->num_elements(); 
    23          double * it   = _doutput->data(); 
    24          if (this->nbcall == 1) 
    25               for (; it1 != end1; it1++, it++) *it = *it1; 
    26          else for (; it1 != end1; it1++, it++) *it = std::min(*it1, *it); 
     23        const double * it1  = _dinput.dataFirst(), 
     24                      * end1 = _dinput.dataFirst() + _dinput.numElements(); 
     25        double * it   = _doutput.dataFirst(); 
     26         
     27        if (this->nbcall == 1)  for (; it1 != end1; it1++, it++) *it = *it1; 
     28        else for (; it1 != end1; it1++, it++) *it = std::min(*it1, *it); 
     29 
    2730      } 
    2831 
  • XIOS/trunk/src/functor/minimum.hpp

    r335 r369  
    44/// xmlioserver headers /// 
    55#include "functor.hpp" 
     6#include "array_new.hpp" 
    67 
    78namespace xios 
     
    1415         /// Définition de type /// 
    1516         typedef CFunctor SuperClass; 
    16          typedef ARRAY(double, 1) DoubleArray; 
    1717 
    1818         public : 
     
    2121            //CMinimum(void);                             // Not implemented. 
    2222            //CMinimum(const CFunData & data); 
    23             CMinimum(DoubleArray doutput); 
     23            CMinimum(CArray<double,1>& doutput); 
    2424            //CMinimum(const CMinimum & Minimum);         // Not implemented. 
    2525            //CMinimum(const CMinimum * const Minimum);   // Not implemented. 
    2626 
    2727            /// Traitement /// 
    28             virtual void apply(const DoubleArray dinput, DoubleArray doutput); 
     28            virtual void apply(const CArray<double,1>& dinput, CArray<double,1>& doutput); 
    2929 
    3030            /// Destructeur /// 
  • XIOS/trunk/src/functor/once.cpp

    r335 r369  
    11#include "once.hpp" 
     2#include "array_new.hpp" 
    23 
    34namespace xios 
     
    78      /// ////////////////////// Définitions ////////////////////// /// 
    89 
    9       COnce::COnce(DoubleArray doutput) 
     10      COnce::COnce(CArray<double,1>& doutput) 
    1011         : SuperClass(StdString("once"), doutput) 
    1112      { /* Ne rien faire de plus */ } 
     
    1617      //--------------------------------------------------------------- 
    1718 
    18       void COnce::apply(const DoubleArray _dinput, 
    19                               DoubleArray _doutput) 
     19      void COnce::apply(const CArray<double,1>& _dinput, 
     20                              CArray<double,1>& _doutput) 
    2021      { 
    21          const double * it1  = _dinput->data(), 
     22/*               const double * it1  = _dinput->data(), 
    2223                      * end1 = _dinput->data() + _dinput->num_elements(); 
    2324               double * it   = _doutput->data(); 
    24         for (; it1 != end1; it1++, it++) *it  = *it1; 
     25        for (; it1 != end1; it1++, it++) *it  = *it1;*/ 
     26        _doutput=_dinput ; 
    2527      } 
    2628 
  • XIOS/trunk/src/functor/once.hpp

    r335 r369  
    44/// xios headers /// 
    55#include "functor.hpp" 
     6#include "array_new.hpp" 
    67 
    78namespace xios 
     
    1415         /// Définition de type /// 
    1516         typedef CFunctor SuperClass; 
    16          typedef ARRAY(double, 1) DoubleArray; 
    1717 
    1818         public : 
     
    2020            /// Constructeurs /// 
    2121            //COnce(void);                       // Not implemented. 
    22             COnce(DoubleArray doutput); 
     22            COnce(CArray<double,1>& doutput); 
    2323            //COnce(const COnce & once);         // Not implemented. 
    2424            //COnce(const COnce * const once);   // Not implemented. 
    2525 
    2626            /// Traitement /// 
    27             virtual void apply(const DoubleArray dinput, DoubleArray doutput); 
     27            virtual void apply(const CArray<double,1>& dinput, CArray<double,1>& doutput); 
    2828 
    2929            /// Destructeur /// 
  • XIOS/trunk/src/generate_fortran_interface.cpp

    r352 r369  
    55#include "object_template.hpp" 
    66#include "group_template.hpp" 
     7#include "context.hpp" 
     8#include "file.hpp" 
    79 
    810int main (int argc, char ** argv, char ** UNUSED (env)) 
  • XIOS/trunk/src/generate_interface_impl.hpp

    r354 r369  
    66#include "type_util.hpp" 
    77#include "indent.hpp" 
    8 #include "array.hpp" 
     8#include "enum.hpp" 
     9#include "array_new.hpp" 
    910 
    1011namespace xios 
     
    8384  } 
    8485 
     86  template<> 
     87  void CInterface::AttributeCInterface<CEnumBase>(ostream& oss, const string& className,const string& name)   
     88  { 
     89    oss<<"void cxios_set_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, const char * "<<name<<", int "<<name<<"_size)"<<iendl ; 
     90    oss<<"{"<<iendl ; 
     91    oss<<"  std::string "<<name<<"_str;"<<iendl; 
     92    oss<<"  if(!cstr2string("<<name<<", "<<name<<"_size, "<<name<<"_str)) return;"<<iendl ; 
     93    oss<<"   CTimer::get(\"XIOS\").resume();"<<iendl ; 
     94    oss<<"  "<<className<<"_hdl->"<<name<<".fromString("<<name<<"_str);"<<iendl ; 
     95    oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ; 
     96    oss<<"   CTimer::get(\"XIOS\").suspend();"<<iendl ; 
     97    oss<<"}"<<iendl ; 
     98     
     99    oss<<iendl ; 
     100     
     101    oss<<"void cxios_get_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, char * "<<name<<", int "<<name<<"_size)"<<iendl ; 
     102    oss<<"{"<<iendl ; 
     103    oss<<"   CTimer::get(\"XIOS\").resume();"<<iendl ; 
     104    oss<<"  if(!string_copy("<<className<<"_hdl->"<<name<<".getStringValue(),"<<name<<" , "<<name<<"_size))"<<iendl ; 
     105    oss<<"    ERROR(\"void cxios_get_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, char * "<<name<<", int " 
     106       <<name<<"_size)\", <<\"Input string is to short\");"<<iendl ; 
     107    oss<<"   CTimer::get(\"XIOS\").suspend();"<<iendl ; 
     108    oss<<"}"<<iendl ; 
     109   
     110  } 
    85111//     if (!array_copy(domain_hdl->mask.getValue(), mask, extent1, extent2)) 
    86112//        ERROR("cxios_get_domain_mask(XDomainPtr domain_hdl, bool * mask, int extent1, int extent2)",<<"Output array size is not conform to array size attribut") ; 
    87113 
    88  
     114/* 
    89115#define macro(T) \ 
    90116  template <>\ 
     
    160186macro(double) 
    161187macro(int) 
     188*/ 
    162189 
    163190#undef macro   
     
    206233      
    207234   } 
    208      
     235 
     236/* 
    209237#define macro(T)\ 
    210238   template <>\ 
     
    280308  macro(double) 
    281309  macro(int) 
    282    
     310 
    283311  #undef macro 
    284    
     312*/   
    285313   template <class T> 
    286314   void CInterface::AttributeFortranInterfaceDeclaration(ostream& oss,const string& className,const string& name) 
     
    309337   } 
    310338 
     339/* 
    311340#define macro(T)\ 
    312341   template <> \ 
     
    356385 
    357386#undef macro 
    358  
     387*/ 
    359388    
    360389   template <class T> 
     
    404433   } 
    405434 
    406  
     435/* 
    407436#define macro(T) \ 
    408437   template <>  \ 
     
    459488 
    460489#undef macro 
    461  
     490*/ 
     491 
     492/* 
    462493#define macro(T) \ 
    463494   template <>  \ 
     
    514545 
    515546#undef macro 
     547*/ 
     548 
     549// declaration for CArray 
     550 
     551 
     552 
     553 
     554#define macro(T) \ 
     555  template <>\ 
     556  void CInterface::AttributeCInterface<CArray<T,1> >(ostream& oss, const string& className,const string& name)\ 
     557  {\ 
     558    string typeName=getStrType<T>() ;\ 
     559\ 
     560    oss<<"void cxios_set_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, "<< typeName<<"* "<<name<<", int extent1)"<<iendl ;\ 
     561    oss<<"{"<<iendl ;\ 
     562    oss<<"  CTimer::get(\"XIOS\").resume();"<<iendl ; \ 
     563    oss<<"  CArray<"<<typeName<<",1> tmp("<<name<<",shape(extent1),neverDeleteData) ;"<<iendl ;\ 
     564    oss<<"  "<<className<<"_hdl->"<<name<<".reference(tmp.copy());"<<iendl ;\ 
     565    oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;\ 
     566    oss<<"}"<<iendl ;\ 
     567    oss<<iendl; \ 
     568    oss<<"void cxios_get_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, "<< typeName<<"* "<<name<<", int extent1)"<<iendl ;\ 
     569    oss<<"{"<<iendl; \ 
     570    oss<<"  CArray<"<<typeName<<",1> tmp("<<name<<",shape(extent1),neverDeleteData) ;"<<iendl ;\ 
     571    oss<<"  tmp="<<className<<"_hdl->"<<name<<" ;"<<iendl ;\ 
     572    oss<<"   CTimer::get(\"XIOS\").suspend();"<<iendl ;\ 
     573    oss<<"}"<<iendl ;\ 
     574  }\ 
     575\ 
     576  template <> \ 
     577  void CInterface::AttributeCInterface<CArray<T,2> >(ostream& oss, const string& className,const string& name)\ 
     578  {\ 
     579    string typeName=getStrType<T>() ;\ 
     580\ 
     581    oss<<"void cxios_set_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, "<< typeName<<"* "<<name<<", int extent1, int extent2)"<<iendl ;\ 
     582    oss<<"{"<<iendl ;\ 
     583    oss<<"  CTimer::get(\"XIOS\").resume();"<<iendl ; \ 
     584    oss<<"  CArray<"<<typeName<<",2> tmp("<<name<<",shape(extent1,extent2),neverDeleteData) ;"<<iendl ;\ 
     585    oss<<"  "<<className<<"_hdl->"<<name<<".reference(tmp.copy());"<<iendl ;\ 
     586    oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;\ 
     587    oss<<"}"<<iendl ;\ 
     588    oss<<iendl; \ 
     589    oss<<"void cxios_get_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, "<< typeName<<"* "<<name<<", int extent1, int extent2)"<<iendl ;\ 
     590    oss<<"{"<<iendl; \ 
     591    oss<<"  CArray<"<<typeName<<",2> tmp("<<name<<",shape(extent1,extent2),neverDeleteData) ;"<<iendl ;\ 
     592    oss<<"  tmp="<<className<<"_hdl->"<<name<<" ;"<<iendl ;\ 
     593    oss<<"   CTimer::get(\"XIOS\").suspend();"<<iendl ;\ 
     594    oss<<"}"<<iendl ;\ 
     595  }\ 
     596\ 
     597  template <>\ 
     598  void CInterface::AttributeCInterface<CArray<T,3> >(ostream& oss, const string& className,const string& name)\ 
     599  {\ 
     600    string typeName=getStrType<T>() ;\ 
     601\ 
     602    oss<<"void cxios_set_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, "<< typeName<<"* "<<name<<", int extent1, int extent2, int extent3)"<<iendl ;\ 
     603    oss<<"{"<<iendl ;\ 
     604    oss<<"  CTimer::get(\"XIOS\").resume();"<<iendl ; \ 
     605    oss<<"  CArray<"<<typeName<<",2> tmp("<<name<<",shape(extent1,extent2,extent3),neverDeleteData) ;"<<iendl ;\ 
     606    oss<<"  "<<className<<"_hdl->"<<name<<".reference(tmp.copy());"<<iendl ;\ 
     607    oss<<"  "<<className<<"_hdl->sendAttributToServer("<<className<<"_hdl->"<<name<<");"<<iendl ;\ 
     608    oss<<"}"<<iendl ;\ 
     609    oss<<iendl; \ 
     610    oss<<"void cxios_get_"<<className<<"_"<<name<<"("<<className<<"_Ptr "<<className<<"_hdl, "<< typeName<<"* "<<name<<", int extent1, int extent2, int extent3)"<<iendl ;\ 
     611    oss<<"{"<<iendl; \ 
     612    oss<<"  CArray<"<<typeName<<",2> tmp("<<name<<",shape(extent1,extent2,extent3),neverDeleteData) ;"<<iendl ;\ 
     613    oss<<"  tmp="<<className<<"_hdl->"<<name<<" ;"<<iendl ;\ 
     614    oss<<"   CTimer::get(\"XIOS\").suspend();"<<iendl ;\ 
     615    oss<<"}"<<iendl ;\ 
     616  } 
     617 
     618macro(bool) 
     619macro(double) 
     620macro(int) 
     621 
     622#undef macro   
     623 
     624// ///////////////////////////////////////////////// 
     625// //          Fortran 2003 Interface             // 
     626// ///////////////////////////////////////////////// 
     627 
     628 
     629     
     630#define macro(T)\ 
     631   template <>\ 
     632   void CInterface::AttributeFortran2003Interface<CArray<T,1> >(ostream& oss,const string& className,const string& name) \ 
     633   { \ 
     634     string fortranType=getStrFortranType<T>() ; \ 
     635     string fortranKindC=getStrFortranKindC<T>() ; \ 
     636      \ 
     637     oss<<"SUBROUTINE cxios_set_"<<className<<"_"<<name<<"("<<className<<"_hdl, "<<name<<", extent1) BIND(C)"<<iendl ; \ 
     638     oss<<"  USE ISO_C_BINDING"<<iendl ; \ 
     639     oss<<"  INTEGER (kind = C_INTPTR_T), VALUE       :: "<<className<<"_hdl"<<iendl ; \ 
     640     oss<<"  "<<fortranType<<" "<<fortranKindC<<"     , DIMENSION(*) :: "<<name<<iendl ; \ 
     641     oss<<"  INTEGER (kind = C_INT), VALUE  :: extent1"<<iendl ; \ 
     642     oss<<"END SUBROUTINE cxios_set_"<<className<<"_"<<name<<iendl ; \ 
     643     oss<<iendl; \ 
     644     oss<<"SUBROUTINE cxios_get_"<<className<<"_"<<name<<"("<<className<<"_hdl, "<<name<<", extent1) BIND(C)"<<iendl ; \ 
     645     oss<<"  USE ISO_C_BINDING"<<iendl ; \ 
     646     oss<<"  INTEGER (kind = C_INTPTR_T), VALUE       :: "<<className<<"_hdl"<<iendl ; \ 
     647     oss<<"  "<<fortranType<<" "<<fortranKindC<<"     , DIMENSION(*) :: "<<name<<iendl ; \ 
     648     oss<<"  INTEGER (kind = C_INT), VALUE  :: extent1"<<iendl ; \ 
     649     oss<<"END SUBROUTINE cxios_get_"<<className<<"_"<<name<<iendl ; \ 
     650   } \ 
     651 \ 
     652   template <> \ 
     653   void CInterface::AttributeFortran2003Interface<CArray<T,2> >(ostream& oss,const string& className,const string& name) \ 
     654   { \ 
     655     string fortranType=getStrFortranType<T>() ; \ 
     656     string fortranKindC=getStrFortranKindC<T>() ; \ 
     657      \ 
     658     oss<<"SUBROUTINE cxios_set_"<<className<<"_"<<name<<"("<<className<<"_hdl, "<<name<<", extent1, extent2) BIND(C)"<<iendl ; \ 
     659     oss<<"  USE ISO_C_BINDING"<<iendl ; \ 
     660     oss<<"  INTEGER (kind = C_INTPTR_T), VALUE       :: "<<className<<"_hdl"<<iendl ; \ 
     661     oss<<"  "<<fortranType<<" "<<fortranKindC<<"     , DIMENSION(*) :: "<<name<<iendl ; \ 
     662     oss<<"  INTEGER (kind = C_INT), VALUE  :: extent1"<<iendl ; \ 
     663     oss<<"  INTEGER (kind = C_INT), VALUE  :: extent2"<<iendl ; \ 
     664     oss<<"END SUBROUTINE cxios_set_"<<className<<"_"<<name<<iendl ; \ 
     665     oss<<iendl ; \ 
     666     oss<<"SUBROUTINE cxios_get_"<<className<<"_"<<name<<"("<<className<<"_hdl, "<<name<<", extent1, extent2) BIND(C)"<<iendl ; \ 
     667     oss<<"  USE ISO_C_BINDING"<<iendl ; \ 
     668     oss<<"  INTEGER (kind = C_INTPTR_T), VALUE       :: "<<className<<"_hdl"<<iendl ; \ 
     669     oss<<"  "<<fortranType<<" "<<fortranKindC<<"     , DIMENSION(*) :: "<<name<<iendl ; \ 
     670     oss<<"  INTEGER (kind = C_INT), VALUE  :: extent1"<<iendl ; \ 
     671     oss<<"  INTEGER (kind = C_INT), VALUE  :: extent2"<<iendl ; \ 
     672     oss<<"END SUBROUTINE cxios_get_"<<className<<"_"<<name<<iendl ; \ 
     673   } \ 
     674     \ 
     675   template <> \ 
     676   void CInterface::AttributeFortran2003Interface<CArray<T,3> >(ostream& oss,const string& className,const string& name) \ 
     677   { \ 
     678     string fortranType=getStrFortranType<T>() ; \ 
     679     string fortranKindC=getStrFortranKindC<T>() ; \ 
     680      \ 
     681     oss<<"SUBROUTINE cxios_set_"<<className<<"_"<<name<<"("<<className<<"_hdl, "<<name<<", extent1, extent2, extent3) BIND(C)"<<iendl ; \ 
     682     oss<<"  USE ISO_C_BINDING"<<iendl ; \ 
     683     oss<<"  INTEGER (kind = C_INTPTR_T), VALUE       :: "<<className<<"_hdl"<<iendl ; \ 
     684     oss<<"  "<<fortranType<<" "<<fortranKindC<<"     , DIMENSION(*) :: "<<name<<iendl ; \ 
     685     oss<<"  INTEGER (kind = C_INT), VALUE  :: extent1"<<iendl ; \ 
     686     oss<<"  INTEGER (kind = C_INT), VALUE  :: extent2"<<iendl ; \ 
     687     oss<<"  INTEGER (kind = C_INT), VALUE  :: extent3"<<iendl ; \ 
     688     oss<<"END SUBROUTINE cxios_set_"<<className<<"_"<<name<<iendl ; \ 
     689     oss<<iendl ;\ 
     690     oss<<"SUBROUTINE cxios_get_"<<className<<"_"<<name<<"("<<className<<"_hdl, "<<name<<", extent1, extent2, extent3) BIND(C)"<<iendl ; \ 
     691     oss<<"  USE ISO_C_BINDING"<<iendl ; \ 
     692     oss<<"  INTEGER (kind = C_INTPTR_T), VALUE       :: "<<className<<"_hdl"<<iendl ; \ 
     693     oss<<"  "<<fortranType<<" "<<fortranKindC<<"     , DIMENSION(*) :: "<<name<<iendl ; \ 
     694     oss<<"  INTEGER (kind = C_INT), VALUE  :: extent1"<<iendl ; \ 
     695     oss<<"  INTEGER (kind = C_INT), VALUE  :: extent2"<<iendl ; \ 
     696     oss<<"  INTEGER (kind = C_INT), VALUE  :: extent3"<<iendl ; \ 
     697     oss<<"END SUBROUTINE cxios_get_"<<className<<"_"<<name<<iendl ; \ 
     698   } 
     699   
     700  macro(bool) 
     701  macro(double) 
     702  macro(int) 
     703   
     704  #undef macro 
     705   
     706 
     707#define macro(T)\ 
     708   template <> \ 
     709   void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,1> >(ostream& oss,const string& className,const string& name) \ 
     710   { \ 
     711     oss<<getStrFortranType<T>()<<" "<<getStrFortranKind<T>() <<" , OPTIONAL, INTENT(IN) :: "<<name<<"(:)"<<iendl ; \ 
     712     if (!matchingTypeCFortran<T>()) oss<<getStrFortranType<T>()<<" "<<getStrFortranKindC<T>() <<" , ALLOCATABLE :: "<<name<<"_tmp(:)"<<iendl ; \ 
     713   } \ 
     714   template <> \ 
     715   void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,1> >(ostream& oss,const string& className,const string& name) \ 
     716   { \ 
     717     oss<<getStrFortranType<T>()<<" "<<getStrFortranKind<T>() <<" , OPTIONAL, INTENT(OUT) :: "<<name<<"(:)"<<iendl ; \ 
     718     if (!matchingTypeCFortran<T>()) oss<<getStrFortranType<T>()<<" "<<getStrFortranKindC<T>() <<" , ALLOCATABLE :: "<<name<<"_tmp(:)"<<iendl ; \ 
     719   } \ 
     720 \ 
     721   template <> \ 
     722   void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,2> >(ostream& oss,const string& className,const string& name) \ 
     723   { \ 
     724     oss<<getStrFortranType<T>()<<" "<<getStrFortranKind<T>() <<" , OPTIONAL, INTENT(IN) :: "<<name<<"(:,:)"<<iendl ; \ 
     725     if (!matchingTypeCFortran<T>()) oss<<getStrFortranType<T>()<<" "<<getStrFortranKindC<T>() <<" , ALLOCATABLE :: "<<name<<"_tmp(:,:)"<<iendl ; \ 
     726   } \ 
     727 \ 
     728   template <> \ 
     729   void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,2> >(ostream& oss,const string& className,const string& name) \ 
     730   { \ 
     731     oss<<getStrFortranType<T>()<<" "<<getStrFortranKind<T>() <<" , OPTIONAL, INTENT(OUT) :: "<<name<<"(:,:)"<<iendl ; \ 
     732     if (!matchingTypeCFortran<T>()) oss<<getStrFortranType<T>()<<" "<<getStrFortranKindC<T>() <<" , ALLOCATABLE :: "<<name<<"_tmp(:,:)"<<iendl ; \ 
     733   } \ 
     734 \ 
     735   template <> \ 
     736   void CInterface::AttributeFortranInterfaceDeclaration<CArray<T,3> >(ostream& oss,const string& className,const string& name) \ 
     737   { \ 
     738     oss<<getStrFortranType<T>()<<" "<<getStrFortranKind<T>() <<" , OPTIONAL, INTENT(IN) :: "<<name<<"(:,:,:)"<<iendl ; \ 
     739     if (!matchingTypeCFortran<T>()) oss<<getStrFortranType<T>()<<" "<<getStrFortranKindC<T>() <<" , ALLOCATABLE :: "<<name<<"_tmp(:,:,:)"<<iendl ; \ 
     740   }\ 
     741 \ 
     742   template <> \ 
     743   void CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T,3> >(ostream& oss,const string& className,const string& name) \ 
     744   { \ 
     745     oss<<getStrFortranType<T>()<<" "<<getStrFortranKind<T>() <<" , OPTIONAL, INTENT(OUT) :: "<<name<<"(:,:,:)"<<iendl ; \ 
     746     if (!matchingTypeCFortran<T>()) oss<<getStrFortranType<T>()<<" "<<getStrFortranKindC<T>() <<" , ALLOCATABLE :: "<<name<<"_tmp(:,:,:)"<<iendl ; \ 
     747   }      
     748    
     749  macro(bool) 
     750  macro(double) 
     751  macro(int) 
     752 
     753#undef macro 
     754 
     755    
     756 
     757#define macro(T) \ 
     758   template <>  \ 
     759   void CInterface::AttributeFortranInterfaceBody< CArray<T,1> >(ostream& oss,const string& className,const string& name) \ 
     760   {  \ 
     761     string name_tmp=name+"__tmp" ; \ 
     762      \ 
     763     oss<<"IF (PRESENT("<<name<<"_)) THEN"<<iendl ; \ 
     764     if (!matchingTypeCFortran<T>())  \ 
     765     { \ 
     766       oss<<"  ALLOCATE("<<name_tmp<<"(size("<<name<<"_,1)))"<<iendl ; \ 
     767       oss<<"  "<<name_tmp<<"="<<name<<"_"<<iendl ; \ 
     768       oss<<"  CALL cxios_set_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr, "<<name_tmp<<",size("<<name<<"_,1))"<<iendl ; \ 
     769     } \ 
     770     else oss<<"  CALL cxios_set_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr, "<<name<<"_,size("<<name<<"_,1))"<<iendl ; \ 
     771     oss<<"ENDIF"<<iendl ; \ 
     772   } \ 
     773 \ 
     774   template <>  \ 
     775   void CInterface::AttributeFortranInterfaceBody< CArray<T,2> >(ostream& oss,const string& className,const string& name) \ 
     776   {  \ 
     777     string name_tmp=name+"__tmp" ; \ 
     778      \ 
     779     oss<<"IF (PRESENT("<<name<<"_)) THEN"<<iendl ; \ 
     780     if (!matchingTypeCFortran<T>())  \ 
     781     { \ 
     782       oss<<"  ALLOCATE("<<name_tmp<<"(size("<<name<<"_,1),size("<<name<<"_,2)))"<<iendl ; \ 
     783       oss<<"  "<<name_tmp<<"="<<name<<"_"<<iendl ; \ 
     784       oss<<"  CALL cxios_set_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr, "<<name_tmp<<",size("<<name<<"_,1),size("<<name<<"_,2))"<<iendl ; \ 
     785     } \ 
     786     else oss<<"  CALL cxios_set_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr, "<<name<<"_,size("<<name<<"_,1),size("<<name<<"_,2))"<<iendl ; \ 
     787     oss<<"ENDIF"<<iendl ; \ 
     788   } \ 
     789    \ 
     790   template <>  \ 
     791   void CInterface::AttributeFortranInterfaceBody< CArray<T,3> >(ostream& oss,const string& className,const string& name) \ 
     792   {  \ 
     793     string name_tmp=name+"__tmp" ; \ 
     794      \ 
     795     oss<<"IF (PRESENT("<<name<<"_)) THEN"<<iendl ; \ 
     796     if (!matchingTypeCFortran<T>())  \ 
     797     { \ 
     798       oss<<"  ALLOCATE("<<name_tmp<<"(size("<<name<<"_,1),size("<<name<<"_,2),size("<<name<<"_,3)))"<<iendl ; \ 
     799       oss<<"  "<<name_tmp<<"="<<name<<"_"<<iendl ; \ 
     800       oss<<"  CALL cxios_set_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr, "<<name_tmp<<",size("<<name<<"_,1),size("<<name<<"_,2),size("<<name<<"_,3))"<<iendl ; \ 
     801     } \ 
     802     else oss<<"  CALL cxios_set_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr, "<<name<<"_,size("<<name<<"_,1),size("<<name<<"_,2),size("<<name<<"_,3))"<<iendl ; \ 
     803     oss<<"ENDIF"<<iendl ; \ 
     804   } 
     805   
     806  macro(bool) 
     807  macro(double) 
     808  macro(int) 
     809 
     810#undef macro 
     811 
     812#define macro(T) \ 
     813   template <>  \ 
     814   void CInterface::AttributeFortranInterfaceGetBody< CArray<T,1> >(ostream& oss,const string& className,const string& name) \ 
     815   {  \ 
     816     string name_tmp=name+"__tmp" ; \ 
     817      \ 
     818     oss<<"IF (PRESENT("<<name<<"_)) THEN"<<iendl ; \ 
     819     if (!matchingTypeCFortran<T>())  \ 
     820     { \ 
     821       oss<<"  ALLOCATE("<<name_tmp<<"(size("<<name<<"_,1)))"<<iendl ; \ 
     822       oss<<"  CALL cxios_get_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr, "<<name_tmp<<",size("<<name<<"_,1))"<<iendl ; \ 
     823       oss<<"  "<<name<<"_="<<name_tmp<<"_"<<iendl ; \ 
     824     } \ 
     825     else oss<<"  CALL cxios_get_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr, "<<name<<"_,size("<<name<<"_,1))"<<iendl ; \ 
     826     oss<<"ENDIF"<<iendl ; \ 
     827   } \ 
     828 \ 
     829   template <>  \ 
     830   void CInterface::AttributeFortranInterfaceGetBody< CArray<T,2> >(ostream& oss,const string& className,const string& name) \ 
     831   {  \ 
     832     string name_tmp=name+"__tmp" ; \ 
     833      \ 
     834     oss<<"IF (PRESENT("<<name<<"_)) THEN"<<iendl ; \ 
     835     if (!matchingTypeCFortran<T>())  \ 
     836     { \ 
     837       oss<<"  ALLOCATE("<<name_tmp<<"(size("<<name<<"_,1),size("<<name<<"_,2)))"<<iendl ; \ 
     838       oss<<"  CALL cxios_get_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr, "<<name_tmp<<",size("<<name<<"_,1),size("<<name<<"_,2))"<<iendl ; \ 
     839       oss<<"  "<<name<<"_="<<name_tmp<<iendl ; \ 
     840     } \ 
     841     else oss<<"  CALL cxios_get_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr, "<<name<<"_,size("<<name<<"_,1),size("<<name<<"_,2))"<<iendl ; \ 
     842     oss<<"ENDIF"<<iendl ; \ 
     843   } \ 
     844    \ 
     845   template <>  \ 
     846   void CInterface::AttributeFortranInterfaceGetBody< CArray<T,3> >(ostream& oss,const string& className,const string& name) \ 
     847   {  \ 
     848     string name_tmp=name+"__tmp" ; \ 
     849      \ 
     850     oss<<"IF (PRESENT("<<name<<"_)) THEN"<<iendl ; \ 
     851     if (!matchingTypeCFortran<T>())  \ 
     852     { \ 
     853       oss<<"  ALLOCATE("<<name_tmp<<"(size("<<name<<"_,1),size("<<name<<"_,2),size("<<name<<"_,3)))"<<iendl ; \ 
     854       oss<<"  CALL cxios_get_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr, "<<name_tmp<<",size("<<name<<"_,1),size("<<name<<"_,2),size("<<name<<"_,3))"<<iendl ; \ 
     855       oss<<"  "<<name<<"_="<<name_tmp<<iendl ; \ 
     856      } \ 
     857     else oss<<"  CALL cxios_get_"<<className<<"_"<<name<<"("<<className<<"_hdl%daddr, "<<name<<"_,size("<<name<<"_,1),size("<<name<<"_,2),size("<<name<<"_,3))"<<iendl ; \ 
     858     oss<<"ENDIF"<<iendl ; \ 
     859   } 
     860      
     861  macro(bool) 
     862  macro(double) 
     863  macro(int) 
     864 
     865#undef macro 
     866 
     867 
     868 
     869 
     870 
     871 
     872 
     873 
     874 
     875 
     876 
     877 
     878 
     879 
     880 
     881 
     882 
     883 
     884 
     885 
     886 
     887 
     888 
     889 
     890 
     891 
     892 
     893 
     894 
     895 
     896 
     897 
     898 
     899 
     900 
    516901} 
    517902 
  • XIOS/trunk/src/group_template.hpp

    r354 r369  
    4545         virtual void fromString(const StdString & str); 
    4646          
    47          virtual void toBinary  (StdOStream & os) const; 
    48          virtual void fromBinary(StdIStream & is); 
     47//         virtual void toBinary  (StdOStream & os) const; 
     48//         virtual void fromBinary(StdIStream & is); 
    4949 
    5050         virtual void parse(xml::CXMLNode & node); 
  • XIOS/trunk/src/group_template_impl.hpp

    r352 r369  
    3838    
    3939   ///-------------------------------------------------------------- 
    40     
     40/* 
    4141   template <class U, class V, class W> 
    4242      void CGroupTemplate<U, V, W>::toBinary(StdOStream & os) const 
     
    161161      } 
    162162   } 
    163  
     163*/ 
    164164   //-------------------------------------------------------------- 
    165165 
  • XIOS/trunk/src/input/inetcdf4.cpp

    r337 r369  
    710710 
    711711      template <> 
    712          void CINetCDF4::getData(ARRAY(int, 1) data, const StdString & var, 
     712         void CINetCDF4::getData(CArray<int, 1>& data, const StdString & var, 
    713713                                 const CVarPath  * const path, StdSize record) 
    714714      { 
     
    719719         StdSize array_size = 1; 
    720720         this->getDataInfo(var, path, record, start, count, array_size); 
    721          data->resize(boost::extents[array_size]); 
    722          CheckError(nc_get_vara_int (grpid, varid, &(start[0]), &(count[0]), data->data())); 
     721         data.resize(array_size); 
     722         CheckError(nc_get_vara_int (grpid, varid, &(start[0]), &(count[0]), data.dataFirst())); 
    723723      } 
    724724 
    725725      template <> 
    726          void CINetCDF4::getData(ARRAY(double, 1) data, const StdString & var, 
     726         void CINetCDF4::getData(CArray<double, 1>& data, const StdString & var, 
    727727                                 const CVarPath  * const path, StdSize record) 
    728728      { 
     
    732732         StdSize array_size = 1; 
    733733         this->getDataInfo(var, path, record, start, count, array_size); 
    734          data->resize(boost::extents[array_size]); 
    735          CheckError(nc_get_vara_double (grpid, varid, &(start[0]), &(count[0]), data->data())); 
     734         data.resize(array_size); 
     735         CheckError(nc_get_vara_double (grpid, varid, &(start[0]), &(count[0]), data.dataFirst())); 
    736736      } 
    737737 
    738738      template <> 
    739          void CINetCDF4::getData(ARRAY(float, 1) data, const StdString & var, 
     739         void CINetCDF4::getData(CArray<float, 1>& data, const StdString & var, 
    740740                                 const CVarPath  * const path, StdSize record) 
    741741      { 
     
    745745         StdSize array_size = 1; 
    746746         this->getDataInfo(var, path, record, start, count, array_size); 
    747          data->resize(boost::extents[array_size]); 
    748          CheckError(nc_get_vara_float (grpid, varid, &(start[0]), &(count[0]), data->data())); 
     747         data.resize(array_size); 
     748         CheckError(nc_get_vara_float (grpid, varid, &(start[0]), &(count[0]), data.dataFirst())); 
    749749      } 
    750750 
  • XIOS/trunk/src/input/inetcdf4.hpp

    r337 r369  
    55#include "xmlioserver_spl.hpp" 
    66#include "exception.hpp" 
    7 #include "array.hpp" 
     7#include "array_new.hpp" 
    88 
    99#include <mpi.h> 
     
    9292 
    9393            template <class T> 
    94                void getData(ARRAY(T, 1) data, 
     94               void getData(CArray<T, 1>& data, 
    9595                            const StdString & var, 
    9696                            const CVarPath  * const path = NULL, 
     
    220220      //--------------------------------------------------------------- 
    221221      template <> 
    222          void CINetCDF4::getData(ARRAY(int, 1) data, const StdString & var, 
     222         void CINetCDF4::getData(CArray<int, 1>& data, const StdString & var, 
    223223                                 const CVarPath  * const path, StdSize record); 
    224224 
    225225      template <> 
    226          void CINetCDF4::getData(ARRAY(double, 1) data, const StdString & var, 
     226         void CINetCDF4::getData(CArray<double, 1>& data, const StdString & var, 
    227227                                 const CVarPath  * const path, StdSize record); 
    228228 
    229229      template <> 
    230          void CINetCDF4::getData(ARRAY(float, 1) data, const StdString & var, 
     230         void CINetCDF4::getData(CArray<float, 1>& data, const StdString & var, 
    231231                                 const CVarPath  * const path, StdSize record); 
    232232      ///-------------------------------------------------------------- 
  • XIOS/trunk/src/interface/c/icdata.cpp

    r361 r369  
    2323#include <mpi.h> 
    2424#include "timer.hpp" 
     25#include "array_new.hpp" 
    2526 
    2627extern "C" 
     
    111112      CTimer::get("XIOS send field").resume() ; 
    112113      CContext* context = CContext::getCurrent() ; 
    113 //      boost::const_multi_array_ref<double, 1> array_(data_k8, 
    114 //          boost::extents [data_Xsize], 
    115 //          boost::fortran_storage_order()); 
    116       ARRAY(double, 1) data(new CArray<double, 1>(boost::extents [data_Xsize])); 
    117       std::copy(data_k8, &(data_k8[data->num_elements()]), data->data()); 
    118        
    119 //      dtreat->write_data(fieldid_str, data); 
    120       CField::get(fieldid_str)->setData(data) ; 
     114 
     115      CArray<double,(StdSize)1> data(data_k8,shape(data_Xsize),neverDeleteData) ; 
     116      CField::get(fieldid_str)->setData(data) ; 
     117      CField toto ; 
     118      toto.setData(data) ; 
    121119      CTimer::get("XIOS send field").suspend() ; 
    122120      CTimer::get("XIOS").suspend() ; 
     
    132130      CContext* context = CContext::getCurrent() ; 
    133131       
    134 //      boost::const_multi_array_ref<double, 2> array_(data_k8, 
    135 //          boost::extents [data_Xsize][data_Ysize], 
    136 //          boost::fortran_storage_order()); 
    137       ARRAY(double, 2) data(new CArray<double, 2>(boost::extents [data_Xsize][data_Ysize])); 
    138       std::copy(data_k8, &(data_k8[data->num_elements()]), data->data()); 
    139 //      dtreat->write_data(fieldid_str, data); 
     132      CArray<double,2>data(data_k8,shape(data_Xsize,data_Ysize),neverDeleteData) ; 
    140133      CField::get(fieldid_str)->setData(data) ; 
    141134      CTimer::get("XIOS send field").suspend() ; 
     
    151144      CTimer::get("XIOS send field").resume() ; 
    152145      CContext* context = CContext::getCurrent() ; 
    153 //      boost::const_multi_array_ref<double, 3> array_(data_k8, 
    154 //          boost::extents [data_Xsize][data_Ysize][data_Zsize], 
    155 //          boost::fortran_storage_order()); 
    156       ARRAY(double, 3) data(new CArray<double, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize])); 
    157       std::copy(data_k8, &(data_k8[data->num_elements()]), data->data()); 
    158 //      dtreat->write_data(fieldid_str, data); 
     146 
     147      CArray<double,3>data(data_k8,shape(data_Xsize,data_Ysize,data_Zsize),neverDeleteData) ; 
    159148      CField::get(fieldid_str)->setData(data) ; 
    160149      CTimer::get("XIOS send field").suspend() ; 
     
    170159      CTimer::get("XIOS send field").resume() ; 
    171160      CContext* context = CContext::getCurrent() ; 
    172 //      boost::const_multi_array_ref<float, 1> array_(data_k4, 
    173 //          boost::extents [data_Xsize], 
    174 //          boost::fortran_storage_order()); 
    175 //      ARRAY(float, 1) data(new CArray<float, 1>(boost::extents [data_Xsize])); 
    176 //      std::copy(data_k4, &(data_k4[data->num_elements()]), data->data()); 
    177 //      dtreat->write_data(fieldid_str, data); 
    178       ARRAY(double, 1) data(new CArray<double, 1>(boost::extents [data_Xsize])); 
    179       double* ptr_data=data->data() ;  
    180       for(int i=0;i<data->num_elements();i++) ptr_data[i]=data_k4[i]; 
     161      CArray<float,1> data_tmp(data_k4,shape(data_Xsize),neverDeleteData) ; 
     162      CArray<double,1> data(data_Xsize) ; 
     163      data=data_tmp ; 
    181164      CField::get(fieldid_str)->setData(data) ; 
    182165      CTimer::get("XIOS send field").suspend() ; 
     
    192175      CTimer::get("XIOS send field").resume() ; 
    193176      CContext* context = CContext::getCurrent() ; 
    194 //      boost::const_multi_array_ref<float, 2> array_(data_k4, 
    195 //          boost::extents [data_Xsize][data_Ysize], 
    196 //          boost::fortran_storage_order()); 
    197 //      ARRAY(float, 2) data(new CArray<float, 2>(boost::extents [data_Xsize][data_Ysize])); 
    198 //      std::copy(data_k4, &(data_k4[data->num_elements()]), data->data()); 
    199 //      dtreat->write_data(fieldid_str, data); 
    200       ARRAY(double, 2) data(new CArray<double, 2>(boost::extents [data_Xsize][data_Ysize])); 
    201       double* ptr_data=data->data() ;  
    202       for(int i=0;i<data->num_elements();i++) ptr_data[i]=data_k4[i]; 
     177      CArray<float,2> data_tmp(data_k4,shape(data_Xsize,data_Ysize),neverDeleteData) ; 
     178      CArray<double,2> data(data_Xsize,data_Ysize) ; 
     179      data=data_tmp ; 
    203180      CField::get(fieldid_str)->setData(data) ; 
    204181      CTimer::get("XIOS send field").suspend() ; 
     
    215192      CTimer::get("XIOS send field").resume() ; 
    216193      CContext* context = CContext::getCurrent() ; 
    217       
    218 //      boost::const_multi_array_ref<float, 3> array_(data_k4, 
    219 //          boost::extents [data_Xsize][data_Ysize][data_Zsize], 
    220 //          boost::fortran_storage_order()); 
    221 //      ARRAY(float, 3) data(new CArray<float, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize])); 
    222 //      std::copy(data_k4, &(data_k4[data->num_elements()]), data->data()); 
    223 //      dtreat->write_data(fieldid_str, data); 
    224       ARRAY(double, 3) data(new CArray<double, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize])); 
    225       double* ptr_data=data->data() ;  
    226       for(int i=0;i<data->num_elements();i++) ptr_data[i]=data_k4[i]; 
     194 
     195      CArray<float,3> data_tmp(data_k4,shape(data_Xsize,data_Ysize,data_Zsize),neverDeleteData) ; 
     196      CArray<double,3> data(data_Xsize,data_Ysize,data_Zsize) ; 
     197      data=data_tmp ; 
     198  
    227199      CField::get(fieldid_str)->setData(data) ; 
    228200      CTimer::get("XIOS send field").suspend() ; 
  • XIOS/trunk/src/interface/c/icutil.hpp

    r335 r369  
    4040  } 
    4141} 
     42/* 
    4243  template<class T> 
    4344  inline  bool array_copy(ARRAY(T,1) array_in, T* array_out, size_t extent1) 
     
    6364    return true ; 
    6465  }         
    65  
     66*/ 
    6667 
    6768#endif // __ICUTIL_HPP__ 
  • XIOS/trunk/src/interface/c_attr/icaxis_attr.cpp

    r352 r369  
    1111#include "icutil.hpp" 
    1212#include "timer.hpp" 
    13 #include "axis.hpp" 
     13#include "node_type.hpp" 
    1414 
    1515extern "C" 
     
    109109  void cxios_set_axis_value(axis_Ptr axis_hdl, double* value, int extent1) 
    110110  { 
    111      CTimer::get("XIOS").resume(); 
    112     ARRAY(double,1) array_tmp(new CArray<double,1>(boost::extents[extent1])); 
    113     std::copy(value, &(value[array_tmp->num_elements()]), array_tmp->data()); 
    114     axis_hdl->value.setValue(array_tmp); 
     111    CTimer::get("XIOS").resume(); 
     112    CArray<double,1> tmp(value,shape(extent1),neverDeleteData) ; 
     113    axis_hdl->value.reference(tmp.copy()); 
    115114    axis_hdl->sendAttributToServer(axis_hdl->value); 
    116115  } 
     
    118117  void cxios_get_axis_value(axis_Ptr axis_hdl, double* value, int extent1) 
    119118  { 
    120     if (!array_copy(axis_hdl->value.getValue(), value, extent1)) 
    121      ERROR("void cxios_set_axis_value(axis_Ptr axis_hdl, double* value, int extent1)",<<"Output array size is not conform to array size attribute") ; 
     119    CArray<double,1> tmp(value,shape(extent1),neverDeleteData) ; 
     120    tmp=axis_hdl->value ; 
    122121     CTimer::get("XIOS").suspend(); 
     122  } 
     123   
     124   
     125  void cxios_set_axis_zoom_begin(axis_Ptr axis_hdl, int zoom_begin) 
     126  { 
     127     CTimer::get("XIOS").resume(); 
     128    axis_hdl->zoom_begin.setValue(zoom_begin); 
     129    axis_hdl->sendAttributToServer(axis_hdl->zoom_begin); 
     130     CTimer::get("XIOS").suspend(); 
     131  } 
     132   
     133  void cxios_get_axis_zoom_begin(axis_Ptr axis_hdl, int* zoom_begin) 
     134  { 
     135    *zoom_begin = axis_hdl->zoom_begin.getValue(); 
     136  } 
     137   
     138   
     139  void cxios_set_axis_zoom_end(axis_Ptr axis_hdl, int zoom_end) 
     140  { 
     141     CTimer::get("XIOS").resume(); 
     142    axis_hdl->zoom_end.setValue(zoom_end); 
     143    axis_hdl->sendAttributToServer(axis_hdl->zoom_end); 
     144     CTimer::get("XIOS").suspend(); 
     145  } 
     146   
     147  void cxios_get_axis_zoom_end(axis_Ptr axis_hdl, int* zoom_end) 
     148  { 
     149    *zoom_end = axis_hdl->zoom_end.getValue(); 
     150  } 
     151   
     152   
     153  void cxios_set_axis_zoom_size(axis_Ptr axis_hdl, int zoom_size) 
     154  { 
     155     CTimer::get("XIOS").resume(); 
     156    axis_hdl->zoom_size.setValue(zoom_size); 
     157    axis_hdl->sendAttributToServer(axis_hdl->zoom_size); 
     158     CTimer::get("XIOS").suspend(); 
     159  } 
     160   
     161  void cxios_get_axis_zoom_size(axis_Ptr axis_hdl, int* zoom_size) 
     162  { 
     163    *zoom_size = axis_hdl->zoom_size.getValue(); 
    123164  } 
    124165   
  • XIOS/trunk/src/interface/c_attr/icaxisgroup_attr.cpp

    r352 r369  
    1111#include "icutil.hpp" 
    1212#include "timer.hpp" 
    13 #include "axis.hpp" 
     13#include "node_type.hpp" 
    1414 
    1515extern "C" 
     
    128128  void cxios_set_axisgroup_value(axisgroup_Ptr axisgroup_hdl, double* value, int extent1) 
    129129  { 
    130      CTimer::get("XIOS").resume(); 
    131     ARRAY(double,1) array_tmp(new CArray<double,1>(boost::extents[extent1])); 
    132     std::copy(value, &(value[array_tmp->num_elements()]), array_tmp->data()); 
    133     axisgroup_hdl->value.setValue(array_tmp); 
     130    CTimer::get("XIOS").resume(); 
     131    CArray<double,1> tmp(value,shape(extent1),neverDeleteData) ; 
     132    axisgroup_hdl->value.reference(tmp.copy()); 
    134133    axisgroup_hdl->sendAttributToServer(axisgroup_hdl->value); 
    135134  } 
     
    137136  void cxios_get_axisgroup_value(axisgroup_Ptr axisgroup_hdl, double* value, int extent1) 
    138137  { 
    139     if (!array_copy(axisgroup_hdl->value.getValue(), value, extent1)) 
    140      ERROR("void cxios_set_axisgroup_value(axisgroup_Ptr axisgroup_hdl, double* value, int extent1)",<<"Output array size is not conform to array size attribute") ; 
     138    CArray<double,1> tmp(value,shape(extent1),neverDeleteData) ; 
     139    tmp=axisgroup_hdl->value ; 
    141140     CTimer::get("XIOS").suspend(); 
     141  } 
     142   
     143   
     144  void cxios_set_axisgroup_zoom_begin(axisgroup_Ptr axisgroup_hdl, int zoom_begin) 
     145  { 
     146     CTimer::get("XIOS").resume(); 
     147    axisgroup_hdl->zoom_begin.setValue(zoom_begin); 
     148    axisgroup_hdl->sendAttributToServer(axisgroup_hdl->zoom_begin); 
     149     CTimer::get("XIOS").suspend(); 
     150  } 
     151   
     152  void cxios_get_axisgroup_zoom_begin(axisgroup_Ptr axisgroup_hdl, int* zoom_begin) 
     153  { 
     154    *zoom_begin = axisgroup_hdl->zoom_begin.getValue(); 
     155  } 
     156   
     157   
     158  void cxios_set_axisgroup_zoom_end(axisgroup_Ptr axisgroup_hdl, int zoom_end) 
     159  { 
     160     CTimer::get("XIOS").resume(); 
     161    axisgroup_hdl->zoom_end.setValue(zoom_end); 
     162    axisgroup_hdl->sendAttributToServer(axisgroup_hdl->zoom_end); 
     163     CTimer::get("XIOS").suspend(); 
     164  } 
     165   
     166  void cxios_get_axisgroup_zoom_end(axisgroup_Ptr axisgroup_hdl, int* zoom_end) 
     167  { 
     168    *zoom_end = axisgroup_hdl->zoom_end.getValue(); 
     169  } 
     170   
     171   
     172  void cxios_set_axisgroup_zoom_size(axisgroup_Ptr axisgroup_hdl, int zoom_size) 
     173  { 
     174     CTimer::get("XIOS").resume(); 
     175    axisgroup_hdl->zoom_size.setValue(zoom_size); 
     176    axisgroup_hdl->sendAttributToServer(axisgroup_hdl->zoom_size); 
     177     CTimer::get("XIOS").suspend(); 
     178  } 
     179   
     180  void cxios_get_axisgroup_zoom_size(axisgroup_Ptr axisgroup_hdl, int* zoom_size) 
     181  { 
     182    *zoom_size = axisgroup_hdl->zoom_size.getValue(); 
    142183  } 
    143184   
  • XIOS/trunk/src/interface/c_attr/iccontext_attr.cpp

    r352 r369  
    1111#include "icutil.hpp" 
    1212#include "timer.hpp" 
    13 #include "context.hpp" 
     13#include "node_type.hpp" 
    1414 
    1515extern "C" 
  • XIOS/trunk/src/interface/c_attr/icdomain_attr.cpp

    r352 r369  
    1111#include "icutil.hpp" 
    1212#include "timer.hpp" 
    13 #include "domain.hpp" 
     13#include "node_type.hpp" 
    1414 
    1515extern "C" 
     
    3333  void cxios_set_domain_data_i_index(domain_Ptr domain_hdl, int* data_i_index, int extent1) 
    3434  { 
    35      CTimer::get("XIOS").resume(); 
    36     ARRAY(int,1) array_tmp(new CArray<int,1>(boost::extents[extent1])); 
    37     std::copy(data_i_index, &(data_i_index[array_tmp->num_elements()]), array_tmp->data()); 
    38     domain_hdl->data_i_index.setValue(array_tmp); 
     35    CTimer::get("XIOS").resume(); 
     36    CArray<int,1> tmp(data_i_index,shape(extent1),neverDeleteData) ; 
     37    domain_hdl->data_i_index.reference(tmp.copy()); 
    3938    domain_hdl->sendAttributToServer(domain_hdl->data_i_index); 
    4039  } 
     
    4241  void cxios_get_domain_data_i_index(domain_Ptr domain_hdl, int* data_i_index, int extent1) 
    4342  { 
    44     if (!array_copy(domain_hdl->data_i_index.getValue(), data_i_index, extent1)) 
    45      ERROR("void cxios_set_domain_data_i_index(domain_Ptr domain_hdl, int* data_i_index, int extent1)",<<"Output array size is not conform to array size attribute") ; 
     43    CArray<int,1> tmp(data_i_index,shape(extent1),neverDeleteData) ; 
     44    tmp=domain_hdl->data_i_index ; 
    4645     CTimer::get("XIOS").suspend(); 
    4746  } 
     
    6463  void cxios_set_domain_data_j_index(domain_Ptr domain_hdl, int* data_j_index, int extent1) 
    6564  { 
    66      CTimer::get("XIOS").resume(); 
    67     ARRAY(int,1) array_tmp(new CArray<int,1>(boost::extents[extent1])); 
    68     std::copy(data_j_index, &(data_j_index[array_tmp->num_elements()]), array_tmp->data()); 
    69     domain_hdl->data_j_index.setValue(array_tmp); 
     65    CTimer::get("XIOS").resume(); 
     66    CArray<int,1> tmp(data_j_index,shape(extent1),neverDeleteData) ; 
     67    domain_hdl->data_j_index.reference(tmp.copy()); 
    7068    domain_hdl->sendAttributToServer(domain_hdl->data_j_index); 
    7169  } 
     
    7371  void cxios_get_domain_data_j_index(domain_Ptr domain_hdl, int* data_j_index, int extent1) 
    7472  { 
    75     if (!array_copy(domain_hdl->data_j_index.getValue(), data_j_index, extent1)) 
    76      ERROR("void cxios_set_domain_data_j_index(domain_Ptr domain_hdl, int* data_j_index, int extent1)",<<"Output array size is not conform to array size attribute") ; 
     73    CArray<int,1> tmp(data_j_index,shape(extent1),neverDeleteData) ; 
     74    tmp=domain_hdl->data_j_index ; 
    7775     CTimer::get("XIOS").suspend(); 
    7876  } 
     
    212210  void cxios_set_domain_latvalue(domain_Ptr domain_hdl, double* latvalue, int extent1) 
    213211  { 
    214      CTimer::get("XIOS").resume(); 
    215     ARRAY(double,1) array_tmp(new CArray<double,1>(boost::extents[extent1])); 
    216     std::copy(latvalue, &(latvalue[array_tmp->num_elements()]), array_tmp->data()); 
    217     domain_hdl->latvalue.setValue(array_tmp); 
     212    CTimer::get("XIOS").resume(); 
     213    CArray<double,1> tmp(latvalue,shape(extent1),neverDeleteData) ; 
     214    domain_hdl->latvalue.reference(tmp.copy()); 
    218215    domain_hdl->sendAttributToServer(domain_hdl->latvalue); 
    219216  } 
     
    221218  void cxios_get_domain_latvalue(domain_Ptr domain_hdl, double* latvalue, int extent1) 
    222219  { 
    223     if (!array_copy(domain_hdl->latvalue.getValue(), latvalue, extent1)) 
    224      ERROR("void cxios_set_domain_latvalue(domain_Ptr domain_hdl, double* latvalue, int extent1)",<<"Output array size is not conform to array size attribute") ; 
     220    CArray<double,1> tmp(latvalue,shape(extent1),neverDeleteData) ; 
     221    tmp=domain_hdl->latvalue ; 
    225222     CTimer::get("XIOS").suspend(); 
    226223  } 
     
    248245  void cxios_set_domain_lonvalue(domain_Ptr domain_hdl, double* lonvalue, int extent1) 
    249246  { 
    250      CTimer::get("XIOS").resume(); 
    251     ARRAY(double,1) array_tmp(new CArray<double,1>(boost::extents[extent1])); 
    252     std::copy(lonvalue, &(lonvalue[array_tmp->num_elements()]), array_tmp->data()); 
    253     domain_hdl->lonvalue.setValue(array_tmp); 
     247    CTimer::get("XIOS").resume(); 
     248    CArray<double,1> tmp(lonvalue,shape(extent1),neverDeleteData) ; 
     249    domain_hdl->lonvalue.reference(tmp.copy()); 
    254250    domain_hdl->sendAttributToServer(domain_hdl->lonvalue); 
    255251  } 
     
    257253  void cxios_get_domain_lonvalue(domain_Ptr domain_hdl, double* lonvalue, int extent1) 
    258254  { 
    259     if (!array_copy(domain_hdl->lonvalue.getValue(), lonvalue, extent1)) 
    260      ERROR("void cxios_set_domain_lonvalue(domain_Ptr domain_hdl, double* lonvalue, int extent1)",<<"Output array size is not conform to array size attribute") ; 
     255    CArray<double,1> tmp(lonvalue,shape(extent1),neverDeleteData) ; 
     256    tmp=domain_hdl->lonvalue ; 
    261257     CTimer::get("XIOS").suspend(); 
    262258  } 
     
    265261  void cxios_set_domain_mask(domain_Ptr domain_hdl, bool* mask, int extent1, int extent2) 
    266262  { 
    267      CTimer::get("XIOS").resume(); 
    268     ARRAY(bool,2) array_tmp(new CArray<bool,2>(boost::extents[extent1][extent2])); 
    269     std::copy(mask, &(mask[array_tmp->num_elements()]), array_tmp->data()); 
    270     domain_hdl->mask.setValue(array_tmp); 
     263    CTimer::get("XIOS").resume(); 
     264    CArray<bool,2> tmp(mask,shape(extent1,extent2),neverDeleteData) ; 
     265    domain_hdl->mask.reference(tmp.copy()); 
    271266    domain_hdl->sendAttributToServer(domain_hdl->mask); 
    272267  } 
     
    274269  void cxios_get_domain_mask(domain_Ptr domain_hdl, bool* mask, int extent1, int extent2) 
    275270  { 
    276     if (!array_copy(domain_hdl->mask.getValue(), mask, extent1, extent2)) 
    277      ERROR("void cxios_set_domain_mask(domain_Ptr domain_hdl, bool* mask, int extent1, int extent2)",<<"Output array size is not conform to array size attribute") ; 
     271    CArray<bool,2> tmp(mask,shape(extent1,extent2),neverDeleteData) ; 
     272    tmp=domain_hdl->mask ; 
    278273     CTimer::get("XIOS").suspend(); 
    279274  } 
  • XIOS/trunk/src/interface/c_attr/icdomaingroup_attr.cpp

    r352 r369  
    1111#include "icutil.hpp" 
    1212#include "timer.hpp" 
    13 #include "domain.hpp" 
     13#include "node_type.hpp" 
    1414 
    1515extern "C" 
     
    3333  void cxios_set_domaingroup_data_i_index(domaingroup_Ptr domaingroup_hdl, int* data_i_index, int extent1) 
    3434  { 
    35      CTimer::get("XIOS").resume(); 
    36     ARRAY(int,1) array_tmp(new CArray<int,1>(boost::extents[extent1])); 
    37     std::copy(data_i_index, &(data_i_index[array_tmp->num_elements()]), array_tmp->data()); 
    38     domaingroup_hdl->data_i_index.setValue(array_tmp); 
     35    CTimer::get("XIOS").resume(); 
     36    CArray<int,1> tmp(data_i_index,shape(extent1),neverDeleteData) ; 
     37    domaingroup_hdl->data_i_index.reference(tmp.copy()); 
    3938    domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_i_index); 
    4039  } 
     
    4241  void cxios_get_domaingroup_data_i_index(domaingroup_Ptr domaingroup_hdl, int* data_i_index, int extent1) 
    4342  { 
    44     if (!array_copy(domaingroup_hdl->data_i_index.getValue(), data_i_index, extent1)) 
    45      ERROR("void cxios_set_domaingroup_data_i_index(domaingroup_Ptr domaingroup_hdl, int* data_i_index, int extent1)",<<"Output array size is not conform to array size attribute") ; 
     43    CArray<int,1> tmp(data_i_index,shape(extent1),neverDeleteData) ; 
     44    tmp=domaingroup_hdl->data_i_index ; 
    4645     CTimer::get("XIOS").suspend(); 
    4746  } 
     
    6463  void cxios_set_domaingroup_data_j_index(domaingroup_Ptr domaingroup_hdl, int* data_j_index, int extent1) 
    6564  { 
    66      CTimer::get("XIOS").resume(); 
    67     ARRAY(int,1) array_tmp(new CArray<int,1>(boost::extents[extent1])); 
    68     std::copy(data_j_index, &(data_j_index[array_tmp->num_elements()]), array_tmp->data()); 
    69     domaingroup_hdl->data_j_index.setValue(array_tmp); 
     65    CTimer::get("XIOS").resume(); 
     66    CArray<int,1> tmp(data_j_index,shape(extent1),neverDeleteData) ; 
     67    domaingroup_hdl->data_j_index.reference(tmp.copy()); 
    7068    domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_j_index); 
    7169  } 
     
    7371  void cxios_get_domaingroup_data_j_index(domaingroup_Ptr domaingroup_hdl, int* data_j_index, int extent1) 
    7472  { 
    75     if (!array_copy(domaingroup_hdl->data_j_index.getValue(), data_j_index, extent1)) 
    76      ERROR("void cxios_set_domaingroup_data_j_index(domaingroup_Ptr domaingroup_hdl, int* data_j_index, int extent1)",<<"Output array size is not conform to array size attribute") ; 
     73    CArray<int,1> tmp(data_j_index,shape(extent1),neverDeleteData) ; 
     74    tmp=domaingroup_hdl->data_j_index ; 
    7775     CTimer::get("XIOS").suspend(); 
    7876  } 
     
    231229  void cxios_set_domaingroup_latvalue(domaingroup_Ptr domaingroup_hdl, double* latvalue, int extent1) 
    232230  { 
    233      CTimer::get("XIOS").resume(); 
    234     ARRAY(double,1) array_tmp(new CArray<double,1>(boost::extents[extent1])); 
    235     std::copy(latvalue, &(latvalue[array_tmp->num_elements()]), array_tmp->data()); 
    236     domaingroup_hdl->latvalue.setValue(array_tmp); 
     231    CTimer::get("XIOS").resume(); 
     232    CArray<double,1> tmp(latvalue,shape(extent1),neverDeleteData) ; 
     233    domaingroup_hdl->latvalue.reference(tmp.copy()); 
    237234    domaingroup_hdl->sendAttributToServer(domaingroup_hdl->latvalue); 
    238235  } 
     
    240237  void cxios_get_domaingroup_latvalue(domaingroup_Ptr domaingroup_hdl, double* latvalue, int extent1) 
    241238  { 
    242     if (!array_copy(domaingroup_hdl->latvalue.getValue(), latvalue, extent1)) 
    243      ERROR("void cxios_set_domaingroup_latvalue(domaingroup_Ptr domaingroup_hdl, double* latvalue, int extent1)",<<"Output array size is not conform to array size attribute") ; 
     239    CArray<double,1> tmp(latvalue,shape(extent1),neverDeleteData) ; 
     240    tmp=domaingroup_hdl->latvalue ; 
    244241     CTimer::get("XIOS").suspend(); 
    245242  } 
     
    267264  void cxios_set_domaingroup_lonvalue(domaingroup_Ptr domaingroup_hdl, double* lonvalue, int extent1) 
    268265  { 
    269      CTimer::get("XIOS").resume(); 
    270     ARRAY(double,1) array_tmp(new CArray<double,1>(boost::extents[extent1])); 
    271     std::copy(lonvalue, &(lonvalue[array_tmp->num_elements()]), array_tmp->data()); 
    272     domaingroup_hdl->lonvalue.setValue(array_tmp); 
     266    CTimer::get("XIOS").resume(); 
     267    CArray<double,1> tmp(lonvalue,shape(extent1),neverDeleteData) ; 
     268    domaingroup_hdl->lonvalue.reference(tmp.copy()); 
    273269    domaingroup_hdl->sendAttributToServer(domaingroup_hdl->lonvalue); 
    274270  } 
     
    276272  void cxios_get_domaingroup_lonvalue(domaingroup_Ptr domaingroup_hdl, double* lonvalue, int extent1) 
    277273  { 
    278     if (!array_copy(domaingroup_hdl->lonvalue.getValue(), lonvalue, extent1)) 
    279      ERROR("void cxios_set_domaingroup_lonvalue(domaingroup_Ptr domaingroup_hdl, double* lonvalue, int extent1)",<<"Output array size is not conform to array size attribute") ; 
     274    CArray<double,1> tmp(lonvalue,shape(extent1),neverDeleteData) ; 
     275    tmp=domaingroup_hdl->lonvalue ; 
    280276     CTimer::get("XIOS").suspend(); 
    281277  } 
     
    284280  void cxios_set_domaingroup_mask(domaingroup_Ptr domaingroup_hdl, bool* mask, int extent1, int extent2) 
    285281  { 
    286      CTimer::get("XIOS").resume(); 
    287     ARRAY(bool,2) array_tmp(new CArray<bool,2>(boost::extents[extent1][extent2])); 
    288     std::copy(mask, &(mask[array_tmp->num_elements()]), array_tmp->data()); 
    289     domaingroup_hdl->mask.setValue(array_tmp); 
     282    CTimer::get("XIOS").resume(); 
     283    CArray<bool,2> tmp(mask,shape(extent1,extent2),neverDeleteData) ; 
     284    domaingroup_hdl->mask.reference(tmp.copy()); 
    290285    domaingroup_hdl->sendAttributToServer(domaingroup_hdl->mask); 
    291286  } 
     
    293288  void cxios_get_domaingroup_mask(domaingroup_Ptr domaingroup_hdl, bool* mask, int extent1, int extent2) 
    294289  { 
    295     if (!array_copy(domaingroup_hdl->mask.getValue(), mask, extent1, extent2)) 
    296      ERROR("void cxios_set_domaingroup_mask(domaingroup_Ptr domaingroup_hdl, bool* mask, int extent1, int extent2)",<<"Output array size is not conform to array size attribute") ; 
     290    CArray<bool,2> tmp(mask,shape(extent1,extent2),neverDeleteData) ; 
     291    tmp=domaingroup_hdl->mask ; 
    297292     CTimer::get("XIOS").suspend(); 
    298293  } 
  • XIOS/trunk/src/interface/c_attr/icfield_attr.cpp

    r352 r369  
    1111#include "icutil.hpp" 
    1212#include "timer.hpp" 
    13 #include "field.hpp" 
     13#include "node_type.hpp" 
    1414 
    1515extern "C" 
  • XIOS/trunk/src/interface/c_attr/icfieldgroup_attr.cpp

    r352 r369  
    1111#include "icutil.hpp" 
    1212#include "timer.hpp" 
    13 #include "field.hpp" 
     13#include "node_type.hpp" 
    1414 
    1515extern "C" 
  • XIOS/trunk/src/interface/c_attr/icfile_attr.cpp

    r352 r369  
    1111#include "icutil.hpp" 
    1212#include "timer.hpp" 
    13 #include "file.hpp" 
     13#include "node_type.hpp" 
    1414 
    1515extern "C" 
     
    183183    if(!cstr2string(type, type_size, type_str)) return; 
    184184     CTimer::get("XIOS").resume(); 
    185     file_hdl->type.setValue(type_str); 
     185    file_hdl->type.fromString(type_str); 
    186186    file_hdl->sendAttributToServer(file_hdl->type); 
    187187     CTimer::get("XIOS").suspend(); 
     
    191191  { 
    192192     CTimer::get("XIOS").resume(); 
    193     if(!string_copy(file_hdl->type.getValue(),type , type_size)) 
     193    if(!string_copy(file_hdl->type.getStringValue(),type , type_size)) 
    194194      ERROR("void cxios_get_file_type(file_Ptr file_hdl, char * type, int type_size)", <<"Input string is to short"); 
    195195     CTimer::get("XIOS").suspend(); 
  • XIOS/trunk/src/interface/c_attr/icfilegroup_attr.cpp

    r352 r369  
    1111#include "icutil.hpp" 
    1212#include "timer.hpp" 
    13 #include "file.hpp" 
     13#include "node_type.hpp" 
    1414 
    1515extern "C" 
     
    202202    if(!cstr2string(type, type_size, type_str)) return; 
    203203     CTimer::get("XIOS").resume(); 
    204     filegroup_hdl->type.setValue(type_str); 
     204    filegroup_hdl->type.fromString(type_str); 
    205205    filegroup_hdl->sendAttributToServer(filegroup_hdl->type); 
    206206     CTimer::get("XIOS").suspend(); 
     
    210210  { 
    211211     CTimer::get("XIOS").resume(); 
    212     if(!string_copy(filegroup_hdl->type.getValue(),type , type_size)) 
     212    if(!string_copy(filegroup_hdl->type.getStringValue(),type , type_size)) 
    213213      ERROR("void cxios_get_filegroup_type(filegroup_Ptr filegroup_hdl, char * type, int type_size)", <<"Input string is to short"); 
    214214     CTimer::get("XIOS").suspend(); 
  • XIOS/trunk/src/interface/c_attr/icgrid_attr.cpp

    r352 r369  
    1111#include "icutil.hpp" 
    1212#include "timer.hpp" 
    13 #include "grid.hpp" 
     13#include "node_type.hpp" 
    1414 
    1515extern "C" 
  • XIOS/trunk/src/interface/c_attr/icgridgroup_attr.cpp

    r352 r369  
    1111#include "icutil.hpp" 
    1212#include "timer.hpp" 
    13 #include "grid.hpp" 
     13#include "node_type.hpp" 
    1414 
    1515extern "C" 
  • XIOS/trunk/src/interface/fortran_attr/axis_interface_attr.f90

    r326 r369  
    9797     
    9898     
     99    SUBROUTINE cxios_set_axis_zoom_begin(axis_hdl, zoom_begin) BIND(C) 
     100      USE ISO_C_BINDING 
     101      INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl 
     102      INTEGER (KIND=C_INT)      , VALUE :: zoom_begin 
     103    END SUBROUTINE cxios_set_axis_zoom_begin 
     104     
     105    SUBROUTINE cxios_get_axis_zoom_begin(axis_hdl, zoom_begin) BIND(C) 
     106      USE ISO_C_BINDING 
     107      INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl 
     108      INTEGER (KIND=C_INT)             :: zoom_begin 
     109    END SUBROUTINE cxios_get_axis_zoom_begin 
     110     
     111     
     112    SUBROUTINE cxios_set_axis_zoom_end(axis_hdl, zoom_end) BIND(C) 
     113      USE ISO_C_BINDING 
     114      INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl 
     115      INTEGER (KIND=C_INT)      , VALUE :: zoom_end 
     116    END SUBROUTINE cxios_set_axis_zoom_end 
     117     
     118    SUBROUTINE cxios_get_axis_zoom_end(axis_hdl, zoom_end) BIND(C) 
     119      USE ISO_C_BINDING 
     120      INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl 
     121      INTEGER (KIND=C_INT)             :: zoom_end 
     122    END SUBROUTINE cxios_get_axis_zoom_end 
     123     
     124     
     125    SUBROUTINE cxios_set_axis_zoom_size(axis_hdl, zoom_size) BIND(C) 
     126      USE ISO_C_BINDING 
     127      INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl 
     128      INTEGER (KIND=C_INT)      , VALUE :: zoom_size 
     129    END SUBROUTINE cxios_set_axis_zoom_size 
     130     
     131    SUBROUTINE cxios_get_axis_zoom_size(axis_hdl, zoom_size) BIND(C) 
     132      USE ISO_C_BINDING 
     133      INTEGER (kind = C_INTPTR_T), VALUE :: axis_hdl 
     134      INTEGER (KIND=C_INT)             :: zoom_size 
     135    END SUBROUTINE cxios_get_axis_zoom_size 
     136     
     137     
    99138    END INTERFACE 
    100139   
  • XIOS/trunk/src/interface/fortran_attr/axisgroup_interface_attr.f90

    r326 r369  
    112112     
    113113     
     114    SUBROUTINE cxios_set_axisgroup_zoom_begin(axisgroup_hdl, zoom_begin) BIND(C) 
     115      USE ISO_C_BINDING 
     116      INTEGER (kind = C_INTPTR_T), VALUE :: axisgroup_hdl 
     117      INTEGER (KIND=C_INT)      , VALUE :: zoom_begin 
     118    END SUBROUTINE cxios_set_axisgroup_zoom_begin 
     119     
     120    SUBROUTINE cxios_get_axisgroup_zoom_begin(axisgroup_hdl, zoom_begin) BIND(C) 
     121      USE ISO_C_BINDING 
     122      INTEGER (kind = C_INTPTR_T), VALUE :: axisgroup_hdl 
     123      INTEGER (KIND=C_INT)             :: zoom_begin 
     124    END SUBROUTINE cxios_get_axisgroup_zoom_begin 
     125     
     126     
     127    SUBROUTINE cxios_set_axisgroup_zoom_end(axisgroup_hdl, zoom_end) BIND(C) 
     128      USE ISO_C_BINDING 
     129      INTEGER (kind = C_INTPTR_T), VALUE :: axisgroup_hdl 
     130      INTEGER (KIND=C_INT)      , VALUE :: zoom_end 
     131    END SUBROUTINE cxios_set_axisgroup_zoom_end 
     132     
     133    SUBROUTINE cxios_get_axisgroup_zoom_end(axisgroup_hdl, zoom_end) BIND(C) 
     134      USE ISO_C_BINDING 
     135      INTEGER (kind = C_INTPTR_T), VALUE :: axisgroup_hdl 
     136      INTEGER (KIND=C_INT)             :: zoom_end 
     137    END SUBROUTINE cxios_get_axisgroup_zoom_end 
     138     
     139     
     140    SUBROUTINE cxios_set_axisgroup_zoom_size(axisgroup_hdl, zoom_size) BIND(C) 
     141      USE ISO_C_BINDING 
     142      INTEGER (kind = C_INTPTR_T), VALUE :: axisgroup_hdl 
     143      INTEGER (KIND=C_INT)      , VALUE :: zoom_size 
     144    END SUBROUTINE cxios_set_axisgroup_zoom_size 
     145     
     146    SUBROUTINE cxios_get_axisgroup_zoom_size(axisgroup_hdl, zoom_size) BIND(C) 
     147      USE ISO_C_BINDING 
     148      INTEGER (kind = C_INTPTR_T), VALUE :: axisgroup_hdl 
     149      INTEGER (KIND=C_INT)             :: zoom_size 
     150    END SUBROUTINE cxios_get_axisgroup_zoom_size 
     151     
     152     
    114153    END INTERFACE 
    115154   
  • XIOS/trunk/src/interface/fortran_attr/iaxis_attr.F90

    r326 r369  
    1212   
    1313  SUBROUTINE xios(set_axis_attr)  & 
    14     ( axis_id, long_name, name, size, standard_name, unit, value ) 
     14    ( axis_id, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end, zoom_size  & 
     15     ) 
    1516     
    1617    IMPLICIT NONE 
     
    2324      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit 
    2425      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: value(:) 
     26      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_begin 
     27      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_end 
     28      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_size 
    2529       
    2630      CALL xios(get_axis_handle)(axis_id,axis_hdl) 
    2731      CALL xios(set_axis_attr_hdl_)   & 
    28       ( axis_hdl, long_name, name, size, standard_name, unit, value ) 
     32      ( axis_hdl, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end, zoom_size  & 
     33       ) 
    2934     
    3035  END SUBROUTINE xios(set_axis_attr) 
    3136   
    3237  SUBROUTINE xios(set_axis_attr_hdl)  & 
    33     ( axis_hdl, long_name, name, size, standard_name, unit, value ) 
     38    ( axis_hdl, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end, zoom_size  & 
     39     ) 
    3440     
    3541    IMPLICIT NONE 
     
    4147      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit 
    4248      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: value(:) 
     49      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_begin 
     50      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_end 
     51      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_size 
    4352       
    4453      CALL xios(set_axis_attr_hdl_)  & 
    45       ( axis_hdl, long_name, name, size, standard_name, unit, value ) 
     54      ( axis_hdl, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end, zoom_size  & 
     55       ) 
    4656     
    4757  END SUBROUTINE xios(set_axis_attr_hdl) 
    4858   
    4959  SUBROUTINE xios(set_axis_attr_hdl_)   & 
    50     ( axis_hdl, long_name_, name_, size_, standard_name_, unit_, value_ ) 
     60    ( axis_hdl, long_name_, name_, size_, standard_name_, unit_, value_, zoom_begin_, zoom_end_  & 
     61    , zoom_size_ ) 
    5162     
    5263    IMPLICIT NONE 
     
    5869      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit_ 
    5970      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: value_(:) 
     71      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_begin_ 
     72      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_end_ 
     73      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_size_ 
    6074       
    6175      IF (PRESENT(long_name_)) THEN 
     
    8397      ENDIF 
    8498       
     99      IF (PRESENT(zoom_begin_)) THEN 
     100        CALL cxios_set_axis_zoom_begin(axis_hdl%daddr, zoom_begin_) 
     101      ENDIF 
     102       
     103      IF (PRESENT(zoom_end_)) THEN 
     104        CALL cxios_set_axis_zoom_end(axis_hdl%daddr, zoom_end_) 
     105      ENDIF 
     106       
     107      IF (PRESENT(zoom_size_)) THEN 
     108        CALL cxios_set_axis_zoom_size(axis_hdl%daddr, zoom_size_) 
     109      ENDIF 
     110       
    85111       
    86112     
     
    88114   
    89115  SUBROUTINE xios(get_axis_attr)  & 
    90     ( axis_id, long_name, name, size, standard_name, unit, value ) 
     116    ( axis_id, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end, zoom_size  & 
     117     ) 
    91118     
    92119    IMPLICIT NONE 
     
    99126      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit 
    100127      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: value(:) 
     128      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_begin 
     129      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_end 
     130      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_size 
    101131       
    102132      CALL xios(get_axis_handle)(axis_id,axis_hdl) 
    103133      CALL xios(get_axis_attr_hdl_)   & 
    104       ( axis_hdl, long_name, name, size, standard_name, unit, value ) 
     134      ( axis_hdl, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end, zoom_size  & 
     135       ) 
    105136     
    106137  END SUBROUTINE xios(get_axis_attr) 
    107138   
    108139  SUBROUTINE xios(get_axis_attr_hdl)  & 
    109     ( axis_hdl, long_name, name, size, standard_name, unit, value ) 
     140    ( axis_hdl, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end, zoom_size  & 
     141     ) 
    110142     
    111143    IMPLICIT NONE 
     
    117149      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit 
    118150      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: value(:) 
     151      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_begin 
     152      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_end 
     153      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_size 
    119154       
    120155      CALL xios(get_axis_attr_hdl_)  & 
    121       ( axis_hdl, long_name, name, size, standard_name, unit, value ) 
     156      ( axis_hdl, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end, zoom_size  & 
     157       ) 
    122158     
    123159  END SUBROUTINE xios(get_axis_attr_hdl) 
    124160   
    125161  SUBROUTINE xios(get_axis_attr_hdl_)   & 
    126     ( axis_hdl, long_name_, name_, size_, standard_name_, unit_, value_ ) 
     162    ( axis_hdl, long_name_, name_, size_, standard_name_, unit_, value_, zoom_begin_, zoom_end_  & 
     163    , zoom_size_ ) 
    127164     
    128165    IMPLICIT NONE 
     
    134171      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit_ 
    135172      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: value_(:) 
     173      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_begin_ 
     174      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_end_ 
     175      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_size_ 
    136176       
    137177      IF (PRESENT(long_name_)) THEN 
     
    159199      ENDIF 
    160200       
     201      IF (PRESENT(zoom_begin_)) THEN 
     202        CALL cxios_get_axis_zoom_begin(axis_hdl%daddr, zoom_begin_) 
     203      ENDIF 
     204       
     205      IF (PRESENT(zoom_end_)) THEN 
     206        CALL cxios_get_axis_zoom_end(axis_hdl%daddr, zoom_end_) 
     207      ENDIF 
     208       
     209      IF (PRESENT(zoom_size_)) THEN 
     210        CALL cxios_get_axis_zoom_size(axis_hdl%daddr, zoom_size_) 
     211      ENDIF 
     212       
    161213       
    162214     
  • XIOS/trunk/src/interface/fortran_attr/iaxisgroup_attr.F90

    r326 r369  
    1212   
    1313  SUBROUTINE xios(set_axisgroup_attr)  & 
    14     ( axisgroup_id, group_ref, long_name, name, size, standard_name, unit, value ) 
     14    ( axisgroup_id, group_ref, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end  & 
     15    , zoom_size ) 
    1516     
    1617    IMPLICIT NONE 
     
    2425      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit 
    2526      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: value(:) 
     27      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_begin 
     28      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_end 
     29      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_size 
    2630       
    2731      CALL xios(get_axisgroup_handle)(axisgroup_id,axisgroup_hdl) 
    2832      CALL xios(set_axisgroup_attr_hdl_)   & 
    29       ( axisgroup_hdl, group_ref, long_name, name, size, standard_name, unit, value ) 
     33      ( axisgroup_hdl, group_ref, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end  & 
     34      , zoom_size ) 
    3035     
    3136  END SUBROUTINE xios(set_axisgroup_attr) 
    3237   
    3338  SUBROUTINE xios(set_axisgroup_attr_hdl)  & 
    34     ( axisgroup_hdl, group_ref, long_name, name, size, standard_name, unit, value ) 
     39    ( axisgroup_hdl, group_ref, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end  & 
     40    , zoom_size ) 
    3541     
    3642    IMPLICIT NONE 
     
    4349      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit 
    4450      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: value(:) 
     51      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_begin 
     52      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_end 
     53      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_size 
    4554       
    4655      CALL xios(set_axisgroup_attr_hdl_)  & 
    47       ( axisgroup_hdl, group_ref, long_name, name, size, standard_name, unit, value ) 
     56      ( axisgroup_hdl, group_ref, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end  & 
     57      , zoom_size ) 
    4858     
    4959  END SUBROUTINE xios(set_axisgroup_attr_hdl) 
    5060   
    5161  SUBROUTINE xios(set_axisgroup_attr_hdl_)   & 
    52     ( axisgroup_hdl, group_ref_, long_name_, name_, size_, standard_name_, unit_, value_ ) 
     62    ( axisgroup_hdl, group_ref_, long_name_, name_, size_, standard_name_, unit_, value_, zoom_begin_  & 
     63    , zoom_end_, zoom_size_ ) 
    5364     
    5465    IMPLICIT NONE 
     
    6172      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit_ 
    6273      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: value_(:) 
     74      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_begin_ 
     75      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_end_ 
     76      INTEGER  , OPTIONAL, INTENT(IN) :: zoom_size_ 
    6377       
    6478      IF (PRESENT(group_ref_)) THEN 
     
    90104      ENDIF 
    91105       
     106      IF (PRESENT(zoom_begin_)) THEN 
     107        CALL cxios_set_axisgroup_zoom_begin(axisgroup_hdl%daddr, zoom_begin_) 
     108      ENDIF 
     109       
     110      IF (PRESENT(zoom_end_)) THEN 
     111        CALL cxios_set_axisgroup_zoom_end(axisgroup_hdl%daddr, zoom_end_) 
     112      ENDIF 
     113       
     114      IF (PRESENT(zoom_size_)) THEN 
     115        CALL cxios_set_axisgroup_zoom_size(axisgroup_hdl%daddr, zoom_size_) 
     116      ENDIF 
     117       
    92118       
    93119     
     
    95121   
    96122  SUBROUTINE xios(get_axisgroup_attr)  & 
    97     ( axisgroup_id, group_ref, long_name, name, size, standard_name, unit, value ) 
     123    ( axisgroup_id, group_ref, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end  & 
     124    , zoom_size ) 
    98125     
    99126    IMPLICIT NONE 
     
    107134      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit 
    108135      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: value(:) 
     136      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_begin 
     137      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_end 
     138      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_size 
    109139       
    110140      CALL xios(get_axisgroup_handle)(axisgroup_id,axisgroup_hdl) 
    111141      CALL xios(get_axisgroup_attr_hdl_)   & 
    112       ( axisgroup_hdl, group_ref, long_name, name, size, standard_name, unit, value ) 
     142      ( axisgroup_hdl, group_ref, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end  & 
     143      , zoom_size ) 
    113144     
    114145  END SUBROUTINE xios(get_axisgroup_attr) 
    115146   
    116147  SUBROUTINE xios(get_axisgroup_attr_hdl)  & 
    117     ( axisgroup_hdl, group_ref, long_name, name, size, standard_name, unit, value ) 
     148    ( axisgroup_hdl, group_ref, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end  & 
     149    , zoom_size ) 
    118150     
    119151    IMPLICIT NONE 
     
    126158      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit 
    127159      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: value(:) 
     160      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_begin 
     161      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_end 
     162      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_size 
    128163       
    129164      CALL xios(get_axisgroup_attr_hdl_)  & 
    130       ( axisgroup_hdl, group_ref, long_name, name, size, standard_name, unit, value ) 
     165      ( axisgroup_hdl, group_ref, long_name, name, size, standard_name, unit, value, zoom_begin, zoom_end  & 
     166      , zoom_size ) 
    131167     
    132168  END SUBROUTINE xios(get_axisgroup_attr_hdl) 
    133169   
    134170  SUBROUTINE xios(get_axisgroup_attr_hdl_)   & 
    135     ( axisgroup_hdl, group_ref_, long_name_, name_, size_, standard_name_, unit_, value_ ) 
     171    ( axisgroup_hdl, group_ref_, long_name_, name_, size_, standard_name_, unit_, value_, zoom_begin_  & 
     172    , zoom_end_, zoom_size_ ) 
    136173     
    137174    IMPLICIT NONE 
     
    144181      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit_ 
    145182      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: value_(:) 
     183      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_begin_ 
     184      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_end_ 
     185      INTEGER  , OPTIONAL, INTENT(OUT) :: zoom_size_ 
    146186       
    147187      IF (PRESENT(group_ref_)) THEN 
     
    173213      ENDIF 
    174214       
     215      IF (PRESENT(zoom_begin_)) THEN 
     216        CALL cxios_get_axisgroup_zoom_begin(axisgroup_hdl%daddr, zoom_begin_) 
     217      ENDIF 
     218       
     219      IF (PRESENT(zoom_end_)) THEN 
     220        CALL cxios_get_axisgroup_zoom_end(axisgroup_hdl%daddr, zoom_end_) 
     221      ENDIF 
     222       
     223      IF (PRESENT(zoom_size_)) THEN 
     224        CALL cxios_get_axisgroup_zoom_size(axisgroup_hdl%daddr, zoom_size_) 
     225      ENDIF 
     226       
    175227       
    176228     
  • XIOS/trunk/src/interface/fortran_attr/icontext_attr.F90

    r326 r369  
    1212   
    1313  SUBROUTINE xios(set_context_attr)  & 
    14     ( context_id, calendar_type, output_dir, start_date, timestep ) 
     14    ( context_id, calendar_type, output_dir, start_date, time_origin, timestep ) 
    1515     
    1616    IMPLICIT NONE 
     
    2020      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir 
    2121      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date 
     22      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin 
    2223      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: timestep 
    2324       
    2425      CALL xios(get_context_handle)(context_id,context_hdl) 
    2526      CALL xios(set_context_attr_hdl_)   & 
    26       ( context_hdl, calendar_type, output_dir, start_date, timestep ) 
     27      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep ) 
    2728     
    2829  END SUBROUTINE xios(set_context_attr) 
    2930   
    3031  SUBROUTINE xios(set_context_attr_hdl)  & 
    31     ( context_hdl, calendar_type, output_dir, start_date, timestep ) 
     32    ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep ) 
    3233     
    3334    IMPLICIT NONE 
     
    3637      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir 
    3738      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date 
     39      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin 
    3840      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: timestep 
    3941       
    4042      CALL xios(set_context_attr_hdl_)  & 
    41       ( context_hdl, calendar_type, output_dir, start_date, timestep ) 
     43      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep ) 
    4244     
    4345  END SUBROUTINE xios(set_context_attr_hdl) 
    4446   
    4547  SUBROUTINE xios(set_context_attr_hdl_)   & 
    46     ( context_hdl, calendar_type_, output_dir_, start_date_, timestep_ ) 
     48    ( context_hdl, calendar_type_, output_dir_, start_date_, time_origin_, timestep_ ) 
    4749     
    4850    IMPLICIT NONE 
     
    5153      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir_ 
    5254      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date_ 
     55      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin_ 
    5356      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: timestep_ 
    5457       
     
    6568      ENDIF 
    6669       
     70      IF (PRESENT(time_origin_)) THEN 
     71        CALL cxios_set_context_time_origin(context_hdl%daddr, time_origin_, len(time_origin_)) 
     72      ENDIF 
     73       
    6774      IF (PRESENT(timestep_)) THEN 
    6875        CALL cxios_set_context_timestep(context_hdl%daddr, timestep_, len(timestep_)) 
     
    7481   
    7582  SUBROUTINE xios(get_context_attr)  & 
    76     ( context_id, calendar_type, output_dir, start_date, timestep ) 
     83    ( context_id, calendar_type, output_dir, start_date, time_origin, timestep ) 
    7784     
    7885    IMPLICIT NONE 
     
    8289      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir 
    8390      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date 
     91      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin 
    8492      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: timestep 
    8593       
    8694      CALL xios(get_context_handle)(context_id,context_hdl) 
    8795      CALL xios(get_context_attr_hdl_)   & 
    88       ( context_hdl, calendar_type, output_dir, start_date, timestep ) 
     96      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep ) 
    8997     
    9098  END SUBROUTINE xios(get_context_attr) 
    9199   
    92100  SUBROUTINE xios(get_context_attr_hdl)  & 
    93     ( context_hdl, calendar_type, output_dir, start_date, timestep ) 
     101    ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep ) 
    94102     
    95103    IMPLICIT NONE 
     
    98106      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir 
    99107      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date 
     108      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin 
    100109      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: timestep 
    101110       
    102111      CALL xios(get_context_attr_hdl_)  & 
    103       ( context_hdl, calendar_type, output_dir, start_date, timestep ) 
     112      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep ) 
    104113     
    105114  END SUBROUTINE xios(get_context_attr_hdl) 
    106115   
    107116  SUBROUTINE xios(get_context_attr_hdl_)   & 
    108     ( context_hdl, calendar_type_, output_dir_, start_date_, timestep_ ) 
     117    ( context_hdl, calendar_type_, output_dir_, start_date_, time_origin_, timestep_ ) 
    109118     
    110119    IMPLICIT NONE 
     
    113122      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir_ 
    114123      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date_ 
     124      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin_ 
    115125      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: timestep_ 
    116126       
     
    127137      ENDIF 
    128138       
     139      IF (PRESENT(time_origin_)) THEN 
     140        CALL cxios_get_context_time_origin(context_hdl%daddr, time_origin_, len(time_origin_)) 
     141      ENDIF 
     142       
    129143      IF (PRESENT(timestep_)) THEN 
    130144        CALL cxios_get_context_timestep(context_hdl%daddr, timestep_, len(timestep_)) 
  • XIOS/trunk/src/interface/fortran_attr/ifile_attr.F90

    r326 r369  
    1212   
    1313  SUBROUTINE xios(set_file_attr)  & 
    14     ( file_id, description, enabled, name, name_suffix, output_freq, output_level, split_freq, sync_freq  & 
    15     , type ) 
     14    ( file_id, description, enabled, name, name_suffix, output_freq, output_level, par_access, split_freq  & 
     15    , sync_freq, type ) 
    1616     
    1717    IMPLICIT NONE 
     
    2525      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_freq 
    2626      INTEGER  , OPTIONAL, INTENT(IN) :: output_level 
     27      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: par_access 
    2728      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: split_freq 
    2829      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: sync_freq 
     
    3132      CALL xios(get_file_handle)(file_id,file_hdl) 
    3233      CALL xios(set_file_attr_hdl_)   & 
    33       ( file_hdl, description, enabled, name, name_suffix, output_freq, output_level, split_freq, sync_freq  & 
    34       , type ) 
     34      ( file_hdl, description, enabled, name, name_suffix, output_freq, output_level, par_access, split_freq  & 
     35      , sync_freq, type ) 
    3536     
    3637  END SUBROUTINE xios(set_file_attr) 
    3738   
    3839  SUBROUTINE xios(set_file_attr_hdl)  & 
    39     ( file_hdl, description, enabled, name, name_suffix, output_freq, output_level, split_freq, sync_freq  & 
    40     , type ) 
     40    ( file_hdl, description, enabled, name, name_suffix, output_freq, output_level, par_access, split_freq  & 
     41    , sync_freq, type ) 
    4142     
    4243    IMPLICIT NONE 
     
    4950      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_freq 
    5051      INTEGER  , OPTIONAL, INTENT(IN) :: output_level 
     52      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: par_access 
    5153      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: split_freq 
    5254      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: sync_freq 
     
    5456       
    5557      CALL xios(set_file_attr_hdl_)  & 
    56       ( file_hdl, description, enabled, name, name_suffix, output_freq, output_level, split_freq, sync_freq  & 
    57       , type ) 
     58      ( file_hdl, description, enabled, name, name_suffix, output_freq, output_level, par_access, split_freq  & 
     59      , sync_freq, type ) 
    5860     
    5961  END SUBROUTINE xios(set_file_attr_hdl) 
    6062   
    6163  SUBROUTINE xios(set_file_attr_hdl_)   & 
    62     ( file_hdl, description_, enabled_, name_, name_suffix_, output_freq_, output_level_, split_freq_  & 
    63     , sync_freq_, type_ ) 
     64    ( file_hdl, description_, enabled_, name_, name_suffix_, output_freq_, output_level_, par_access_  & 
     65    , split_freq_, sync_freq_, type_ ) 
    6466     
    6567    IMPLICIT NONE 
     
    7274      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_freq_ 
    7375      INTEGER  , OPTIONAL, INTENT(IN) :: output_level_ 
     76      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: par_access_ 
    7477      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: split_freq_ 
    7578      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: sync_freq_ 
     
    101104      ENDIF 
    102105       
     106      IF (PRESENT(par_access_)) THEN 
     107        CALL cxios_set_file_par_access(file_hdl%daddr, par_access_, len(par_access_)) 
     108      ENDIF 
     109       
    103110      IF (PRESENT(split_freq_)) THEN 
    104111        CALL cxios_set_file_split_freq(file_hdl%daddr, split_freq_, len(split_freq_)) 
     
    118125   
    119126  SUBROUTINE xios(get_file_attr)  & 
    120     ( file_id, description, enabled, name, name_suffix, output_freq, output_level, split_freq, sync_freq  & 
    121     , type ) 
     127    ( file_id, description, enabled, name, name_suffix, output_freq, output_level, par_access, split_freq  & 
     128    , sync_freq, type ) 
    122129     
    123130    IMPLICIT NONE 
     
    131138      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_freq 
    132139      INTEGER  , OPTIONAL, INTENT(OUT) :: output_level 
     140      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: par_access 
    133141      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: split_freq 
    134142      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: sync_freq 
     
    137145      CALL xios(get_file_handle)(file_id,file_hdl) 
    138146      CALL xios(get_file_attr_hdl_)   & 
    139       ( file_hdl, description, enabled, name, name_suffix, output_freq, output_level, split_freq, sync_freq  & 
    140       , type ) 
     147      ( file_hdl, description, enabled, name, name_suffix, output_freq, output_level, par_access, split_freq  & 
     148      , sync_freq, type ) 
    141149     
    142150  END SUBROUTINE xios(get_file_attr) 
    143151   
    144152  SUBROUTINE xios(get_file_attr_hdl)  & 
    145     ( file_hdl, description, enabled, name, name_suffix, output_freq, output_level, split_freq, sync_freq  & 
    146     , type ) 
     153    ( file_hdl, description, enabled, name, name_suffix, output_freq, output_level, par_access, split_freq  & 
     154    , sync_freq, type ) 
    147155     
    148156    IMPLICIT NONE 
     
    155163      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_freq 
    156164      INTEGER  , OPTIONAL, INTENT(OUT) :: output_level 
     165      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: par_access 
    157166      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: split_freq 
    158167      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: sync_freq 
     
    160169       
    161170      CALL xios(get_file_attr_hdl_)  & 
    162       ( file_hdl, description, enabled, name, name_suffix, output_freq, output_level, split_freq, sync_freq  & 
    163       , type ) 
     171      ( file_hdl, description, enabled, name, name_suffix, output_freq, output_level, par_access, split_freq  & 
     172      , sync_freq, type ) 
    164173     
    165174  END SUBROUTINE xios(get_file_attr_hdl) 
    166175   
    167176  SUBROUTINE xios(get_file_attr_hdl_)   & 
    168     ( file_hdl, description_, enabled_, name_, name_suffix_, output_freq_, output_level_, split_freq_  & 
    169     , sync_freq_, type_ ) 
     177    ( file_hdl, description_, enabled_, name_, name_suffix_, output_freq_, output_level_, par_access_  & 
     178    , split_freq_, sync_freq_, type_ ) 
    170179     
    171180    IMPLICIT NONE 
     
    178187      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_freq_ 
    179188      INTEGER  , OPTIONAL, INTENT(OUT) :: output_level_ 
     189      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: par_access_ 
    180190      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: split_freq_ 
    181191      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: sync_freq_ 
     
    207217      ENDIF 
    208218       
     219      IF (PRESENT(par_access_)) THEN 
     220        CALL cxios_get_file_par_access(file_hdl%daddr, par_access_, len(par_access_)) 
     221      ENDIF 
     222       
    209223      IF (PRESENT(split_freq_)) THEN 
    210224        CALL cxios_get_file_split_freq(file_hdl%daddr, split_freq_, len(split_freq_)) 
  • XIOS/trunk/src/interface/fortran_attr/ifilegroup_attr.F90

    r326 r369  
    1313  SUBROUTINE xios(set_filegroup_attr)  & 
    1414    ( filegroup_id, description, enabled, group_ref, name, name_suffix, output_freq, output_level  & 
    15     , split_freq, sync_freq, type ) 
     15    , par_access, split_freq, sync_freq, type ) 
    1616     
    1717    IMPLICIT NONE 
     
    2626      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_freq 
    2727      INTEGER  , OPTIONAL, INTENT(IN) :: output_level 
     28      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: par_access 
    2829      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: split_freq 
    2930      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: sync_freq 
     
    3334      CALL xios(set_filegroup_attr_hdl_)   & 
    3435      ( filegroup_hdl, description, enabled, group_ref, name, name_suffix, output_freq, output_level  & 
    35       , split_freq, sync_freq, type ) 
     36      , par_access, split_freq, sync_freq, type ) 
    3637     
    3738  END SUBROUTINE xios(set_filegroup_attr) 
     
    3940  SUBROUTINE xios(set_filegroup_attr_hdl)  & 
    4041    ( filegroup_hdl, description, enabled, group_ref, name, name_suffix, output_freq, output_level  & 
    41     , split_freq, sync_freq, type ) 
     42    , par_access, split_freq, sync_freq, type ) 
    4243     
    4344    IMPLICIT NONE 
     
    5152      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_freq 
    5253      INTEGER  , OPTIONAL, INTENT(IN) :: output_level 
     54      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: par_access 
    5355      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: split_freq 
    5456      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: sync_freq 
     
    5759      CALL xios(set_filegroup_attr_hdl_)  & 
    5860      ( filegroup_hdl, description, enabled, group_ref, name, name_suffix, output_freq, output_level  & 
    59       , split_freq, sync_freq, type ) 
     61      , par_access, split_freq, sync_freq, type ) 
    6062     
    6163  END SUBROUTINE xios(set_filegroup_attr_hdl) 
     
    6365  SUBROUTINE xios(set_filegroup_attr_hdl_)   & 
    6466    ( filegroup_hdl, description_, enabled_, group_ref_, name_, name_suffix_, output_freq_, output_level_  & 
    65     , split_freq_, sync_freq_, type_ ) 
     67    , par_access_, split_freq_, sync_freq_, type_ ) 
    6668     
    6769    IMPLICIT NONE 
     
    7577      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_freq_ 
    7678      INTEGER  , OPTIONAL, INTENT(IN) :: output_level_ 
     79      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: par_access_ 
    7780      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: split_freq_ 
    7881      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: sync_freq_ 
     
    108111      ENDIF 
    109112       
     113      IF (PRESENT(par_access_)) THEN 
     114        CALL cxios_set_filegroup_par_access(filegroup_hdl%daddr, par_access_, len(par_access_)) 
     115      ENDIF 
     116       
    110117      IF (PRESENT(split_freq_)) THEN 
    111118        CALL cxios_set_filegroup_split_freq(filegroup_hdl%daddr, split_freq_, len(split_freq_)) 
     
    126133  SUBROUTINE xios(get_filegroup_attr)  & 
    127134    ( filegroup_id, description, enabled, group_ref, name, name_suffix, output_freq, output_level  & 
    128     , split_freq, sync_freq, type ) 
     135    , par_access, split_freq, sync_freq, type ) 
    129136     
    130137    IMPLICIT NONE 
     
    139146      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_freq 
    140147      INTEGER  , OPTIONAL, INTENT(OUT) :: output_level 
     148      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: par_access 
    141149      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: split_freq 
    142150      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: sync_freq 
     
    146154      CALL xios(get_filegroup_attr_hdl_)   & 
    147155      ( filegroup_hdl, description, enabled, group_ref, name, name_suffix, output_freq, output_level  & 
    148       , split_freq, sync_freq, type ) 
     156      , par_access, split_freq, sync_freq, type ) 
    149157     
    150158  END SUBROUTINE xios(get_filegroup_attr) 
     
    152160  SUBROUTINE xios(get_filegroup_attr_hdl)  & 
    153161    ( filegroup_hdl, description, enabled, group_ref, name, name_suffix, output_freq, output_level  & 
    154     , split_freq, sync_freq, type ) 
     162    , par_access, split_freq, sync_freq, type ) 
    155163     
    156164    IMPLICIT NONE 
     
    164172      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_freq 
    165173      INTEGER  , OPTIONAL, INTENT(OUT) :: output_level 
     174      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: par_access 
    166175      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: split_freq 
    167176      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: sync_freq 
     
    170179      CALL xios(get_filegroup_attr_hdl_)  & 
    171180      ( filegroup_hdl, description, enabled, group_ref, name, name_suffix, output_freq, output_level  & 
    172       , split_freq, sync_freq, type ) 
     181      , par_access, split_freq, sync_freq, type ) 
    173182     
    174183  END SUBROUTINE xios(get_filegroup_attr_hdl) 
     
    176185  SUBROUTINE xios(get_filegroup_attr_hdl_)   & 
    177186    ( filegroup_hdl, description_, enabled_, group_ref_, name_, name_suffix_, output_freq_, output_level_  & 
    178     , split_freq_, sync_freq_, type_ ) 
     187    , par_access_, split_freq_, sync_freq_, type_ ) 
    179188     
    180189    IMPLICIT NONE 
     
    188197      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_freq_ 
    189198      INTEGER  , OPTIONAL, INTENT(OUT) :: output_level_ 
     199      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: par_access_ 
    190200      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: split_freq_ 
    191201      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: sync_freq_ 
     
    221231      ENDIF 
    222232       
     233      IF (PRESENT(par_access_)) THEN 
     234        CALL cxios_get_filegroup_par_access(filegroup_hdl%daddr, par_access_, len(par_access_)) 
     235      ENDIF 
     236       
    223237      IF (PRESENT(split_freq_)) THEN 
    224238        CALL cxios_get_filegroup_split_freq(filegroup_hdl%daddr, split_freq_, len(split_freq_)) 
  • XIOS/trunk/src/log.hpp

    r364 r369  
    33#include <string> 
    44#include <iostream> 
     5#include <string> 
    56 
    67namespace xios 
  • XIOS/trunk/src/node/axis.cpp

    r352 r369  
    7373      this->zoom_size.setValue(zoom_size) ; 
    7474       
    75       StdSize true_size = value.getValue()->num_elements(); 
     75      StdSize true_size = value.numElements(); 
    7676      if (size != true_size) 
    7777         ERROR("CAxis::checkAttributes(void)", 
  • XIOS/trunk/src/node/axis.hpp

    r345 r369  
    77 
    88#include "declare_group.hpp" 
     9#include "attribute_array.hpp" 
    910 
    1011namespace xios { 
  • XIOS/trunk/src/node/context.cpp

    r354 r369  
    176176    
    177177   //---------------------------------------------------------------- 
    178     
     178/* 
    179179   void CContext::toBinary(StdOStream & os) const 
    180180   { 
     
    192192#include "node_type.conf" 
    193193   } 
    194     
    195    //---------------------------------------------------------------- 
    196     
     194*/ 
     195   //---------------------------------------------------------------- 
     196/* 
    197197   void CContext::fromBinary(StdIStream & is) 
    198198   { 
     
    213213       
    214214   } 
    215     
     215 */ 
    216216    
    217217   //---------------------------------------------------------------- 
  • XIOS/trunk/src/node/context.hpp

    r352 r369  
    138138 
    139139         virtual StdString toString(void) const; 
    140          virtual void toBinary  (StdOStream & os) const; 
    141          virtual void fromBinary(StdIStream & is); 
     140//         virtual void toBinary  (StdOStream & os) const; 
     141//         virtual void fromBinary(StdIStream & is); 
    142142          
    143143      public : 
  • XIOS/trunk/src/node/domain.cpp

    r352 r369  
    1313#include "context.hpp" 
    1414#include "context_client.hpp" 
     15#include "array_new.hpp" 
    1516 
    1617namespace xios { 
     
    2021   CDomain::CDomain(void) 
    2122      : CObjectTemplate<CDomain>(), CDomainAttributes() 
    22       , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])), relFiles() 
     23      , isChecked(false), relFiles() 
    2324      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 
    2425      , ibegin_zoom_sub(), jbegin_zoom_sub(), ni_zoom_sub(), nj_zoom_sub() 
    25       , lonvalue_sub(), latvalue_sub(),lonvalue_srv(new CArray<double,1>()) 
    26       , latvalue_srv(new CArray<double,1>()) 
     26      , lonvalue_sub(), latvalue_sub() 
    2727   { /* Ne rien faire de plus */ } 
    2828 
    2929   CDomain::CDomain(const StdString & id) 
    3030      : CObjectTemplate<CDomain>(id), CDomainAttributes() 
    31       , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])), relFiles() 
     31      , isChecked(false), relFiles() 
    3232      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 
    3333      , ibegin_zoom_sub(), jbegin_zoom_sub(),ni_zoom_sub(), nj_zoom_sub() 
    34       , lonvalue_sub(), latvalue_sub(),lonvalue_srv(new CArray<double,1>()) 
    35       , latvalue_srv(new CArray<double,1>()) 
     34      , lonvalue_sub(), latvalue_sub() 
    3635   { /* Ne rien faire de plus */ } 
    3736 
    3837   CDomain::~CDomain(void) 
    3938   {  
    40       this->local_mask.reset(); 
    41       for (StdSize i = 0; i < this->lonvalue_sub.size(); i++) 
    42       { 
    43          this->lonvalue_sub[i].reset(); 
    44          this->latvalue_sub[i].reset(); 
    45       }      
     39     vector<CArray<double,1>* >::iterator it; 
     40     for(it=lonvalue_sub.begin();it<lonvalue_sub.end();it++) delete *it; 
     41     for(it=latvalue_sub.begin();it<latvalue_sub.end();it++) delete *it; 
    4642   } 
    4743 
     
    8480 
    8581   //---------------------------------------------------------------- 
    86  
     82/* 
    8783   void CDomain::fromBinary(StdIStream & is) 
    8884   { 
     
    112108       
    113109#define CLEAR_ATT(name_)\ 
    114       SuperClassAttribute::operator[](#name_)->clear() 
     110      SuperClassAttribute::operator[](#name_)->reset() 
    115111 
    116112         CLEAR_ATT(mask); 
     
    143139      } 
    144140   } 
    145  
     141*/ 
    146142   //---------------------------------------------------------------- 
    147143 
     
    265261      if (!mask.isEmpty()) 
    266262      { 
    267          ARRAY(bool, 2) mask_ = mask.getValue(); 
    268263         unsigned int niu = ni.getValue(), nju = nj.getValue(); 
    269          if ((mask_->shape()[0] != niu) || 
    270              (mask_->shape()[1] != nju)) 
     264         if ((mask.extent(0) != niu) || 
     265             (mask.extent(1) != nju)) 
    271266            ERROR("CDomain::checkAttributes(void)", 
    272267                  <<"Le masque n'a pas la même taille que le domaine local") ; 
     
    278273               if (i < ibegin_mask && i > iend_mask && 
    279274                   j < jbegin_mask && j > jend_mask ) 
    280                      (*mask_)[i][j] = false; 
     275                     mask(i,j) = false; 
    281276            } 
    282277         } 
     
    285280      { // Si aucun masque n'est défini, 
    286281        // on en crée un nouveau qui valide l'intégralité du domaine. 
    287          ARRAY_CREATE(__arr, bool, 2, [ni.getValue()][nj.getValue()]); 
     282         mask.resize(ni,nj) ; 
    288283         for (int i = 0; i < ni.getValue(); i++) 
    289284         { 
     
    292287               if (i >= ibegin_mask && i <= iend_mask && 
    293288                   j >= jbegin_mask && j <= jend_mask ) 
    294                      (*__arr)[i][j] = true; 
    295                else  (*__arr)[i][j] = false; 
     289                     mask(i,j) = true; 
     290               else  mask(i,j) = false; 
    296291            } 
    297292         } 
    298                 
    299          mask.setValue(__arr); 
    300          __arr.reset(); 
    301293      } 
    302294   } 
     
    355347      if (!data_i_index.isEmpty()) 
    356348      { 
    357          int ssize = data_i_index.getValue()->size(); 
     349         int ssize = data_i_index.numElements(); 
    358350         if (!data_n_index.isEmpty() && 
    359351            (data_n_index.getValue() != ssize)) 
     
    368360         { 
    369361            if (!data_j_index.isEmpty() && 
    370                (data_j_index.getValue()->size() != data_i_index.getValue()->size())) 
     362               (data_j_index.numElements() != data_i_index.numElements())) 
    371363            { 
    372364               ERROR("CDomain::checkAttributes(void)", 
     
    392384         { 
    393385            const int dni = data_ni.getValue(); 
    394             ARRAY_CREATE(__arri, int, 1, [dni]); 
     386            data_i_index.resize(dni) ; 
    395387            data_n_index.setValue(dni); 
    396             for (int i = 0; i < dni; i++) 
    397                (*__arri)[i] = i+1 ; 
    398             data_i_index.setValue(__arri) ; 
     388            for (int i = 0; i < dni; i++) data_i_index(i) = i+1 ; 
    399389         } 
    400390         else   // (data_dim == 2) 
    401391         { 
    402392            const int dni = data_ni.getValue() * data_nj.getValue(); 
     393            data_i_index.resize(dni) ; 
     394            data_j_index.resize(dni) ; 
    403395             
    404             ARRAY_CREATE(__arri, int, 1, [dni]); 
    405             ARRAY_CREATE(__arrj, int, 1, [dni]);                
    406396            data_n_index.setValue(dni); 
    407              
    408             //for(int count = 0, i = 0; i  < data_ni.getValue(); i++) 
    409             //for(int j = 0; j < data_nj.getValue(); j++, count++) 
    410397             
    411398            for(int count = 0, j = 0; j  < data_nj.getValue(); j++) 
     
    413400               for(int i = 0; i < data_ni.getValue(); i++, count++) 
    414401               { 
    415                   (*__arri)[count] = i+1 ; 
    416                   (*__arrj)[count] = j+1 ; 
     402                  data_i_index(count) = i+1 ; 
     403                  data_j_index(count) = j+1 ; 
    417404               } 
    418405            } 
    419             data_i_index.setValue(__arri) ; 
    420             data_j_index.setValue(__arrj) ;             
    421             __arri.reset(); 
    422             __arrj.reset(); 
    423406         } 
    424407      } 
     
    429412   void CDomain::completeLonLatClient(void) 
    430413   { 
    431       ARRAY_CREATE(lonvalue_temp, double, 1, [0]); 
    432       ARRAY_CREATE(latvalue_temp, double, 1, [0]); 
     414      CArray<double,1> lonvalue_temp ; 
     415      CArray<double,1> latvalue_temp ; 
    433416       
    434417      const int zoom_ibegin_client  = zoom_ibegin_loc.getValue(), 
     
    437420                zoom_nj_client      = zoom_nj_loc.getValue(); 
    438421                 
    439       ARRAY(double, 1) lonvalue_ = this->lonvalue.getValue(), 
    440                        latvalue_ = this->latvalue.getValue(); 
    441                  
    442422      if (this->data_dim.getValue() == 2) 
    443423      { 
    444424         StdSize dm = zoom_ni_client * zoom_nj_client; 
    445425 
    446          lonvalue_temp->resize(boost::extents[dm]); 
    447          latvalue_temp->resize(boost::extents[dm]); 
     426         lonvalue_temp.resize(dm); 
     427         latvalue_temp.resize(dm); 
    448428          
    449429         for (int i = 0; i < zoom_ni_client; i++) 
     
    451431            for (int j = 0; j < zoom_nj_client; j++) 
    452432            { 
    453                (*lonvalue_temp)[i + j * zoom_ni_client] = 
    454                (*lonvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()];               
    455                (*latvalue_temp)[i + j * zoom_ni_client] = 
    456                (*latvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()]; 
     433               lonvalue_temp(i + j * zoom_ni_client) = lonvalue( (i + zoom_ibegin_client -1) + (j + zoom_jbegin_client -1)*ni.getValue() );  
     434               latvalue_temp(i + j * zoom_ni_client) = latvalue( (i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue() ); 
    457435            } 
    458436         } 
    459          this->lonvalue.setValue(lonvalue_temp); 
    460          this->latvalue.setValue(latvalue_temp); 
     437         lonvalue.reference(lonvalue_temp.copy()) ; 
     438         latvalue.reference(latvalue_temp.copy()) ; 
     439         cout<<lonvalue<<endl ; 
     440         cout<<latvalue<<endl ; 
    461441      } 
    462442      else 
    463443      { 
    464          lonvalue_temp->resize(boost::extents[zoom_ni_client]); 
    465          latvalue_temp->resize(boost::extents[zoom_nj_client]); 
    466           
     444         lonvalue_temp.resize(zoom_ni_client); 
     445         latvalue_temp.resize(zoom_nj_client); 
     446 
     447// Attention ici à revoir, probablement faux          
    467448         for (int i = zoom_ibegin_client - 1; i < (zoom_ni_client - zoom_ibegin_client + 1); i++) 
    468449         { 
    469             (*lonvalue_temp)[i] = (*lonvalue_)[i];  
    470          } 
    471           
    472          for (int j = zoom_ibegin_client - 1; j < (zoom_nj_client - zoom_jbegin_client + 1); j++) 
    473          { 
    474             (*latvalue_temp)[j] = (*latvalue_)[j]; 
    475          } 
    476           
    477          this->lonvalue.setValue(lonvalue_temp); 
    478          this->latvalue.setValue(latvalue_temp); 
     450            lonvalue_temp(i) = lonvalue(i);  
     451         } 
     452          
     453         for (int j = zoom_jbegin_client - 1; j < (zoom_nj_client - zoom_jbegin_client + 1); j++) 
     454         { 
     455            latvalue_temp(j) = latvalue(j); 
     456         } 
     457          
     458         lonvalue.reference(lonvalue_temp.copy()) ; 
     459         latvalue.reference(latvalue_temp.copy()) ; 
    479460      }   
    480461   } 
     
    484465   void CDomain::completeLonLatServer(void) 
    485466   { 
    486       ARRAY_CREATE(lonvalue_temp, double, 1, [0]); 
    487       ARRAY_CREATE(latvalue_temp, double, 1, [0]); 
     467      CArray<double,1> lonvalue_temp ; 
     468      CArray<double,1> latvalue_temp ; 
    488469       
    489470      const int ibegin_serv     = ibegin.getValue(), 
     
    499480         StdSize dm = zoom_ni_serv * zoom_nj_serv;       
    500481          
    501          lonvalue_temp->resize(boost::extents[dm]); 
    502          latvalue_temp->resize(boost::extents[dm]); 
     482         lonvalue_temp.resize(dm); 
     483         latvalue_temp.resize(dm); 
    503484          
    504485         for (StdSize k = 0; k < lonvalue_sub.size(); k++) 
    505486         { 
    506             ARRAY(double, 1) lonvalue_loc = this->lonvalue_sub[k], 
    507                              latvalue_loc = this->latvalue_sub[k]; 
     487            CArray<double,1> lonvalue_loc(*(lonvalue_sub[k])) ; 
     488            CArray<double,1> latvalue_loc (*(latvalue_sub[k])); 
     489             
    508490            const int zoom_ibegin_cl = ibegin_zoom_sub[k], zoom_ni_cl = ni_zoom_sub[k], 
    509491                      zoom_jbegin_cl = jbegin_zoom_sub[k], zoom_nj_cl = nj_zoom_sub[k], 
     
    518500                  int ii = i + (ibegin_cl-1) - (ibegin_serv - 1) + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1); 
    519501                  int jj = j + (jbegin_cl-1) - (jbegin_serv - 1) + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1); 
    520                   (*lonvalue_temp)[ii + jj * zoom_ni_serv] = 
    521                   (*lonvalue_loc)[i + j * zoom_ni_cl]; 
    522                   (*latvalue_temp)[ii + jj * zoom_ni_serv] =  
    523                   (*latvalue_loc)[i + j * zoom_ni_cl]; 
     502                  lonvalue_temp(ii + jj * zoom_ni_serv) = lonvalue_loc(i + j * zoom_ni_cl); 
     503                  latvalue_temp(ii + jj * zoom_ni_serv) = latvalue_loc(i + j * zoom_ni_cl); 
    524504               } 
    525505            } 
    526506         } 
    527          this->lonvalue.setValue(lonvalue_temp); 
    528          this->latvalue.setValue(latvalue_temp); 
     507          
     508         lonvalue.reference(lonvalue_temp.copy()) ; 
     509         latvalue.reference(latvalue_temp.copy()) ; 
    529510      } 
    530511      else 
    531512      { 
    532          lonvalue_temp->resize(boost::extents[zoom_ni_serv]); 
    533          latvalue_temp->resize(boost::extents[zoom_nj_serv]); 
     513         lonvalue_temp.resize(zoom_ni_serv); 
     514         latvalue_temp.resize(zoom_nj_serv); 
    534515          
    535516         for (StdSize k = 0; k < lonvalue_sub.size(); k++) 
    536517         { 
    537             ARRAY(double, 1) lonvalue_loc = this->lonvalue_sub[k], 
    538                              latvalue_loc = this->latvalue_sub[k]; 
     518            CArray<double,1> lonvalue_loc(*(lonvalue_sub[k])); 
     519            CArray<double,1> latvalue_loc(*(latvalue_sub[k])); 
     520             
    539521            const int zoom_ibegin_cl = ibegin_zoom_sub[k], zoom_ni_cl = ni_zoom_sub[k], 
    540522                      zoom_jbegin_cl = jbegin_zoom_sub[k], zoom_nj_cl = nj_zoom_sub[k]; 
    541523                       
    542524            for (int i = 0; i < zoom_ni_cl; i++) 
    543                (*lonvalue_temp)[i /*- (ibegin_serv - 1)*/ + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1)] = 
    544                (*lonvalue_loc)[i]; 
     525              lonvalue_temp(i /*- (ibegin_serv - 1)*/ + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1)) = lonvalue_loc(i); 
    545526                
    546527            for (int j = 0; j < zoom_nj_cl; j++) 
    547                (*latvalue_temp)[j /*- (jbegin_serv - 1)*/ + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1)] = 
    548                (*latvalue_loc)[j]; 
     528              latvalue_temp(j /*- (jbegin_serv - 1)*/ + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1)) = latvalue_loc(j); 
    549529         }        
    550          this->lonvalue.setValue(lonvalue_temp); 
    551          this->latvalue.setValue(latvalue_temp); 
     530         lonvalue.reference(lonvalue_temp.copy()) ; 
     531         latvalue.reference(latvalue_temp.copy()) ; 
    552532      } 
    553533   } 
     
    662642         this->nj_zoom_sub.push_back(this->zoom_nj_loc.getValue()); 
    663643       
    664          this->latvalue_sub.push_back(this->latvalue.getValue()); 
    665          this->lonvalue_sub.push_back(this->lonvalue.getValue());   
     644         this->latvalue_sub.push_back(new CArray<double,1>(latvalue.copy())); 
     645         this->lonvalue_sub.push_back(new CArray<double,1>(lonvalue.copy()));   
    666646 
    667647 
     
    855835    CEventClient event(getType(),EVENT_ID_LON_LAT) ; 
    856836     
    857     ARRAY(double, 1) lonvalue_client = lonvalue.getValue(), 
    858                      latvalue_client = latvalue.getValue(); 
    859      
    860837    int ib,ie,in ; 
    861838    int jb,je,jn ; 
    862839   
    863840    list<shared_ptr<CMessage> > list_msg ;     
    864     list<ARRAY(double,1)> list_indi,list_indj,list_lon,list_lat ; 
     841    list<CArray<double,1>* > list_indi,list_indj,list_lon,list_lat ; 
    865842 
    866843    for(int ns=0;ns<connectedServer.size();ns++) 
     
    869846      jb=jb_srv[ns] ; je=je_srv[ns] ; jn=jn_srv[ns] ; 
    870847       
    871       ARRAY_CREATE(indi,double,1,[in*jn]) ; 
    872       ARRAY_CREATE(indj,double,1,[in*jn]) ; 
    873       ARRAY_CREATE(lon,double,1,[in*jn]) ; 
    874       ARRAY_CREATE(lat,double,1,[in*jn]) ; 
     848      CArray<double,1> indi(in*jn) ; 
     849      CArray<double,1> indj(in*jn) ; 
     850      CArray<double,1> lon(in*jn) ; 
     851      CArray<double,1> lat(in*jn) ; 
    875852 
    876853           
     
    882859          ind_client=(i-zoom_ibegin_client)+(j-zoom_jbegin_client)*zoom_ni_client ; 
    883860          ind_loc=(i-ib)+(j-jb)*in ; 
    884           (*lon)[ind_loc]=(*lonvalue_client)[ind_client] ; 
    885           (*lat)[ind_loc]=(*latvalue_client)[ind_client] ; 
    886           (*indi)[ind_loc]=i ; 
    887           (*indj)[ind_loc]=j ; 
     861          lon(ind_loc)=lonvalue(ind_client) ; 
     862          lat(ind_loc)=latvalue(ind_client) ; 
     863          indi(ind_loc)=i ; 
     864          indj(ind_loc)=j ; 
    888865        } 
    889866       
    890       list_indi.push_back(indi) ; list_indj.push_back(indj) ; 
    891       list_lon.push_back(lon) ; list_lat.push_back(lat) ; 
     867      list_indi.push_back(new CArray<double,1>(indi.copy())) ; 
     868      list_indj.push_back(new CArray<double,1>(indj.copy())) ; 
     869      list_lon.push_back(new CArray<double,1>(lon.copy())) ; 
     870      list_lat.push_back(new CArray<double,1>(lat.copy())) ; 
     871 
    892872      list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 
    893873 
    894874      *list_msg.back()<<this->getId() ; 
    895       *list_msg.back()<<list_indi.back()<<list_indj.back()<<list_lon.back()<<list_lat.back() ; 
     875      *list_msg.back()<<*list_indi.back()<<*list_indj.back()<<*list_lon.back()<<*list_lat.back() ; 
    896876      event.push(connectedServer[ns],nbSenders[ns],*list_msg.back()) ; 
    897877    } 
    898878 
    899879    client->sendEvent(event) ; 
     880     
     881    list<CArray<double,1>* >::iterator it; 
     882    for(it=list_indi.begin();it!=list_indi.end();it++) delete *it; 
     883    for(it=list_indj.begin();it!=list_indj.end();it++) delete *it; 
     884    for(it=list_lon.begin();it!=list_lon.end();it++)   delete *it; 
     885    for(it=list_lat.begin();it!=list_lat.end();it++)   delete *it; 
     886     
    900887  } 
    901888   
     
    953940    } 
    954941     
    955     lonvalue_srv->resize(extents[zoom_ni_srv*zoom_nj_srv]) ; 
    956     latvalue_srv->resize(extents[zoom_ni_srv*zoom_nj_srv]) ; 
     942    lonvalue_srv.resize(zoom_ni_srv*zoom_nj_srv) ; 
     943    latvalue_srv.resize(zoom_ni_srv*zoom_nj_srv) ; 
    957944  } 
    958945     
     
    971958  void CDomain::recvLonLat(CBufferIn& buffer) 
    972959  { 
    973     ARRAY_CREATE(indi,double,1,[0]) ; 
    974     ARRAY_CREATE(indj,double,1,[0]) ; 
    975     ARRAY_CREATE(lon,double,1,[0]) ; 
    976     ARRAY_CREATE(lat,double,1,[0]) ; 
    977      
     960    CArray<double,1> indi ; 
     961    CArray<double,1> indj ; 
     962    CArray<double,1> lon ; 
     963    CArray<double,1> lat ; 
     964      
    978965    buffer>>indi>>indj>>lon>>lat ; 
    979966    int i,j,ind_srv ; 
    980967 
    981     for(int ind=0;ind<indi->num_elements();ind++) 
     968    for(int ind=0;ind<indi.numElements();ind++) 
    982969    { 
    983       i=(*indi)[ind] ; j=(*indj)[ind] ; 
     970      i=indi(ind) ; j=indj(ind) ; 
    984971      ind_srv=(i-zoom_ibegin_srv)+(j-zoom_jbegin_srv)*zoom_ni_srv ; 
    985       (*lonvalue_srv)[ind_srv]=(*lon)[ind] ; 
    986       (*latvalue_srv)[ind_srv]=(*lat)[ind] ; 
     972      lonvalue_srv(ind_srv)=lon(ind) ; 
     973      latvalue_srv(ind_srv)=lat(ind) ; 
    987974    } 
    988975  } 
     
    991978   void CDomain::completeMask(void) 
    992979   { 
    993       this->local_mask->resize(boost::extents[zoom_ni_loc.getValue()][zoom_nj_loc.getValue()]); 
    994    } 
    995  
    996    //---------------------------------------------------------------- 
    997  
    998    ARRAY(int, 2) CDomain::getLocalMask(void) const 
     980      this->local_mask.resize(zoom_ni_loc,zoom_nj_loc); 
     981   } 
     982 
     983   //---------------------------------------------------------------- 
     984 
     985   CArray<int,2> CDomain::getLocalMask(void) const 
    999986   { 
    1000987      return (this->local_mask); 
     
    10561043   //---------------------------------------------------------------- 
    10571044    
    1058    const std::vector<ARRAY(double, 1)> & CDomain::getLonValueSub(void) const 
     1045   const std::vector<CArray<double, 1>* > & CDomain::getLonValueSub(void) const 
    10591046   { 
    10601047      return (this->lonvalue_sub); 
     
    10631050   //---------------------------------------------------------------- 
    10641051    
    1065    const std::vector<ARRAY(double, 1)> & CDomain::getLatValueSub(void) const 
     1052   const std::vector<CArray<double,1>*> & CDomain::getLatValueSub(void) const 
    10661053   { 
    10671054      return (this->latvalue_sub); 
  • XIOS/trunk/src/node/domain.hpp

    r345 r369  
    1010#include "event_server.hpp" 
    1111#include "buffer_in.hpp" 
     12#include "array_new.hpp" 
     13#include "attribute_array.hpp" 
    1214 
    1315namespace xios { 
     
    7375       
    7476         /// Autres /// 
    75          virtual void fromBinary(StdIStream & is); 
     77//         virtual void fromBinary(StdIStream & is); 
    7678 
    7779         /// Accesseurs /// 
    78          ARRAY(int, 2) getLocalMask(void) const; 
     80         CArray<int, 2> getLocalMask(void) const; 
    7981          
    8082         const std::set<StdString> & getRelFiles(void) const; 
     
    9092         const std::vector<int> & getNjZoomSub(void) const; 
    9193          
    92          const std::vector<ARRAY(double, 1)> & getLonValueSub(void) const; 
    93          const std::vector<ARRAY(double, 1)> & getLatValueSub(void) const; 
     94         const std::vector<CArray<double,1>* > & getLonValueSub(void) const; 
     95         const std::vector<CArray<double,1>* > & getLatValueSub(void) const; 
    9496 
    9597         /// Test /// 
     
    111113         int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ; 
    112114 
    113          ARRAY(double, 1) lonvalue_srv, latvalue_srv ; 
     115         CArray<double, 1> lonvalue_srv, latvalue_srv ; 
    114116          
    115117          
     
    142144         static ENodeType GetType(void); 
    143145 
     146         CArray<int, 2> local_mask; 
     147 
    144148       private : 
    145149 
    146150         /// Proriétés protégées /// 
    147151         bool isChecked; 
    148          ARRAY(int, 2) local_mask; 
    149152         std::set<StdString> relFiles; 
    150153 
    151154         std::vector<int> ibegin_sub, iend_sub, jbegin_sub, jend_sub; 
    152155         std::vector<int> ibegin_zoom_sub, jbegin_zoom_sub, ni_zoom_sub, nj_zoom_sub; 
    153          std::vector<ARRAY(double, 1)> lonvalue_sub, latvalue_sub; 
     156         std::vector<CArray<double,1>* > lonvalue_sub, latvalue_sub; 
    154157          
    155158 
  • XIOS/trunk/src/node/field.cpp

    r352 r369  
    2424      , last_Write(), last_operation() 
    2525      , foperation() 
    26       , data(new CArray<double, 1>(boost::extents[0])) 
    27    { /* Ne rien faire de plus */ } 
     26      { /* Ne rien faire de plus */ } 
    2827 
    2928   CField::CField(const StdString & id) 
     
    3534      , last_Write(), last_operation() 
    3635      , foperation() 
    37       , data(new CArray<double, 1>(boost::extents[0])) 
    3836   { /* Ne rien faire de plus */ } 
    3937 
     
    4341//      this->file.reset() ; 
    4442      this->foperation.reset() ; 
    45       this->data.reset() ; 
    4643   } 
    4744 
     
    5047   bool CField::updateDataServer 
    5148      (const CDate & currDate, 
    52        const std::deque<ARRAY(double, 1)> storedClient) 
     49       const std::deque< CArray<double, 1>* > storedClient) 
    5350   { 
    5451      const CDate opeDate      = *last_operation + freq_operation; 
     
    5754      if (opeDate <= currDate) 
    5855      { 
    59          if (this->data->num_elements() != this->grid->storeIndex[0]->num_elements()) 
     56         if (this->data.numElements() != this->grid->storeIndex[0]->numElements()) 
    6057         { 
    61             this->data->resize(boost::extents[this->grid->storeIndex[0] ->num_elements()]); 
     58            this->data.resize(this->grid->storeIndex[0] ->numElements()); 
    6259         }   
    63          ARRAY_CREATE(input, double, 1, [this->data->num_elements()]); 
     60         CArray<double,1> input(data.numElements()) ; 
    6461         this->grid->inputFieldServer(storedClient, input);           
    6562         (*this->foperation)(input); 
     
    103100    CEventClient event(getType(),EVENT_ID_UPDATE_DATA) ; 
    104101     
    105     map<int,ARRAY(int, 1)>::iterator it ; 
     102    map<int,CArray<int, 1>* >::iterator it ; 
    106103    list<shared_ptr<CMessage> > list_msg ; 
    107     list<ARRAY(double,1) > list_data ; 
     104    list< CArray<double,1>* > list_data ; 
    108105     
    109106    for(it=grid->storeIndex_toSrv.begin();it!=grid->storeIndex_toSrv.end();it++) 
    110107    { 
    111108      int rank=(*it).first ; 
    112       ARRAY(int,1) index=(*it).second ; 
    113       ARRAY_CREATE(data_tmp,double,1,[index->num_elements()]) ; 
    114       for(int n=0;n<data_tmp->num_elements();n++) (*data_tmp)[n]=(*data)[(*index)[n]] ; 
     109      CArray<int,1>& index = *(it->second) ; 
     110      CArray<double,1> data_tmp(index.numElements()) ; 
     111       
     112      for(int n=0;n<data_tmp.numElements();n++) data_tmp(n)=data(index(n)) ; 
    115113      list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 
    116       list_data.push_back(data_tmp) ; 
    117       *list_msg.back()<<getId()<<list_data.back() ; 
     114      list_data.push_back(new CArray<double,1>(data_tmp)) ; 
     115      *list_msg.back()<<getId()<<*list_data.back() ; 
    118116      event.push(rank,grid->nbSenders[rank],*list_msg.back()) ; 
    119117    } 
    120118    client->sendEvent(event) ; 
     119     
     120    for(list< CArray<double,1>* >::iterator it=list_data.begin();it!=list_data.end();it++) delete *it ; 
    121121  } 
    122122   
     
    145145    if (data_srv.empty()) 
    146146    { 
    147       for(map<int,ARRAY(int, 1)>::iterator it=grid->out_i_fromClient.begin();it!=grid->out_i_fromClient.end();it++) 
     147      for(map<int, CArray<int, 1>* >::iterator it=grid->out_i_fromClient.begin();it!=grid->out_i_fromClient.end();it++) 
    148148      { 
    149149        int rank=it->first ; 
    150         ARRAY_CREATE(data_tmp,double,1,[it->second->num_elements()]) ; 
    151         data_srv.insert(pair<int, ARRAY(double,1)>(rank,data_tmp)) ; 
    152         foperation_srv.insert(pair<int,boost::shared_ptr<func::CFunctor> >(rank,boost::shared_ptr<func::CFunctor>(new func::CInstant(data_srv[rank])))) ; 
     150        CArray<double,1> data_tmp(it->second->numElements()) ; 
     151        data_srv.insert( pair<int, CArray<double,1>* >(rank, new CArray<double,1>(data_tmp) ) ) ; 
     152        foperation_srv.insert(pair<int,boost::shared_ptr<func::CFunctor> >(rank,boost::shared_ptr<func::CFunctor>(new func::CInstant(*data_srv[rank])))) ; 
    153153      } 
    154154    } 
     
    165165      for(int n=0;n<ranks.size();n++) 
    166166      { 
    167         ARRAY_CREATE(data_tmp,double,1,[0]) ; 
     167        CArray<double,1> data_tmp ; 
    168168        *buffers[n]>>data_tmp ; 
    169169        (*foperation_srv[ranks[n]])(data_tmp) ; 
     
    187187  void CField::writeField(void) 
    188188  { 
    189     if (! grid->domain->isEmpty() || getRelFile()->type.getValue()=="one_file") 
     189//    if (! grid->domain->isEmpty() || getRelFile()->type.getValue()=="one_file") 
     190    if (! grid->domain->isEmpty() || getRelFile()->type == CFile::type_attr::one_file) 
    190191    { 
    191192      getRelFile()->checkFile(); 
     
    305306   //---------------------------------------------------------------- 
    306307    
    307    ARRAY(double, 1) CField::getData(void) const 
     308   CArray<double, 1> CField::getData(void) const 
    308309   { 
    309310      return(this->data); 
     
    410411         const CDuration toffset = this->freq_operation - freq_offset_ - context->getCalendar()->getTimeStep();  
    411412         *this->last_operation   = *this->last_operation - toffset;   
     413         cout<<operation<<endl ; 
    412414          
    413415#define DECLARE_FUNCTOR(MType, mtype)              \ 
     
    429431    
    430432   //---------------------------------------------------------------- 
    431     
     433/* 
    432434   void CField::fromBinary(StdIStream & is) 
    433435   { 
    434436      SuperClass::fromBinary(is); 
    435437#define CLEAR_ATT(name_)\ 
    436       SuperClassAttribute::operator[](#name_)->clear() 
     438      SuperClassAttribute::operator[](#name_)->reset() 
    437439 
    438440         CLEAR_ATT(domain_ref); 
     
    441443 
    442444   } 
    443  
     445*/ 
    444446   //---------------------------------------------------------------- 
    445447 
     
    537539   } 
    538540    
    539    void CField::outputField(ARRAY(double,3) fieldOut) 
    540    { 
    541       map<int,ARRAY(double,1)>::iterator it; 
     541   void CField::outputField(CArray<double,3>& fieldOut) 
     542   { 
     543      map<int, CArray<double,1>* >::iterator it; 
    542544      for(it=data_srv.begin();it!=data_srv.end();it++) 
    543          grid->outputField(it->first,it->second, fieldOut) ; 
    544        
    545    } 
    546     
    547    void CField::outputField(ARRAY(double,2) fieldOut) 
    548    { 
    549       map<int,ARRAY(double,1)>::iterator it; 
     545         grid->outputField(it->first,*it->second, fieldOut) ; 
     546       
     547   } 
     548    
     549   void CField::outputField(CArray<double,2>& fieldOut) 
     550   { 
     551      map<int, CArray<double,1>* >::iterator it; 
    550552 
    551553      for(it=data_srv.begin();it!=data_srv.end();it++) 
    552554      { 
    553          grid->outputField(it->first,it->second, fieldOut) ; 
     555         grid->outputField(it->first,*it->second, fieldOut) ; 
    554556      } 
    555557   } 
  • XIOS/trunk/src/node/field.hpp

    r347 r369  
    1111#include "declare_group.hpp" 
    1212#include "calendar_util.hpp" 
     13#include "array_new.hpp" 
     14#include "attribute_array.hpp" 
    1315//#include "context.hpp" 
    1416 
     
    8082         boost::shared_ptr<func::CFunctor> getFieldOperation(void) const; 
    8183          
    82          ARRAY(double, 1) getData(void) const; 
     84         CArray<double, 1> getData(void) const; 
    8385 
    8486         const StdString & getBaseFieldId(void) const; 
     
    8991         void resetNStep() ; 
    9092 
    91          template <StdSize N> bool updateData(const ARRAY(double, N)   data); 
     93         template <int N> bool updateData(const CArray<double, N>&   data); 
    9294          
    9395         bool updateDataServer 
    9496               (const CDate & currDate, 
    95                 const std::deque<ARRAY(double, 1)> storedClient); 
     97                const std::deque< CArray<double, 1>* > storedClient); 
    9698  
    9799       public : 
     
    106108         void solveOperation(void); 
    107109 
    108          virtual void fromBinary(StdIStream & is); 
     110//         virtual void fromBinary(StdIStream & is); 
    109111 
    110112         /// Destructeur /// 
     
    117119         static ENodeType GetType(void); 
    118120          
    119         template <StdSize N> void setData(const ARRAY(double, N) _data) ; 
     121        template <int N> void setData(const CArray<double, N>& _data) ; 
    120122        static bool dispatchEvent(CEventServer& event) ; 
    121123        void sendUpdateData(void) ; 
     
    123125        void recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers) ; 
    124126        void writeField(void) ; 
    125         void outputField(ARRAY(double,3) fieldOut) ; 
    126         void outputField(ARRAY(double,2) fieldOut) ; 
     127        void outputField(CArray<double,3>& fieldOut) ; 
     128        void outputField(CArray<double,2>& fieldOut) ; 
    127129         
    128130      public : 
     
    145147         map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; 
    146148          
    147          ARRAY(double, 1) data; 
    148          map<int,ARRAY(double,1)> data_srv ; 
     149         CArray<double, 1> data; 
     150         map<int, CArray<double,1>* > data_srv ; 
    149151 
    150152   }; // class CField 
  • XIOS/trunk/src/node/field_decl.cpp

    r352 r369  
    33namespace xios 
    44{ 
    5   template void CField::setData<1>(const ARRAY(double, 1) _data) ; 
    6   template void CField::setData<2>(const ARRAY(double, 2) _data) ; 
    7   template void CField::setData<3>(const ARRAY(double, 3) _data) ; 
     5  template void CField::setData<1>(const CArray<double, 1>& _data) ; 
     6  template void CField::setData<2>(const CArray<double, 2>& _data) ; 
     7  template void CField::setData<3>(const CArray<double, 3>& _data) ; 
    88 
    99} 
  • XIOS/trunk/src/node/field_impl.hpp

    r352 r369  
    88#include "grid.hpp" 
    99#include "timer.hpp" 
    10 #include "array.hpp" 
     10#include "array_new.hpp" 
     11 
    1112 
    1213namespace xios { 
    1314 
    14    template <StdSize N> 
    15    void CField::setData(const ARRAY(double, N) _data) 
     15   template <int N> 
     16   void CField::setData(const CArray<double, N>& _data) 
    1617   { 
    1718     const std::vector<CField*>& refField=getAllReference(); 
     
    2122    } 
    2223     
    23    template <StdSize N> 
    24       bool CField::updateData(const ARRAY(double, N) _data) 
     24   template <int N> 
     25      bool CField::updateData(const CArray<double, N>& _data) 
    2526   {         
    2627      CContext* context=CContext::getCurrent(); 
     
    3536      if (opeDate <= currDate) 
    3637      { 
    37          if (this->data->num_elements() != this->grid->storeIndex_client->num_elements()) 
     38         if (this->data.numElements() != this->grid->storeIndex_client.numElements()) 
    3839         { 
    39             this->data->resize(boost::extents[this->grid->storeIndex_client ->num_elements()]); 
     40            this->data.resize(this->grid->storeIndex_client.numElements()); 
    4041         } 
    4142             
    42          ARRAY_CREATE(input, double, 1, [this->data->num_elements()]); 
     43         CArray<double,1> input(data.numElements()) ; 
    4344         this->grid->inputField(_data, input);           
    4445         (*this->foperation)(input); 
  • XIOS/trunk/src/node/file.cpp

    r352 r369  
    216216      nbDomain=setDomain.size() ; 
    217217 
    218       if (!AllDomainEmpty ||  type.getValue()=="one_file") 
     218      if (!AllDomainEmpty ||  type == type_attr::one_file) 
    219219      { 
    220220         StdString filename = (!name.isEmpty()) ?   name.getValue() : getId(); 
     
    228228         if (!type.isEmpty()) 
    229229         { 
    230            if (type.getValue()=="one_file") multifile=false ; 
    231            else if (type.getValue()=="multi_file") multifile=true ; 
     230           if (type==type_attr::one_file) multifile=false ; 
     231           else if (type==type_attr::multiple_file) multifile=true ; 
    232232           else ERROR("void Context::createDataOutput(void)", 
    233233                      "incorrect file <type> attribut : must be <multi_file> or <one_file>, " 
     
    280280     delete lastSync ; 
    281281     delete lastSplit ; 
    282      if (!AllDomainEmpty ||  type.getValue()=="one_file") 
     282     if (!AllDomainEmpty ||  type==type_attr::one_file) 
    283283       if (isOpen)  
    284284       { 
     
    349349    
    350350   //--------------------------------------------------------------- 
    351     
     351/* 
    352352   void CFile::toBinary  (StdOStream & os) const 
    353353   { 
     
    382382       
    383383   } 
    384     
     384*/ 
     385 
    385386   CField* CFile::addField(const string& id) 
    386387   { 
  • XIOS/trunk/src/node/file.hpp

    r347 r369  
    88#include "declare_group.hpp" 
    99#include "date.hpp" 
     10#include "attribute_enum.hpp" 
     11#include "attribute_enum_impl.hpp" 
    1012 
    1113 
     
    8284         virtual StdString toString(void) const; 
    8385          
    84          virtual void toBinary  (StdOStream & os) const; 
    85          virtual void fromBinary(StdIStream & is); 
     86//         virtual void toBinary  (StdOStream & os) const; 
     87//         virtual void fromBinary(StdIStream & is); 
    8688 
    8789         /// Accesseurs statiques /// 
  • XIOS/trunk/src/node/grid.cpp

    r352 r369  
    1111#include "context.hpp" 
    1212#include "context_client.hpp" 
     13#include "array_new.hpp" 
    1314 
    1415namespace xios { 
     
    3233 //     this->axis.reset() ; 
    3334//      this->domain.reset() ; 
    34        
    35       for (StdSize i = 0; i < this->storeIndex.size(); i++) 
    36       { 
    37          this->storeIndex[i].reset(); 
    38          this->out_i_index[i].reset(); 
    39          this->out_j_index[i].reset(); 
    40          this->out_l_index[i].reset(); 
    41       } 
     35    deque< CArray<int, 1>* >::iterator it ; 
     36     
     37    for(deque< CArray<int,1>* >::iterator it=storeIndex.begin(); it!=storeIndex.end();it++)  delete *it ; 
     38    for(deque< CArray<int,1>* >::iterator it=out_i_index.begin();it!=out_i_index.end();it++) delete *it ; 
     39    for(deque< CArray<int,1>* >::iterator it=out_j_index.begin();it!=out_j_index.end();it++) delete *it ; 
     40    for(deque< CArray<int,1>* >::iterator it=out_l_index.begin();it!=out_l_index.end();it++) delete *it ; 
     41 
     42    for(map<int,CArray<int,1>* >::iterator it=out_i_fromClient.begin();it!=out_i_fromClient.end();it++) delete it->second ; 
     43    for(map<int,CArray<int,1>* >::iterator it=out_j_fromClient.begin();it!=out_j_fromClient.end();it++) delete it->second ; 
     44    for(map<int,CArray<int,1>* >::iterator it=out_l_fromClient.begin();it!=out_l_fromClient.end();it++) delete it->second ; 
     45 
    4246   } 
    4347 
     
    5054   //---------------------------------------------------------------- 
    5155 
    52    const std::deque<ARRAY(int, 1)> & CGrid::getStoreIndex(void) const 
     56   const std::deque< CArray<int,1>* > & CGrid::getStoreIndex(void) const 
    5357   {  
    5458      return (this->storeIndex ); 
     
    5761   //--------------------------------------------------------------- 
    5862 
    59    const std::deque<ARRAY(int, 1)> & CGrid::getOutIIndex(void)  const 
     63   const std::deque< CArray<int,1>* > & CGrid::getOutIIndex(void)  const 
    6064   {  
    6165      return (this->out_i_index );  
     
    6468   //--------------------------------------------------------------- 
    6569 
    66    const std::deque<ARRAY(int, 1)> & CGrid::getOutJIndex(void)  const 
     70   const std::deque< CArray<int,1>* > & CGrid::getOutJIndex(void)  const 
    6771   {  
    6872      return (this->out_j_index );  
     
    7175   //--------------------------------------------------------------- 
    7276 
    73    const std::deque<ARRAY(int, 1)> & CGrid::getOutLIndex(void)  const 
     77   const std::deque< CArray<int,1>* > & CGrid::getOutLIndex(void)  const 
    7478   {  
    7579      return (this->out_l_index );  
     
    155159   StdSize CGrid::getDataSize(void) const 
    156160   { 
    157       StdSize retvalue ; 
    158       retvalue=domain->data_ni.getValue() ; 
     161      StdSize retvalue=domain->data_ni.getValue() ; 
    159162      if (domain->data_dim.getValue()==2) retvalue*=domain->data_nj.getValue() ; 
    160163      if (this->withAxis) retvalue*=this->axis->size.getValue() ; 
     
    177180          
    178181         this->computeIndex() ; 
    179          ARRAY_CREATE(storeIndex_ , int, 1, [0]); 
    180          ARRAY_CREATE(out_l_index_, int, 1, [0]); 
    181          ARRAY_CREATE(out_i_index_, int, 1, [0]); 
    182          ARRAY_CREATE(out_j_index_, int, 1, [0]); 
    183                   
    184          this->storeIndex .push_front(storeIndex_); 
    185          this->out_i_index.push_front(out_i_index_); 
    186          this->out_j_index.push_front(out_j_index_); 
    187          this->out_l_index.push_front(out_l_index_); 
     182 
     183         this->storeIndex.push_front(new CArray<int,1>() ); 
     184         this->out_i_index.push_front(new CArray<int,1>()); 
     185         this->out_j_index.push_front(new CArray<int,1>()); 
     186         this->out_l_index.push_front(new CArray<int,1>()); 
    188187      } 
    189188//      this->computeIndexServer(); 
     
    245244                             ? domain->data_jbegin.getValue() : -1; 
    246245 
    247       ARRAY(int, 1) data_i_index = domain->data_i_index.getValue() , 
    248                     data_j_index = domain->data_j_index.getValue() ; 
    249  
    250  
    251       ARRAY(bool, 2) mask = domain->mask.getValue() ; 
    252       ARRAY(int, 2) local_mask =  this->domain->getLocalMask(); 
     246      CArray<int,1> data_i_index = domain->data_i_index ; 
     247      CArray<int,1> data_j_index = domain->data_j_index ; 
     248       
     249 
     250      CArray<bool,2>& mask = domain->mask ; 
     251      CArray<int,2>& local_mask = domain->local_mask ; 
     252       
    253253 
    254254      int indexCount = 0; 
     
    258258         for(int n = 0, i = 0, j = 0; n < data_n_index; n++) 
    259259         { 
    260             int temp_i = (*data_i_index)[n] + data_ibegin, 
     260            int temp_i = data_i_index(n) + data_ibegin, 
    261261                temp_j = (data_dim == 1) ? -1 
    262                        : (*data_j_index)[n] + data_jbegin; 
     262                       : data_j_index(n) + data_jbegin; 
    263263            i = (data_dim == 1) ? (temp_i - 1) % ni 
    264264                                : (temp_i - 1) ; 
     
    268268            if ((l >=lbegin && l<= lend) && 
    269269                (i >= 0 && i < ni) && 
    270                 (j >= 0 && j < nj) && (*mask)[i][j]) 
     270                (j >= 0 && j < nj) && mask(i,j)) 
    271271               indexCount++ ; 
    272272         } 
    273273      } 
    274274       
    275       ARRAY_ASSIGN(this->storeIndex[0] , int, 1, [indexCount]); 
    276       ARRAY_ASSIGN(this->out_l_index[0], int, 1, [indexCount]); 
    277       ARRAY_ASSIGN(this->out_i_index[0], int, 1, [indexCount]); 
    278       ARRAY_ASSIGN(this->out_j_index[0], int, 1, [indexCount]); 
    279        
    280       ARRAY_ASSIGN(storeIndex_client,int,1,[indexCount]); 
    281       ARRAY_ASSIGN(out_i_client,int,1,[indexCount]); 
    282       ARRAY_ASSIGN(out_j_client,int,1,[indexCount]); 
    283       ARRAY_ASSIGN(out_l_client,int,1,[indexCount]); 
     275      storeIndex[0]  = new CArray<int,1>(indexCount) ; 
     276      out_i_index[0] = new CArray<int,1>(indexCount) ; 
     277      out_j_index[0] = new CArray<int,1>(indexCount) ; 
     278      out_l_index[0] = new CArray<int,1>(indexCount) ; 
     279       
     280      storeIndex_client.resize(indexCount) ; 
     281      out_i_client.resize(indexCount) ; 
     282      out_j_client.resize(indexCount) ; 
     283      out_l_client.resize(indexCount) ; 
    284284       
    285285       
     
    288288         for(int n = 0, i = 0, j = 0; n < data_n_index; n++, count++) 
    289289         { 
    290             int temp_i = (*data_i_index)[n] + data_ibegin, 
     290            int temp_i = data_i_index(n) + data_ibegin, 
    291291                temp_j = (data_dim == 1) ? -1 
    292                        : (*data_j_index)[n] + data_jbegin; 
     292                       : data_j_index(n) + data_jbegin; 
    293293            i = (data_dim == 1) ? (temp_i - 1) % ni 
    294294                                : (temp_i - 1) ; 
     
    298298            if ((l >= lbegin && l <= lend) && 
    299299                (i >= 0 && i < ni) && 
    300                 (j >= 0 && j < nj) && (*mask)[i][j]) 
     300                (j >= 0 && j < nj) && mask(i,j)) 
    301301            { 
    302                (*this->storeIndex[0]) [indexCount] = count ; 
    303                (*this->out_l_index[0])[indexCount] = l ; 
    304                (*this->out_i_index[0])[indexCount] = i ; 
    305                (*this->out_j_index[0])[indexCount] = j ; 
     302               (*storeIndex[0])(indexCount) = count ; 
     303               (*out_l_index[0])(indexCount) = l ; 
     304               (*out_i_index[0])(indexCount) = i ; 
     305               (*out_j_index[0])(indexCount) = j ; 
    306306                
    307                (*storeIndex_client)[indexCount] = count ; 
    308                (*out_i_client)[indexCount]=i+domain->ibegin_client-1 ; 
    309                (*out_j_client)[indexCount]=j+domain->jbegin_client-1 ; 
    310                (*out_l_client)[indexCount]=l-lbegin ; 
     307               storeIndex_client(indexCount) = count ; 
     308               out_i_client(indexCount)=i+domain->ibegin_client-1 ; 
     309               out_j_client(indexCount)=j+domain->jbegin_client-1 ; 
     310               out_l_client(indexCount)=l-lbegin ; 
    311311               indexCount++ ; 
    312312            } 
     
    340340   //---------------------------------------------------------------- 
    341341 
    342    void CGrid::outputField(int rank, const ARRAY(double, 1) stored,  ARRAY(double, 3) field)  
    343    { 
    344       ARRAY(int,1) out_i=out_i_fromClient[rank] ; 
    345       ARRAY(int,1) out_j=out_j_fromClient[rank] ; 
    346       ARRAY(int,1) out_l=out_l_fromClient[rank] ; 
    347        
    348       for(StdSize n = 0; n < stored->num_elements(); n++) 
    349          (*field)[(*out_i)[n]][(*out_j)[n]][(*out_l)[n]] = (*stored)[n] ; 
    350    } 
    351  
    352    void CGrid::outputField(int rank, const ARRAY(double, 1) stored,  ARRAY(double, 2) field)  
    353    { 
    354       ARRAY(int,1) out_i=out_i_fromClient[rank] ; 
    355       ARRAY(int,1) out_j=out_j_fromClient[rank] ; 
    356  
    357        for(StdSize n = 0; n < stored->num_elements(); n++) 
    358          (*field)[(*out_i)[n]][(*out_j)[n]] = (*stored)[n] ; 
    359    } 
    360  
    361    //--------------------------------------------------------------- 
    362  
    363    void CGrid::outputField(int rank,const ARRAY(double, 1) stored,  ARRAY(double, 1) field) 
    364    { 
    365       ARRAY(int,1) out_i = out_i_fromClient[rank] ; 
    366       for(StdSize n = 0; n < stored->num_elements(); n++) 
    367          (*field)[(*out_i)[n]] = (*stored)[n] ; 
     342   void CGrid::outputField(int rank, const CArray<double, 1>& stored,  CArray<double, 3>& field)  
     343   { 
     344      CArray<int,1>& out_i=*out_i_fromClient[rank] ; 
     345      CArray<int,1>& out_j=*out_j_fromClient[rank] ; 
     346      CArray<int,1>& out_l=*out_l_fromClient[rank] ; 
     347       
     348      for(StdSize n = 0; n < stored.numElements(); n++) 
     349         field(out_i(n), out_j(n), out_l(n)) = stored(n) ; 
     350   } 
     351 
     352   void CGrid::outputField(int rank, const CArray<double, 1>& stored,  CArray<double, 2>& field)  
     353   { 
     354      CArray<int,1>& out_i=*out_i_fromClient[rank] ; 
     355      CArray<int,1>& out_j=*out_j_fromClient[rank] ; 
     356       
     357      for(StdSize n = 0; n < stored.numElements(); n++) 
     358         field(out_i(n), out_j(n)) = stored(n) ;   } 
     359 
     360   //--------------------------------------------------------------- 
     361 
     362   void CGrid::outputField(int rank,const CArray<double, 1>& stored,  CArray<double, 1>& field) 
     363   { 
     364      CArray<int,1>& out_i=*out_i_fromClient[rank] ; 
     365  
     366      for(StdSize n = 0; n < stored.numElements(); n++) 
     367         field(out_i(n)) = stored(n) ; 
    368368   } 
    369369 
     
    372372 
    373373   void CGrid::storeField_arr 
    374       (const double * const data, ARRAY(double, 1) stored) const 
    375    { 
    376       const StdSize size = (this->storeIndex_client)->num_elements() ; 
    377  
    378       stored->resize(boost::extents[size]) ; 
    379       for(StdSize i = 0; i < size; i++) 
    380          (*stored)[i] = data[(*storeIndex_client)[i]] ; 
     374      (const double * const data, CArray<double, 1>& stored) const 
     375   { 
     376      const StdSize size = storeIndex_client.numElements() ; 
     377 
     378      stored.resize(size) ; 
     379      for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client(i)] ; 
    381380   } 
    382381    
    383382   //--------------------------------------------------------------- 
    384     
    385    void CGrid::toBinary  (StdOStream & os) const 
    386    { 
    387       SuperClass::toBinary(os); 
    388       
    389       os.write (reinterpret_cast<const char*>(&this->isChecked), sizeof(bool));  
    390       
    391       if (this->isChecked) 
    392       { 
    393          this->storeIndex [0]->toBinary(os); 
    394          this->out_i_index[0]->toBinary(os); 
    395          this->out_j_index[0]->toBinary(os); 
    396          this->out_l_index[0]->toBinary(os); 
    397       } 
    398    } 
    399  
    400    //--------------------------------------------------------------- 
    401     
    402    void CGrid::fromBinary(StdIStream & is) 
    403    { 
    404       bool hasIndex = false; 
    405       SuperClass::fromBinary(is);             
    406       is.read (reinterpret_cast<char*>(&hasIndex), sizeof(bool));  
    407        
    408       if (hasIndex) 
    409       { 
    410          ARRAY_CREATE(storeIndex_ , int, 1, [0]); 
    411          ARRAY_CREATE(out_l_index_, int, 1, [0]); 
    412          ARRAY_CREATE(out_i_index_, int, 1, [0]); 
    413          ARRAY_CREATE(out_j_index_, int, 1, [0]); 
    414           
    415          storeIndex_ ->fromBinary(is); 
    416          out_i_index_->fromBinary(is); 
    417          out_j_index_->fromBinary(is); 
    418          out_l_index_->fromBinary(is); 
    419           
    420          this->storeIndex .push_back(storeIndex_); 
    421          this->out_i_index.push_back(out_i_index_); 
    422          this->out_j_index.push_back(out_j_index_); 
    423          this->out_l_index.push_back(out_l_index_); 
    424       } 
    425    } 
    426     
    427    //--------------------------------------------------------------- 
     383 
    428384  void CGrid::sendIndex(void) 
    429385  { 
     
    434390    int rank ; 
    435391    list<shared_ptr<CMessage> > list_msg ; 
    436     list<ARRAY(int,1) > list_out_i,list_out_j,list_out_l ; 
     392    list< CArray<int,1>* > list_out_i,list_out_j,list_out_l ; 
    437393      
    438394    for(int ns=0;ns<domain->connectedServer.size();ns++) 
     
    446402       int i,j ; 
    447403       int nb=0 ; 
    448        for(int k=0;k<storeIndex_client->num_elements();k++) 
     404       for(int k=0;k<storeIndex_client.numElements();k++) 
    449405       { 
    450          i=(*out_i_client)[k] ; 
    451          j=(*out_j_client)[k] ; 
     406         i=out_i_client(k) ; 
     407         j=out_j_client(k) ; 
    452408         if (i>=ib-1 && i<=ie-1 && j>=jb-1 && j<=je-1) nb++ ;  
    453409       } 
    454410        
    455        ARRAY_CREATE(storeIndex,int,1,[nb]) ; 
    456        ARRAY_CREATE(out_i,int,1,[nb]) ; 
    457        ARRAY_CREATE(out_j,int,1,[nb]) ; 
    458        ARRAY_CREATE(out_l,int,1,[nb]) ; 
     411       CArray<int,1> storeIndex(nb) ; 
     412       CArray<int,1> out_i(nb) ; 
     413       CArray<int,1> out_j(nb) ; 
     414       CArray<int,1> out_l(nb) ; 
     415  
    459416        
    460417       nb=0 ; 
    461        for(int k=0;k<storeIndex_client->num_elements();k++) 
     418       for(int k=0;k<storeIndex_client.numElements();k++) 
    462419       { 
    463          i=(*out_i_client)[k] ; 
    464          j=(*out_j_client)[k] ; 
     420         i=out_i_client(k) ; 
     421         j=out_j_client(k) ; 
    465422         if (i>=ib-1 && i<=ie-1 && j>=jb-1 && j<=je-1)  
    466423         { 
    467             (*storeIndex)[nb]=k ; 
    468             (*out_i)[nb]=(*out_i_client)[k] ; 
    469             (*out_j)[nb]=(*out_j_client)[k] ; 
    470             (*out_l)[nb]=(*out_l_client)[k] ; 
     424            storeIndex(nb)=k ; 
     425            out_i(nb)=out_i_client(k) ; 
     426            out_j(nb)=out_j_client(k) ; 
     427            out_l(nb)=out_l_client(k) ; 
    471428            nb++ ; 
    472429         } 
    473430       } 
    474431        
    475        storeIndex_toSrv.insert(pair<int,ARRAY(int,1) >(rank,storeIndex)) ; 
     432       storeIndex_toSrv.insert( pair<int,CArray<int,1>* >(rank,new CArray<int,1>(storeIndex) )) ; 
    476433       nbSenders.insert(pair<int,int>(rank,domain->nbSenders[ns])) ; 
    477434       list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 
    478        list_out_i.push_back(out_i) ; 
    479        list_out_j.push_back(out_j) ; 
    480        list_out_l.push_back(out_l) ; 
    481  
    482        *list_msg.back()<<getId()<<list_out_i.back()<<list_out_j.back()<<list_out_l.back() ; 
     435       list_out_i.push_back(new CArray<int,1>(out_i)) ; 
     436       list_out_j.push_back(new CArray<int,1>(out_j)) ; 
     437       list_out_l.push_back(new CArray<int,1>(out_l)) ; 
     438 
     439       *list_msg.back()<<getId()<<*list_out_i.back()<<*list_out_j.back()<<*list_out_l.back() ; 
    483440       event.push(rank,domain->nbSenders[ns],*list_msg.back()) ; 
    484441    } 
    485442    client->sendEvent(event) ; 
     443 
     444    for(list<CArray<int,1>* >::iterator it=list_out_i.begin();it!=list_out_i.end();it++) delete *it ; 
     445    for(list<CArray<int,1>* >::iterator it=list_out_j.begin();it!=list_out_j.end();it++) delete *it ; 
     446    for(list<CArray<int,1>* >::iterator it=list_out_l.begin();it!=list_out_l.end();it++) delete *it ; 
     447     
    486448  } 
    487449   
     
    501463  void CGrid::recvIndex(int rank, CBufferIn& buffer) 
    502464  { 
    503     ARRAY_CREATE(out_i,int,1,[0]) ; 
    504     ARRAY_CREATE(out_j,int,1,[0]) ; 
    505     ARRAY_CREATE(out_l,int,1,[0]) ; 
     465    CArray<int,1> out_i ; 
     466    CArray<int,1> out_j ; 
     467    CArray<int,1> out_l ; 
    506468     
    507469    buffer>>out_i>>out_j>>out_l ; 
    508     int offset ; 
    509470     
    510     offset=domain->zoom_ibegin_srv-1 ; 
    511     for(int k=0;k<out_i->num_elements();k++) (*out_i)[k]=(*out_i)[k]-offset ; 
     471    out_i -= domain->zoom_ibegin_srv-1 ; 
     472    out_j -= domain->zoom_jbegin_srv-1 ; 
    512473     
    513     offset=domain->zoom_jbegin_srv-1 ; 
    514     for(int k=0;k<out_i->num_elements();k++) (*out_j)[k]=(*out_j)[k]-offset ; 
    515      
    516     out_i_fromClient.insert(pair< int,ARRAY(int,1) >(rank,out_i)) ; 
    517     out_j_fromClient.insert(pair< int,ARRAY(int,1) >(rank,out_j)) ; 
    518     out_l_fromClient.insert(pair< int,ARRAY(int,1) >(rank,out_l)) ; 
     474    out_i_fromClient.insert(pair< int,CArray<int,1>* >(rank,new CArray<int,1>(out_i) )) ; 
     475    out_j_fromClient.insert(pair< int,CArray<int,1>* >(rank,new CArray<int,1>(out_j) )) ; 
     476    out_l_fromClient.insert(pair< int,CArray<int,1>* >(rank,new CArray<int,1>(out_l) )) ; 
    519477  } 
    520478 
     
    540498  } 
    541499 
    542  
    543 /* 
    544    void CGrid::computeIndexServer(void) 
    545    { 
    546       ARRAY(int, 2) local_mask =  this->domain->getLocalMask(); 
    547        
    548       const std::vector<int> & ibegin = this->domain->getIBeginSub(); 
    549       const std::vector<int> & jbegin = this->domain->getJBeginSub(); 
    550       const std::vector<int> & iend = this->domain->getIEndSub(); 
    551       const std::vector<int> & jend = this->domain->getJEndSub(); 
    552       const std::vector<int> & ibegin_zoom = this->domain->getIBeginZoomSub(); 
    553       const std::vector<int> & jbegin_zoom = this->domain->getJBeginZoomSub(); 
    554       const std::vector<int> & ni_zoom = this->domain->getNiZoomSub(); 
    555       const std::vector<int> & nj_zoom = this->domain->getNjZoomSub(); 
    556        
    557       const int ibegin_srv  = this->domain->ibegin.getValue(); 
    558       const int jbegin_srv  = this->domain->jbegin.getValue(); 
    559       const int iend_srv  = this->domain->iend.getValue(); 
    560       const int jend_srv  = this->domain->jend.getValue(); 
    561       const int zoom_ni_srv = this->domain->zoom_ni_loc.getValue(); 
    562       const int zoom_nj_srv = this->domain->zoom_nj_loc.getValue(); 
    563        
    564       const int ibegin_zoom_srv = this->domain->zoom_ibegin_loc.getValue(); 
    565       const int jbegin_zoom_srv = this->domain->zoom_jbegin_loc.getValue(); 
    566        const int iend_zoom_srv = ibegin_zoom_srv + zoom_ni_srv-1 ; 
    567       const int  jend_zoom_srv = jbegin_zoom_srv + zoom_nj_srv-1 ; 
    568          
    569       StdSize dn = 0;       
    570       for (StdSize j = 1; j < this->out_i_index.size(); j++) 
    571          dn += this->out_i_index[j]->size(); 
    572           
    573       ARRAY_CREATE(storeIndex_srv , int, 1, [dn]); 
    574       ARRAY_CREATE(out_i_index_srv, int, 1, [dn]); 
    575       ARRAY_CREATE(out_j_index_srv, int, 1, [dn]); 
    576       ARRAY_CREATE(out_l_index_srv, int, 1, [dn]); 
    577        
    578       for (StdSize i = 0, dn = 0; i < ibegin.size(); i++) 
    579       { 
    580          ARRAY(int, 1) storeIndex_cl   =  this->storeIndex [i + 1]; 
    581          ARRAY(int, 1) out_i_index_cl  =  this->out_i_index[i + 1]; 
    582          ARRAY(int, 1) out_j_index_cl  =  this->out_j_index[i + 1]; 
    583          ARRAY(int, 1) out_l_index_cl  =  this->out_l_index[i + 1]; 
    584                   
    585          int ibegin_zoom_cl = ibegin[i]; //ibegin_zoom[i]; 
    586          int jbegin_zoom_cl = jbegin[i]; //jbegin_zoom[i]; 
    587          int iend_zoom_cl = iend[i]; //ibegin_zoom[i]; 
    588          int jend_zoom_cl = jend[i]; //jbegin_zoom[i]; 
    589  
    590          int ibegin_cl = ibegin[i]; //ibegin[i]; 
    591          int jbegin_cl = jbegin[i]; //jbegin[i]; 
    592          int iend_cl = iend[i]; //ibegin[i]; 
    593          int jend_cl = jend[i]; //jbegin[i]; 
    594           
    595          if (ibegin_zoom.size() != 0) 
    596          { 
    597             ibegin_zoom_cl = ibegin_zoom[i]; 
    598             jbegin_zoom_cl = jbegin_zoom[i]; 
    599             iend_zoom_cl = ibegin_zoom[i]+ni_zoom[i]-1; 
    600             jend_zoom_cl = jbegin_zoom[i]+nj_zoom[i]-1; 
    601          } 
    602           
    603  
    604          if (comm::CMPIManager::IsClient()) 
    605          { 
    606            for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) 
    607            { 
    608               (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
    609  
    610               (*out_i_index_srv)[n] = (*out_i_index_cl)[m] + ibegin_cl - 1 - (ibegin_srv + ibegin_zoom_srv - 1) + 1 ; 
    611               (*out_j_index_srv)[n] = (*out_j_index_cl)[m] + jbegin_cl - 1 - (jbegin_srv + jbegin_zoom_srv - 1) + 1 ; 
    612               (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
    613            } 
    614          } 
    615          else 
    616          { 
    617            for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) 
    618            { 
    619               (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
    620             (*out_i_index_srv)[n] = (*out_i_index_cl)[m]  
    621                                    + (ibegin_cl - 1) - (ibegin_srv - 1) + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1); 
    622             (*out_j_index_srv)[n] = (*out_j_index_cl)[m] 
    623                                    + (jbegin_cl - 1) - (jbegin_srv - 1) + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 
    624             (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
    625            }          
    626              
    627          } 
    628                    
    629          dn += storeIndex_cl->size();  
    630       } 
    631        
    632       if (storeIndex_srv->size() != 0) 
    633       { 
    634          const int ibegin_t =  
    635             *std::min_element(out_i_index_srv->begin(), out_i_index_srv->end()); 
    636          const int iend_t   = 
    637             *std::max_element(out_i_index_srv->begin(), out_i_index_srv->end()); 
    638          const int jbegin_t =    
    639             *std::min_element(out_j_index_srv->begin(), out_j_index_srv->end()); 
    640          const int jend_t   = 
    641             *std::max_element(out_j_index_srv->begin(), out_j_index_srv->end()); 
    642                 
    643                                   
    644          if ((ibegin_t < 0) || (jbegin_t < 0) || 
    645              (iend_t >= zoom_ni_srv) || (jend_t >= zoom_nj_srv)) 
    646          { 
    647             ERROR("CGrid::computeIndexServer(void)", 
    648                   << "[ grille = "      << this->getId() 
    649                   << ", ibegin_t = "    << ibegin_t 
    650                   << ", jbegin_t = "    << jbegin_t 
    651                   << ", iend_t = "      << iend_t 
    652                   << ", jend_t = "      << jend_t 
    653                   << ", zoom_ni_srv = " << zoom_ni_srv 
    654                   << ", zoom_nj_srv = " << zoom_nj_srv 
    655                   << ", nb subdomain = "   << out_i_index.size()-1 
    656                   <<" ] Erreur d'indexation de la grille au niveau du serveur") ; 
    657          } 
    658       } 
    659  
    660       if (storeIndex_srv->size() != 0) 
    661          for (StdSize u = 0; u < storeIndex_srv->size(); u++) 
    662             (*local_mask)[(*out_i_index_srv)[u]][(*out_j_index_srv)[u]] = 1; 
    663  
    664 //      StdOFStream ofs(("log_server_"+this->getId()).c_str()); 
    665 //      for (StdSize h = 0; h < storeIndex_srv->size(); h++) 
    666 //      { 
    667 //        ofs << "(" << (*storeIndex_srv)[h]  << ";" 
    668 //            << (*out_i_index_srv)[h] << "," 
    669 //            << (*out_j_index_srv)[h] << "," 
    670 //            << (*out_l_index_srv)[h] << ")" << std::endl; 
    671 //      } 
    672 //       ofs.close(); 
    673     
    674       this->storeIndex [0] = storeIndex_srv ; 
    675       this->out_i_index[0] = out_i_index_srv; 
    676       this->out_j_index[0] = out_j_index_srv; 
    677       this->out_l_index[0] = out_l_index_srv;       
    678    } 
    679 */ 
    680     
    681    void CGrid::inputFieldServer 
    682          (const std::deque<ARRAY(double, 1)> storedClient, 
    683                            ARRAY(double, 1)  storedServer) const 
     500   void CGrid::inputFieldServer(const std::deque< CArray<double, 1>* > storedClient, CArray<double, 1>&  storedServer) const 
    684501   { 
    685502      if ((this->storeIndex.size()-1 ) != storedClient.size()) 
    686          ERROR("CGrid::inputFieldServer(...)", 
     503         ERROR("void CGrid::inputFieldServer(const std::deque< CArray<double, 1>* > storedClient, CArray<double, 1>&  storedServer) const", 
    687504                << "[ Nombre de tableau attendu = " << (this->storeIndex.size()-1) << ", " 
    688505                << "[ Nombre de tableau reçu = "    << storedClient.size() << "] " 
    689506                << "Les données d'un client sont manquantes !") ; 
    690       if (storedServer.get() != NULL) 
    691          storedServer->resize(boost::extents[this->storeIndex[0]->num_elements()]); 
    692       else  
    693          ARRAY_ASSIGN(storedServer, double, 1, [this->storeIndex[0]->num_elements()]); 
     507      storedServer.resize(storeIndex[0]->numElements()); 
    694508          
    695509      for (StdSize i = 0, n = 0; i < storedClient.size(); i++) 
    696          for (StdSize j = 0; j < storedClient[i]->num_elements(); j++) 
    697             (*storedServer)[n++] = (*storedClient[i])[j]; 
    698    } 
    699  
    700    void CGrid::outputFieldToServer(ARRAY(double, 1) fieldIn, int rank, ARRAY(double, 1) fieldOut) 
    701    { 
    702      ARRAY(int,1) index=storeIndex_toSrv[rank] ; 
    703      int nb=index->num_elements() ; 
    704      fieldOut->resize(extents[nb]) ; 
     510         for (StdSize j = 0; j < storedClient[i]->numElements(); j++) 
     511            storedServer(n++) = (*storedClient[i])(j); 
     512   } 
     513 
     514   void CGrid::outputFieldToServer(CArray<double,1>& fieldIn, int rank, CArray<double,1>& fieldOut) 
     515   { 
     516     CArray<int,1>& index = *storeIndex_toSrv[rank] ; 
     517     int nb=index.numElements() ; 
     518     fieldOut.resize(nb) ; 
    705519      
    706      for(int k=0;k<nb;k++) (*fieldOut)[k]=(*fieldIn)[(*index)[k]] ; 
     520     for(int k=0;k<nb;k++) fieldOut(k)=fieldIn(index(k)) ; 
    707521    } 
    708522   ///--------------------------------------------------------------- 
  • XIOS/trunk/src/node/grid.hpp

    r351 r369  
    99#include "domain.hpp" 
    1010#include "axis.hpp" 
     11#include "array_new.hpp" 
     12#include "attribute_array.hpp" 
    1113 
    1214namespace xios { 
     
    5456         void solveReference(void); 
    5557 
    56          virtual void toBinary  (StdOStream & os) const; 
    57          virtual void fromBinary(StdIStream & is); 
     58 //        virtual void toBinary  (StdOStream & os) const; 
     59//         virtual void fromBinary(StdIStream & is); 
    5860 
    5961         /// Tests /// 
     
    6365 
    6466         /// Accesseurs /// 
    65          const std::deque<ARRAY(int, 1)> & getStoreIndex(void) const; 
    66          const std::deque<ARRAY(int, 1)> & getOutIIndex(void)  const; 
    67          const std::deque<ARRAY(int, 1)> & getOutJIndex(void)  const; 
    68          const std::deque<ARRAY(int, 1)> & getOutLIndex(void)  const; 
     67         const std::deque< CArray<int, 1>* > & getStoreIndex(void) const; 
     68         const std::deque< CArray<int, 1>* > & getOutIIndex(void)  const; 
     69         const std::deque< CArray<int, 1>* > & getOutJIndex(void)  const; 
     70         const std::deque< CArray<int, 1>* > & getOutLIndex(void)  const; 
    6971 
    7072         const CAxis*   getRelAxis  (void) const; 
     
    8082 
    8183         /// Entrées-sorties de champs /// 
    82          template <StdSize n> 
    83             void inputField(const ARRAY(double, n) field, ARRAY(double, 1) stored) const; 
     84         template <int n> 
     85            void inputField(const CArray<double,n>& field, CArray<double,1>& stored) const; 
    8486             
    85          void inputFieldServer(const std::deque<ARRAY(double, 1)> storedClient, 
    86                                                 ARRAY(double, 1)  storedServer) const; 
    87 /* 
    88          template <StdSize n> 
    89             void outputField(const ARRAY(double, 1) stored,  ARRAY(double, n) field) const; 
    90 */ 
    91          void outputField(int rank, const ARRAY(double, 1) stored,  ARRAY(double, 3) field)  ; 
    92          void outputField(int rank, const ARRAY(double, 1) stored,  ARRAY(double, 2) field)  ; 
    93          void outputField(int rank,const ARRAY(double, 1) stored,  ARRAY(double, 1) field)  ;  
     87         void inputFieldServer(const std::deque< CArray<double, 1>* > storedClient, 
     88                               CArray<double, 1>&  storedServer) const; 
     89 
     90         void outputField(int rank, const CArray<double,1>& stored,  CArray<double,3>& field)  ; 
     91         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)  ;  
    9493    
    9594         /// Destructeur /// 
     
    111110 
    112111         /// Entrées-sorties de champs (interne) /// 
    113          void storeField_arr(const double * const data, ARRAY(double, 1) stored) const; 
     112         void storeField_arr(const double * const data, CArray<double,1>& stored) const; 
    114113 
    115114         /// Traitements protégés /// 
     
    120119 
    121120         static bool dispatchEvent(CEventServer& event) ; 
    122          void outputFieldToServer(ARRAY(double, 1) fieldIn, int rank, ARRAY(double, 1) fieldOut) ; 
     121         void outputFieldToServer(CArray<double,1>& fieldIn, int rank, CArray<double,1>& fieldOut) ; 
    123122         static void recvIndex(CEventServer& event) ; 
    124123         void recvIndex(int rank, CBufferIn& buffer) ; 
     
    134133         CDomain* domain ; 
    135134 
    136          std::deque<ARRAY(int, 1)> storeIndex ; 
    137          std::deque<ARRAY(int, 1)> out_i_index ; 
    138          std::deque<ARRAY(int, 1)> out_j_index ; 
    139          std::deque<ARRAY(int, 1)> out_l_index ; 
    140          ARRAY(int, 1) storeIndex_client ; 
    141          ARRAY(int, 1) out_i_client ; 
    142          ARRAY(int, 1) out_j_client ; 
    143          ARRAY(int, 1) out_l_client ; 
     135         std::deque< CArray<int, 1>* > storeIndex ; 
     136         std::deque< CArray<int, 1>* > out_i_index ; 
     137         std::deque< CArray<int, 1>* > out_j_index ; 
     138         std::deque< CArray<int, 1>* > out_l_index ; 
    144139          
    145          map<int,ARRAY(int, 1)>  storeIndex_toSrv ; 
     140        CArray<int, 1>  storeIndex_client ; 
     141        CArray<int, 1>  out_i_client ; 
     142        CArray<int, 1>  out_j_client ; 
     143        CArray<int, 1>  out_l_client ; 
     144          
     145         map<int, CArray<int, 1>* >  storeIndex_toSrv ; 
    146146         map<int,int> nbSenders ; 
    147147//         std::deque<ARRAY(int, 1)> out_i_toSrv ; 
     
    149149//         std::deque<ARRAY(int, 1)> out_l_toSrv ; 
    150150          
    151          map<int,ARRAY(int, 1)> out_i_fromClient ; 
    152          map<int,ARRAY(int, 1)> out_j_fromClient ; 
    153          map<int,ARRAY(int, 1)> out_l_fromClient ; 
     151         map<int, CArray<int, 1>* > out_i_fromClient ; 
     152         map<int, CArray<int, 1>* > out_j_fromClient ; 
     153         map<int, CArray<int, 1>* > out_l_fromClient ; 
    154154          
    155155   }; // class CGrid 
     
    157157   ///-------------------------------------------------------------- 
    158158 
    159    template <StdSize n> 
    160       void CGrid::inputField(const  ARRAY(double, n) field, ARRAY(double, 1) stored) const 
     159   template <int n> 
     160      void CGrid::inputField(const CArray<double,n>& field, CArray<double,1>& stored) const 
    161161   { 
    162       if (this->getDataSize() != field->num_elements()) 
    163          ERROR("CGrid::inputField(const  ARRAY(double, n) field, ARRAY(double, 1) stored)", 
     162      if (this->getDataSize() != field.numElements()) 
     163         ERROR("void CGrid::inputField(const  CArray<double,n>& field, CArray<double,1>& stored) const", 
    164164                << "[ Taille des données attendue = " << this->getDataSize()       << ", " 
    165                 << "Taille des données reçue = "      << field->num_elements() << " ] " 
     165                << "Taille des données reçue = "      << field.numElements() << " ] " 
    166166                << "Le tableau de données n'a pas la bonne taille !") ; 
    167       this->storeField_arr(field->data(), stored) ; 
     167      this->storeField_arr(field.dataFirst(), stored) ; 
    168168   } 
    169169 
  • XIOS/trunk/src/node/variable.cpp

    r352 r369  
    6060      return (oss.str()); 
    6161   } 
    62  
     62/* 
    6363   void CVariable::toBinary(StdOStream & os) const 
    6464   { 
     
    7979      is.read (const_cast<char *>(this->content.data()), size * sizeof(char)); 
    8080   } 
    81  
     81*/ 
    8282   void CVariableGroup::parse(xml::CXMLNode & node, bool withAttr) 
    8383   { 
  • XIOS/trunk/src/node/variable.hpp

    r352 r369  
    5555            virtual StdString toString(void) const; 
    5656 
    57             virtual void toBinary  (StdOStream & os) const; 
    58             virtual void fromBinary(StdIStream & is); 
     57//            virtual void toBinary  (StdOStream & os) const; 
     58//            virtual void fromBinary(StdIStream & is); 
    5959 
    6060            /// Accesseur /// 
     
    6767             
    6868            template <typename T, StdSize N> 
    69                inline void getData(ARRAY(T, N) _data_array) const; 
     69            inline void getData(CArray<T, N>& _data_array) const; 
    7070 
    7171         public : 
  • XIOS/trunk/src/object.cpp

    r335 r369  
    4040      this->IdDefined = true ; 
    4141   } 
    42  
     42/* 
    4343   bool CObject::operator==(const CObject & other) const 
    4444   { 
     
    5252      return (!(*this == other)); 
    5353   } 
    54  
     54*/ 
    5555   StdOStream & operator << (StdOStream & os, const CObject & object) 
    5656   {  
  • XIOS/trunk/src/object.hpp

    r335 r369  
    2727 
    2828         /// Opérateurs /// 
    29          bool operator==(const CObject & other) const; 
    30          bool operator!=(const CObject & other) const; 
     29//         bool operator==(const CObject & other) const; 
     30//         bool operator!=(const CObject & other) const; 
    3131 
    3232         /// Flux /// 
  • XIOS/trunk/src/object_template.hpp

    r347 r369  
    3838         virtual void fromString(const StdString & str); 
    3939 
    40          virtual void toBinary  (StdOStream & os) const; 
    41          virtual void fromBinary(StdIStream & is); 
     40//         virtual void toBinary  (StdOStream & os) const; 
     41//         virtual void fromBinary(StdIStream & is); 
    4242         virtual string getName(void) const ; 
    4343         virtual void parse(xml::CXMLNode & node); 
  • XIOS/trunk/src/object_template_impl.hpp

    r352 r369  
    9090    
    9191   //--------------------------------------------------------------- 
    92     
     92 
     93/*    
    9394   template <class T> 
    9495      void CObjectTemplate<T>::toBinary(StdOStream & os) const 
     
    102103      SuperClassMap::fromBinary(is);  
    103104   } 
    104     
     105*/ 
     106 
    105107   //--------------------------------------------------------------- 
    106108 
     
    321323     oss<<"#include \"icutil.hpp\""<<iendl ; 
    322324     oss<<"#include \"timer.hpp\""<<iendl ; 
     325     oss<<"#include \"node_type.hpp\""<<iendl ; 
    323326     oss<<iendl ; 
    324327     oss<<"extern \"C\""<<iendl ; 
  • XIOS/trunk/src/output/nc4_data_output.cpp

    r352 r369  
    7979                             ? StdString("lat").append(appendDomid).append("_local") 
    8080                             : latid; 
    81 // supress mask         StdString maskid    = StdString("mask_").append(domid).append("_local"); 
    82  
    83 // supress mask         ARRAY(int, 2) mask = domain->getLocalMask(); 
    84  
    85 //         unsigned int ssize = domain->zoom_ni_loc.getValue() * domain->zoom_nj_loc.getValue(); 
    86 //         bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize); 
     81 
    8782         bool isCurvilinear = true ; //for moment 
    8883 
     
    258253               SuperClassWriter::definition_end(); 
    259254                
    260                ARRAY(double,1) axis_value=axis->value.getValue() ; 
    261                ARRAY_CREATE(value,double,1,[zoom_size]) ; 
    262                for(StdSize i = 0 ; i < zoom_size ; i++) (*value)[i]=(*axis_value)[i+zoom_begin] ; 
    263                SuperClassWriter::writeData(value, axisid, isCollective, 0); 
     255               CArray<double,1> axis_value(zoom_size) ; 
     256               for(StdSize i = 0 ; i < zoom_size ; i++) axis_value(i)=axis->value(i+zoom_begin) ; 
     257               SuperClassWriter::writeData(axis_value, axisid, isCollective, 0); 
    264258                
    265259               SuperClassWriter::definition_start(); 
     
    488482             << "_" << field->getRelFile()->output_freq.getValue(); 
    489483              
    490  //        ARRAY(double, 1) field_data = field->data_srv; 
    491          ARRAY_CREATE(time_data, double, 1, [1]); 
    492          if (field->operation.getValue()=="instant") (*time_data)[0] = Time(*field->last_Write_srv) 
     484         CArray<double,1> time_data(1) ; 
     485         if (field->operation.getValue()=="instant") time_data(0) = Time(*field->last_Write_srv) 
    493486                                                                      -Time(context->calendar->getTimeOrigin()); 
    494          else (*time_data)[0] = (Time(*field->last_Write_srv)+Time(*field->lastlast_Write_srv))/2 
     487         else time_data(0) = (Time(*field->last_Write_srv)+Time(*field->lastlast_Write_srv))/2 
    495488                               -Time(context->calendar->getTimeOrigin()); 
    496489            
     
    498491         { 
    499492            CAxis* axis = grid->axis ; 
    500             ARRAY_CREATE(field_data3D,double,3,[domain->zoom_ni_srv][domain->zoom_nj_srv][axis->zoom_size.getValue()]) ; 
     493            CArray<double,3> field_data3D(domain->zoom_ni_srv,domain->zoom_nj_srv,axis->zoom_size) ; 
    501494            field->outputField(field_data3D); 
    502495            switch (SuperClass::type) 
     
    532525         else // 2D 
    533526         { 
    534             ARRAY_CREATE(field_data2D,double,2,[domain->zoom_ni_srv][domain->zoom_nj_srv]) ; 
     527            CArray<double,2> field_data2D(domain->zoom_ni_srv,domain->zoom_nj_srv) ; 
    535528            field->outputField(field_data2D); 
    536529            switch (SuperClass::type) 
  • XIOS/trunk/src/output/nc4_data_output.hpp

    r352 r369  
    8181                                     const StdString & units, 
    8282                                     const StdString & nav_model); 
    83 /* 
    84             template <class T> 
    85                void writeAxisData(const StdString & axis_name, 
    86                                   const ARRAY(T, 1) data, 
    87                                   bool collective, StdSize record, 
    88                                   const std::vector<StdSize> * start = NULL, 
    89                                   const std::vector<StdSize> * count = NULL); 
    90 */ 
     83 
    9184         private : 
    9285 
  • XIOS/trunk/src/output/onetcdf4.cpp

    r354 r369  
    358358         void CONetCDF4::writeData_(int grpid, int varid, 
    359359                                    const std::vector<StdSize> & sstart, 
    360                                     const std::vector<StdSize> & scount, double * data) 
     360                                    const std::vector<StdSize> & scount, const double * data) 
    361361      { 
    362362         cout<<"writeData_"<<endl ; 
     
    375375         void CONetCDF4::writeData_(int grpid, int varid, 
    376376                                    const std::vector<StdSize> & sstart, 
    377                                     const std::vector<StdSize> & scount, int * data) 
     377                                    const std::vector<StdSize> & scount, const int * data) 
    378378      { 
    379379          CheckError(nc_put_vara_int(grpid, varid, &(sstart[0]), &(scount[0]), data)); 
     
    386386         void CONetCDF4::writeData_(int grpid, int varid, 
    387387                                    const std::vector<StdSize> & sstart, 
    388                                     const std::vector<StdSize> & scount, float * data) 
     388                                    const std::vector<StdSize> & scount, const float * data) 
    389389      { 
    390390          CheckError(nc_put_vara_float(grpid, varid, &(sstart[0]), &(scount[0]), data)); 
     
    394394      //--------------------------------------------------------------- 
    395395 
    396       void CONetCDF4::writeData(const ARRAY(int, 2) data, const StdString & name) 
     396      void CONetCDF4::writeData(const CArray<int, 2>& data, const StdString & name) 
    397397      { 
    398398         int grpid = this->getCurrentGroup(); 
     
    402402 
    403403         this->getWriteDataInfos(name, 0, array_size,  sstart, scount, NULL, NULL); 
    404          this->writeData_(grpid, varid, sstart, scount, data->data()); 
     404         this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 
    405405      } 
    406406 
  • XIOS/trunk/src/output/onetcdf4.hpp

    r354 r369  
    55#include "xmlioserver_spl.hpp" 
    66#include "exception.hpp" 
    7 #include "array.hpp" 
    87#include "data_output.hpp" 
     8#include "array_new.hpp" 
    99 
    1010#include <mpi.h> 
     
    6666 
    6767            /// Ecriture des données /// 
    68             template <class T, StdSize ndim> 
    69                void writeData(const ARRAY(T, ndim) data, const StdString & name, 
     68            template <class T, int ndim> 
     69               void writeData(const CArray<T,ndim>& data, const StdString & name, 
    7070                              bool collective, StdSize record, 
    7171                              const std::vector<StdSize> * start = NULL, 
    7272                              const std::vector<StdSize> * count = NULL); 
    7373 
    74             void writeData(const ARRAY(int, 2) data, const StdString & name); 
     74            void writeData(const CArray<int, 2>& data, const StdString & name); 
    7575 
    7676            /// Accesseur /// 
  • XIOS/trunk/src/output/onetcdf4_decl.cpp

    r352 r369  
    44{ 
    55# define  macro(type,size) \ 
    6   template void CONetCDF4::writeData<type,size>(const ARRAY(type, size) data, const StdString & name, \ 
     6  template void CONetCDF4::writeData<type,size>(const CArray<type, size>& data, const StdString & name, \ 
    77                                               bool collective, StdSize record, \ 
    88                                               const std::vector<StdSize> * start, \ 
  • XIOS/trunk/src/output/onetcdf4_impl.hpp

    r354 r369  
    66namespace xios 
    77{ 
    8   template <class T, StdSize ndim> 
    9   void CONetCDF4::writeData(const ARRAY(T, ndim) data, const StdString & name, 
     8  template <class T, int ndim> 
     9  void CONetCDF4::writeData(const CArray<T, ndim>& data, const StdString & name, 
    1010                            bool collective, StdSize record, 
    1111                            const std::vector<StdSize> * start, 
     
    2424    this->getWriteDataInfos 
    2525    (name, record, array_size,  sstart, scount, start, count); 
    26     if (data->num_elements() != array_size) 
     26    if (data.numElements() != array_size) 
    2727    { 
    2828      ERROR("CONetCDF4::writeData(...)", 
    29       << "[ input array size = "  << data->num_elements() 
     29      << "[ input array size = "  << data.numElements() 
    3030      << ", intern array size = " << array_size 
    3131      << " ] Invalid input data !" ); 
    3232    } 
    3333          
    34     this->writeData_(grpid, varid, sstart, scount, data->data()); 
     34    this->writeData_(grpid, varid, sstart, scount, data.dataFirst()); 
    3535  } 
    3636       
     
    5757 
    5858 
    59  
    60  
    61  
    62  
    63  
    64  
    65  
    66  
    67  
    6859#endif 
  • XIOS/trunk/src/test/test.cpp

    r343 r369  
    88#include "date.hpp" 
    99#include "calendar_util.hpp" 
     10//#include "test_enum.hpp" 
     11#include "type.hpp" 
     12//#include "axis.hpp" 
     13//#include "field.hpp" 
     14#include "declare_attribute.hpp" 
     15#include "attribute_map.hpp" 
     16#include "array_new.hpp" 
     17#include "attribute_array.hpp" 
     18#include "attribute_array_impl.hpp" 
     19 
     20 
    1021 
    1122using namespace std ; 
     
    1324using namespace boost::gregorian ; 
    1425using namespace xios; 
     26using namespace blitz; 
     27 
     28  class CEnum_color 
     29  { 
     30    public: 
     31    enum t_enum { rouge=0, vert, bleu} ; 
     32    static const char** getStr(void) { static const char * enumStr[] = { "rouge", "vert", "bleu" } ; return enumStr ; }    
     33    int getSize(void) { return 3 ; }    
     34  } ; 
     35 
     36#include "enum.hpp" 
     37#include "enum_impl.hpp" 
     38#include "enum_ref_impl.hpp" 
     39#include "attribute_enum.hpp" 
     40#include "attribute_enum_impl.hpp" 
     41 
     42template class CEnum<CEnum_color> ; 
     43template class CAttributeEnum<CEnum_color> ; 
     44 
    1545 
    1646int main(void) 
     
    1848//      ptime t(time_from_string("2012-02-30 15:24")) ; 
    1949//      std::cout << to_simple_string(t) << std::endl; 
    20       CGregorianCalendar MyCalendar("2011-03-01 00:00") ; 
    21       cout<<MyCalendar.getInitDate()<<endl; 
    22       cout<<MyCalendar.getCurrentDate()<<endl ; 
    23       cout<<MyCalendar.getCurrentDate()-1*Day<<endl ; 
     50  CGregorianCalendar MyCalendar("2011-03-01 00:00") ; 
     51  cout<<MyCalendar.getInitDate()<<endl; 
     52  cout<<MyCalendar.getCurrentDate()<<endl ; 
     53  cout<<MyCalendar.getCurrentDate()-1*Day<<endl ; 
     54       
     55  //CEnum<CEnum_color> MyEnum ; 
     56  //MyEnum.val=CEnum<CEnum_color>::rouge ; 
     57   
     58  CEnum_color::t_enum y; 
     59   
     60  CType<int> a(10) ; 
     61  CType<int> b ; 
     62   
     63  a=5 ; 
     64  b=10.5 ; 
     65  a=a+b ; 
     66  cout<<a<<endl ; 
     67  if (a==5) cout<<"a que coucou"<<endl ; 
     68  else if (a!=5) cout<<"a que pas coucou"<<endl ; 
     69   
     70  CType_ref<int> c(a); 
     71  cout<<c<<endl ; 
     72  a=3 ; 
     73  cout<<c<<endl ; 
     74//  c=b ; 
     75  cout<<c<<endl ; 
     76  b=4 ; 
     77  cout<<c<<endl ; 
     78  c.set_ref(b) ; 
     79  cout<<c<<endl ; 
     80  int x=c+c+a ; 
     81  cout<<x<<endl ; 
     82  
     83//  test::CAttributeTemplate<int> xx("toto") ; 
     84//  test::totoatt toto ; 
     85//  test::titiatt titi ; 
     86//  CAxis A ; 
     87//  CTest A ; 
     88//  CAxis B ; 
     89//    CField A ; 
     90//    cout<<xx.size()<<endl ; 
     91 
     92  CEnum<CEnum_color> color,color1 ; 
     93  color=CEnum<CEnum_color>::rouge ; 
     94  color1=color ; 
     95   
     96  if (color1==CEnum<CEnum_color>::rouge) cout<<"Rouge !!"<<endl ; 
     97  if (color1==color) cout<<"Rouge !!"<<endl ; 
     98  color=CEnum<CEnum_color>::bleu ; 
     99  
     100  if (color1==color) cout<<"Rouge !!"<<endl ; 
     101   
     102  cout<<color1.toString()<<endl ; 
     103  color1.fromString("vert ") ; 
     104  cout<<color1.toString()<<endl ; 
     105  
     106//  color1.fromString("jaune") ; 
     107  cout<<color1.toString()<<endl ; 
     108  cout<<sizeof(CEnum_color::t_enum)<<endl ;  
     109   
     110  CEnum_color::t_enum tt ; 
     111  tt=(CEnum_color::t_enum)1 ; 
     112  int ii=tt ; 
     113  cout<<ii<<endl ; 
     114   
     115  CAttributeEnum<CEnum_color> toto("toto",CEnum_color::rouge) ; 
     116  CAttributeEnum<CEnum_color> titi("titi",CEnum_color::vert) ; 
     117  cout<<toto.toString()<<endl ; 
     118  toto.fromString(" vert  ") ; 
     119  cout<<toto.toString()<<endl ; 
     120 
     121  tt=toto ; 
     122  cout<<tt<<endl ; 
     123  cout<<titi.toString()<<endl ; 
     124   
     125  if (titi==toto) cout<<"titi==toto"<<endl ; 
     126  else cout<<"titi!=toto"<<endl ; 
     127  titi=CEnum_color::rouge ; 
     128  if (titi==toto) cout<<"titi==toto"<<endl ; 
     129  else cout<<"titi!=toto"<<endl ; 
     130 
     131  CArray<int,2> A(2,2) ; 
     132  CArray<int,2> B(2,2) ; 
     133  A=1,2,3,4 ; 
     134  B = 1 ; 
     135  B+=A ; 
     136  cout<<B.toString()<<endl ; 
     137  cout<<A.toString()<<endl ; 
     138  string str="(0,1) x (0,1) [4 3 2 1]" ; 
     139  CArray<int,2> C ; 
     140  CBufferOut out(B.size()) ; 
     141   
     142  B.toBuffer(out) ; 
     143   
     144  CBufferIn in(out.begin,B.size()) ; 
     145  C.fromBuffer(in) ; 
     146   
     147  cout<<C<<endl ;  
     148   
     149  CAttributeArray<int,2> attr("toto") ; 
     150  attr.resize(2,2) ; 
     151  attr=C ; 
     152  cout<<"attr "<<attr<<endl ; 
     153  cout<<attr.toString()<<endl ; 
    24154  return 1 ;   
    25155} 
  • XIOS/trunk/src/test/test_cs.f90

    r351 r369  
    1010  CALL MPI_COMM_SIZE(MPI_COMM_WORLD,size,ierr) 
    1111   
    12   IF (rank<8) THEN 
    13    CALL client("client",rank,8) 
     12  IF (rank<7) THEN 
     13   CALL client("client",rank,7) 
    1414  ELSE  
    1515    CALL server 
     
    9090  CALL xios_set_axis_attr("axis_A",size=llm ,value=lval) ; 
    9191  CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj) 
    92   !CALL xios_set_domain_attr("domain_A",zoom_ni=3,zoom_ibegin=3,zoom_nj=3,zoom_jbegin=6) 
     92!  CALL xios_set_domain_attr("domain_A",zoom_ni=10,zoom_ibegin=5,zoom_nj=20,zoom_jbegin=10) 
    9393  CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4) 
    9494  CALL xios_set_domain_attr("domain_A",lonvalue=RESHAPE(lon,(/ni*nj/)),latvalue=RESHAPE(lat,(/ni*nj/))) 
  • XIOS/trunk/src/test/test_xios.cpp

    r352 r369  
    1111#include "context_server.hpp" 
    1212#include "object_template.hpp" 
     13#include "array_new.hpp" 
    1314#include <mpi.h> 
    1415 
     
    2728   CBufferIn  bufferIn(&buff,sizeof(buff)) ; 
    2829   CMessage msg ; 
    29 /* 
    30    msg<<(int)3<<(int)2<<(int)1<<str ; 
    31 //   msg<<a<<b<<c ; 
    32    std::cout<<"message size : "<<msg.size()<<std::endl ; 
    33    str="turlututu" ; 
    34    bufferOut<<msg ; 
    35    msg.clear() ; 
    36    msg<<a<<b<<c<<str ; 
    37 //   bufferIn>>c>>b>>a>>str ; 
    38    bufferIn>>msg ; 
    39    std::cout<<a<<"  "<<b<<"  "<<c<<"  "<<str<<endl ; 
    40 */ 
    41 //   CAttributeTemplate<ARRAY(double,1)> tabIn ; 
    42  //  CAttributeTemplate<ARRAY(double,1)> tabOut ; 
    43    CAttributeTemplate<ARRAY(double,1)> tabIn("in") ; 
    44    CAttributeTemplate<ARRAY(double,1)> tabOut("out") ; 
    4530 
    46    ARRAY_CREATE(tab,double,1,[5]) ;  
    47  //   tab->resize(extents[5]) ; 
    48     (*tab)[0]=0 ; (*tab)[1]=1 ;(*tab)[2]=2 ; (*tab)[3]=3 ;(*tab)[4]=4 ; 
     31   CAttributeArray<double,1> tabIn("in") ; 
     32   CAttributeArray<double,1> tabOut("out") ; 
     33 
     34   CArray<double,1> tab(5) 
     35    tab=0,1,2,3,4 ; 
    4936    tabIn=tab ; 
    50     (*tab)[0]=4 ; (*tab)[1]=3 ;(*tab)[2]=2 ; (*tab)[3]=1 ;(*tab)[4]=0 ; 
     37    tab= 4,3,2,1,0 
    5138    tabOut=tab ; 
    5239//   tabOut=1 ; 
  • XIOS/trunk/src/type/base_type.hpp

    r335 r369  
    1313    public: 
    1414     
    15     CBaseType(void) ; 
    16     virtual void fromString(const string& str) ; 
    17     virtual string toString(void) const; 
     15    CBaseType(void) {} 
     16    virtual ~CBaseType() {} 
     17    virtual void fromString(const string& str) =0 ; 
     18    virtual string toString(void) const =0; 
    1819     
    19     virtual bool fromBuffer(CBufferIn& buffer) ; 
    20     virtual bool toBuffer(CBufferOut& buffer) const; 
    21     virtual CBaseType* duplicate(void) const; 
    22     virtual CBaseType* duplicate(void) ; 
    23     virtual void destroy(void) ; 
    24     virtual size_t size(void) const; 
     20    virtual bool fromBuffer(CBufferIn& buffer) =0; 
     21    virtual bool toBuffer(CBufferOut& buffer) const =0; 
     22    virtual CBaseType* clone(void) const =0; 
     23    virtual size_t size(void) const =0; 
     24    virtual bool isEmpty(void) const =0; 
     25    virtual void reset(void) =0; 
    2526  } ; 
    2627 
  • XIOS/trunk/src/type/message.cpp

    r335 r369  
    1212   CMessage& CMessage::push(const CBaseType& type) 
    1313   { 
    14      typeList.push_back(type.duplicate()); 
     14     typeList.push_back(type.clone()); 
    1515     return *this ; 
    1616   } 
    1717    
    18     CMessage& CMessage::push(CBaseType& type) 
    19    { 
    20      typeList.push_back(&type); 
    21      return *this ; 
    22    } 
     18//    CMessage& CMessage::push(CBaseType& type) 
     19//   { 
     20//     typeList.push_back(&type); 
     21//     return *this ; 
     22//   } 
    2323    
    2424   size_t CMessage::size(void) const 
     
    6666    { 
    6767      list<CBaseType*>::iterator it;  
    68       for(it=typeList.begin();it!=typeList.end();it++) (*it)->destroy() ; 
     68      for(it=typeList.begin();it!=typeList.end();it++) delete *it ; 
    6969      typeList.clear() ; 
    7070    } 
     
    9797  } 
    9898 
    99   CMessage& operator<<(CMessage& msg, const CBaseType&  type) 
    100   { 
    101     msg.push(*type.duplicate()) ; 
    102     return msg ; 
    103   }  
     99//  CMessage& operator<<(CMessage& msg, const CBaseType&  type) 
     100//  { 
     101//    msg.push(*type.clone()) ; 
     102//    return msg ; 
     103//  }  
    104104   
    105105} 
  • XIOS/trunk/src/type/message.hpp

    r335 r369  
    1212{ 
    1313 
    14   class CMessage : public CBaseType  
     14  class CMessage 
    1515  { 
    1616    public: 
     
    2323   
    2424    CMessage& push(const CBaseType& type) ;  
    25     CMessage& push(CBaseType& type) ; 
     25//    CMessage& push(CBaseType& type) ; 
    2626    void clear(void) ;   
    2727    ~CMessage() ;     
     
    3131  CBufferIn& operator>>(CBufferIn& buffer, CMessage& msg) ; 
    3232 
    33   CMessage& operator<<(CMessage& msg,CBaseType& type) ; 
     33//  CMessage& operator<<(CMessage& msg,CBaseType& type) ; 
    3434  CMessage& operator<<(CMessage& msg,const CBaseType& type) ; 
    3535  
  • XIOS/trunk/src/type/type.hpp

    r352 r369  
    1212{ 
    1313 
     14  template <typename T> class CType_ref ; 
     15     
    1416  template <typename T>  
    15   class CType : public CBaseType 
     17  class CType : public  virtual CBaseType 
    1618  { 
    1719    public: 
     
    1921    CType(void) ; 
    2022    CType(const T& val) ; 
    21     CType(T& val) ; 
    2223    CType(const CType& type) ; 
     24    CType(const CType_ref<T>& type) ; 
     25    virtual ~CType() { _reset() ; } 
    2326 
    24     ~CType() {} ; 
     27    T& get(void) ; 
     28    const T& get(void) const; 
    2529 
    26     void fromString(const string& str) ; 
    27     string toString(void) const; 
     30    void set(const T& val) ; 
     31    void set(const CType& val) ; 
     32    void set(const CType_ref<T>& val) ; 
     33    CType& operator = (const T& val) ; 
     34    CType& operator = (const CType& val) ; 
     35    CType& operator = (const CType_ref<T>& val) ; 
     36    operator T&() ; 
    2837     
    29     bool fromBuffer(CBufferIn& buffer) ; 
    30     bool toBuffer(CBufferOut& buffer) const; 
    31     void destroy(void) ; 
     38    virtual CType* clone(void) const   { return _clone(); } 
     39    virtual void fromString(const string& str)   { _fromString(str); } 
     40    virtual string toString(void) const { return _toString(); } 
     41    virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer) ; } 
     42    virtual bool toBuffer(CBufferOut& buffer) const { return _toBuffer(buffer); } 
     43    virtual void reset(void) { _reset(); } 
     44    virtual bool isEmpty() const { return _isEmpty(); }  
     45    virtual size_t size(void) const { return _size(); } 
    3246     
    33     size_t size(void) const; 
    34     CBaseType* duplicate(void) const;   
    35  
    36     void checkAccess(void) const; 
     47    void allocate(void) ; 
     48    void checkEmpty(void) const; 
     49        
    3750    T* ptrValue ; 
    38      
    39     bool clone ; 
    40     T value ;  
     51    bool empty ; 
     52       
     53    friend class CType_ref<T> ;  
     54  
     55    private : 
     56  
     57    CType* _clone(void) const; 
     58    void _fromString(const string& str) ; 
     59    string _toString(void) const; 
     60    bool _fromBuffer(CBufferIn& buffer) ; 
     61    bool _toBuffer(CBufferOut& buffer) const; 
     62    void _reset(void) ; 
     63    bool _isEmpty() const ;   
     64    size_t _size(void) const ; 
     65  
    4166  } ; 
    4267 
     68 
     69  template<typename T> class CType ; 
     70     
     71  template <typename T>  
     72  class CType_ref : public virtual CBaseType 
     73  { 
     74    public: 
     75   
     76    CType_ref(void) ; 
     77    CType_ref(T& val) ; 
     78    CType_ref(CType<T>& type) ; 
     79    CType_ref(const CType_ref& type) ; 
     80    virtual ~CType_ref() {}; 
     81 
     82    T& get(void) const; 
     83 
     84    void set(const T& val) const ; 
     85    void set(const CType<T>& val) const ; 
     86    void set(const CType_ref& val) const ; 
     87 
     88    void set_ref(T& val) ; 
     89    void set_ref(CType<T>& val) ; 
     90    void set_ref(const CType_ref& val) ; 
     91     
     92    const CType_ref& operator = (T& val) const ; 
     93    const CType_ref& operator = (CType<T>& val) const ; 
     94    const CType_ref& operator = (const CType_ref& val) const; 
     95    operator T&() const; 
     96 
     97    virtual CType_ref* clone(void) const   { return _clone(); } 
     98    virtual void fromString(const string& str)   { _fromString(str); } 
     99    virtual void fromString(const string& str) const  { _fromString(str); } 
     100    virtual string toString(void) const { return _toString(); } 
     101    virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer) ; } 
     102    virtual bool fromBuffer(CBufferIn& buffer) const { return _fromBuffer(buffer); } 
     103    virtual bool toBuffer(CBufferOut& buffer) const { return _toBuffer(buffer); } 
     104    virtual void reset(void) { _reset(); } 
     105    virtual bool isEmpty() const { return _isEmpty(); }  
     106    virtual size_t size(void) const { return _size(); } 
     107 
     108    void checkEmpty(void) const; 
     109     
     110 
     111    T mutable * ptrValue ; 
     112    bool empty ; 
     113    friend class CType<T> ; 
     114     
     115    private : 
     116     
     117    CType_ref* _clone(void) const; 
     118    void _fromString(const string& str) ; 
     119    void _fromString(const string& str) const; 
     120    string _toString(void) const; 
     121    bool _fromBuffer(CBufferIn& buffer) ; 
     122    bool _fromBuffer(CBufferIn& buffer) const ; 
     123    bool _toBuffer(CBufferOut& buffer) const; 
     124    void _reset(void) ; 
     125    bool _isEmpty() const ;   
     126    size_t _size(void) const ; 
     127  } ; 
     128   
     129   
    43130  class CMessage ; 
    44131   
    45132  template <typename T> 
    46133  CBufferOut& operator<<(CBufferOut& buffer, const CType<T>& type) ; 
    47    
    48134 
    49135  template <typename T> 
    50   CBufferOut& operator<<(CBufferOut& buffer, T& type) ; 
     136  CBufferOut& operator<<(CBufferOut& buffer, const CType_ref<T>& type) ; 
    51137   
    52138  template <typename T> 
     
    54140   
    55141  template <typename T> 
    56   CBufferIn& operator>>(CBufferIn& buffer, const CType<T>& type) ; 
    57    
    58   template <typename T> 
    59   CBufferIn& operator>>(CBufferIn& buffer, T& type) ; 
    60    
     142  CBufferOut& operator<<(CBufferOut& buffer, T& type) ; 
    61143 
    62144 
    63145  template <typename T> 
     146  CBufferIn& operator>>(CBufferIn& buffer, CType<T>& type) ; 
     147 
     148  template <typename T> 
     149  CBufferIn& operator>>(CBufferIn& buffer, const CType_ref<T>& type) ; 
     150 
     151  template <typename T> 
     152  CBufferIn& operator>>(CBufferIn& buffer, T& type) ; 
     153 
     154  template <typename T> 
    64155  CMessage& operator<<(CMessage& msg, const CType<T>& type) ; 
     156 
     157  template <typename T> 
     158  CMessage& operator<<(CMessage& msg, const CType_ref<T>& type) ; 
    65159   
    66   template <typename T> 
    67   CMessage& operator<<(CMessage& msg,CType<T>& type) ; 
    68160   
    69161  template <typename T> 
    70162  CMessage& operator<<(CMessage& msg, const T& type) ; 
    71    
     163 
    72164  template <typename T> 
    73165  CMessage& operator<<(CMessage& msg, T& type) ; 
    74    
     166 
    75167} 
    76168 
    77169 
    78 //#include "type_impl.hpp" 
    79 //#include "type_specialisation.hpp" 
     170//#include "test_type_impl.hpp" 
     171//#include "test_type_specialisation.hpp" 
    80172 
    81173#endif 
     174 
  • XIOS/trunk/src/type/type_decl.cpp

    r352 r369  
     1#include "type.hpp" 
    12#include "type_impl.hpp" 
     3#include "type_ref_impl.hpp" 
    24#include "type_specialisation.hpp" 
    35#include <string> ; 
     
    810#define macro(decl_type)         \ 
    911  template class CType<decl_type> ; \ 
     12  template class CType_ref<decl_type> ; \ 
    1013  template CBufferOut& operator<< <decl_type> (CBufferOut& buffer, const CType<decl_type>& type) ; \ 
     14  template CBufferOut& operator<< <decl_type> (CBufferOut& buffer, const CType_ref<decl_type>& type) ; \ 
    1115  template CBufferOut& operator<< <decl_type> (CBufferOut& buffer, decl_type& type) ; \ 
    1216  template CBufferOut& operator<< <decl_type> (CBufferOut& buffer, const decl_type& type) ; \ 
    13   template CBufferIn& operator>> <decl_type> (CBufferIn& buffer, const CType<decl_type>& type) ; \ 
     17  template CBufferIn& operator>> <decl_type> (CBufferIn& buffer, CType<decl_type>& type) ; \ 
     18  template CBufferIn& operator>> <decl_type> (CBufferIn& buffer, const CType_ref<decl_type>& type) ; \ 
    1419  template CBufferIn& operator>> <decl_type> (CBufferIn& buffer, decl_type& type) ; \ 
    1520  template CMessage& operator<< <decl_type> (CMessage& msg, const CType<decl_type>& type) ;\ 
    16   template CMessage& operator<< <decl_type> (CMessage& msg,CType<decl_type>& type) ; \ 
     21  template CMessage& operator<< <decl_type> (CMessage& msg, const CType_ref<decl_type>& type) ; \ 
    1722  template CMessage& operator<< <decl_type> (CMessage& msg, const decl_type& type) ; \ 
    1823  template CMessage& operator<< <decl_type> (CMessage& msg, decl_type& type) ; 
     
    2328  macro(bool)   
    2429  macro(StdSize)  
    25   macro(ARRAY(double,1))  
    26   macro(ARRAY(int,1))  
    27   macro(ARRAY(bool,2)) 
     30 
    2831} 
  • XIOS/trunk/src/type/type_impl.hpp

    r352 r369  
    77#include "buffer_out.hpp" 
    88#include "message.hpp" 
    9 #include "type.hpp" 
     9 
    1010 
    1111 
     
    1313namespace xios 
    1414{ 
     15  
    1516  using namespace std; 
    1617   
    1718  template <typename T> 
     19  CType<T>::CType(void) 
     20  { 
     21    empty=true ; 
     22  } 
     23     
     24  template <typename T> 
    1825  CType<T>::CType(const T& val) 
    1926  { 
    20     value=val ; 
    21     ptrValue=&value ; 
    22     clone=false ; 
    23   } 
    24    
    25   template <typename T> 
    26   CType<T>::CType(T& val) 
    27   { 
    28     ptrValue=&val ; 
    29     clone=false ; 
    30   } 
    31  
     27    empty=true ; 
     28    set(val) ; 
     29  } 
     30   
    3231  template <typename T> 
    3332  CType<T>::CType(const CType<T>& type) 
    3433  { 
    35     if (type.ptrValue==&type.value) 
    36     { 
    37        value=type.value ; 
    38        ptrValue=&value ; 
    39     } 
    40     else  
    41     { 
    42       ptrValue=type.ptrValue ; 
    43     } 
    44   } 
    45    
    46  
    47    
    48   template <typename T> 
    49   void CType<T>::fromString(const string& str) 
     34    empty=true ; 
     35    set(type) ; 
     36  } 
     37 
     38  template <typename T> 
     39  CType<T>::CType(const CType_ref<T>& type) 
     40  { 
     41    empty=true ; 
     42    set(type) ; 
     43  }   
     44   
     45  template <typename T> 
     46  void CType<T>::set(const T& val) 
     47  { 
     48    if (empty)  
     49    {  
     50      ptrValue = new T(val) ; 
     51      empty=false ; 
     52    } 
     53    else *ptrValue = val ; 
     54  } 
     55 
     56  template <typename T> 
     57  void CType<T>::set(const CType<T>& type) 
     58  { 
     59    if (type.isEmpty()) reset() ; 
     60    else 
     61    { 
     62      if (empty) 
     63      {  
     64        ptrValue = new T(*type.ptrValue) ; 
     65        empty=false ; 
     66      } 
     67      else *ptrValue = *type.ptrValue ; 
     68    } 
     69  } 
     70 
     71  template <typename T> 
     72  void CType<T>::set(const CType_ref<T>& type) 
     73  { 
     74    if (type.isEmpty()) reset() ; 
     75    else 
     76    { 
     77      if (empty) 
     78      {  
     79        ptrValue = new T(*type.ptrValue) ; 
     80        empty=false ; 
     81      } 
     82      else *ptrValue = *type.ptrValue ; 
     83    } 
     84  } 
     85 
     86  template <typename T> 
     87  T& CType<T>::get(void) 
     88  { 
     89    checkEmpty(); 
     90   return *ptrValue ; 
     91  } 
     92 
     93  template <typename T> 
     94  const T& CType<T>::get(void) const 
     95  { 
     96    checkEmpty(); 
     97    return *ptrValue ; 
     98  } 
     99   
     100  template <typename T> 
     101  CType<T>& CType<T>::operator = (const T& val) 
     102  { 
     103    set(val) ; 
     104    return *this ; 
     105  } 
     106   
     107  template <typename T> 
     108  CType<T>& CType<T>::operator = (const CType<T>& type) 
     109  { 
     110    set(type) ; 
     111    return *this ; 
     112  } 
     113   
     114  template <typename T> 
     115  CType<T>& CType<T>::operator = (const CType_ref<T>& type) 
     116  { 
     117    set(type) ; 
     118    return *this ; 
     119  } 
     120   
     121   template <typename T> 
     122   CType<T>::operator T&() 
     123   { 
     124    checkEmpty(); 
     125    return *ptrValue ; 
     126   } 
     127 
     128   template <typename T> 
     129   CType<T>* CType<T>::_clone(void) const 
     130   { 
     131     checkEmpty(); 
     132     return new CType(*this) ; 
     133   } 
     134 
     135   
     136  template <typename T> 
     137  void CType<T>::_fromString(const string& str) 
    50138  { 
    51139    istringstream iss(str); 
    52     checkAccess() ; 
     140    allocate() ; 
    53141    iss>>*ptrValue ; 
    54      
    55   } 
    56  
    57   template <typename T> 
    58   size_t CType<T>::size(void) const 
     142  } 
     143 
     144  template <typename T> 
     145  size_t CType<T>::_size(void) const 
    59146  { 
    60147    return sizeof(T) ; 
    61148  } 
    62149   
    63  
    64   template <typename T> 
    65   string CType<T>::toString(void) const 
     150  template <typename T> 
     151  bool CType<T>::_isEmpty(void) const 
     152  { 
     153    return empty ; 
     154  } 
     155   
     156  template <typename T> 
     157  string CType<T>::_toString(void) const 
    66158  { 
    67159    ostringstream oss; 
    68     checkAccess() ; 
     160    checkEmpty(); 
    69161    oss<<*ptrValue ; 
    70162    return oss.str() ; 
     
    72164   
    73165  template <typename T> 
    74   bool CType<T>::toBuffer(CBufferOut& buffer) const 
    75   { 
    76     checkAccess() ; 
     166  bool CType<T>::_toBuffer(CBufferOut& buffer) const 
     167  { 
     168    checkEmpty(); 
    77169    return buffer.put(*ptrValue) ; 
    78170  } 
    79171   
    80172  template <typename T> 
    81   bool CType<T>::fromBuffer(CBufferIn& buffer) 
    82   { 
    83     checkAccess() ; 
     173  bool CType<T>::_fromBuffer(CBufferIn& buffer) 
     174  { 
     175    allocate() ; 
    84176    return buffer.get(*ptrValue) ; 
    85177  } 
    86178  
    87       
    88   template <typename T> 
    89   void CType<T>::checkAccess(void) const 
    90   { 
    91 //    if (!isAssign) ERROR("void CType<T>::checkAccess",<<"CType<type> has not been assign to any buffer") ; 
    92   } 
    93  
    94   template <typename T> 
    95   CBaseType* CType<T>::duplicate(void) const 
    96   { 
    97      
    98     CType<T>* ret= new CType<T>(*this) ; 
    99     ret->clone=true ; 
    100     return ret ; 
    101   } 
    102    
    103   template <typename T> 
    104   void CType<T>::destroy(void) 
    105   { 
    106     if (clone) delete this ; 
    107   } 
    108    
     179 
     180  template <typename T> 
     181  void CType<T>::allocate(void) 
     182  { 
     183    if (empty)  
     184    { 
     185      ptrValue = new T ; 
     186      empty=false ; 
     187    } 
     188  } 
     189   
     190  template <typename T> 
     191  void CType<T>::_reset(void) 
     192  { 
     193    if (!empty)  
     194    { 
     195      delete ptrValue ; 
     196      empty=true ; 
     197    } 
     198  } 
     199   
     200  template <typename T> 
     201  void CType<T>::checkEmpty(void) const 
     202  { 
     203    if (empty) ERROR("template <typename T> void CTypef<T>::checkEmpty(void) const", <<"Type is not initialized") ; 
     204  }   
    109205 
    110206   
     
    117213  } 
    118214 
    119   template <typename T> 
    120   CBufferOut& operator<<(CBufferOut& buffer, T& type) 
    121   { 
    122     if (!CType<T>(type).toBuffer(buffer)) ERROR("operator<<(CBuffer& buffer, T& type)", 
    123                                            <<"Buffer remain size is to low for size type") ;       
    124     return buffer ; 
    125   } 
    126215 
    127216  template <typename T> 
     
    134223   
    135224  template <typename T> 
    136   CBufferIn& operator>>(CBufferIn& buffer, const CType<T>& type) 
    137   { 
    138     if (! const_cast<CType<T> & >(type).fromBuffer(buffer)) ERROR("CBuffer& operator<<(CBuffer& buffer, CType<T>& type)", 
     225  CBufferIn& operator>>(CBufferIn& buffer, CType<T>& type) 
     226  { 
     227    if (! type.fromBuffer(buffer)) ERROR("CBuffer& operator<<(CBuffer& buffer, CType<T>& type)", 
    139228                                           <<"Buffer remain size is to low for size type") ; 
    140229    return buffer ; 
    141230  } 
    142231   
    143   template <typename T> 
    144   CBufferIn& operator>>(CBufferIn& buffer, T& type) 
    145   { 
    146     if (!CType<T>(type).fromBuffer(buffer)) ERROR(" CBuffer& operator>>(CBuffer& buffer, T& type)", 
    147                                            <<"Buffer remain size is to low for size type") ; 
    148     return buffer ; 
    149   } 
    150  
    151  
    152  
     232   
    153233  template <typename T> 
    154234  CMessage& operator<<(CMessage& msg, const CType<T>& type) 
    155235  { 
    156     msg.push(*type.duplicate()) ; 
     236    msg.push(*type.clone()) ; 
    157237    return msg ; 
    158238  } 
    159239 
    160240  template <typename T> 
    161   CMessage& operator<<(CMessage& msg,CType<T>& type) 
    162   { 
    163     msg.push(type) ; 
     241  CMessage& operator<<(CMessage& msg, const T& type) 
     242  { 
     243    msg.push(*CType<T>(type).clone()) ; 
    164244    return msg ; 
    165245  } 
    166246 
    167   template <typename T> 
    168   CMessage& operator<<(CMessage& msg, const T& type) 
    169   { 
    170     msg.push(*CType<T>(type).duplicate()) ; 
    171     return msg ; 
    172   } 
    173    
    174   template <typename T> 
    175   CMessage& operator<<(CMessage& msg, T& type) 
    176   { 
    177     msg.push(*CType<T>(type).duplicate()) ; 
    178     return msg ; 
    179   } 
    180  
    181247} 
    182248 
  • XIOS/trunk/src/type/type_specialisation.hpp

    r354 r369  
    66#include "buffer_in.hpp" 
    77#include "buffer_out.hpp" 
    8 #include "array.hpp" 
    9  
     8#include "type.hpp" 
     9#include <string> 
     10#include <boost/algorithm/string.hpp> 
     11  
    1012namespace xios 
    1113{ 
    1214 
    13  
    14 // template specialisation for string 
    15  
    16   template <> 
    17   size_t CType<string>::size() const 
     15// template specialization for bool 
     16 
     17  template <> void CType<bool>::_fromString(const string& str) 
     18  { 
     19    string tmpStr=boost::to_lower_copy(boost::trim_copy(str)) ; 
     20    if (tmpStr=="true" || tmpStr==".true." || tmpStr=="yes" || tmpStr=="y") set(true) ; 
     21    else if (tmpStr=="false" || tmpStr==".false." || tmpStr=="no" || tmpStr=="n") set(false) ; 
     22    else ERROR("template <> CType<bool>::fromString(const string& str)",<< tmpStr << " cannot be converted in a boolean value") ; 
     23  } 
     24   
     25  template <> string CType<bool>::_toString(void) const 
     26  { 
     27    if (get()) return string("true") ; 
     28    else return string("false") ; 
     29  } 
     30  
     31  template <> void CType_ref<bool>::_fromString(const string& str) const 
     32  { 
     33    string tmpStr=boost::to_lower_copy(boost::trim_copy(str)) ; 
     34    if (tmpStr=="true" || tmpStr==".true." || tmpStr=="yes" || tmpStr=="y") set(true) ; 
     35    else if (tmpStr=="false" || tmpStr==".false." || tmpStr=="no" || tmpStr=="n") set(false) ; 
     36    else ERROR("template <> CType<bool>::fromString(const string& str)",<< tmpStr << " cannot be converted in a boolean value") ; 
     37  } 
     38  
     39  template <> void CType_ref<bool>::_fromString(const string& str) 
     40  { 
     41    string tmpStr=boost::to_lower_copy(boost::trim_copy(str)) ; 
     42    if (tmpStr=="true" || tmpStr==".true." || tmpStr=="yes" || tmpStr=="y") set(true) ; 
     43    else if (tmpStr=="false" || tmpStr==".false." || tmpStr=="no" || tmpStr=="n") set(false) ; 
     44    else ERROR("template <> CType<bool>::fromString(const string& str)",<< tmpStr << " cannot be converted in a boolean value") ; 
     45  } 
     46   
     47  template <> string CType_ref<bool>::_toString(void) const 
     48  { 
     49    if (get()) return string("true") ; 
     50    else return string("false") ; 
     51  } 
     52 
     53// template specialization for string 
     54 
     55  template <> 
     56  size_t CType<string>::_size() const 
    1857  { 
    1958    size_t typeSize=0 ; 
     
    2261    return typeSize ; 
    2362  } 
    24    
    25   template <> 
    26   bool CType<string>::toBuffer(CBufferOut& buffer) const 
     63 
     64  template <> 
     65  size_t CType_ref<string>::_size() const 
     66  { 
     67    size_t typeSize=0 ; 
     68    typeSize+=sizeof(size_t) ; 
     69    typeSize+=ptrValue->size() ; 
     70    return typeSize ; 
     71  } 
     72   
     73  template <> 
     74  void CType<string>::_fromString(const string& str) 
     75  { 
     76    allocate() ; 
     77    *ptrValue=str ; 
     78  }   
     79 
     80  template <> 
     81  void CType_ref<string>::_fromString(const string& str) 
     82  { 
     83    checkEmpty() ; 
     84    *ptrValue=str ; 
     85  }   
     86 
     87  template <> 
     88  void CType_ref<string>::_fromString(const string& str) const 
     89  { 
     90    checkEmpty() ; 
     91    *ptrValue=str ; 
     92  }   
     93   
     94  template <> 
     95  bool CType<string>::_toBuffer(CBufferOut& buffer) const 
    2796  { 
    2897    if (buffer.remain()<size()) return false ; 
     
    35104    } 
    36105  } 
    37  
    38   template <> 
    39   bool CType<string>::fromBuffer(CBufferIn& buffer) 
    40   { 
     106   
     107  template <> 
     108  bool CType_ref<string>::_toBuffer(CBufferOut& buffer) const 
     109  { 
     110    if (buffer.remain()<size()) return false ; 
     111    else 
     112    { 
     113      bool ret=true ; 
     114      if (ret) ret&=buffer.put(ptrValue->size()) ; 
     115      if (ret) ret&=buffer.put(ptrValue->data(),ptrValue->size()) ; 
     116      return ret ; 
     117    } 
     118  } 
     119   
     120   
     121   
     122  template <> 
     123  bool CType<string>::_fromBuffer(CBufferIn& buffer) 
     124  { 
     125    allocate() ; 
    41126    bool ret=true ; 
    42127    size_t typeSize ; 
     
    50135    return ret ; 
    51136  }   
    52    
    53    
     137 
     138  template <> 
     139  bool CType_ref<string>::_fromBuffer(CBufferIn& buffer) const 
     140  { 
     141    bool ret=true ; 
     142    size_t typeSize ; 
     143    if (ret) ret&=buffer.get(typeSize) ; 
     144     
     145    char* str; 
     146    str= (char*) buffer.ptr() ; 
     147    if (ret) buffer.advance(typeSize) ; 
     148    if (ret) *ptrValue=string(str,typeSize) ; 
     149     
     150    return ret ; 
     151  }    
     152 
     153  template <> 
     154  bool CType_ref<string>::_fromBuffer(CBufferIn& buffer) 
     155  { 
     156    bool ret=true ; 
     157    size_t typeSize ; 
     158    if (ret) ret&=buffer.get(typeSize) ; 
     159     
     160    char* str; 
     161    str= (char*) buffer.ptr() ; 
     162    if (ret) buffer.advance(typeSize) ; 
     163    if (ret) *ptrValue=string(str,typeSize) ; 
     164     
     165    return ret ; 
     166  }      
    54167  // template specialisation for CArray 
    55168/* 
     
    95208boost::detail::multi_array::extent_gen<1> getExtentNull<1>(void) { return extents[0]; } 
    96209*/ 
    97  
     210/* 
    98211#define CTYPE_ARRAY(ValueType,NumsDims)                                \ 
     212                                                                       \ 
     213  template <>                                                          \ 
     214  void CType<ARRAY(ValueType,NumsDims)>::allocate(void)  \ 
     215  {                                                                    \ 
     216    if (empty) ptrValue=new shared_ptr<CArray<ValueType, NumsDims> >(new  CArray<ValueType, NumsDims>()) ;\ 
     217    empty=false ;                                                      \ 
     218  }                                                                    \ 
     219                                                                        \    
    99220  template<>                                                           \ 
    100   size_t CType< ARRAY(ValueType,NumsDims)>::size() const                           \ 
     221  size_t CType< ARRAY(ValueType,NumsDims)>::_size() const               \ 
    101222  {                                                                    \ 
    102223     return (*(this->ptrValue))->getSize() ;                           \ 
    103224  }                                                                    \ 
    104225                                                                       \ 
    105   template <>                                                          \ 
    106   bool CType<ARRAY(ValueType,NumsDims)>::toBuffer(CBufferOut& buffer) const        \ 
     226  template<>                                                           \ 
     227  size_t CType_ref< ARRAY(ValueType,NumsDims)>::_size() const           \ 
     228  {                                                                    \ 
     229     return (*(this->ptrValue))->getSize() ;                           \ 
     230  }                                                                    \ 
     231                                                                       \ 
     232  template <>                                                          \ 
     233  bool CType<ARRAY(ValueType,NumsDims)>::_toBuffer(CBufferOut& buffer) const        \ 
    107234  {                                                                    \ 
    108235      return (*(this->ptrValue))->toBuffer(buffer) ;                   \ 
     
    110237                                                                       \ 
    111238  template <>                                                          \ 
    112   bool CType<ARRAY(ValueType,NumsDims)>::fromBuffer(CBufferIn& buffer)       \ 
     239  bool CType_ref<ARRAY(ValueType,NumsDims)>::_toBuffer(CBufferOut& buffer) const        \ 
     240  {                                                                    \ 
     241      return (*(this->ptrValue))->toBuffer(buffer) ;                   \ 
     242  }                                                                    \ 
     243                                                                       \ 
     244  template <>                                                          \ 
     245  bool CType<ARRAY(ValueType,NumsDims)>::_fromBuffer(CBufferIn& buffer)       \ 
     246  {                                                                    \ 
     247    allocate();                                                        \ 
     248    return (*(ptrValue))->fromBuffer(buffer) ;                         \ 
     249  }                                                                    \ 
     250                                                                       \ 
     251  template <>                                                          \ 
     252  bool CType_ref<ARRAY(ValueType,NumsDims)>::_fromBuffer(CBufferIn& buffer) const  \ 
     253  {                                                                    \ 
     254    checkEmpty() ;                                                     \  
     255    return (*(this->ptrValue))->fromBuffer(buffer) ;                   \ 
     256  }                                                                    \ 
     257                                                                       \ 
     258 template <>                                                          \ 
     259  bool CType_ref<ARRAY(ValueType,NumsDims)>::_fromBuffer(CBufferIn& buffer)   \ 
    113260  {                                                                    \ 
    114261    shared_ptr<CArray<ValueType, NumsDims> > tmp(new CArray<ValueType, NumsDims>() ) ; \ 
     
    117264  }                                                                    \ 
    118265                                                                       \ 
    119   template <>                                                          \ 
    120   void CType<ARRAY(ValueType,NumsDims)>::fromString(const string& str)       \ 
    121   {                                                                    \ 
    122  /* to implement */                                                    \ 
    123   }                                                                    \ 
    124                                                                        \ 
    125   template <>                                                          \ 
    126   string CType<ARRAY(ValueType,NumsDims)>::toString(void) const                    \ 
    127   {                                                                    \ 
    128  /* to implement */                                                    \ 
     266                                                                       \ 
     267  template <>                                                          \ 
     268  void CType<ARRAY(ValueType,NumsDims)>::_fromString(const string& str)       \ 
     269  {                                                                    \ 
     270                                      \ 
     271  }                                                                    \ 
     272                                                                       \ 
     273  template <>                                                          \ 
     274  void CType_ref<ARRAY(ValueType,NumsDims)>::_fromString(const string& str) const \ 
     275  {                                                                    \ 
     276                                        \ 
     277  }                                                                    \ 
     278  template <>                                                          \ 
     279  void CType_ref<ARRAY(ValueType,NumsDims)>::_fromString(const string& str) \ 
     280  {                                                                    \ 
     281                                                \ 
     282  }                                                                    \ 
     283                                                                          \ 
     284  template <>                                                          \ 
     285  string CType<ARRAY(ValueType,NumsDims)>::_toString(void) const                    \ 
     286  {                                                                    \ 
     287                               \ 
    129288   return string("") ;                                                 \ 
    130   } 
    131  
     289  }                                                                    \ 
     290                                                                          \ 
     291  template <>                                                          \ 
     292  string CType_ref<ARRAY(ValueType,NumsDims)>::_toString(void) const                    \ 
     293  {                                                                    \ 
     294                                      \ 
     295   return string("") ;                                                 \ 
     296  } 
    132297//CTYPE_ARRAY(double,1)  
    133298 
     
    147312CTYPE_ARRAY(float,2)  
    148313CTYPE_ARRAY(float,3)  
    149  
     314*/ 
    150315 
    151316 
Note: See TracChangeset for help on using the changeset viewer.