Changeset 619 for XIOS/trunk/src/node/field_impl.hpp
- Timestamp:
- 06/22/15 13:36:12 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/field_impl.hpp
r599 r619 25 25 { 26 26 const std::vector<CField*>& refField=getAllReference(); 27 std::vector<CField*>::const_iterator it = refField.begin(), end = refField.end(); 28 29 for (; it != end; it++) (*it)->setData(_data); 30 if (hasOutputFile || hasFieldOut) updateData(_data); 27 std::vector<CField*>::const_iterator it = refField.begin(), end = refField.end(), 28 itFilterSrc, iteFilterSrc; 29 30 for (; it != end; it++) 31 { 32 const std::vector<CField*>& fieldFilterSources = (*it)->getFilterSources(); 33 if (!fieldFilterSources.empty()) 34 { 35 itFilterSrc = fieldFilterSources.begin(); iteFilterSrc = fieldFilterSources.end(); 36 for (; itFilterSrc != iteFilterSrc; ++itFilterSrc) (*itFilterSrc)->updateDataWithoutOperation(_data); 37 (*it)->applyFilter(); 38 std::cout << "it data " << (*it)->data << std::endl; 39 std::cout << "it filtered data " << (*it)->filteredData << std::endl; 40 if ((*it)->hasOutputFile || (*it)->hasFieldOut) (*it)->updateFilteredData((*it)->filteredData); 41 } 42 else 43 { 44 (*it)->setData(_data); 45 if (hasOutputFile || hasFieldOut) updateData(_data); 46 } 47 48 } 49 31 50 } 32 51 } … … 50 69 } 51 70 52 template <int N> 53 bool CField::updateData(const CArray<double, N>& _data) 71 template<int N> 72 void CField::updateDataWithoutOperation(const CArray<double, N>& _data) 73 { 74 if (this->data.numElements() != this->grid->storeIndex_client.numElements()) 75 { 76 this->data.resize(this->grid->storeIndex_client.numElements()); 77 this->grid->inputField(_data, this->data); 78 } 79 } 80 81 template<int N> 82 bool CField::updateFilteredData(CArray<double, N>& filteredData) 54 83 { 55 84 CContext* context=CContext::getCurrent(); … … 70 99 if (doOperation) 71 100 { 72 if (this->data.numElements() != this->grid->storeIndex_client.numElements()) 73 { 74 this->data.resize(this->grid->storeIndex_client.numElements()); 75 } 76 77 CArray<double,1> input(data.numElements()); 78 this->grid->inputField(_data, input); 79 (*this->foperation)(input); 101 if (this->data.numElements() != filteredData.numElements()) 102 { 103 this->data.resize(filteredData.numElements()); 104 } 105 106 (*this->foperation)(filteredData); 80 107 81 108 *last_operation = currDate; … … 106 133 } 107 134 108 if (hasFieldOut)109 {110 fieldOut->setDataFromExpression(data);111 }135 // if (hasFieldOut) 136 // { 137 // fieldOut->setDataFromExpression(data); 138 // } 112 139 return (true); 113 140 } … … 116 143 } 117 144 118 bool CField::updateDataFromExpression(const CArray<double, 1>& _data) 145 template <int N> 146 bool CField::updateData(const CArray<double, N>& _data) 119 147 { 120 148 CContext* context=CContext::getCurrent(); … … 140 168 } 141 169 142 (*this->foperation)(_data); 170 CArray<double,1> input(data.numElements()); 171 this->grid->inputField(_data, input); 172 (*this->foperation)(input); 143 173 144 174 *last_operation = currDate; … … 179 209 } 180 210 211 bool CField::updateDataFromExpression(const CArray<double, 1>& _data) 212 { 213 CContext* context=CContext::getCurrent(); 214 const CDate & currDate = context->getCalendar()->getCurrentDate(); 215 const CDate opeDate = *last_operation + freq_operation; 216 const CDate writeDate = *last_Write + freq_write; 217 bool doOperation, doWrite; 218 219 220 info(50) << "CField::updateData " << currDate << " : send data to " << this->getBaseFieldId() << std::endl; 221 info(50) << "Next operation " << opeDate<<std::endl; 222 223 doOperation = (opeDate <= currDate); 224 if (isOnceOperation) 225 if (isFirstOperation) doOperation=true; 226 else doOperation=false; 227 228 if (doOperation) 229 { 230 if (this->data.numElements() != this->grid->storeIndex_client.numElements()) 231 { 232 this->data.resize(this->grid->storeIndex_client.numElements()); 233 } 234 235 (*this->foperation)(_data); 236 237 *last_operation = currDate; 238 info(50) << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl; 239 } 240 241 doWrite = (writeDate < (currDate + freq_operation)); 242 if (isOnceOperation) 243 { 244 if(isFirstOperation) 245 { 246 doWrite=true; 247 isFirstOperation=false; 248 } 249 else doWrite=false; 250 } 251 252 if (doWrite) 253 { 254 this->foperation->final(); 255 *last_Write = writeDate; 256 if (hasOutputFile) 257 { 258 info(50) << "(*last_Write = currDate) : " << *last_Write << " = " << currDate << std::endl; 259 CTimer::get("XIOS Send Data").resume(); 260 sendUpdateData(); 261 CTimer::get("XIOS Send Data").suspend(); 262 } 263 264 if (hasFieldOut) 265 { 266 fieldOut->setDataFromExpression(data); 267 } 268 return (true); 269 } 270 271 return (false); 272 } 273 181 274 template <int N> 182 275 void CField::getData(CArray<double, N>& _data) const
Note: See TracChangeset
for help on using the changeset viewer.