Changeset 369
- Timestamp:
- 10/16/12 13:04:44 (11 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 11 added
- 3 deleted
- 88 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/attribute.cpp
r345 r369 7 7 CAttribute::CAttribute(const StdString & id) 8 8 : CObject(id), CBaseType() 9 , value()9 // , value() 10 10 { /* Ne rien faire de plus */ } 11 11 /* 12 12 CAttribute::CAttribute(const CAttribute & attribut) 13 13 : CObject(attribut.getId()),CBaseType() 14 14 { 15 this->value = attribut.getAnyValue();15 // this->value = attribut.getAnyValue(); 16 16 } 17 17 */ 18 18 CAttribute::~CAttribute(void) 19 19 { /* Ne rien faire de plus */ } 20 20 21 21 ///-------------------------------------------------------------- 22 22 /* 23 23 const boost::any & CAttribute::getAnyValue(void) const 24 24 { … … 43 43 return (this->value.empty()); 44 44 } 45 45 */ 46 46 const StdString & CAttribute::getName(void) const 47 47 { … … 52 52 ///-------------------------------------------------------------- 53 53 54 54 55 55 CMessage& operator<<(CMessage& msg,CAttribute& type) 56 56 { … … 61 61 CMessage& operator<<(CMessage& msg, const CAttribute& type) 62 62 { 63 msg.push(*type.duplicate()) ;63 // msg.push(*type.clone()) ; 64 64 return msg ; 65 65 } -
XIOS/trunk/src/attribute.hpp
r352 r369 16 16 { 17 17 /// ////////////////////// Déclarations ////////////////////// /// 18 class CAttribute : public CObject, public CBaseType18 class CAttribute : public CObject, public virtual CBaseType 19 19 { 20 20 typedef CObject SuperClass; … … 24 24 /// Constructeurs /// 25 25 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. 28 28 29 29 /// Accesseurs /// 30 30 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); 34 34 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); 39 39 40 40 /// 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 ; 44 44 /// Destructeur /// 45 45 virtual ~CAttribute(void); … … 49 49 virtual void fromString(const StdString & str) = 0; 50 50 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 53 54 virtual void generateCInterface(ostream& oss, const string& className) = 0 ; 54 55 virtual void generateFortran2003Interface(ostream& oss, const string& className) = 0 ; … … 65 66 66 67 /// Constructeurs /// 67 CAttribute(void); // Not implemented.68 // CAttribute(void); // Not implemented. 68 69 69 70 /// Propriété /// 70 boost::any value;71 // boost::any value; 71 72 72 73 }; // class CAttribute 73 74 74 75 /// ////////////////////// Définitions ////////////////////// /// 76 /* 75 77 template <typename T> 76 78 T CAttribute::getValue(void) const … … 96 98 return (this->value.type() == typeid(T)); 97 99 } 98 100 */ 99 101 100 102 CMessage& operator<<(CMessage& msg,CAttribute& type) ; … … 103 105 CBufferOut& operator<<(CBufferOut& buffer,CAttribute& type) ; 104 106 CBufferIn& operator>>(CBufferIn& buffer, CAttribute& type) ; 107 105 108 } 106 109 // namespace xios -
XIOS/trunk/src/attribute_map.cpp
r345 r369 23 23 { 24 24 const StdStrAttPair & att = *it; 25 if (!att.second->isEmpty()) 26 att.second->clear(); 25 att.second->reset(); 27 26 } 28 27 } … … 45 44 ERROR("CAttributeMap::setAttribute(key, attr)", 46 45 << "[ 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()); 48 48 } 49 49 … … 127 127 128 128 //--------------------------------------------------------------- 129 129 /* 130 130 void CAttributeMap::toBinary(StdOStream & os) const 131 131 { … … 184 184 } 185 185 } 186 186 */ 187 187 void CAttributeMap::generateCInterface(ostream& oss, const string& className) 188 188 { … … 204 204 } 205 205 } 206 206 207 207 ///-------------------------------------------------------------- 208 208 -
XIOS/trunk/src/attribute_map.hpp
r345 r369 44 44 virtual void fromString(const StdString & str); 45 45 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); 48 48 virtual void generateCInterface(ostream& oss, const string& className) ; 49 49 virtual void generateFortran2003Interface(ostream& oss, const string& className) ; -
XIOS/trunk/src/attribute_template.hpp
r354 r369 8 8 #include "xmlioserver_spl.hpp" 9 9 #include "exception.hpp" 10 #include "array.hpp"11 10 #include "attribute.hpp" 12 11 #include "buffer_in.hpp" 13 12 #include "buffer_out.hpp" 13 #include "type.hpp" 14 14 15 15 … … 18 18 /// ////////////////////// Déclarations ////////////////////// /// 19 19 template <class T> 20 class CAttributeTemplate : public CAttribute 20 class CAttributeTemplate : public CAttribute, public CType<T> 21 21 { 22 22 typedef CAttribute SuperClass; … … 34 34 CAttributeTemplate(const StdString & id, const ValueType & value, 35 35 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. 38 38 39 39 public : … … 41 41 /// Accesseur /// 42 42 ValueType getValue(void) const; 43 ValueType* getRef(void) ;43 // ValueType* getRef(void) ; 44 44 45 45 /// Mutateurs /// 46 46 void setValue(const ValueType & value); 47 47 48 void set(const CAttribute& attr) ; 49 void set(const CAttributeTemplate& attr) ; 50 48 51 /// Destructeur /// 49 virtual ~CAttributeTemplate(void) ;52 virtual ~CAttributeTemplate(void) { } 50 53 51 54 /// Operateur /// 52 ValueTypeoperator=(const ValueType & value);55 CAttributeTemplate& operator=(const ValueType & value); 53 56 54 57 /// 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); 57 63 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; 64 67 virtual void generateCInterface(ostream& oss,const string& className) ; 65 68 virtual void generateFortran2003Interface(ostream& oss,const string& className) ; … … 75 78 76 79 /// 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) ; 79 86 }; // class CAttribute 80 87 -
XIOS/trunk/src/attribute_template_decl.cpp
r352 r369 9 9 template class CAttributeTemplate<bool> ; 10 10 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 2 2 #define __XMLIO_CAttributeTemplate_impl__ 3 3 4 #include "array.hpp"5 4 #include "type.hpp" 6 5 #include "buffer_in.hpp" … … 25 24 this->setValue(value); 26 25 } 27 26 /* 28 27 template <class T> 29 28 CAttributeTemplate<T>::CAttributeTemplate(const CAttribute & attribut) … … 34 33 ERROR("CAttributeTemplate", << "Invalid instantiation !"); 35 34 } 36 35 */ 37 36 template <class T> 38 37 CAttributeTemplate<T>::CAttributeTemplate(const StdString & id, … … 52 51 umap.insert(umap.end(), std::make_pair(id, this)); 53 52 } 54 55 template <class T> 56 53 /* 54 template <class T> 55 CAttributeTemplate<T>::~CAttributeTemplate(void) 57 56 { 58 this->clear(); 59 } 60 57 // this->CType<T>::reset() ; 58 // this->clear(); 59 } 60 */ 61 61 ///-------------------------------------------------------------- 62 62 … … 64 64 T CAttributeTemplate<T>::getValue(void) const 65 65 { 66 return CType<T>::get() ; 67 /* 66 68 if (SuperClass::isEmpty()) 67 69 { … … 71 73 } 72 74 return (SuperClass::getValue<T>()); 73 } 74 75 */ 76 } 77 78 /* 75 79 template <class T> 76 80 T* CAttributeTemplate<T>::getRef(void) … … 84 88 return (SuperClass::getRef<T>()); 85 89 } 90 */ 86 91 87 92 template <class T> 88 93 void CAttributeTemplate<T>::setValue(const T & value) 89 94 { 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) 97 115 { 98 116 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 106 125 { 107 126 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() << "\""; 110 129 return (oss.str()); 111 130 } 112 131 113 132 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 /* 122 140 template <class T> 123 141 void CAttributeTemplate<T>::toBinary (StdOStream & os) const … … 133 151 this->setValue(value); 134 152 } 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 /* 139 159 if (isEmpty()) return buffer.put(true) ; 140 160 else … … 146 166 return ret ; 147 167 } 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 /* 153 176 bool empty ; 154 177 bool ret=true ; … … 170 193 return val.fromBuffer(buffer) ; 171 194 } 172 } 173 195 */ 196 } 197 /* 174 198 template <class T> 175 199 size_t CAttributeTemplate<T>::size(void) const 176 { 200 { 201 return CType<T>::size() ;*/ 202 /* 177 203 if (isEmpty()) return sizeof(bool) ; 178 204 else … … 181 207 return val.size()+sizeof(bool) ; 182 208 } 183 } 209 */ 210 /* }*/ 184 211 185 212 template <typename T> … … 231 258 } 232 259 233 234 //--------------------------------------------------------------- 235 236 / ** Spécialisations des templates pour la fonction [toString] **/260 /* 261 //--------------------------------------------------------------- 262 263 // Spécialisations des templates pour la fonction [toString] 237 264 238 265 template <> … … 241 268 //--------------------------------------------------------------- 242 269 243 / ** Spécialisations des templates pour la fonction [fromString] **/270 // Spécialisations des templates pour la fonction [fromString] 244 271 245 272 template <> // Chaîne de caractÚres. … … 260 287 //--------------------------------------------------------------- 261 288 262 / ** Spécialisations des templates pour la fonction [toBinary] **/289 // Spécialisations des templates pour la fonction [toBinary] // 263 290 264 291 template <> // Chaîne de caractÚres. … … 276 303 //--------------------------------------------------------------- 277 304 278 / ** Spécialisations des templates pour la fonction [fromBinary] **/305 // Spécialisations des templates pour la fonction [fromBinary] // 279 306 280 307 template <> // Chaîne de caractÚres. … … 291 318 292 319 ///-------------------------------------------------------------- 320 */ 293 321 } // namespace xios 294 322 -
XIOS/trunk/src/attribute_template_specialisation.hpp
r352 r369 6 6 namespace xios 7 7 { 8 /* 8 9 /// ////////////////////// Définitions ////////////////////// /// 9 10 10 / ** Spécialisations des templates pour la fonction [toString] **/11 /// Spécialisations des templates pour la fonction [toString] /// 11 12 12 13 template <> … … 26 27 //--------------------------------------------------------------- 27 28 28 / ** Spécialisations des templates pour la fonction [fromString] **/29 /// Spécialisations des templates pour la fonction [fromString] /// 29 30 30 31 template <> // Chaîne de caractÚres. … … 143 144 //--------------------------------------------------------------- 144 145 145 / ** Spécialisations des templates pour la fonction [toBinary] **/146 /// Spécialisations des templates pour la fonction [toBinary] /// 146 147 147 148 template <> // Chaîne de caractÚres. … … 177 178 //--------------------------------------------------------------- 178 179 179 / ** Spécialisations des templates pour la fonction [fromBinary] **/180 /// Spécialisations des templates pour la fonction [fromBinary] /// 180 181 181 182 template <> // Chaîne de caractÚres. … … 212 213 this->setValue(value); 213 214 } 214 215 215 ///-------------------------------------------------------------- 216 */ 216 217 } // namespace xios -
XIOS/trunk/src/config/axis_attribute.conf
r351 r369 9 9 DECLARE_ATTRIBUTE(int, zoom_end) 10 10 DECLARE_ATTRIBUTE(int, zoom_size) 11 DECLARE_A TTRIBUTE(ARRAY(double, 1), value)11 DECLARE_ARRAY(double, 1, value) 12 12 13 13 -
XIOS/trunk/src/config/domain_attribute.conf
r219 r369 22 22 23 23 /* LOCAL */ 24 DECLARE_A TTRIBUTE(ARRAY(bool, 2), mask)24 DECLARE_ARRAY(bool, 2 , mask) 25 25 26 26 /* GLOBAL */ … … 47 47 /* LOCAL */ 48 48 DECLARE_ATTRIBUTE(int , data_n_index) 49 DECLARE_A TTRIBUTE(ARRAY(int, 1), data_i_index)50 DECLARE_A TTRIBUTE(ARRAY(int, 1), data_j_index)49 DECLARE_ARRAY(int, 1 , data_i_index) 50 DECLARE_ARRAY(int, 1, data_j_index) 51 51 52 52 /* LOCAL */ 53 DECLARE_A TTRIBUTE(ARRAY(double, 1), lonvalue)54 DECLARE_A TTRIBUTE(ARRAY(double, 1), latvalue)53 DECLARE_ARRAY(double, 1, lonvalue) 54 DECLARE_ARRAY(double, 1, latvalue) 55 55 -
XIOS/trunk/src/config/field_attribute.conf
r266 r369 16 16 DECLARE_ATTRIBUTE(StdString, axis_ref) 17 17 DECLARE_ATTRIBUTE(StdString, grid_ref) 18 //DECLARE_ATTRIBUTE(StdString, zoom_ref)19 18 DECLARE_ATTRIBUTE(StdString, field_ref) 20 19 -
XIOS/trunk/src/config/file_attribute.conf
r335 r369 9 9 DECLARE_ATTRIBUTE(StdString, split_freq) 10 10 DECLARE_ATTRIBUTE(bool, enabled) 11 DECLARE_ ATTRIBUTE(StdString, type)11 DECLARE_ENUM2(type,one_file,multiple_file) 12 12 DECLARE_ATTRIBUTE(StdString, par_access) 13 13 -
XIOS/trunk/src/declare_attribute.hpp
r219 r369 5 5 6 6 #define DECLARE_ATTRIBUTE(type, name) \ 7 class name##att : public CAttributeTemplate<type>{ \ 7 class name##_attr : public CAttributeTemplate<type> \ 8 { \ 8 9 public : \ 9 name## att(void) \10 name##_attr(void) \ 10 11 : CAttributeTemplate<type> \ 11 12 (#name, *CAttributeMap::Current) \ … … 13 14 type operator=(const type & value) \ 14 15 { return (CAttributeTemplate<type>::operator=(value)); } \ 15 virtual ~name## att(void) \16 virtual ~name##_attr(void) \ 16 17 { /* Ne rien faire de plus */ } \ 17 18 } name; 18 19 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) {} \ 30 26 } 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 31 116 32 117 #define BEGIN_DECLARE_ATTRIBUTE_MAP(type) \ 33 class type##Attributes : public virtual CAttributeMap { \ 118 class type##Attributes : public virtual CAttributeMap \ 119 { \ 34 120 public : 35 121 -
XIOS/trunk/src/functor.cpp
r335 r369 1 1 #include "functor.hpp" 2 #include "array_new.hpp" 2 3 3 4 namespace xios … … 7 8 /// ////////////////////// Définitions ////////////////////// /// 8 9 9 CFunctor::CFunctor(const StdString & id, ARRAY(double, 1)doutput)10 CFunctor::CFunctor(const StdString & id, CArray<double, 1>& doutput) 10 11 : SuperClass(id), doutput(doutput), nbcall(0) 11 12 { /* Ne rien faire de plus */ } … … 16 17 //--------------------------------------------------------------- 17 18 18 ARRAY(double, 1)CFunctor::getDataOutput(void) const19 CArray<double,1> CFunctor::getDataOutput(void) const 19 20 { 20 21 return (this->doutput); … … 37 38 //--------------------------------------------------------------- 38 39 39 ARRAY(double, 1) CFunctor::operator ()(const ARRAY(double, 1)dinput)40 CArray<double,1> CFunctor::operator ()(const CArray<double,1>& dinput) 40 41 { 41 42 this->nbcall++; 42 if (dinput ->size() != this->doutput->size())43 if (dinput.numElements() != this->doutput.numElements()) 43 44 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() << " ]" 46 47 << " size of input array != size of output array !"); 47 48 this->apply(dinput, this->doutput); -
XIOS/trunk/src/functor.hpp
r352 r369 5 5 #include "xmlioserver_spl.hpp" 6 6 #include "exception.hpp" 7 #include "array .hpp"7 #include "array_new.hpp" 8 8 9 9 namespace xios … … 16 16 /// Définition de type /// 17 17 typedef CObject SuperClass; 18 typedef ARRAY(double, 1) DoubleArray;19 18 20 19 public : 21 20 22 21 /// Accesseurs /// 23 DoubleArraygetDataOutput(void) const;22 CArray<double,1> getDataOutput(void) const; 24 23 /// Opérateur /// 25 DoubleArray operator ()(const DoubleArraydinput);24 CArray<double,1> operator ()(const CArray<double,1>& dinput); 26 25 27 26 /// Destructeur /// … … 34 33 35 34 /// Traitement /// 36 virtual void apply(const DoubleArray dinput, DoubleArraydoutput) = 0;35 virtual void apply(const CArray<double,1>& dinput, CArray<double,1>& doutput) = 0; 37 36 38 37 /// Autres /// … … 42 41 /// Constructeurs /// 43 42 CFunctor(void); // Not implemented. 44 CFunctor(const StdString & id, DoubleArraydoutput);43 CFunctor(const StdString & id, CArray<double,1>& doutput); 45 44 CFunctor(const CFunctor & functor); // Not implemented. 46 45 CFunctor(const CFunctor * const functor); // Not implemented. 47 46 48 private : 49 47 protected : 50 48 /// Propriétés privées /// 51 DoubleArray doutput; 52 53 protected : 49 CArray<double,1>& doutput; 54 50 /// Propriétés protégées /// 55 51 int nbcall; -
XIOS/trunk/src/functor/average.cpp
r335 r369 1 1 #include "average.hpp" 2 #include "array_new.hpp" 2 3 3 4 namespace xios … … 7 8 /// ////////////////////// Définitions ////////////////////// /// 8 9 9 CAverage::CAverage( DoubleArraydoutput)10 CAverage::CAverage(CArray<double,1>& doutput) 10 11 : SuperClass(StdString("average"), doutput) 11 { /* Ne rien faire de plus */ }12 { doutput.dumpStructureInformation(cout) ;/* Ne rien faire de plus */ } 12 13 13 14 CAverage::~CAverage(void) … … 16 17 //--------------------------------------------------------------- 17 18 18 void CAverage::apply(const DoubleArray_dinput,19 DoubleArray_doutput)19 void CAverage::apply(const CArray<double,1>& _dinput, 20 CArray<double,1>& _doutput) 20 21 { 22 /* 21 23 const double * it1 = _dinput->data(), 22 24 * end1 = _dinput->data() + _dinput->num_elements(); … … 25 27 for (; it1 != end1; it1++, it++) *it = *it1; 26 28 else for (; it1 != end1; it1++, it++) *it += *it1; 29 */ 30 if (this->nbcall == 1) _doutput=_dinput ; 31 else _doutput+=_dinput ; 32 27 33 } 28 34 29 35 void CAverage::final(void) 30 36 { 31 double * it1 = this->getDataOutput()->data(),37 /* double * it1 = this->getDataOutput()->data(), 32 38 * end1 = this->getDataOutput()->data() + this->getDataOutput()->num_elements(); 33 39 for (; it1 != end1; it1++) *it1 /= this->nbcall; 34 40 this->nbcall = 0; 41 */ 42 doutput/=this->nbcall; 43 this->nbcall = 0; 35 44 } 36 45 } // namespace func -
XIOS/trunk/src/functor/average.hpp
r335 r369 4 4 /// xmlioserver headers /// 5 5 #include "functor.hpp" 6 #include "array_new.hpp" 6 7 7 8 namespace xios … … 14 15 /// Définition de type /// 15 16 typedef CFunctor SuperClass; 16 typedef ARRAY(double, 1) DoubleArray;17 17 18 18 public : … … 21 21 //CAverage(void); // Not implemented. 22 22 //CAverage(const CFunData & data); 23 CAverage( DoubleArraydoutput);23 CAverage(CArray<double,1>& doutput); 24 24 //CAverage(const CAverage & average); // Not implemented. 25 25 //CAverage(const CAverage * const average); // Not implemented. 26 26 27 27 /// Traitement /// 28 virtual void apply(const DoubleArray dinput, DoubleArraydoutput);28 virtual void apply(const CArray<double,1>& dinput, CArray<double,1>& doutput); 29 29 virtual void final(void) ; 30 30 -
XIOS/trunk/src/functor/instant.cpp
r335 r369 1 1 #include "instant.hpp" 2 #include "array_new.hpp" 2 3 3 4 namespace xios … … 7 8 /// ////////////////////// Définitions ////////////////////// /// 8 9 9 CInstant::CInstant( DoubleArraydoutput)10 CInstant::CInstant(CArray<double,1>& doutput) 10 11 : SuperClass(StdString("instant"), doutput) 11 12 { /* Ne rien faire de plus */ } … … 16 17 //--------------------------------------------------------------- 17 18 18 void CInstant::apply(const DoubleArray_dinput,19 DoubleArray_doutput)19 void CInstant::apply(const CArray<double,1>& _dinput, 20 CArray<double,1>& _doutput) 20 21 { 21 const double * it1 = _dinput->data(),22 /* const double * it1 = _dinput->data(), 22 23 * end1 = _dinput->data() + _dinput->num_elements(); 23 24 double * it = _doutput->data(); 24 for (; it1 != end1; it1++, it++) *it = *it1; 25 for (; it1 != end1; it1++, it++) *it = *it1;*/ 26 _doutput=_dinput ; 25 27 } 26 28 -
XIOS/trunk/src/functor/instant.hpp
r335 r369 4 4 /// xios headers /// 5 5 #include "functor.hpp" 6 #include "array_new.hpp" 6 7 7 8 namespace xios … … 14 15 /// Définition de type /// 15 16 typedef CFunctor SuperClass; 16 typedef ARRAY(double, 1) DoubleArray;17 17 18 18 public : … … 21 21 //CInstant(void); // Not implemented. 22 22 //CInstant(const CFunData & data); 23 CInstant( DoubleArraydoutput);23 CInstant(CArray<double,1>& doutput); 24 24 //CInstant(const CInstant & instant); // Not implemented. 25 25 //CInstant(const CInstant * const instant); // Not implemented. 26 26 27 27 /// Traitement /// 28 virtual void apply(const DoubleArray dinput, DoubleArraydoutput);28 virtual void apply(const CArray<double,1>& dinput, CArray<double,1>& doutput); 29 29 30 30 /// Destructeur /// -
XIOS/trunk/src/functor/maximum.cpp
r335 r369 1 1 #include "maximum.hpp" 2 #include <algorithm> 2 #include "array_new.hpp" 3 3 4 4 5 … … 9 10 /// ////////////////////// Définitions ////////////////////// /// 10 11 11 CMaximum::CMaximum( DoubleArraydoutput)12 CMaximum::CMaximum(CArray<double,1>& doutput) 12 13 : SuperClass(StdString("maximum"), doutput) 13 14 { /* Ne rien faire de plus */ } … … 18 19 //--------------------------------------------------------------- 19 20 20 void CMaximum::apply(const DoubleArray_dinput,21 DoubleArray_doutput)21 void CMaximum::apply(const CArray<double,1>& _dinput, 22 CArray<double,1>& _doutput) 22 23 { 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; 28 28 else for (; it1 != end1; it1++, it++) *it = std::max(*it1, *it); 29 29 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 35 31 } 36 32 -
XIOS/trunk/src/functor/maximum.hpp
r335 r369 4 4 /// xios headers /// 5 5 #include "functor.hpp" 6 #include "array_new.hpp" 6 7 7 8 namespace xios … … 14 15 /// Définition de type /// 15 16 typedef CFunctor SuperClass; 16 typedef ARRAY(double, 1) DoubleArray;17 17 18 18 public : … … 21 21 //CMaximum(void); // Not implemented. 22 22 //CMaximum(const CFunData & data); 23 CMaximum( DoubleArraydoutput);23 CMaximum(CArray<double,1>& doutput); 24 24 //CMaximum(const CMaximum & Maximum); // Not implemented. 25 25 //CMaximum(const CMaximum * const Maximum); // Not implemented. 26 26 27 27 /// Traitement /// 28 virtual void apply(const DoubleArray dinput, DoubleArraydoutput);28 virtual void apply(const CArray<double,1>& dinput, CArray<double,1>& doutput); 29 29 30 30 /// Destructeur /// -
XIOS/trunk/src/functor/minimum.cpp
r335 r369 1 1 #include "minimum.hpp" 2 #include "array_new.hpp" 3 #include <algorithm> 2 4 3 5 namespace xios … … 7 9 /// ////////////////////// Définitions ////////////////////// /// 8 10 9 CMinimum::CMinimum( DoubleArraydoutput)11 CMinimum::CMinimum(CArray<double,1>& doutput) 10 12 : SuperClass(StdString("minimum"), doutput) 11 13 { /* Ne rien faire de plus */ } … … 16 18 //--------------------------------------------------------------- 17 19 18 void CMinimum::apply(const DoubleArray_dinput,19 DoubleArray_doutput)20 void CMinimum::apply(const CArray<double,1>& _dinput, 21 CArray<double,1>& _doutput) 20 22 { 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 27 30 } 28 31 -
XIOS/trunk/src/functor/minimum.hpp
r335 r369 4 4 /// xmlioserver headers /// 5 5 #include "functor.hpp" 6 #include "array_new.hpp" 6 7 7 8 namespace xios … … 14 15 /// Définition de type /// 15 16 typedef CFunctor SuperClass; 16 typedef ARRAY(double, 1) DoubleArray;17 17 18 18 public : … … 21 21 //CMinimum(void); // Not implemented. 22 22 //CMinimum(const CFunData & data); 23 CMinimum( DoubleArraydoutput);23 CMinimum(CArray<double,1>& doutput); 24 24 //CMinimum(const CMinimum & Minimum); // Not implemented. 25 25 //CMinimum(const CMinimum * const Minimum); // Not implemented. 26 26 27 27 /// Traitement /// 28 virtual void apply(const DoubleArray dinput, DoubleArraydoutput);28 virtual void apply(const CArray<double,1>& dinput, CArray<double,1>& doutput); 29 29 30 30 /// Destructeur /// -
XIOS/trunk/src/functor/once.cpp
r335 r369 1 1 #include "once.hpp" 2 #include "array_new.hpp" 2 3 3 4 namespace xios … … 7 8 /// ////////////////////// Définitions ////////////////////// /// 8 9 9 COnce::COnce( DoubleArraydoutput)10 COnce::COnce(CArray<double,1>& doutput) 10 11 : SuperClass(StdString("once"), doutput) 11 12 { /* Ne rien faire de plus */ } … … 16 17 //--------------------------------------------------------------- 17 18 18 void COnce::apply(const DoubleArray_dinput,19 DoubleArray_doutput)19 void COnce::apply(const CArray<double,1>& _dinput, 20 CArray<double,1>& _doutput) 20 21 { 21 const double * it1 = _dinput->data(),22 /* const double * it1 = _dinput->data(), 22 23 * end1 = _dinput->data() + _dinput->num_elements(); 23 24 double * it = _doutput->data(); 24 for (; it1 != end1; it1++, it++) *it = *it1; 25 for (; it1 != end1; it1++, it++) *it = *it1;*/ 26 _doutput=_dinput ; 25 27 } 26 28 -
XIOS/trunk/src/functor/once.hpp
r335 r369 4 4 /// xios headers /// 5 5 #include "functor.hpp" 6 #include "array_new.hpp" 6 7 7 8 namespace xios … … 14 15 /// Définition de type /// 15 16 typedef CFunctor SuperClass; 16 typedef ARRAY(double, 1) DoubleArray;17 17 18 18 public : … … 20 20 /// Constructeurs /// 21 21 //COnce(void); // Not implemented. 22 COnce( DoubleArraydoutput);22 COnce(CArray<double,1>& doutput); 23 23 //COnce(const COnce & once); // Not implemented. 24 24 //COnce(const COnce * const once); // Not implemented. 25 25 26 26 /// Traitement /// 27 virtual void apply(const DoubleArray dinput, DoubleArraydoutput);27 virtual void apply(const CArray<double,1>& dinput, CArray<double,1>& doutput); 28 28 29 29 /// Destructeur /// -
XIOS/trunk/src/generate_fortran_interface.cpp
r352 r369 5 5 #include "object_template.hpp" 6 6 #include "group_template.hpp" 7 #include "context.hpp" 8 #include "file.hpp" 7 9 8 10 int main (int argc, char ** argv, char ** UNUSED (env)) -
XIOS/trunk/src/generate_interface_impl.hpp
r354 r369 6 6 #include "type_util.hpp" 7 7 #include "indent.hpp" 8 #include "array.hpp" 8 #include "enum.hpp" 9 #include "array_new.hpp" 9 10 10 11 namespace xios … … 83 84 } 84 85 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 } 85 111 // if (!array_copy(domain_hdl->mask.getValue(), mask, extent1, extent2)) 86 112 // ERROR("cxios_get_domain_mask(XDomainPtr domain_hdl, bool * mask, int extent1, int extent2)",<<"Output array size is not conform to array size attribut") ; 87 113 88 114 /* 89 115 #define macro(T) \ 90 116 template <>\ … … 160 186 macro(double) 161 187 macro(int) 188 */ 162 189 163 190 #undef macro … … 206 233 207 234 } 208 235 236 /* 209 237 #define macro(T)\ 210 238 template <>\ … … 280 308 macro(double) 281 309 macro(int) 282 310 283 311 #undef macro 284 312 */ 285 313 template <class T> 286 314 void CInterface::AttributeFortranInterfaceDeclaration(ostream& oss,const string& className,const string& name) … … 309 337 } 310 338 339 /* 311 340 #define macro(T)\ 312 341 template <> \ … … 356 385 357 386 #undef macro 358 387 */ 359 388 360 389 template <class T> … … 404 433 } 405 434 406 435 /* 407 436 #define macro(T) \ 408 437 template <> \ … … 459 488 460 489 #undef macro 461 490 */ 491 492 /* 462 493 #define macro(T) \ 463 494 template <> \ … … 514 545 515 546 #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 618 macro(bool) 619 macro(double) 620 macro(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 516 901 } 517 902 -
XIOS/trunk/src/group_template.hpp
r354 r369 45 45 virtual void fromString(const StdString & str); 46 46 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); 49 49 50 50 virtual void parse(xml::CXMLNode & node); -
XIOS/trunk/src/group_template_impl.hpp
r352 r369 38 38 39 39 ///-------------------------------------------------------------- 40 40 /* 41 41 template <class U, class V, class W> 42 42 void CGroupTemplate<U, V, W>::toBinary(StdOStream & os) const … … 161 161 } 162 162 } 163 163 */ 164 164 //-------------------------------------------------------------- 165 165 -
XIOS/trunk/src/input/inetcdf4.cpp
r337 r369 710 710 711 711 template <> 712 void CINetCDF4::getData( ARRAY(int, 1)data, const StdString & var,712 void CINetCDF4::getData(CArray<int, 1>& data, const StdString & var, 713 713 const CVarPath * const path, StdSize record) 714 714 { … … 719 719 StdSize array_size = 1; 720 720 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())); 723 723 } 724 724 725 725 template <> 726 void CINetCDF4::getData( ARRAY(double, 1)data, const StdString & var,726 void CINetCDF4::getData(CArray<double, 1>& data, const StdString & var, 727 727 const CVarPath * const path, StdSize record) 728 728 { … … 732 732 StdSize array_size = 1; 733 733 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())); 736 736 } 737 737 738 738 template <> 739 void CINetCDF4::getData( ARRAY(float, 1)data, const StdString & var,739 void CINetCDF4::getData(CArray<float, 1>& data, const StdString & var, 740 740 const CVarPath * const path, StdSize record) 741 741 { … … 745 745 StdSize array_size = 1; 746 746 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())); 749 749 } 750 750 -
XIOS/trunk/src/input/inetcdf4.hpp
r337 r369 5 5 #include "xmlioserver_spl.hpp" 6 6 #include "exception.hpp" 7 #include "array .hpp"7 #include "array_new.hpp" 8 8 9 9 #include <mpi.h> … … 92 92 93 93 template <class T> 94 void getData( ARRAY(T, 1)data,94 void getData(CArray<T, 1>& data, 95 95 const StdString & var, 96 96 const CVarPath * const path = NULL, … … 220 220 //--------------------------------------------------------------- 221 221 template <> 222 void CINetCDF4::getData( ARRAY(int, 1)data, const StdString & var,222 void CINetCDF4::getData(CArray<int, 1>& data, const StdString & var, 223 223 const CVarPath * const path, StdSize record); 224 224 225 225 template <> 226 void CINetCDF4::getData( ARRAY(double, 1)data, const StdString & var,226 void CINetCDF4::getData(CArray<double, 1>& data, const StdString & var, 227 227 const CVarPath * const path, StdSize record); 228 228 229 229 template <> 230 void CINetCDF4::getData( ARRAY(float, 1)data, const StdString & var,230 void CINetCDF4::getData(CArray<float, 1>& data, const StdString & var, 231 231 const CVarPath * const path, StdSize record); 232 232 ///-------------------------------------------------------------- -
XIOS/trunk/src/interface/c/icdata.cpp
r361 r369 23 23 #include <mpi.h> 24 24 #include "timer.hpp" 25 #include "array_new.hpp" 25 26 26 27 extern "C" … … 111 112 CTimer::get("XIOS send field").resume() ; 112 113 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) ; 121 119 CTimer::get("XIOS send field").suspend() ; 122 120 CTimer::get("XIOS").suspend() ; … … 132 130 CContext* context = CContext::getCurrent() ; 133 131 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) ; 140 133 CField::get(fieldid_str)->setData(data) ; 141 134 CTimer::get("XIOS send field").suspend() ; … … 151 144 CTimer::get("XIOS send field").resume() ; 152 145 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) ; 159 148 CField::get(fieldid_str)->setData(data) ; 160 149 CTimer::get("XIOS send field").suspend() ; … … 170 159 CTimer::get("XIOS send field").resume() ; 171 160 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 ; 181 164 CField::get(fieldid_str)->setData(data) ; 182 165 CTimer::get("XIOS send field").suspend() ; … … 192 175 CTimer::get("XIOS send field").resume() ; 193 176 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 ; 203 180 CField::get(fieldid_str)->setData(data) ; 204 181 CTimer::get("XIOS send field").suspend() ; … … 215 192 CTimer::get("XIOS send field").resume() ; 216 193 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 227 199 CField::get(fieldid_str)->setData(data) ; 228 200 CTimer::get("XIOS send field").suspend() ; -
XIOS/trunk/src/interface/c/icutil.hpp
r335 r369 40 40 } 41 41 } 42 /* 42 43 template<class T> 43 44 inline bool array_copy(ARRAY(T,1) array_in, T* array_out, size_t extent1) … … 63 64 return true ; 64 65 } 65 66 */ 66 67 67 68 #endif // __ICUTIL_HPP__ -
XIOS/trunk/src/interface/c_attr/icaxis_attr.cpp
r352 r369 11 11 #include "icutil.hpp" 12 12 #include "timer.hpp" 13 #include " axis.hpp"13 #include "node_type.hpp" 14 14 15 15 extern "C" … … 109 109 void cxios_set_axis_value(axis_Ptr axis_hdl, double* value, int extent1) 110 110 { 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()); 115 114 axis_hdl->sendAttributToServer(axis_hdl->value); 116 115 } … … 118 117 void cxios_get_axis_value(axis_Ptr axis_hdl, double* value, int extent1) 119 118 { 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 ; 122 121 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(); 123 164 } 124 165 -
XIOS/trunk/src/interface/c_attr/icaxisgroup_attr.cpp
r352 r369 11 11 #include "icutil.hpp" 12 12 #include "timer.hpp" 13 #include " axis.hpp"13 #include "node_type.hpp" 14 14 15 15 extern "C" … … 128 128 void cxios_set_axisgroup_value(axisgroup_Ptr axisgroup_hdl, double* value, int extent1) 129 129 { 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()); 134 133 axisgroup_hdl->sendAttributToServer(axisgroup_hdl->value); 135 134 } … … 137 136 void cxios_get_axisgroup_value(axisgroup_Ptr axisgroup_hdl, double* value, int extent1) 138 137 { 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 ; 141 140 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(); 142 183 } 143 184 -
XIOS/trunk/src/interface/c_attr/iccontext_attr.cpp
r352 r369 11 11 #include "icutil.hpp" 12 12 #include "timer.hpp" 13 #include " context.hpp"13 #include "node_type.hpp" 14 14 15 15 extern "C" -
XIOS/trunk/src/interface/c_attr/icdomain_attr.cpp
r352 r369 11 11 #include "icutil.hpp" 12 12 #include "timer.hpp" 13 #include " domain.hpp"13 #include "node_type.hpp" 14 14 15 15 extern "C" … … 33 33 void cxios_set_domain_data_i_index(domain_Ptr domain_hdl, int* data_i_index, int extent1) 34 34 { 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()); 39 38 domain_hdl->sendAttributToServer(domain_hdl->data_i_index); 40 39 } … … 42 41 void cxios_get_domain_data_i_index(domain_Ptr domain_hdl, int* data_i_index, int extent1) 43 42 { 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 ; 46 45 CTimer::get("XIOS").suspend(); 47 46 } … … 64 63 void cxios_set_domain_data_j_index(domain_Ptr domain_hdl, int* data_j_index, int extent1) 65 64 { 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()); 70 68 domain_hdl->sendAttributToServer(domain_hdl->data_j_index); 71 69 } … … 73 71 void cxios_get_domain_data_j_index(domain_Ptr domain_hdl, int* data_j_index, int extent1) 74 72 { 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 ; 77 75 CTimer::get("XIOS").suspend(); 78 76 } … … 212 210 void cxios_set_domain_latvalue(domain_Ptr domain_hdl, double* latvalue, int extent1) 213 211 { 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()); 218 215 domain_hdl->sendAttributToServer(domain_hdl->latvalue); 219 216 } … … 221 218 void cxios_get_domain_latvalue(domain_Ptr domain_hdl, double* latvalue, int extent1) 222 219 { 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 ; 225 222 CTimer::get("XIOS").suspend(); 226 223 } … … 248 245 void cxios_set_domain_lonvalue(domain_Ptr domain_hdl, double* lonvalue, int extent1) 249 246 { 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()); 254 250 domain_hdl->sendAttributToServer(domain_hdl->lonvalue); 255 251 } … … 257 253 void cxios_get_domain_lonvalue(domain_Ptr domain_hdl, double* lonvalue, int extent1) 258 254 { 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 ; 261 257 CTimer::get("XIOS").suspend(); 262 258 } … … 265 261 void cxios_set_domain_mask(domain_Ptr domain_hdl, bool* mask, int extent1, int extent2) 266 262 { 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()); 271 266 domain_hdl->sendAttributToServer(domain_hdl->mask); 272 267 } … … 274 269 void cxios_get_domain_mask(domain_Ptr domain_hdl, bool* mask, int extent1, int extent2) 275 270 { 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 ; 278 273 CTimer::get("XIOS").suspend(); 279 274 } -
XIOS/trunk/src/interface/c_attr/icdomaingroup_attr.cpp
r352 r369 11 11 #include "icutil.hpp" 12 12 #include "timer.hpp" 13 #include " domain.hpp"13 #include "node_type.hpp" 14 14 15 15 extern "C" … … 33 33 void cxios_set_domaingroup_data_i_index(domaingroup_Ptr domaingroup_hdl, int* data_i_index, int extent1) 34 34 { 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()); 39 38 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_i_index); 40 39 } … … 42 41 void cxios_get_domaingroup_data_i_index(domaingroup_Ptr domaingroup_hdl, int* data_i_index, int extent1) 43 42 { 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 ; 46 45 CTimer::get("XIOS").suspend(); 47 46 } … … 64 63 void cxios_set_domaingroup_data_j_index(domaingroup_Ptr domaingroup_hdl, int* data_j_index, int extent1) 65 64 { 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()); 70 68 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->data_j_index); 71 69 } … … 73 71 void cxios_get_domaingroup_data_j_index(domaingroup_Ptr domaingroup_hdl, int* data_j_index, int extent1) 74 72 { 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 ; 77 75 CTimer::get("XIOS").suspend(); 78 76 } … … 231 229 void cxios_set_domaingroup_latvalue(domaingroup_Ptr domaingroup_hdl, double* latvalue, int extent1) 232 230 { 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()); 237 234 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->latvalue); 238 235 } … … 240 237 void cxios_get_domaingroup_latvalue(domaingroup_Ptr domaingroup_hdl, double* latvalue, int extent1) 241 238 { 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 ; 244 241 CTimer::get("XIOS").suspend(); 245 242 } … … 267 264 void cxios_set_domaingroup_lonvalue(domaingroup_Ptr domaingroup_hdl, double* lonvalue, int extent1) 268 265 { 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()); 273 269 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->lonvalue); 274 270 } … … 276 272 void cxios_get_domaingroup_lonvalue(domaingroup_Ptr domaingroup_hdl, double* lonvalue, int extent1) 277 273 { 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 ; 280 276 CTimer::get("XIOS").suspend(); 281 277 } … … 284 280 void cxios_set_domaingroup_mask(domaingroup_Ptr domaingroup_hdl, bool* mask, int extent1, int extent2) 285 281 { 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()); 290 285 domaingroup_hdl->sendAttributToServer(domaingroup_hdl->mask); 291 286 } … … 293 288 void cxios_get_domaingroup_mask(domaingroup_Ptr domaingroup_hdl, bool* mask, int extent1, int extent2) 294 289 { 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 ; 297 292 CTimer::get("XIOS").suspend(); 298 293 } -
XIOS/trunk/src/interface/c_attr/icfield_attr.cpp
r352 r369 11 11 #include "icutil.hpp" 12 12 #include "timer.hpp" 13 #include " field.hpp"13 #include "node_type.hpp" 14 14 15 15 extern "C" -
XIOS/trunk/src/interface/c_attr/icfieldgroup_attr.cpp
r352 r369 11 11 #include "icutil.hpp" 12 12 #include "timer.hpp" 13 #include " field.hpp"13 #include "node_type.hpp" 14 14 15 15 extern "C" -
XIOS/trunk/src/interface/c_attr/icfile_attr.cpp
r352 r369 11 11 #include "icutil.hpp" 12 12 #include "timer.hpp" 13 #include " file.hpp"13 #include "node_type.hpp" 14 14 15 15 extern "C" … … 183 183 if(!cstr2string(type, type_size, type_str)) return; 184 184 CTimer::get("XIOS").resume(); 185 file_hdl->type. setValue(type_str);185 file_hdl->type.fromString(type_str); 186 186 file_hdl->sendAttributToServer(file_hdl->type); 187 187 CTimer::get("XIOS").suspend(); … … 191 191 { 192 192 CTimer::get("XIOS").resume(); 193 if(!string_copy(file_hdl->type.get Value(),type , type_size))193 if(!string_copy(file_hdl->type.getStringValue(),type , type_size)) 194 194 ERROR("void cxios_get_file_type(file_Ptr file_hdl, char * type, int type_size)", <<"Input string is to short"); 195 195 CTimer::get("XIOS").suspend(); -
XIOS/trunk/src/interface/c_attr/icfilegroup_attr.cpp
r352 r369 11 11 #include "icutil.hpp" 12 12 #include "timer.hpp" 13 #include " file.hpp"13 #include "node_type.hpp" 14 14 15 15 extern "C" … … 202 202 if(!cstr2string(type, type_size, type_str)) return; 203 203 CTimer::get("XIOS").resume(); 204 filegroup_hdl->type. setValue(type_str);204 filegroup_hdl->type.fromString(type_str); 205 205 filegroup_hdl->sendAttributToServer(filegroup_hdl->type); 206 206 CTimer::get("XIOS").suspend(); … … 210 210 { 211 211 CTimer::get("XIOS").resume(); 212 if(!string_copy(filegroup_hdl->type.get Value(),type , type_size))212 if(!string_copy(filegroup_hdl->type.getStringValue(),type , type_size)) 213 213 ERROR("void cxios_get_filegroup_type(filegroup_Ptr filegroup_hdl, char * type, int type_size)", <<"Input string is to short"); 214 214 CTimer::get("XIOS").suspend(); -
XIOS/trunk/src/interface/c_attr/icgrid_attr.cpp
r352 r369 11 11 #include "icutil.hpp" 12 12 #include "timer.hpp" 13 #include " grid.hpp"13 #include "node_type.hpp" 14 14 15 15 extern "C" -
XIOS/trunk/src/interface/c_attr/icgridgroup_attr.cpp
r352 r369 11 11 #include "icutil.hpp" 12 12 #include "timer.hpp" 13 #include " grid.hpp"13 #include "node_type.hpp" 14 14 15 15 extern "C" -
XIOS/trunk/src/interface/fortran_attr/axis_interface_attr.f90
r326 r369 97 97 98 98 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 99 138 END INTERFACE 100 139 -
XIOS/trunk/src/interface/fortran_attr/axisgroup_interface_attr.f90
r326 r369 112 112 113 113 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 114 153 END INTERFACE 115 154 -
XIOS/trunk/src/interface/fortran_attr/iaxis_attr.F90
r326 r369 12 12 13 13 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 ) 15 16 16 17 IMPLICIT NONE … … 23 24 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit 24 25 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 25 29 26 30 CALL xios(get_axis_handle)(axis_id,axis_hdl) 27 31 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 ) 29 34 30 35 END SUBROUTINE xios(set_axis_attr) 31 36 32 37 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 ) 34 40 35 41 IMPLICIT NONE … … 41 47 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit 42 48 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 43 52 44 53 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 ) 46 56 47 57 END SUBROUTINE xios(set_axis_attr_hdl) 48 58 49 59 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_ ) 51 62 52 63 IMPLICIT NONE … … 58 69 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit_ 59 70 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_ 60 74 61 75 IF (PRESENT(long_name_)) THEN … … 83 97 ENDIF 84 98 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 85 111 86 112 … … 88 114 89 115 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 ) 91 118 92 119 IMPLICIT NONE … … 99 126 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit 100 127 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 101 131 102 132 CALL xios(get_axis_handle)(axis_id,axis_hdl) 103 133 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 ) 105 136 106 137 END SUBROUTINE xios(get_axis_attr) 107 138 108 139 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 ) 110 142 111 143 IMPLICIT NONE … … 117 149 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit 118 150 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 119 154 120 155 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 ) 122 158 123 159 END SUBROUTINE xios(get_axis_attr_hdl) 124 160 125 161 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_ ) 127 164 128 165 IMPLICIT NONE … … 134 171 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit_ 135 172 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_ 136 176 137 177 IF (PRESENT(long_name_)) THEN … … 159 199 ENDIF 160 200 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 161 213 162 214 -
XIOS/trunk/src/interface/fortran_attr/iaxisgroup_attr.F90
r326 r369 12 12 13 13 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 ) 15 16 16 17 IMPLICIT NONE … … 24 25 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit 25 26 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 26 30 27 31 CALL xios(get_axisgroup_handle)(axisgroup_id,axisgroup_hdl) 28 32 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 ) 30 35 31 36 END SUBROUTINE xios(set_axisgroup_attr) 32 37 33 38 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 ) 35 41 36 42 IMPLICIT NONE … … 43 49 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit 44 50 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 45 54 46 55 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 ) 48 58 49 59 END SUBROUTINE xios(set_axisgroup_attr_hdl) 50 60 51 61 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_ ) 53 64 54 65 IMPLICIT NONE … … 61 72 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit_ 62 73 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_ 63 77 64 78 IF (PRESENT(group_ref_)) THEN … … 90 104 ENDIF 91 105 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 92 118 93 119 … … 95 121 96 122 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 ) 98 125 99 126 IMPLICIT NONE … … 107 134 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit 108 135 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 109 139 110 140 CALL xios(get_axisgroup_handle)(axisgroup_id,axisgroup_hdl) 111 141 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 ) 113 144 114 145 END SUBROUTINE xios(get_axisgroup_attr) 115 146 116 147 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 ) 118 150 119 151 IMPLICIT NONE … … 126 158 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit 127 159 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 128 163 129 164 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 ) 131 167 132 168 END SUBROUTINE xios(get_axisgroup_attr_hdl) 133 169 134 170 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_ ) 136 173 137 174 IMPLICIT NONE … … 144 181 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit_ 145 182 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_ 146 186 147 187 IF (PRESENT(group_ref_)) THEN … … 173 213 ENDIF 174 214 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 175 227 176 228 -
XIOS/trunk/src/interface/fortran_attr/icontext_attr.F90
r326 r369 12 12 13 13 SUBROUTINE xios(set_context_attr) & 14 ( context_id, calendar_type, output_dir, start_date, time step )14 ( context_id, calendar_type, output_dir, start_date, time_origin, timestep ) 15 15 16 16 IMPLICIT NONE … … 20 20 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir 21 21 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date 22 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin 22 23 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: timestep 23 24 24 25 CALL xios(get_context_handle)(context_id,context_hdl) 25 26 CALL xios(set_context_attr_hdl_) & 26 ( context_hdl, calendar_type, output_dir, start_date, time step )27 ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep ) 27 28 28 29 END SUBROUTINE xios(set_context_attr) 29 30 30 31 SUBROUTINE xios(set_context_attr_hdl) & 31 ( context_hdl, calendar_type, output_dir, start_date, time step )32 ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep ) 32 33 33 34 IMPLICIT NONE … … 36 37 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir 37 38 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date 39 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin 38 40 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: timestep 39 41 40 42 CALL xios(set_context_attr_hdl_) & 41 ( context_hdl, calendar_type, output_dir, start_date, time step )43 ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep ) 42 44 43 45 END SUBROUTINE xios(set_context_attr_hdl) 44 46 45 47 SUBROUTINE xios(set_context_attr_hdl_) & 46 ( context_hdl, calendar_type_, output_dir_, start_date_, time step_ )48 ( context_hdl, calendar_type_, output_dir_, start_date_, time_origin_, timestep_ ) 47 49 48 50 IMPLICIT NONE … … 51 53 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir_ 52 54 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date_ 55 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin_ 53 56 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: timestep_ 54 57 … … 65 68 ENDIF 66 69 70 IF (PRESENT(time_origin_)) THEN 71 CALL cxios_set_context_time_origin(context_hdl%daddr, time_origin_, len(time_origin_)) 72 ENDIF 73 67 74 IF (PRESENT(timestep_)) THEN 68 75 CALL cxios_set_context_timestep(context_hdl%daddr, timestep_, len(timestep_)) … … 74 81 75 82 SUBROUTINE xios(get_context_attr) & 76 ( context_id, calendar_type, output_dir, start_date, time step )83 ( context_id, calendar_type, output_dir, start_date, time_origin, timestep ) 77 84 78 85 IMPLICIT NONE … … 82 89 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir 83 90 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date 91 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin 84 92 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: timestep 85 93 86 94 CALL xios(get_context_handle)(context_id,context_hdl) 87 95 CALL xios(get_context_attr_hdl_) & 88 ( context_hdl, calendar_type, output_dir, start_date, time step )96 ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep ) 89 97 90 98 END SUBROUTINE xios(get_context_attr) 91 99 92 100 SUBROUTINE xios(get_context_attr_hdl) & 93 ( context_hdl, calendar_type, output_dir, start_date, time step )101 ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep ) 94 102 95 103 IMPLICIT NONE … … 98 106 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir 99 107 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date 108 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin 100 109 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: timestep 101 110 102 111 CALL xios(get_context_attr_hdl_) & 103 ( context_hdl, calendar_type, output_dir, start_date, time step )112 ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep ) 104 113 105 114 END SUBROUTINE xios(get_context_attr_hdl) 106 115 107 116 SUBROUTINE xios(get_context_attr_hdl_) & 108 ( context_hdl, calendar_type_, output_dir_, start_date_, time step_ )117 ( context_hdl, calendar_type_, output_dir_, start_date_, time_origin_, timestep_ ) 109 118 110 119 IMPLICIT NONE … … 113 122 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir_ 114 123 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date_ 124 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin_ 115 125 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: timestep_ 116 126 … … 127 137 ENDIF 128 138 139 IF (PRESENT(time_origin_)) THEN 140 CALL cxios_get_context_time_origin(context_hdl%daddr, time_origin_, len(time_origin_)) 141 ENDIF 142 129 143 IF (PRESENT(timestep_)) THEN 130 144 CALL cxios_get_context_timestep(context_hdl%daddr, timestep_, len(timestep_)) -
XIOS/trunk/src/interface/fortran_attr/ifile_attr.F90
r326 r369 12 12 13 13 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 ) 16 16 17 17 IMPLICIT NONE … … 25 25 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_freq 26 26 INTEGER , OPTIONAL, INTENT(IN) :: output_level 27 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: par_access 27 28 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: split_freq 28 29 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: sync_freq … … 31 32 CALL xios(get_file_handle)(file_id,file_hdl) 32 33 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 ) 35 36 36 37 END SUBROUTINE xios(set_file_attr) 37 38 38 39 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 ) 41 42 42 43 IMPLICIT NONE … … 49 50 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_freq 50 51 INTEGER , OPTIONAL, INTENT(IN) :: output_level 52 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: par_access 51 53 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: split_freq 52 54 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: sync_freq … … 54 56 55 57 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 ) 58 60 59 61 END SUBROUTINE xios(set_file_attr_hdl) 60 62 61 63 SUBROUTINE xios(set_file_attr_hdl_) & 62 ( file_hdl, description_, enabled_, name_, name_suffix_, output_freq_, output_level_, split_freq_ &63 , s ync_freq_, type_ )64 ( file_hdl, description_, enabled_, name_, name_suffix_, output_freq_, output_level_, par_access_ & 65 , split_freq_, sync_freq_, type_ ) 64 66 65 67 IMPLICIT NONE … … 72 74 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_freq_ 73 75 INTEGER , OPTIONAL, INTENT(IN) :: output_level_ 76 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: par_access_ 74 77 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: split_freq_ 75 78 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: sync_freq_ … … 101 104 ENDIF 102 105 106 IF (PRESENT(par_access_)) THEN 107 CALL cxios_set_file_par_access(file_hdl%daddr, par_access_, len(par_access_)) 108 ENDIF 109 103 110 IF (PRESENT(split_freq_)) THEN 104 111 CALL cxios_set_file_split_freq(file_hdl%daddr, split_freq_, len(split_freq_)) … … 118 125 119 126 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 ) 122 129 123 130 IMPLICIT NONE … … 131 138 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_freq 132 139 INTEGER , OPTIONAL, INTENT(OUT) :: output_level 140 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: par_access 133 141 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: split_freq 134 142 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: sync_freq … … 137 145 CALL xios(get_file_handle)(file_id,file_hdl) 138 146 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 ) 141 149 142 150 END SUBROUTINE xios(get_file_attr) 143 151 144 152 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 ) 147 155 148 156 IMPLICIT NONE … … 155 163 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_freq 156 164 INTEGER , OPTIONAL, INTENT(OUT) :: output_level 165 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: par_access 157 166 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: split_freq 158 167 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: sync_freq … … 160 169 161 170 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 ) 164 173 165 174 END SUBROUTINE xios(get_file_attr_hdl) 166 175 167 176 SUBROUTINE xios(get_file_attr_hdl_) & 168 ( file_hdl, description_, enabled_, name_, name_suffix_, output_freq_, output_level_, split_freq_ &169 , s ync_freq_, type_ )177 ( file_hdl, description_, enabled_, name_, name_suffix_, output_freq_, output_level_, par_access_ & 178 , split_freq_, sync_freq_, type_ ) 170 179 171 180 IMPLICIT NONE … … 178 187 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_freq_ 179 188 INTEGER , OPTIONAL, INTENT(OUT) :: output_level_ 189 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: par_access_ 180 190 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: split_freq_ 181 191 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: sync_freq_ … … 207 217 ENDIF 208 218 219 IF (PRESENT(par_access_)) THEN 220 CALL cxios_get_file_par_access(file_hdl%daddr, par_access_, len(par_access_)) 221 ENDIF 222 209 223 IF (PRESENT(split_freq_)) THEN 210 224 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 13 13 SUBROUTINE xios(set_filegroup_attr) & 14 14 ( 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 ) 16 16 17 17 IMPLICIT NONE … … 26 26 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_freq 27 27 INTEGER , OPTIONAL, INTENT(IN) :: output_level 28 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: par_access 28 29 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: split_freq 29 30 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: sync_freq … … 33 34 CALL xios(set_filegroup_attr_hdl_) & 34 35 ( 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 ) 36 37 37 38 END SUBROUTINE xios(set_filegroup_attr) … … 39 40 SUBROUTINE xios(set_filegroup_attr_hdl) & 40 41 ( 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 ) 42 43 43 44 IMPLICIT NONE … … 51 52 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_freq 52 53 INTEGER , OPTIONAL, INTENT(IN) :: output_level 54 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: par_access 53 55 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: split_freq 54 56 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: sync_freq … … 57 59 CALL xios(set_filegroup_attr_hdl_) & 58 60 ( 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 ) 60 62 61 63 END SUBROUTINE xios(set_filegroup_attr_hdl) … … 63 65 SUBROUTINE xios(set_filegroup_attr_hdl_) & 64 66 ( 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_ ) 66 68 67 69 IMPLICIT NONE … … 75 77 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_freq_ 76 78 INTEGER , OPTIONAL, INTENT(IN) :: output_level_ 79 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: par_access_ 77 80 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: split_freq_ 78 81 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: sync_freq_ … … 108 111 ENDIF 109 112 113 IF (PRESENT(par_access_)) THEN 114 CALL cxios_set_filegroup_par_access(filegroup_hdl%daddr, par_access_, len(par_access_)) 115 ENDIF 116 110 117 IF (PRESENT(split_freq_)) THEN 111 118 CALL cxios_set_filegroup_split_freq(filegroup_hdl%daddr, split_freq_, len(split_freq_)) … … 126 133 SUBROUTINE xios(get_filegroup_attr) & 127 134 ( 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 ) 129 136 130 137 IMPLICIT NONE … … 139 146 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_freq 140 147 INTEGER , OPTIONAL, INTENT(OUT) :: output_level 148 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: par_access 141 149 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: split_freq 142 150 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: sync_freq … … 146 154 CALL xios(get_filegroup_attr_hdl_) & 147 155 ( 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 ) 149 157 150 158 END SUBROUTINE xios(get_filegroup_attr) … … 152 160 SUBROUTINE xios(get_filegroup_attr_hdl) & 153 161 ( 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 ) 155 163 156 164 IMPLICIT NONE … … 164 172 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_freq 165 173 INTEGER , OPTIONAL, INTENT(OUT) :: output_level 174 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: par_access 166 175 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: split_freq 167 176 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: sync_freq … … 170 179 CALL xios(get_filegroup_attr_hdl_) & 171 180 ( 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 ) 173 182 174 183 END SUBROUTINE xios(get_filegroup_attr_hdl) … … 176 185 SUBROUTINE xios(get_filegroup_attr_hdl_) & 177 186 ( 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_ ) 179 188 180 189 IMPLICIT NONE … … 188 197 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_freq_ 189 198 INTEGER , OPTIONAL, INTENT(OUT) :: output_level_ 199 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: par_access_ 190 200 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: split_freq_ 191 201 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: sync_freq_ … … 221 231 ENDIF 222 232 233 IF (PRESENT(par_access_)) THEN 234 CALL cxios_get_filegroup_par_access(filegroup_hdl%daddr, par_access_, len(par_access_)) 235 ENDIF 236 223 237 IF (PRESENT(split_freq_)) THEN 224 238 CALL cxios_get_filegroup_split_freq(filegroup_hdl%daddr, split_freq_, len(split_freq_)) -
XIOS/trunk/src/log.hpp
r364 r369 3 3 #include <string> 4 4 #include <iostream> 5 #include <string> 5 6 6 7 namespace xios -
XIOS/trunk/src/node/axis.cpp
r352 r369 73 73 this->zoom_size.setValue(zoom_size) ; 74 74 75 StdSize true_size = value. getValue()->num_elements();75 StdSize true_size = value.numElements(); 76 76 if (size != true_size) 77 77 ERROR("CAxis::checkAttributes(void)", -
XIOS/trunk/src/node/axis.hpp
r345 r369 7 7 8 8 #include "declare_group.hpp" 9 #include "attribute_array.hpp" 9 10 10 11 namespace xios { -
XIOS/trunk/src/node/context.cpp
r354 r369 176 176 177 177 //---------------------------------------------------------------- 178 178 /* 179 179 void CContext::toBinary(StdOStream & os) const 180 180 { … … 192 192 #include "node_type.conf" 193 193 } 194 195 //---------------------------------------------------------------- 196 194 */ 195 //---------------------------------------------------------------- 196 /* 197 197 void CContext::fromBinary(StdIStream & is) 198 198 { … … 213 213 214 214 } 215 215 */ 216 216 217 217 //---------------------------------------------------------------- -
XIOS/trunk/src/node/context.hpp
r352 r369 138 138 139 139 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); 142 142 143 143 public : -
XIOS/trunk/src/node/domain.cpp
r352 r369 13 13 #include "context.hpp" 14 14 #include "context_client.hpp" 15 #include "array_new.hpp" 15 16 16 17 namespace xios { … … 20 21 CDomain::CDomain(void) 21 22 : CObjectTemplate<CDomain>(), CDomainAttributes() 22 , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])),relFiles()23 , isChecked(false), relFiles() 23 24 , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 24 25 , 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() 27 27 { /* Ne rien faire de plus */ } 28 28 29 29 CDomain::CDomain(const StdString & id) 30 30 : CObjectTemplate<CDomain>(id), CDomainAttributes() 31 , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])),relFiles()31 , isChecked(false), relFiles() 32 32 , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 33 33 , 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() 36 35 { /* Ne rien faire de plus */ } 37 36 38 37 CDomain::~CDomain(void) 39 38 { 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; 46 42 } 47 43 … … 84 80 85 81 //---------------------------------------------------------------- 86 82 /* 87 83 void CDomain::fromBinary(StdIStream & is) 88 84 { … … 112 108 113 109 #define CLEAR_ATT(name_)\ 114 SuperClassAttribute::operator[](#name_)-> clear()110 SuperClassAttribute::operator[](#name_)->reset() 115 111 116 112 CLEAR_ATT(mask); … … 143 139 } 144 140 } 145 141 */ 146 142 //---------------------------------------------------------------- 147 143 … … 265 261 if (!mask.isEmpty()) 266 262 { 267 ARRAY(bool, 2) mask_ = mask.getValue();268 263 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)) 271 266 ERROR("CDomain::checkAttributes(void)", 272 267 <<"Le masque n'a pas la même taille que le domaine local") ; … … 278 273 if (i < ibegin_mask && i > iend_mask && 279 274 j < jbegin_mask && j > jend_mask ) 280 (*mask_)[i][j]= false;275 mask(i,j) = false; 281 276 } 282 277 } … … 285 280 { // Si aucun masque n'est défini, 286 281 // 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) ; 288 283 for (int i = 0; i < ni.getValue(); i++) 289 284 { … … 292 287 if (i >= ibegin_mask && i <= iend_mask && 293 288 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; 296 291 } 297 292 } 298 299 mask.setValue(__arr);300 __arr.reset();301 293 } 302 294 } … … 355 347 if (!data_i_index.isEmpty()) 356 348 { 357 int ssize = data_i_index. getValue()->size();349 int ssize = data_i_index.numElements(); 358 350 if (!data_n_index.isEmpty() && 359 351 (data_n_index.getValue() != ssize)) … … 368 360 { 369 361 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())) 371 363 { 372 364 ERROR("CDomain::checkAttributes(void)", … … 392 384 { 393 385 const int dni = data_ni.getValue(); 394 ARRAY_CREATE(__arri, int, 1, [dni]);386 data_i_index.resize(dni) ; 395 387 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 ; 399 389 } 400 390 else // (data_dim == 2) 401 391 { 402 392 const int dni = data_ni.getValue() * data_nj.getValue(); 393 data_i_index.resize(dni) ; 394 data_j_index.resize(dni) ; 403 395 404 ARRAY_CREATE(__arri, int, 1, [dni]);405 ARRAY_CREATE(__arrj, int, 1, [dni]);406 396 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++)410 397 411 398 for(int count = 0, j = 0; j < data_nj.getValue(); j++) … … 413 400 for(int i = 0; i < data_ni.getValue(); i++, count++) 414 401 { 415 (*__arri)[count]= i+1 ;416 (*__arrj)[count]= j+1 ;402 data_i_index(count) = i+1 ; 403 data_j_index(count) = j+1 ; 417 404 } 418 405 } 419 data_i_index.setValue(__arri) ;420 data_j_index.setValue(__arrj) ;421 __arri.reset();422 __arrj.reset();423 406 } 424 407 } … … 429 412 void CDomain::completeLonLatClient(void) 430 413 { 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 ; 433 416 434 417 const int zoom_ibegin_client = zoom_ibegin_loc.getValue(), … … 437 420 zoom_nj_client = zoom_nj_loc.getValue(); 438 421 439 ARRAY(double, 1) lonvalue_ = this->lonvalue.getValue(),440 latvalue_ = this->latvalue.getValue();441 442 422 if (this->data_dim.getValue() == 2) 443 423 { 444 424 StdSize dm = zoom_ni_client * zoom_nj_client; 445 425 446 lonvalue_temp ->resize(boost::extents[dm]);447 latvalue_temp ->resize(boost::extents[dm]);426 lonvalue_temp.resize(dm); 427 latvalue_temp.resize(dm); 448 428 449 429 for (int i = 0; i < zoom_ni_client; i++) … … 451 431 for (int j = 0; j < zoom_nj_client; j++) 452 432 { 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() ); 457 435 } 458 436 } 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 ; 461 441 } 462 442 else 463 443 { 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 467 448 for (int i = zoom_ibegin_client - 1; i < (zoom_ni_client - zoom_ibegin_client + 1); i++) 468 449 { 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()) ; 479 460 } 480 461 } … … 484 465 void CDomain::completeLonLatServer(void) 485 466 { 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 ; 488 469 489 470 const int ibegin_serv = ibegin.getValue(), … … 499 480 StdSize dm = zoom_ni_serv * zoom_nj_serv; 500 481 501 lonvalue_temp ->resize(boost::extents[dm]);502 latvalue_temp ->resize(boost::extents[dm]);482 lonvalue_temp.resize(dm); 483 latvalue_temp.resize(dm); 503 484 504 485 for (StdSize k = 0; k < lonvalue_sub.size(); k++) 505 486 { 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 508 490 const int zoom_ibegin_cl = ibegin_zoom_sub[k], zoom_ni_cl = ni_zoom_sub[k], 509 491 zoom_jbegin_cl = jbegin_zoom_sub[k], zoom_nj_cl = nj_zoom_sub[k], … … 518 500 int ii = i + (ibegin_cl-1) - (ibegin_serv - 1) + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1); 519 501 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); 524 504 } 525 505 } 526 506 } 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()) ; 529 510 } 530 511 else 531 512 { 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); 534 515 535 516 for (StdSize k = 0; k < lonvalue_sub.size(); k++) 536 517 { 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 539 521 const int zoom_ibegin_cl = ibegin_zoom_sub[k], zoom_ni_cl = ni_zoom_sub[k], 540 522 zoom_jbegin_cl = jbegin_zoom_sub[k], zoom_nj_cl = nj_zoom_sub[k]; 541 523 542 524 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); 545 526 546 527 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); 549 529 } 550 this->lonvalue.setValue(lonvalue_temp);551 this->latvalue.setValue(latvalue_temp);530 lonvalue.reference(lonvalue_temp.copy()) ; 531 latvalue.reference(latvalue_temp.copy()) ; 552 532 } 553 533 } … … 662 642 this->nj_zoom_sub.push_back(this->zoom_nj_loc.getValue()); 663 643 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())); 666 646 667 647 … … 855 835 CEventClient event(getType(),EVENT_ID_LON_LAT) ; 856 836 857 ARRAY(double, 1) lonvalue_client = lonvalue.getValue(),858 latvalue_client = latvalue.getValue();859 860 837 int ib,ie,in ; 861 838 int jb,je,jn ; 862 839 863 840 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 ; 865 842 866 843 for(int ns=0;ns<connectedServer.size();ns++) … … 869 846 jb=jb_srv[ns] ; je=je_srv[ns] ; jn=jn_srv[ns] ; 870 847 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) ; 875 852 876 853 … … 882 859 ind_client=(i-zoom_ibegin_client)+(j-zoom_jbegin_client)*zoom_ni_client ; 883 860 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 ; 888 865 } 889 866 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 892 872 list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 893 873 894 874 *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() ; 896 876 event.push(connectedServer[ns],nbSenders[ns],*list_msg.back()) ; 897 877 } 898 878 899 879 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 900 887 } 901 888 … … 953 940 } 954 941 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) ; 957 944 } 958 945 … … 971 958 void CDomain::recvLonLat(CBufferIn& buffer) 972 959 { 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 978 965 buffer>>indi>>indj>>lon>>lat ; 979 966 int i,j,ind_srv ; 980 967 981 for(int ind=0;ind<indi ->num_elements();ind++)968 for(int ind=0;ind<indi.numElements();ind++) 982 969 { 983 i= (*indi)[ind] ; j=(*indj)[ind];970 i=indi(ind) ; j=indj(ind) ; 984 971 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) ; 987 974 } 988 975 } … … 991 978 void CDomain::completeMask(void) 992 979 { 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) const980 this->local_mask.resize(zoom_ni_loc,zoom_nj_loc); 981 } 982 983 //---------------------------------------------------------------- 984 985 CArray<int,2> CDomain::getLocalMask(void) const 999 986 { 1000 987 return (this->local_mask); … … 1056 1043 //---------------------------------------------------------------- 1057 1044 1058 const std::vector< ARRAY(double, 1)> & CDomain::getLonValueSub(void) const1045 const std::vector<CArray<double, 1>* > & CDomain::getLonValueSub(void) const 1059 1046 { 1060 1047 return (this->lonvalue_sub); … … 1063 1050 //---------------------------------------------------------------- 1064 1051 1065 const std::vector< ARRAY(double, 1)> & CDomain::getLatValueSub(void) const1052 const std::vector<CArray<double,1>*> & CDomain::getLatValueSub(void) const 1066 1053 { 1067 1054 return (this->latvalue_sub); -
XIOS/trunk/src/node/domain.hpp
r345 r369 10 10 #include "event_server.hpp" 11 11 #include "buffer_in.hpp" 12 #include "array_new.hpp" 13 #include "attribute_array.hpp" 12 14 13 15 namespace xios { … … 73 75 74 76 /// Autres /// 75 virtual void fromBinary(StdIStream & is);77 // virtual void fromBinary(StdIStream & is); 76 78 77 79 /// Accesseurs /// 78 ARRAY(int, 2)getLocalMask(void) const;80 CArray<int, 2> getLocalMask(void) const; 79 81 80 82 const std::set<StdString> & getRelFiles(void) const; … … 90 92 const std::vector<int> & getNjZoomSub(void) const; 91 93 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; 94 96 95 97 /// Test /// … … 111 113 int zoom_nj_srv,zoom_jbegin_srv,zoom_jend_srv ; 112 114 113 ARRAY(double, 1)lonvalue_srv, latvalue_srv ;115 CArray<double, 1> lonvalue_srv, latvalue_srv ; 114 116 115 117 … … 142 144 static ENodeType GetType(void); 143 145 146 CArray<int, 2> local_mask; 147 144 148 private : 145 149 146 150 /// Proriétés protégées /// 147 151 bool isChecked; 148 ARRAY(int, 2) local_mask;149 152 std::set<StdString> relFiles; 150 153 151 154 std::vector<int> ibegin_sub, iend_sub, jbegin_sub, jend_sub; 152 155 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; 154 157 155 158 -
XIOS/trunk/src/node/field.cpp
r352 r369 24 24 , last_Write(), last_operation() 25 25 , foperation() 26 , data(new CArray<double, 1>(boost::extents[0])) 27 { /* Ne rien faire de plus */ } 26 { /* Ne rien faire de plus */ } 28 27 29 28 CField::CField(const StdString & id) … … 35 34 , last_Write(), last_operation() 36 35 , foperation() 37 , data(new CArray<double, 1>(boost::extents[0]))38 36 { /* Ne rien faire de plus */ } 39 37 … … 43 41 // this->file.reset() ; 44 42 this->foperation.reset() ; 45 this->data.reset() ;46 43 } 47 44 … … 50 47 bool CField::updateDataServer 51 48 (const CDate & currDate, 52 const std::deque< ARRAY(double, 1)> storedClient)49 const std::deque< CArray<double, 1>* > storedClient) 53 50 { 54 51 const CDate opeDate = *last_operation + freq_operation; … … 57 54 if (opeDate <= currDate) 58 55 { 59 if (this->data ->num_elements() != this->grid->storeIndex[0]->num_elements())56 if (this->data.numElements() != this->grid->storeIndex[0]->numElements()) 60 57 { 61 this->data ->resize(boost::extents[this->grid->storeIndex[0] ->num_elements()]);58 this->data.resize(this->grid->storeIndex[0] ->numElements()); 62 59 } 63 ARRAY_CREATE(input, double, 1, [this->data->num_elements()]);60 CArray<double,1> input(data.numElements()) ; 64 61 this->grid->inputFieldServer(storedClient, input); 65 62 (*this->foperation)(input); … … 103 100 CEventClient event(getType(),EVENT_ID_UPDATE_DATA) ; 104 101 105 map<int, ARRAY(int, 1)>::iterator it ;102 map<int,CArray<int, 1>* >::iterator it ; 106 103 list<shared_ptr<CMessage> > list_msg ; 107 list< ARRAY(double,1)> list_data ;104 list< CArray<double,1>* > list_data ; 108 105 109 106 for(it=grid->storeIndex_toSrv.begin();it!=grid->storeIndex_toSrv.end();it++) 110 107 { 111 108 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)) ; 115 113 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() ; 118 116 event.push(rank,grid->nbSenders[rank],*list_msg.back()) ; 119 117 } 120 118 client->sendEvent(event) ; 119 120 for(list< CArray<double,1>* >::iterator it=list_data.begin();it!=list_data.end();it++) delete *it ; 121 121 } 122 122 … … 145 145 if (data_srv.empty()) 146 146 { 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++) 148 148 { 149 149 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])))) ; 153 153 } 154 154 } … … 165 165 for(int n=0;n<ranks.size();n++) 166 166 { 167 ARRAY_CREATE(data_tmp,double,1,[0]);167 CArray<double,1> data_tmp ; 168 168 *buffers[n]>>data_tmp ; 169 169 (*foperation_srv[ranks[n]])(data_tmp) ; … … 187 187 void CField::writeField(void) 188 188 { 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) 190 191 { 191 192 getRelFile()->checkFile(); … … 305 306 //---------------------------------------------------------------- 306 307 307 ARRAY(double, 1)CField::getData(void) const308 CArray<double, 1> CField::getData(void) const 308 309 { 309 310 return(this->data); … … 410 411 const CDuration toffset = this->freq_operation - freq_offset_ - context->getCalendar()->getTimeStep(); 411 412 *this->last_operation = *this->last_operation - toffset; 413 cout<<operation<<endl ; 412 414 413 415 #define DECLARE_FUNCTOR(MType, mtype) \ … … 429 431 430 432 //---------------------------------------------------------------- 431 433 /* 432 434 void CField::fromBinary(StdIStream & is) 433 435 { 434 436 SuperClass::fromBinary(is); 435 437 #define CLEAR_ATT(name_)\ 436 SuperClassAttribute::operator[](#name_)-> clear()438 SuperClassAttribute::operator[](#name_)->reset() 437 439 438 440 CLEAR_ATT(domain_ref); … … 441 443 442 444 } 443 445 */ 444 446 //---------------------------------------------------------------- 445 447 … … 537 539 } 538 540 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; 542 544 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; 550 552 551 553 for(it=data_srv.begin();it!=data_srv.end();it++) 552 554 { 553 grid->outputField(it->first, it->second, fieldOut) ;555 grid->outputField(it->first,*it->second, fieldOut) ; 554 556 } 555 557 } -
XIOS/trunk/src/node/field.hpp
r347 r369 11 11 #include "declare_group.hpp" 12 12 #include "calendar_util.hpp" 13 #include "array_new.hpp" 14 #include "attribute_array.hpp" 13 15 //#include "context.hpp" 14 16 … … 80 82 boost::shared_ptr<func::CFunctor> getFieldOperation(void) const; 81 83 82 ARRAY(double, 1)getData(void) const;84 CArray<double, 1> getData(void) const; 83 85 84 86 const StdString & getBaseFieldId(void) const; … … 89 91 void resetNStep() ; 90 92 91 template < StdSize N> bool updateData(const ARRAY(double, N)data);93 template <int N> bool updateData(const CArray<double, N>& data); 92 94 93 95 bool updateDataServer 94 96 (const CDate & currDate, 95 const std::deque< ARRAY(double, 1)> storedClient);97 const std::deque< CArray<double, 1>* > storedClient); 96 98 97 99 public : … … 106 108 void solveOperation(void); 107 109 108 virtual void fromBinary(StdIStream & is);110 // virtual void fromBinary(StdIStream & is); 109 111 110 112 /// Destructeur /// … … 117 119 static ENodeType GetType(void); 118 120 119 template < StdSize N> void setData(const ARRAY(double, N)_data) ;121 template <int N> void setData(const CArray<double, N>& _data) ; 120 122 static bool dispatchEvent(CEventServer& event) ; 121 123 void sendUpdateData(void) ; … … 123 125 void recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers) ; 124 126 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) ; 127 129 128 130 public : … … 145 147 map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; 146 148 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 ; 149 151 150 152 }; // class CField -
XIOS/trunk/src/node/field_decl.cpp
r352 r369 3 3 namespace xios 4 4 { 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) ; 8 8 9 9 } -
XIOS/trunk/src/node/field_impl.hpp
r352 r369 8 8 #include "grid.hpp" 9 9 #include "timer.hpp" 10 #include "array.hpp" 10 #include "array_new.hpp" 11 11 12 12 13 namespace xios { 13 14 14 template < StdSizeN>15 void CField::setData(const ARRAY(double, N)_data)15 template <int N> 16 void CField::setData(const CArray<double, N>& _data) 16 17 { 17 18 const std::vector<CField*>& refField=getAllReference(); … … 21 22 } 22 23 23 template < StdSizeN>24 bool CField::updateData(const ARRAY(double, N)_data)24 template <int N> 25 bool CField::updateData(const CArray<double, N>& _data) 25 26 { 26 27 CContext* context=CContext::getCurrent(); … … 35 36 if (opeDate <= currDate) 36 37 { 37 if (this->data ->num_elements() != this->grid->storeIndex_client->num_elements())38 if (this->data.numElements() != this->grid->storeIndex_client.numElements()) 38 39 { 39 this->data ->resize(boost::extents[this->grid->storeIndex_client ->num_elements()]);40 this->data.resize(this->grid->storeIndex_client.numElements()); 40 41 } 41 42 42 ARRAY_CREATE(input, double, 1, [this->data->num_elements()]);43 CArray<double,1> input(data.numElements()) ; 43 44 this->grid->inputField(_data, input); 44 45 (*this->foperation)(input); -
XIOS/trunk/src/node/file.cpp
r352 r369 216 216 nbDomain=setDomain.size() ; 217 217 218 if (!AllDomainEmpty || type .getValue()=="one_file")218 if (!AllDomainEmpty || type == type_attr::one_file) 219 219 { 220 220 StdString filename = (!name.isEmpty()) ? name.getValue() : getId(); … … 228 228 if (!type.isEmpty()) 229 229 { 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 ; 232 232 else ERROR("void Context::createDataOutput(void)", 233 233 "incorrect file <type> attribut : must be <multi_file> or <one_file>, " … … 280 280 delete lastSync ; 281 281 delete lastSplit ; 282 if (!AllDomainEmpty || type .getValue()=="one_file")282 if (!AllDomainEmpty || type==type_attr::one_file) 283 283 if (isOpen) 284 284 { … … 349 349 350 350 //--------------------------------------------------------------- 351 351 /* 352 352 void CFile::toBinary (StdOStream & os) const 353 353 { … … 382 382 383 383 } 384 384 */ 385 385 386 CField* CFile::addField(const string& id) 386 387 { -
XIOS/trunk/src/node/file.hpp
r347 r369 8 8 #include "declare_group.hpp" 9 9 #include "date.hpp" 10 #include "attribute_enum.hpp" 11 #include "attribute_enum_impl.hpp" 10 12 11 13 … … 82 84 virtual StdString toString(void) const; 83 85 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); 86 88 87 89 /// Accesseurs statiques /// -
XIOS/trunk/src/node/grid.cpp
r352 r369 11 11 #include "context.hpp" 12 12 #include "context_client.hpp" 13 #include "array_new.hpp" 13 14 14 15 namespace xios { … … 32 33 // this->axis.reset() ; 33 34 // 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 42 46 } 43 47 … … 50 54 //---------------------------------------------------------------- 51 55 52 const std::deque< ARRAY(int, 1)> & CGrid::getStoreIndex(void) const56 const std::deque< CArray<int,1>* > & CGrid::getStoreIndex(void) const 53 57 { 54 58 return (this->storeIndex ); … … 57 61 //--------------------------------------------------------------- 58 62 59 const std::deque< ARRAY(int, 1)> & CGrid::getOutIIndex(void) const63 const std::deque< CArray<int,1>* > & CGrid::getOutIIndex(void) const 60 64 { 61 65 return (this->out_i_index ); … … 64 68 //--------------------------------------------------------------- 65 69 66 const std::deque< ARRAY(int, 1)> & CGrid::getOutJIndex(void) const70 const std::deque< CArray<int,1>* > & CGrid::getOutJIndex(void) const 67 71 { 68 72 return (this->out_j_index ); … … 71 75 //--------------------------------------------------------------- 72 76 73 const std::deque< ARRAY(int, 1)> & CGrid::getOutLIndex(void) const77 const std::deque< CArray<int,1>* > & CGrid::getOutLIndex(void) const 74 78 { 75 79 return (this->out_l_index ); … … 155 159 StdSize CGrid::getDataSize(void) const 156 160 { 157 StdSize retvalue ; 158 retvalue=domain->data_ni.getValue() ; 161 StdSize retvalue=domain->data_ni.getValue() ; 159 162 if (domain->data_dim.getValue()==2) retvalue*=domain->data_nj.getValue() ; 160 163 if (this->withAxis) retvalue*=this->axis->size.getValue() ; … … 177 180 178 181 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>()); 188 187 } 189 188 // this->computeIndexServer(); … … 245 244 ? domain->data_jbegin.getValue() : -1; 246 245 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 253 253 254 254 int indexCount = 0; … … 258 258 for(int n = 0, i = 0, j = 0; n < data_n_index; n++) 259 259 { 260 int temp_i = (*data_i_index)[n]+ data_ibegin,260 int temp_i = data_i_index(n) + data_ibegin, 261 261 temp_j = (data_dim == 1) ? -1 262 : (*data_j_index)[n]+ data_jbegin;262 : data_j_index(n) + data_jbegin; 263 263 i = (data_dim == 1) ? (temp_i - 1) % ni 264 264 : (temp_i - 1) ; … … 268 268 if ((l >=lbegin && l<= lend) && 269 269 (i >= 0 && i < ni) && 270 (j >= 0 && j < nj) && (*mask)[i][j])270 (j >= 0 && j < nj) && mask(i,j)) 271 271 indexCount++ ; 272 272 } 273 273 } 274 274 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) ; 284 284 285 285 … … 288 288 for(int n = 0, i = 0, j = 0; n < data_n_index; n++, count++) 289 289 { 290 int temp_i = (*data_i_index)[n]+ data_ibegin,290 int temp_i = data_i_index(n) + data_ibegin, 291 291 temp_j = (data_dim == 1) ? -1 292 : (*data_j_index)[n]+ data_jbegin;292 : data_j_index(n) + data_jbegin; 293 293 i = (data_dim == 1) ? (temp_i - 1) % ni 294 294 : (temp_i - 1) ; … … 298 298 if ((l >= lbegin && l <= lend) && 299 299 (i >= 0 && i < ni) && 300 (j >= 0 && j < nj) && (*mask)[i][j])300 (j >= 0 && j < nj) && mask(i,j)) 301 301 { 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 ; 306 306 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 ; 311 311 indexCount++ ; 312 312 } … … 340 340 //---------------------------------------------------------------- 341 341 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) ; 368 368 } 369 369 … … 372 372 373 373 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)] ; 381 380 } 382 381 383 382 //--------------------------------------------------------------- 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 428 384 void CGrid::sendIndex(void) 429 385 { … … 434 390 int rank ; 435 391 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 ; 437 393 438 394 for(int ns=0;ns<domain->connectedServer.size();ns++) … … 446 402 int i,j ; 447 403 int nb=0 ; 448 for(int k=0;k<storeIndex_client ->num_elements();k++)404 for(int k=0;k<storeIndex_client.numElements();k++) 449 405 { 450 i= (*out_i_client)[k];451 j= (*out_j_client)[k];406 i=out_i_client(k) ; 407 j=out_j_client(k) ; 452 408 if (i>=ib-1 && i<=ie-1 && j>=jb-1 && j<=je-1) nb++ ; 453 409 } 454 410 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 459 416 460 417 nb=0 ; 461 for(int k=0;k<storeIndex_client ->num_elements();k++)418 for(int k=0;k<storeIndex_client.numElements();k++) 462 419 { 463 i= (*out_i_client)[k];464 j= (*out_j_client)[k];420 i=out_i_client(k) ; 421 j=out_j_client(k) ; 465 422 if (i>=ib-1 && i<=ie-1 && j>=jb-1 && j<=je-1) 466 423 { 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) ; 471 428 nb++ ; 472 429 } 473 430 } 474 431 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) )) ; 476 433 nbSenders.insert(pair<int,int>(rank,domain->nbSenders[ns])) ; 477 434 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() ; 483 440 event.push(rank,domain->nbSenders[ns],*list_msg.back()) ; 484 441 } 485 442 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 486 448 } 487 449 … … 501 463 void CGrid::recvIndex(int rank, CBufferIn& buffer) 502 464 { 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 ; 506 468 507 469 buffer>>out_i>>out_j>>out_l ; 508 int offset ;509 470 510 o ffset=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 ; 512 473 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) )) ; 519 477 } 520 478 … … 540 498 } 541 499 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 684 501 { 685 502 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", 687 504 << "[ Nombre de tableau attendu = " << (this->storeIndex.size()-1) << ", " 688 505 << "[ Nombre de tableau reçu = " << storedClient.size() << "] " 689 506 << "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()); 694 508 695 509 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) ; 705 519 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)) ; 707 521 } 708 522 ///--------------------------------------------------------------- -
XIOS/trunk/src/node/grid.hpp
r351 r369 9 9 #include "domain.hpp" 10 10 #include "axis.hpp" 11 #include "array_new.hpp" 12 #include "attribute_array.hpp" 11 13 12 14 namespace xios { … … 54 56 void solveReference(void); 55 57 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); 58 60 59 61 /// Tests /// … … 63 65 64 66 /// 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; 69 71 70 72 const CAxis* getRelAxis (void) const; … … 80 82 81 83 /// Entrées-sorties de champs /// 82 template < StdSizen>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; 84 86 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) ; 94 93 95 94 /// Destructeur /// … … 111 110 112 111 /// 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; 114 113 115 114 /// Traitements protégés /// … … 120 119 121 120 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) ; 123 122 static void recvIndex(CEventServer& event) ; 124 123 void recvIndex(int rank, CBufferIn& buffer) ; … … 134 133 CDomain* domain ; 135 134 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 ;