Changeset 459 for XIOS/trunk/src/node/field_impl.hpp
- Timestamp:
- 01/16/14 14:28:23 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/field_impl.hpp
r436 r459 13 13 namespace xios { 14 14 15 16 17 18 const std::vector<CField*>& refField=getAllReference();19 std::vector<CField*>::const_iterator it = refField.begin(), end = refField.end();20 21 for (; it != end; it++) (*it)->updateData(_data) ;15 template <int N> 16 void CField::setData(const CArray<double, N>& _data) 17 { 18 if (hasInstantData) 19 { 20 grid->inputField(_data, instantData); 21 for(list< pair<CField *,int> >::iterator it=fieldDependency.begin(); it!=fieldDependency.end(); ++it) it->first->setSlot(it->second) ; 22 22 } 23 23 24 if (!hasExpression) 25 { 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) updateData(_data) ; 31 } 32 33 } 34 35 24 36 template <int N> 25 37 bool CField::updateData(const CArray<double, N>& _data) 26 38 { 27 39 CContext* context=CContext::getCurrent(); 28 40 const CDate & currDate = context->getCalendar()->getCurrentDate(); 29 41 const CDate opeDate = *last_operation + freq_operation; 30 const CDate writeDate = *last_Write + freq_write; 42 const CDate writeDate = *last_Write + freq_write; 31 43 bool doOperation, doWrite; 32 33 44 34 45 35 46 info(50) << "CField::updateData " << currDate << " : send data to " << this->getBaseFieldId() << std::endl; 36 47 info(50) << "Next operation " << opeDate<<std::endl; 37 48 38 49 doOperation = (opeDate <= currDate) ; 39 50 if (isOnceOperation) 40 51 if (isFirstOperation) doOperation=true ; 41 52 else doOperation=false ; 42 53 43 54 if (doOperation) 44 55 { … … 55 66 info(50) << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl; 56 67 } 68 69 doWrite = (writeDate < (currDate + freq_operation)) ; 70 if (isOnceOperation) 71 { 72 if(isFirstOperation) 73 { 74 doWrite=true ; 75 isFirstOperation=false ; 76 } 77 else doWrite=false ; 78 } 57 79 58 80 if (doWrite) 81 { 82 this->foperation->final(); 83 *last_Write = writeDate; 84 info(50) << "(*last_Write = currDate) : " << *last_Write << " = " << currDate << std::endl; 85 CTimer::get("XIOS Send Data").resume() ; 86 sendUpdateData() ; 87 CTimer::get("XIOS Send Data").suspend() ; 88 return (true); 89 } 90 91 return (false); 92 } 93 94 bool CField::updateDataFromExpression(const CArray<double, 1>& _data) 95 { 96 CContext* context=CContext::getCurrent(); 97 const CDate & currDate = context->getCalendar()->getCurrentDate(); 98 const CDate opeDate = *last_operation + freq_operation; 99 const CDate writeDate = *last_Write + freq_write; 100 bool doOperation, doWrite; 101 102 103 info(50) << "CField::updateData " << currDate << " : send data to " << this->getBaseFieldId() << std::endl; 104 info(50) << "Next operation " << opeDate<<std::endl; 105 106 doOperation = (opeDate <= currDate) ; 107 if (isOnceOperation) 108 if (isFirstOperation) doOperation=true ; 109 else doOperation=false ; 110 111 if (doOperation) 112 { 113 if (this->data.numElements() != this->grid->storeIndex_client.numElements()) 114 { 115 this->data.resize(this->grid->storeIndex_client.numElements()); 116 } 117 118 (*this->foperation)(_data); 119 120 *last_operation = currDate; 121 info(50) << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl; 122 } 123 59 124 doWrite = (writeDate < (currDate + freq_operation)) ; 60 125 if (isOnceOperation)
Note: See TracChangeset
for help on using the changeset viewer.