Changeset 265 for XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.hpp
- Timestamp:
- 09/06/11 11:57:45 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.hpp
r229 r265 81 81 boost::shared_ptr<CFile> file = *it; 82 82 StdString filename = (!file->name.isEmpty()) 83 ? file->name.getValue() : file->getId();83 ? file->name.getValue() : file->getId(); 84 84 StdOStringStream oss; 85 oss << "wk/data/" << filename << "_node" << comm::CMPIManager::GetCommRank() << ".nc"; 85 if (!CObjectFactory::GetObject<CContext> 86 (CObjectFactory::GetCurrentContextId())->output_dir.isEmpty()) 87 oss << CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId())->output_dir.getValue(); 88 oss << filename; 89 if (!file->name_suffix.isEmpty()) 90 oss << file->name_suffix.getValue(); 91 if (comm::CMPIManager::GetCommSize() > 1) 92 oss << "_node" << comm::CMPIManager::GetCommRank(); 93 oss << ".nc"; 86 94 boost::shared_ptr<io::CDataOutput> dout(new T(oss.str(), false)); 87 95 file->initializeDataOutput(dout); … … 93 101 (const StdString & fieldId, const ARRAY(float, N) & data) 94 102 { 95 103 typedef typename boost::multi_array<double, N>::size_type sizetp; 96 104 std::vector<sizetp> shape; 97 105 const sizetp * shapearr = data->shape(); 98 106 99 107 shape.assign(shapearr, shapearr + N); 100 ARRAY_CREATE(datad, double, N, [shape]); 101 datad->assign(data->begin(), data->end()); 108 ARRAY(double, N) datad(new CArray<double, N>(shape)); 109 for (StdSize i = 0; i < datad->num_elements(); i++) 110 datad->data()[i] = data->data()[i]; 102 111 103 112 this->write_data(fieldId, datad); … … 110 119 const date::CDate & currDate = 111 120 this->currentContext->getCalendar()->getCurrentDate(); 121 const date::CDuration & timestep = 122 this->currentContext->getCalendar()->getTimeStep(); 112 123 const std::vector<boost::shared_ptr<CField> > & refField= 113 124 CObjectFactory::GetObject<CField>(fieldId)->getAllReference(); 114 125 std::vector<boost::shared_ptr<CField> >::const_iterator 115 126 it = refField.begin(), end = refField.end(); 116 127 // std::cout << "nb :" << refField.size() << std::endl; 117 128 for (; it != end; it++) 118 129 { 119 130 boost::shared_ptr<CField> field = *it; 120 131 boost::shared_ptr<CFile> file = field->getRelFile(); 121 if (field->updateData(currDate, data)) 132 // std::cout << ">> " << fieldId << ", " << file->getId() << std::endl; 133 if (field->updateData(currDate, timestep, data)) 122 134 { 123 135 if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT) … … 131 143 } 132 144 } 133 return;134 145 } 135 146
Note: See TracChangeset
for help on using the changeset viewer.