Changeset 214 for XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.hpp
- Timestamp:
- 06/14/11 16:20:27 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.hpp
r208 r214 7 7 #include "mpi_manager.hpp" 8 8 #include "data_output.hpp" 9 #include "duration.hpp" 10 #include "client.hpp" 11 #include "xios_manager.hpp" 9 12 10 13 namespace xmlioserver … … 29 32 const std::vector<boost::shared_ptr<CFile> > & getEnabledFiles (void) const; 30 33 31 /// Creation des sorties /// 34 /// Ecriture et mise à jour du calendrier /// 35 void write_data(const StdString & fieldId, 36 const StdString & fileId, 37 const std::deque<ARRAY(double, 1)> & data); 38 39 template <StdSize N> 40 void write_data(const StdString & fieldId, const ARRAY(double, N) & data); 41 42 template <StdSize N> 43 void write_data(const StdString & fieldId, const ARRAY(float, N) & data); 44 45 void update_calendar(int step); 46 void set_timestep(const date::CDuration & duration); 47 48 /// Création des sorties /// 32 49 template <class T> void createDataOutput(void); 33 50 … … 72 89 } 73 90 91 template <StdSize N> 92 void CDataTreatment::write_data 93 (const StdString & fieldId, const ARRAY(float, N) & data) 94 { 95 std::vector<boost::multi_array<double, N>::size_type shape() > shape; 96 const size_type * shapearr = data->shape(); 97 98 shape.assign(shapearr, shapearr + N); 99 ARRAY_CREATE(datad, double, N, shape); 100 datad->assign(data->begin(), data->end()); 101 102 this->write_data(fieldId, datad); 103 } 104 105 template <StdSize N> 106 void CDataTreatment::write_data 107 (const StdString & fieldId, const ARRAY(double, N) & data) 108 { 109 const date::CDate & currDate = 110 this->currentContext->getCalendar()->getCurrentDate(); 111 const std::vector<boost::shared_ptr<CField> > & refField= 112 CObjectFactory::GetObject<CField>(fieldId)->getAllReference(); 113 std::vector<boost::shared_ptr<CField> >::const_iterator 114 it = refField.begin(), end = refField.end(); 115 116 for (; it != end; it++) 117 { 118 boost::shared_ptr<CField> field = *it; 119 boost::shared_ptr<CFile> file = field->getRelFile(); 120 if (field->updateData(currDate, data)) 121 { 122 if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT) 123 { 124 boost::shared_ptr<comm::CClient> client = comm::CClient::GetClient(); 125 client.sendData(fieldId, file->getId(), field->getData()); 126 } 127 else 128 { 129 file->getDataOutput()->writeFieldData(field); 130 } 131 } 132 return; 133 } 134 135 } 136 74 137 } // namespace data 75 138
Note: See TracChangeset
for help on using the changeset viewer.