Changeset 205
- Timestamp:
- 05/26/11 13:34:49 (14 years ago)
- Location:
- XMLIO_V2/dev/dev_rv/src/xmlio
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/xmlio/fortran/ixmlioserver.f03.in
r179 r205 146 146 #include "../config/grid_attribute.conf" 147 147 148 149 148 END INTERFACE 150 149 -
XMLIO_V2/dev/dev_rv/src/xmlio/functor.cpp
r187 r205 7 7 /// ////////////////////// Définitions ////////////////////// /// 8 8 9 CFunctor::CFunctor(const StdString & id, ARRAY(double, 1) doutput, 10 const CFunData & data, CFuncType type) 11 : SuperClass(id) 12 , doutput(doutput), size() 13 , data(data), type(type) 14 { this->resize(size); } 15 16 CFunctor::CFunctor(const StdString & id, DoubleArray doutput, 17 const std::vector<StdSize> size, 18 const CFunData & data, CFuncType type) 19 : SuperClass(id) 20 , doutput(doutput), size(size) 21 , data(data), type(type) 22 { this->resize(size); } 9 CFunctor::CFunctor(const StdString & id, ARRAY(double, 1) doutput) 10 : SuperClass(id), doutput(doutput) 11 { /* Ne rien faire de plus */ } 23 12 24 13 CFunctor::~CFunctor(void) … … 27 16 //--------------------------------------------------------------- 28 17 29 const CFunctor::CFunData & CFunctor::getData(void) const30 { return (this->data); }31 32 CFunctor::CFuncType CFunctor::getType(void) const33 { return (this->type); }34 35 18 ARRAY(double, 1) CFunctor::getDataOutput(void) const 36 { return (this->doutput); } 37 38 const std::vector<StdSize> & CFunctor::getShape(void) const 39 { return (this->size); } 40 41 StdSize CFunctor::getSize(void) const 42 { return (this->doutput->size()); } 43 44 //--------------------------------------------------------------- 45 46 void CFunctor::resize(StdSize x, StdSize y, StdSize z) 47 { 48 this->size.clear(); 49 this->size.push_back(x); 50 if (y != 1) this->size.push_back(y); 51 if (z != 1) this->size.push_back(z); 52 this->doutput->resize(boost::extents[x * y * z]); 53 } 54 55 void CFunctor::resize(const std::vector<StdSize> & sizes) 56 { 57 StdSize newsize = 1; 58 this->size.clear(); 59 std::vector<StdSize>::const_iterator it = sizes.begin(), end = sizes.end(); 60 61 for (; it!=end; it++) 62 { 63 StdSize size = *it; 64 newsize *= size; 65 this->size.push_back(size); 66 } 67 this->doutput->resize(boost::extents[newsize]); 19 { 20 return (this->doutput); 68 21 } 69 22 … … 91 44 << ", output size = " << this->doutput->size() << " ]" 92 45 << " size of input array != size of output array !"); 93 this->apply(dinput, this->doutput , this->size, this->data);46 this->apply(dinput, this->doutput); 94 47 return (this->doutput); 95 48 } -
XMLIO_V2/dev/dev_rv/src/xmlio/functor.hpp
r202 r205 20 20 public : 21 21 22 typedef enum func_type { SPATIAL = 0, TEMPORAL } CFuncType;23 typedef struct func_data24 { int timestep; } CFunData;25 26 22 /// Accesseurs /// 27 CFuncType getType(void) const;28 StdSize getSize(void) const;29 30 const CFunData & getData(void) const;31 const std::vector<StdSize> & getShape(void) const;32 33 23 DoubleArray getDataOutput(void) const; 34 35 /// Mutateur ///36 void resize(StdSize x, StdSize y = 1, StdSize z = 1);37 void resize(const std::vector<StdSize> & sizes);38 39 24 /// Opérateur /// 40 25 DoubleArray operator ()(const DoubleArray dinput); … … 46 31 47 32 /// Traitement /// 48 virtual void apply(const DoubleArray dinput, DoubleArray doutput, 49 const std::vector<StdSize> size, const CFunData & data) = 0; 33 virtual void apply(const DoubleArray dinput, DoubleArray doutput) = 0; 50 34 51 35 /// Autres /// … … 53 37 virtual void fromString(const StdString & str); 54 38 55 56 39 /// Constructeurs /// 57 40 CFunctor(void); // Not implemented. 58 59 CFunctor(const StdString & id, DoubleArray doutput, 60 const CFunData & data, CFuncType type = TEMPORAL); 61 62 CFunctor(const StdString & id, DoubleArray doutput, 63 const std::vector<StdSize> size, 64 const CFunData & data, CFuncType type = TEMPORAL); 65 41 CFunctor(const StdString & id, DoubleArray doutput); 66 42 CFunctor(const CFunctor & functor); // Not implemented. 67 43 CFunctor(const CFunctor * const functor); // Not implemented. … … 71 47 /// Propriétés privées /// 72 48 DoubleArray doutput; 73 std::vector<StdSize> size; 74 CFunData data; CFuncType type; 75 49 76 50 }; // class CFunctor 77 51 } // namespace func -
XMLIO_V2/dev/dev_rv/src/xmlio/functor/average.cpp
r152 r205 7 7 /// ////////////////////// Définitions ////////////////////// /// 8 8 9 CAverage::CAverage(DoubleArray doutput, 10 const CFunData & data, 11 const std::vector<size_t> size) 12 : SuperClass(StdString("average"), doutput, size, data) 9 CAverage::CAverage(DoubleArray doutput) 10 : SuperClass(StdString("average"), doutput) 13 11 { /* Ne rien faire de plus */ } 14 12 … … 19 17 20 18 void CAverage::apply(const DoubleArray UNUSED(dinput), 21 DoubleArray UNUSED(doutput), 22 const std::vector<size_t> UNUSED(size), 23 const CFunData & UNUSED(data)) 19 DoubleArray UNUSED(doutput)) 24 20 { 25 21 ERROR("CAverage::apply(...)", << "Not implemented yet !"); -
XMLIO_V2/dev/dev_rv/src/xmlio/functor/average.hpp
r152 r205 19 19 20 20 /// Constructeurs /// 21 CAverage(void); // Not implemented. 22 CAverage(const CFunData & data); 23 CAverage(DoubleArray doutput, const CFunData & data, 24 const std::vector<size_t> size); 25 CAverage(const CAverage & average); // Not implemented. 26 CAverage(const CAverage * const average); // Not implemented. 21 //CAverage(void); // Not implemented. 22 //CAverage(const CFunData & data); 23 CAverage(DoubleArray doutput); 24 //CAverage(const CAverage & average); // Not implemented. 25 //CAverage(const CAverage * const average); // Not implemented. 27 26 28 27 /// Traitement /// 29 virtual void apply(const DoubleArray dinput, DoubleArray doutput, 30 const std::vector<size_t> size, const CFunData & data); 28 virtual void apply(const DoubleArray dinput, DoubleArray doutput); 31 29 32 30 /// Destructeur /// -
XMLIO_V2/dev/dev_rv/src/xmlio/functor/instant.cpp
r152 r205 7 7 /// ////////////////////// Définitions ////////////////////// /// 8 8 9 CInstant::CInstant(DoubleArray doutput, 10 const CFunData & data, 11 const std::vector<size_t> size) 12 : SuperClass(StdString("instant"), doutput, size, data) 9 CInstant::CInstant(DoubleArray doutput) 10 : SuperClass(StdString("instant"), doutput) 13 11 { /* Ne rien faire de plus */ } 14 12 … … 19 17 20 18 void CInstant::apply(const DoubleArray UNUSED(dinput), 21 DoubleArray UNUSED(doutput), 22 const std::vector<size_t> UNUSED(size), 23 const CFunData & UNUSED(data)) 19 DoubleArray UNUSED(doutput)) 24 20 { 25 21 ERROR("CInstant::apply(...)", << "Not implemented yet !"); -
XMLIO_V2/dev/dev_rv/src/xmlio/functor/instant.hpp
r152 r205 19 19 20 20 /// Constructeurs /// 21 CInstant(void); // Not implemented. 22 CInstant(const CFunData & data); 23 CInstant(DoubleArray doutput, const CFunData & data, 24 const std::vector<size_t> size); 25 CInstant(const CInstant & instant); // Not implemented. 26 CInstant(const CInstant * const instant); // Not implemented. 21 //CInstant(void); // Not implemented. 22 //CInstant(const CFunData & data); 23 CInstant(DoubleArray doutput); 24 //CInstant(const CInstant & instant); // Not implemented. 25 //CInstant(const CInstant * const instant); // Not implemented. 27 26 28 27 /// Traitement /// 29 virtual void apply(const DoubleArray dinput, DoubleArray doutput, 30 const std::vector<size_t> size, const CFunData & data); 28 virtual void apply(const DoubleArray dinput, DoubleArray doutput); 31 29 32 30 /// Destructeur /// -
XMLIO_V2/dev/dev_rv/src/xmlio/functor/once.cpp
r152 r205 7 7 /// ////////////////////// Définitions ////////////////////// /// 8 8 9 COnce::COnce(DoubleArray doutput, 10 const CFunData & data, 11 const std::vector<size_t> size) 12 : SuperClass(StdString("once"), doutput, size, data) 9 COnce::COnce(DoubleArray doutput) 10 : SuperClass(StdString("once"), doutput) 13 11 { /* Ne rien faire de plus */ } 14 12 … … 19 17 20 18 void COnce::apply(const DoubleArray UNUSED(dinput), 21 DoubleArray UNUSED(doutput), 22 const std::vector<size_t> UNUSED(size), 23 const CFunData & UNUSED(data)) 19 DoubleArray UNUSED(doutput)) 24 20 { 25 21 ERROR("COnce::apply(...)", << "Not implemented yet !"); -
XMLIO_V2/dev/dev_rv/src/xmlio/functor/once.hpp
r152 r205 19 19 20 20 /// Constructeurs /// 21 COnce(void); // Not implemented. 22 COnce(DoubleArray doutput, const CFunData & data, 23 const std::vector<size_t> size); 24 COnce(const COnce & once); // Not implemented. 25 COnce(const COnce * const once); // Not implemented. 21 //COnce(void); // Not implemented. 22 COnce(DoubleArray doutput); 23 //COnce(const COnce & once); // Not implemented. 24 //COnce(const COnce * const once); // Not implemented. 26 25 27 26 /// Traitement /// 28 virtual void apply(const DoubleArray dinput, DoubleArray doutput, 29 const std::vector<size_t> size, const CFunData & data); 27 virtual void apply(const DoubleArray dinput, DoubleArray doutput); 30 28 31 29 /// Destructeur /// -
XMLIO_V2/dev/dev_rv/src/xmlio/iface/interface.cpp.in
r202 r205 365 365 void xios_update_calendar(int step) 366 366 { 367 367 try 368 { 369 } 370 catch (CException & exc) 371 { 372 std::cerr << exc.getMessage() << std::endl; 373 exit (EXIT_FAILURE); 374 } 368 375 } 369 376 … … 373 380 double ts_hour, double ts_minute, double ts_second) 374 381 { 375 376 382 try 383 { 384 } 385 catch (CException & exc) 386 { 387 std::cerr << exc.getMessage() << std::endl; 388 exit (EXIT_FAILURE); 389 } 377 390 } 378 391 -
XMLIO_V2/dev/dev_rv/src/xmlio/node/field.cpp
r202 r205 183 183 if (CXIOSManager::GetStatus() == CXIOSManager::LOC_SERVER) 184 184 { 185 this->freq_operation = CDuration::FromString(this->file->output_freq.getValue()); 186 this->freq_write = CDuration::FromString(this->file->output_freq.getValue()); 187 //this->foperation = boost::shared_ptr<func::CFunctor>(new CInstant()); 185 this->freq_operation = 186 CDuration::FromString(this->file->output_freq.getValue()); 187 this->freq_write = 188 CDuration::FromString(this->file->output_freq.getValue()); 189 this->foperation = 190 boost::shared_ptr<func::CFunctor>(new CInstant(this->data)); 188 191 } 189 192 else … … 192 195 this->freq_write = CDuration::FromString(this->file->output_freq.getValue()); 193 196 194 #define DECLARE_FUNCTOR(MType, mtype) \197 #define DECLARE_FUNCTOR(MType, mtype) \ 195 198 if (operation.getValue().compare(#mtype) == 0) \ 196 { /*this->foperation = boost::shared_ptr<func::CFunctor>(new C##MType()); */ \ 197 return; } 198 199 { \ 200 boost::shared_ptr<func::CFunctor> \ 201 foperation_(new C##MType(this->data)); \ 202 this->foperation = foperation_; \ 203 return; \ 204 } 199 205 200 206 #include "functor_type.conf" -
XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.cpp
r200 r205 89 89 { 90 90 return (this->withAxis); 91 } 92 93 //--------------------------------------------------------------- 94 95 StdSize CGrid::getDimension(void) const 96 { 97 return ((this->withAxis)?3:2); 98 } 99 100 //--------------------------------------------------------------- 101 102 std::vector<StdSize> CGrid::getShape(void) const 103 { 104 std::vector<StdSize> retvalue; 105 retvalue.push_back(this->domain->ni.getValue()); 106 retvalue.push_back(this->domain->nj.getValue()); 107 if (this->withAxis) 108 retvalue.push_back(this->axis->size.getValue()); 109 return (retvalue); 110 } 111 //--------------------------------------------------------------- 112 113 StdSize CGrid::getSize(void) const 114 { 115 StdSize retvalue = 1; 116 std::vector<StdSize> shape_ = this->getShape(); 117 for (StdSize s = 0; s < shape_.size(); s++) 118 retvalue *= shape_[s]; 119 return (retvalue); 91 120 } 92 121 -
XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.hpp
r183 r205 67 67 const boost::shared_ptr<CDomain> getRelDomain(void) const; 68 68 69 StdSize getDimension(void) const; 70 StdSize getSize(void) const; 71 std::vector<StdSize> getShape(void) const; 72 69 73 /// Entrées-sorties de champs /// 70 74 template <StdSize n> … … 125 129 template <StdSize n> 126 130 void CGrid::inputField(const ARRAY(double, n) field, ARRAY(double, 1) stored) const 127 { this->storeField_arr(field.data(), stored) ; } 131 { 132 if (this->getSize() != field->num_elements()) 133 ERROR("CGrid::inputField(const ARRAY(double, n) field, ARRAY(double, 1) stored)", 134 << "[ Taille des données attendue = " << this->getSize() << ", " 135 << "Taille des données reçue = " << field->num_elements() << " ] " 136 << "Le tableau de données n'a pas la bonne taille !") ; 137 this->storeField_arr(field.data(), stored) ; 138 } 128 139 129 140 ///-------------------------------------------------------------- -
XMLIO_V2/dev/dev_rv/src/xmlio/output/nc4_data_output.cpp
r204 r205 381 381 { 382 382 ARRAY(double, 3) field_data3D; 383 grid->outputField(field_data, 383 grid->outputField(field_data, field_data3D); 384 384 SuperClassWriter::writeData(field_data3D, fieldid, true, 0); 385 385
Note: See TracChangeset
for help on using the changeset viewer.