Changeset 645
- Timestamp:
- 07/17/15 13:58:14 (9 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 3 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/context.cpp
r640 r645 388 388 if (hasClient) 389 389 { 390 //this->buildAllExpressionOfEnabledFields();391 //buildAllExpressionOfFieldsWithReadAccess();392 390 this->buildFilterGraphOfEnabledFields(); 393 391 buildFilterGraphOfFieldsWithReadAccess(); … … 421 419 { 422 420 this->enabledFiles[i]->solveAllRefOfEnabledFields(sendToServer); 423 }424 }425 426 void CContext::buildAllExpressionOfEnabledFields()427 {428 int size = this->enabledFiles.size();429 for (int i = 0; i < size; ++i)430 {431 this->enabledFiles[i]->buildAllExpressionOfEnabledFields();432 421 } 433 422 } … … 476 465 { 477 466 for (size_t i = 0; i < fieldsWithReadAccess.size(); ++i) 478 {479 467 fieldsWithReadAccess[i]->solveAllReferenceEnabledField(false); 480 // Ensure that the instant data will be properly saved481 fieldsWithReadAccess[i]->getInstantData();482 }483 }484 485 void CContext::buildAllExpressionOfFieldsWithReadAccess()486 {487 for (size_t i = 0; i < fieldsWithReadAccess.size(); ++i)488 fieldsWithReadAccess[i]->buildAllExpressionEnabledField();489 468 } 490 469 -
XIOS/trunk/src/node/context.hpp
r640 r645 103 103 // Some functions to process context 104 104 void findAllEnabledFields(void); 105 void processEnabledFiles(void);106 105 void solveAllInheritance(bool apply=true); 107 106 void findEnabledFiles(void); … … 111 110 void createFileHeader(void ); 112 111 void solveAllRefOfEnabledFields(bool sendToServer); 113 void buildAllExpressionOfEnabledFields();114 112 void buildFilterGraphOfEnabledFields(); 115 113 void startPrefetchingOfEnabledReadModeFiles(); … … 117 115 void findFieldsWithReadAccess(void); 118 116 void solveAllRefOfFieldsWithReadAccess(); 119 void buildAllExpressionOfFieldsWithReadAccess();120 117 void buildFilterGraphOfFieldsWithReadAccess(); 121 118 void postProcessing(); … … 227 224 // virtual void toBinary (StdOStream & os) const; 228 225 // virtual void fromBinary(StdIStream & is); 229 // void solveAllGridRef(void);230 // void solveAllOperation(void);231 // void solveAllExpression(void);232 // void solveFieldRefInheritance(bool apply);233 234 226 }; // class CContext 235 227 -
XIOS/trunk/src/node/field.cpp
r644 r645 32 32 , refObject(), baseRefObject() 33 33 , grid(), file() 34 , freq_operation(), freq_write() 35 , nstep(0), nstepMax(0), isEOF(false) 36 , last_Write(), last_operation() 37 , foperation(), hasInstantData(false), hasExpression(false) 38 , active(false) , hasOutputFile(false),hasFieldOut(false), slotUpdateDate(NULL) 39 , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false) 34 , nstep(0), nstepMax(0) 35 , hasOutputFile(false) 36 , domAxisIds_("", ""), areAllReferenceSolved(false) 40 37 , isReadDataRequestPending(false) 41 , filterSources_()42 38 { setVirtualVariableGroup(); } 43 39 … … 46 42 , refObject(), baseRefObject() 47 43 , grid(), file() 48 , freq_operation(), freq_write() 49 , nstep(0), nstepMax(0), isEOF(false) 50 , last_Write(), last_operation() 51 , foperation(), hasInstantData(false), hasExpression(false) 52 , active(false), hasOutputFile(false), hasFieldOut(false), slotUpdateDate(NULL) 53 , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false) 44 , nstep(0), nstepMax(0) 45 , hasOutputFile(false) 46 , domAxisIds_("", ""), areAllReferenceSolved(false) 54 47 , isReadDataRequestPending(false) 55 , filterSources_()56 48 { setVirtualVariableGroup(); } 57 49 58 50 CField::~CField(void) 59 { 60 // this->grid.reset(); 61 // this->file.reset(); 62 this->foperation.reset(); 63 if (hasExpression) delete expression; 64 if (slotUpdateDate != NULL) delete slotUpdateDate; 65 66 } 67 51 {} 68 52 69 53 //---------------------------------------------------------------- … … 95 79 this->getVirtualVariableGroup()->solveDescInheritance(apply, NULL); 96 80 } 97 //---------------------------------------------------------------- 98 //---------------------------------------------------------------- 99 100 bool CField::updateDataServer 101 (const CDate& currDate, 102 const std::deque< CArray<double, 1>* > storedClient) 103 { 104 const CDate opeDate = *last_operation + freq_operation; 105 const CDate writeDate = *last_Write + freq_write; 106 107 if (opeDate <= currDate) 108 { 109 if (this->data.numElements() != this->grid->storeIndex[0]->numElements()) 110 { 111 this->data.resize(this->grid->storeIndex[0]->numElements()); 112 } 113 CArray<double,1> input(data.numElements()); 114 this->grid->inputFieldServer(storedClient, input); 115 (*this->foperation)(input); 116 *last_operation = currDate; 117 } 118 if (writeDate < (currDate + freq_operation)) 119 { 120 this->foperation->final(); 121 this->incrementNStep(); 122 *last_Write = writeDate; 123 return true; 124 } 125 return false; 126 } 81 82 //---------------------------------------------------------------- 127 83 128 84 bool CField::dispatchEvent(CEventServer& event) … … 163 119 } 164 120 } 165 }166 167 void CField::sendUpdateData(void)168 {169 CContext* context = CContext::getCurrent();170 CContextClient* client = context->client;171 172 CEventClient event(getType(),EVENT_ID_UPDATE_DATA);173 174 map<int,CArray<int, 1>* >::iterator it;175 list<shared_ptr<CMessage> > list_msg;176 list< CArray<double,1>* > list_data;177 178 if (!grid->doGridHaveDataDistributed())179 {180 if (0 == client->clientRank)181 {182 for(it=grid->storeIndex_toSrv.begin();it!=grid->storeIndex_toSrv.end();it++)183 {184 int rank=(*it).first ;185 CArray<int,1>& index = *(it->second) ;186 CArray<double,1> data_tmp(index.numElements()) ;187 for(int n=0;n<data_tmp.numElements();n++) data_tmp(n)=data(index(n)) ;188 189 list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ;190 list_data.push_back(new CArray<double,1>(data_tmp)) ;191 *list_msg.back()<<getId()<<*list_data.back() ;192 event.push(rank,1,*list_msg.back()) ;193 }194 client->sendEvent(event) ;195 } else client->sendEvent(event);196 }197 else198 {199 for(it=grid->storeIndex_toSrv.begin();it!=grid->storeIndex_toSrv.end();it++)200 {201 int rank=(*it).first ;202 CArray<int,1>& index = *(it->second) ;203 CArray<double,1> data_tmp(index.numElements()) ;204 for(int n=0;n<data_tmp.numElements();n++) data_tmp(n)=data(index(n)) ;205 list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ;206 list_data.push_back(new CArray<double,1>(data_tmp)) ;207 *list_msg.back()<<getId()<<*list_data.back() ;208 event.push(rank,grid->nbSenders[rank],*list_msg.back()) ;209 }210 client->sendEvent(event) ;211 }212 213 for (list< CArray<double,1>* >::iterator it = list_data.begin(); it != list_data.end(); it++) delete *it;214 121 } 215 122 … … 467 374 std::map<int, CArray<double,1> > data; 468 375 376 bool isEOF = false; 377 469 378 for (int i = 0; i < ranks.size(); i++) 470 379 { … … 484 393 serverSourceFilter->streamDataFromServer(lastDataRequestedFromServer, data); 485 394 486 /*for (int i = 0; i < ranks.size(); i++)487 {488 int rank = ranks[i];489 *buffers[i] >> record;490 isEOF = (record == size_t(-1));491 492 if (!isEOF)493 {494 CArray<int,1>& index = *grid->storeIndex_toSrv[rank];495 CArray<double,1> data_tmp(index.numElements());496 *buffers[i] >> data_tmp;497 for (int n = 0; n < data_tmp.numElements(); n++)498 instantData(index(n)) = data_tmp(n);499 }500 else501 break;502 }503 504 if (!isEOF)505 {506 for (list< pair<CField*, int> >::iterator it = fieldDependency.begin(); it != fieldDependency.end(); ++it)507 it->first->setSlot(it->second);508 509 if (!hasExpression) // Should be always true ?510 {511 const std::vector<CField*>& refField = getAllReference();512 std::vector<CField*>::const_iterator it = refField.begin(), end = refField.end();513 514 for (; it != end; it++) (*it)->setDataFromExpression(instantData);515 if (hasFieldOut) updateDataFromExpression(instantData);516 }517 }*/518 519 395 isReadDataRequestPending = false; 520 396 } … … 553 429 } 554 430 431 func::CFunctor::ETimeType CField::getOperationTimeType() const 432 { 433 return operationTimeType; 434 } 435 436 //---------------------------------------------------------------- 437 555 438 void CField::incrementNStep(void) 556 439 { … … 570 453 //---------------------------------------------------------------- 571 454 572 const CDuration& CField::getFreqOperation(void) const573 {574 return this->freq_operation;575 }576 577 //----------------------------------------------------------------578 579 const CDuration& CField::getFreqWrite(void) const580 {581 return this->freq_write;582 }583 584 //----------------------------------------------------------------585 586 boost::shared_ptr<func::CFunctor> CField::getFieldOperation(void) const587 {588 return this->foperation;589 }590 591 455 bool CField::isActive(void) const 592 456 { 593 457 return !this->refObject.empty(); 594 }595 596 //----------------------------------------------------------------597 598 CArray<double, 1> CField::getData(void) const599 {600 return(this->data);601 }602 603 //----------------------------------------------------------------604 605 boost::shared_ptr<CDate> CField::getLastWriteDate(void) const606 {607 return(this->last_Write);608 }609 610 //----------------------------------------------------------------611 612 boost::shared_ptr<CDate> CField::getLastOperationDate(void) const613 {614 return(this->last_operation);615 458 } 616 459 … … 637 480 if (hasDirectFieldReference()) getDirectFieldReference()->solveAllReferenceEnabledField(false); 638 481 } 639 640 solveOperation(); 482 else if (context->hasServer) 483 solveServerOperation(); 484 641 485 solveGridReference(); 486 487 lastDataRequestedFromServer.setRelCalendar(*context->getCalendar()); 642 488 } 643 489 solveGridDomainAxisRef(doSending2Sever); … … 654 500 } 655 501 656 void CField::buildAllExpressionEnabledField() 657 { 658 if (!areAllReferenceSolved) solveAllReferenceEnabledField(true); 659 if (!areAllExpressionBuilt) 660 { 661 areAllExpressionBuilt = true; 662 if (hasDirectFieldReference() && (grid_ref.isEmpty())) baseRefObject->buildAllExpressionEnabledField(); 663 buildExpression(); 664 active = true; 665 } 666 } 667 668 //---------------------------------------------------------------- 669 670 void CField::solveOperation(void) 671 { 672 using namespace func; 673 502 //---------------------------------------------------------------- 503 504 void CField::solveServerOperation(void) 505 { 674 506 CContext* context = CContext::getCurrent(); 675 507 676 508 if (!context->hasServer || !hasOutputFile) return; 677 509 678 StdString id; 679 if (hasId()) id = getId(); 680 else if (!name.isEmpty()) id = name; 681 else if (hasDirectFieldReference()) id = baseRefObject->getId(); 682 683 if (freq_op.isEmpty()) freq_op.setValue(TimeStep); 684 685 if (operation.isEmpty()) 686 { 687 ERROR("CField::solveOperation(void)", 688 << "[ id = " << id << "]" 689 << "Impossible to define an operation for this field !"); 690 } 510 if (freq_op.isEmpty()) 511 freq_op.setValue(TimeStep); 691 512 692 513 if (freq_offset.isEmpty()) 693 514 freq_offset.setValue(NoneDu); 694 515 695 // if (CXIOSManager::GetStatus() == CXIOSManager::LOC_SERVER) 696 if (context->hasServer) 697 { 698 if (hasOutputFile) 699 { 700 this->freq_operation_srv = this->file->output_freq.getValue(); 701 this->freq_write_srv = this->file->output_freq.getValue(); 702 } 703 this->lastlast_Write_srv = boost::shared_ptr<CDate> 704 (new CDate(context->getCalendar()->getInitDate())); 705 this->last_Write_srv = boost::shared_ptr<CDate> 706 (new CDate(context->getCalendar()->getInitDate())); 707 this->last_operation_srv = boost::shared_ptr<CDate> 708 (new CDate(context->getCalendar()->getInitDate())); 709 // this->foperation_srv = 710 // boost::shared_ptr<func::CFunctor>(new CInstant(this->data_srv)); 711 712 if (hasOutputFile) 713 { 714 const CDuration toffset = this->freq_operation_srv - freq_offset.getValue() - context->getCalendar()->getTimeStep(); 715 *this->last_operation_srv = *this->last_operation_srv - toffset; 716 } 717 } 718 719 // if (context->hasClient) 720 // { 721 this->freq_operation = freq_op.getValue(); 722 if (hasOutputFile) this->freq_write = this->file->output_freq.getValue(); 723 if (hasFieldOut) 724 { 725 this->freq_write = this->fieldOut->freq_op.getValue(); 726 } 727 this->last_Write = boost::shared_ptr<CDate> 728 (new CDate(context->getCalendar()->getInitDate())); 729 this->last_operation = boost::shared_ptr<CDate> 730 (new CDate(context->getCalendar()->getInitDate())); 731 732 const CDuration toffset = this->freq_operation - freq_offset.getValue() - context->getCalendar()->getTimeStep(); 733 *this->last_operation = *this->last_operation - toffset; 734 735 lastDataRequestedFromServer.setRelCalendar(*context->getCalendar()); 736 737 if (operation.get() == "once") isOnceOperation = true; 738 else isOnceOperation = false; 739 isFirstOperation = true; 516 freq_operation_srv = file->output_freq.getValue(); 517 freq_write_srv = file->output_freq.getValue(); 518 519 lastlast_Write_srv = boost::shared_ptr<CDate>(new CDate(context->getCalendar()->getInitDate())); 520 last_Write_srv = boost::shared_ptr<CDate>(new CDate(context->getCalendar()->getInitDate())); 521 last_operation_srv = boost::shared_ptr<CDate>(new CDate(context->getCalendar()->getInitDate())); 522 523 const CDuration toffset = freq_operation_srv - freq_offset.getValue() - context->getCalendar()->getTimeStep(); 524 *last_operation_srv = *last_operation_srv - toffset; 525 526 if (operation.isEmpty()) 527 ERROR("void CField::solveServerOperation(void)", 528 << "An operation must be defined for field \"" << getId() << "\"."); 529 530 boost::shared_ptr<func::CFunctor> functor; 531 CArray<double, 1> dummyData; 740 532 741 533 #define DECLARE_FUNCTOR(MType, mtype) \ 742 if (operation.getValue().compare(#mtype) == 0) \ 743 { \ 744 if (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true) \ 534 if (operation.getValue().compare(#mtype) == 0) \ 745 535 { \ 746 boost::shared_ptr<func::CFunctor> foperation_(new C##MType(this->data,default_value)); \ 747 this->foperation = foperation_; \ 748 } \ 749 else \ 750 { \ 751 boost::shared_ptr<func::CFunctor> foperation_(new C##MType(this->data)); \ 752 this->foperation = foperation_; \ 753 } \ 754 return; \ 755 } 536 functor.reset(new func::C##MType(dummyData)); \ 537 } 756 538 757 539 #include "functor_type.conf" 758 540 759 ERROR("CField::solveOperation(void)", 760 << "[ operation = " << operation.getValue() << "]" 761 << "The operation is not defined !"); 762 // } 541 if (!functor) 542 ERROR("void CField::solveServerOperation(void)", 543 << "\"" << operation << "\" is not a valid operation."); 544 545 operationTimeType = functor->timeType(); 763 546 } 764 547 … … 974 757 } 975 758 976 CGrid* CField::getGridRefOfBaseReference()977 {978 solveRefInheritance(true);979 solveBaseReference();980 baseRefObject->solveGridReference();981 982 return baseRefObject->grid;983 }984 985 759 void CField::solveTransformedGrid() 986 760 { … … 988 762 && grid_ref.getValue() != getDirectFieldReference()->grid_ref.getValue() && !grid->isTransformed()) 989 763 grid->transformGrid(getDirectFieldReference()->grid); 990 991 /*if (!grid_ref.isEmpty() && (!field_ref.isEmpty()))992 {993 CField* fieldRef = this;994 CGrid* gridRefOfFieldRef = 0;995 while (fieldRef->hasDirectFieldReference())996 {997 if ((!(fieldRef->grid_ref.isEmpty())) &&998 (fieldRef->grid_ref.getValue() != grid_ref.getValue()))999 {1000 gridRefOfFieldRef = fieldRef->getGridRefOfBaseReference();1001 fieldRef->addReference(this);1002 fieldRef->solveGridDomainAxisRef(false);1003 break;1004 }1005 CField* tmp = fieldRef->getDirectFieldReference();1006 fieldRef = tmp;1007 }1008 1009 if ((0 == gridRefOfFieldRef) &&1010 (!(fieldRef->grid_ref.isEmpty())) &&1011 (fieldRef->grid_ref.getValue() != grid_ref.getValue()))1012 {1013 gridRefOfFieldRef = fieldRef->getGridRefOfBaseReference();1014 fieldRef->addReference(this);1015 fieldRef->solveGridDomainAxisRef(false);1016 }1017 1018 CGrid* relGridRef = CGrid::get(grid_ref.getValue());1019 if ((0 != gridRefOfFieldRef) && (relGridRef != gridRefOfFieldRef) && (!(relGridRef->isTransformed())))1020 {1021 relGridRef->transformGrid(gridRefOfFieldRef);1022 filterSources_.push_back(fieldRef);1023 }1024 }*/1025 }1026 1027 const std::vector<CField*>& CField::getFilterSources()1028 {1029 return filterSources_;1030 }1031 1032 void CField::applyFilter(const CArray<double, 1>& dataToSend, CArray<double,1>& dataToReceive)1033 {1034 std::vector<CField*>::iterator itFilterSrc, iteFilterSrc;1035 if (!filterSources_.empty())1036 {1037 itFilterSrc = filterSources_.begin(); iteFilterSrc = filterSources_.end();1038 dataToReceive = 0.0; // Reset all data destination1039 for (; itFilterSrc != iteFilterSrc; ++itFilterSrc)1040 {1041 if (0 != grid->getTransformations())1042 {1043 const std::map<int, CArray<int,1>* >& localIndexToSend = grid->getTransformations()->getLocalIndexToSendFromGridSource();1044 const std::map<int,std::vector<std::vector<std::pair<int,double> > > >& localIndexToReceive = grid->getTransformations()->getLocalIndexToReceiveOnGridDest();1045 1046 sendAndReceiveTransformedData(localIndexToSend, dataToSend,1047 localIndexToReceive, dataToReceive);1048 }1049 1050 }1051 }1052 }1053 1054 void CField::sendAndReceiveTransformedData(const std::map<int, CArray<int,1>* >& localIndexToSend,1055 const CArray<double, 1>& dataSrc,1056 const std::map<int,std::vector<std::vector<std::pair<int,double> > > >& localIndexToReceive,1057 CArray<double,1>& dataDest)1058 {1059 CContext* context = CContext::getCurrent();1060 CContextClient* client=context->client;1061 1062 // Sending data from field sources to do transformations1063 std::map<int, CArray<int,1>* >::const_iterator itbSend = localIndexToSend.begin(), itSend,1064 iteSend = localIndexToSend.end();1065 int sendBuffSize = 0;1066 for (itSend = itbSend; itSend != iteSend; ++itSend) sendBuffSize = (sendBuffSize < (itSend->second)->numElements())1067 ? (itSend->second)->numElements(): sendBuffSize;1068 double* sendBuff;1069 if (0 != sendBuffSize) sendBuff = new double [sendBuffSize];1070 for (itSend = itbSend; itSend != iteSend; ++itSend)1071 {1072 int destRank = itSend->first;1073 CArray<int,1>* localIndex_p = itSend->second;1074 int countSize = localIndex_p->numElements();1075 for (int idx = 0; idx < countSize; ++idx)1076 {1077 sendBuff[idx] = dataSrc((*localIndex_p)(idx));1078 }1079 MPI_Send(sendBuff, countSize, MPI_DOUBLE, destRank, 12, client->intraComm);1080 }1081 1082 // Receiving data on destination fields1083 std::map<int,std::vector<std::vector<std::pair<int,double> > > >::const_iterator itbRecv = localIndexToReceive.begin(), itRecv,1084 iteRecv = localIndexToReceive.end();1085 int recvBuffSize = 0;1086 for (itRecv = itbRecv; itRecv != iteRecv; ++itRecv) recvBuffSize = (recvBuffSize < (itRecv->second).size())1087 ? (itRecv->second).size() : recvBuffSize;1088 double* recvBuff;1089 if (0 != recvBuffSize) recvBuff = new double [recvBuffSize];1090 for (itRecv = itbRecv; itRecv != iteRecv; ++itRecv)1091 {1092 MPI_Status status;1093 int srcRank = itRecv->first;1094 int countSize = (itRecv->second).size();1095 MPI_Recv(recvBuff, recvBuffSize, MPI_DOUBLE, srcRank, 12, client->intraComm, &status);1096 for (int idx = 0; idx < countSize; ++idx)1097 {1098 const std::vector<std::pair<int,double> >& localIndex_p = (itRecv->second)[idx];1099 int numIndex = localIndex_p.size();1100 for (int i = 0; i < numIndex; ++i)1101 {1102 // if ((localIndex_p)[i].first >= dataDest.numElements() )1103 dataDest((localIndex_p)[i].first) += recvBuff[idx] * ((localIndex_p)[i].second);1104 }1105 }1106 }1107 1108 if (0 != sendBuffSize) delete [] sendBuff;1109 if (0 != recvBuffSize) delete [] recvBuff;1110 764 } 1111 765 … … 1221 875 } 1222 876 } 1223 1224 CArray<double,1>* CField::getInstantData(void)1225 {1226 if (!hasInstantData)1227 {1228 instantData.resize(grid->storeIndex_client.numElements());1229 hasInstantData = true;1230 }1231 return &instantData;1232 }1233 1234 void CField::addDependency(CField* field, int slotId)1235 {1236 fieldDependency.push_back(pair<CField*,int>(field,slotId));1237 }1238 1239 void CField::buildExpression(void)1240 {1241 if (content.size() > 0)1242 {1243 CSimpleNodeExpr* simpleExpr;// = parseExpr(content+'\0');1244 expression = CFieldNode::newNode(simpleExpr);1245 delete simpleExpr;1246 set<string> instantFieldIds;1247 map<string,CField*> associatedInstantFieldIds;1248 expression->getInstantFieldIds(instantFieldIds);1249 for (set<string>::iterator it = instantFieldIds.begin(); it != instantFieldIds.end(); ++it)1250 {1251 if (*it != "this")1252 {1253 if (CField::has(*it))1254 {1255 CField* field = CField::get(*it);1256 // field->processEnabledField();1257 field->buildAllExpressionEnabledField();1258 associatedInstantFieldIds[*it] = field;1259 }1260 else ERROR("void CField::buildExpression(void)", << " Field " << *it << " does not exist");1261 }1262 }1263 1264 set<string> averageFieldIds;1265 map<string,CField*> associatedAverageFieldIds;1266 1267 expression->getAverageFieldIds(averageFieldIds);1268 for (set<string>::iterator it = averageFieldIds.begin(); it != averageFieldIds.end(); ++it)1269 {1270 if (CField::has(*it))1271 {1272 CFieldGroup* root = CFieldGroup::get("field_definition");1273 CField* averageField = root->createChild();1274 CField* instantField = root->createChild();1275 averageField->field_ref = *it;1276 averageField->hasFieldOut = true;1277 averageField->fieldOut = instantField;1278 instantField->freq_op = freq_op;1279 // averageField-> processEnabledField();1280 averageField->buildAllExpressionEnabledField();1281 instantField->SuperClassAttribute::setAttributes(averageField, true);1282 instantField->field_ref.reset();1283 instantField->operation.reset();1284 1285 // instantField-> processEnabledField();1286 instantField->buildAllExpressionEnabledField();1287 associatedAverageFieldIds[*it] = instantField;1288 }1289 else ERROR("void CField::buildExpression(void)", << " Field " << *it << " does not exist");1290 }1291 1292 expression->reduce(this,associatedInstantFieldIds,associatedAverageFieldIds);1293 1294 slots.resize(instantFieldIds.size() + averageFieldIds.size());1295 resetSlots();1296 int slotId = 0;1297 set<CField*> fields;1298 expression->getFields(fields);1299 for (set<CField*>::iterator it = fields.begin(); it != fields.end(); ++it, ++slotId) (*it)->addDependency(this,slotId);1300 hasExpression = true;1301 }1302 }1303 1304 void CField::resetSlots(void)1305 {1306 for (vector<bool>::iterator it = slots.begin(); it != slots.end(); ++it) *it = false;1307 }1308 1309 bool CField::slotsFull(void)1310 {1311 bool ret = true;1312 for (vector<bool>::iterator it = slots.begin(); it != slots.end(); ++it) ret &= *it;1313 return ret;1314 }1315 1316 void CField::setSlot(int slotId)1317 {1318 CContext* context = CContext::getCurrent();1319 const CDate& currDate = context->getCalendar()->getCurrentDate();1320 if (slotUpdateDate == NULL || currDate != *slotUpdateDate)1321 {1322 resetSlots();1323 if (slotUpdateDate == NULL) slotUpdateDate = new CDate(currDate);1324 else *slotUpdateDate = currDate;1325 }1326 slots[slotId] = true;1327 if (slotsFull())1328 {1329 CArray<double,1> expr(expression->compute());1330 1331 if (hasInstantData)1332 {1333 instantData = expr;1334 for (list< pair<CField *,int> >::iterator it = fieldDependency.begin(); it != fieldDependency.end(); ++it)1335 if (it->first != this) it->first->setSlot(it->second);1336 }1337 1338 if (hasOutputFile) updateDataFromExpression(expr);1339 1340 const std::vector<CField*>& refField = getAllReference();1341 for (std::vector<CField*>::const_iterator it = refField.begin(); it != refField.end(); it++)1342 {1343 if (!(*it)->hasExpression)1344 (*it)->setDataFromExpression(expr);1345 }1346 }1347 }1348 877 1349 878 /*! … … 1484 1013 1485 1014 DEFINE_REF_FUNC(Field,field) 1486 1487 // void CField::addReference(CField* field)1488 // {1489 // refObject.push_back(field);1490 // }1491 //1492 // //----------------------------------------------------------------1493 //1494 // bool CField::hasDirectFieldReference(void) const1495 // {1496 // return !this->field_ref.isEmpty();1497 // }1498 //1499 // //----------------------------------------------------------------1500 //1501 // const StdString& CField::getBaseFieldId(void) const1502 // {1503 // return this->getBaseFieldReference()->getId();1504 // }1505 //1506 // //----------------------------------------------------------------1507 //1508 // /*!1509 // \brief Get pointer to direct field to which the current field refers.1510 // */1511 // CField* CField::getDirectFieldReference(void) const1512 // {1513 // if (this->field_ref.isEmpty())1514 // return this->getBaseFieldReference();1515 //1516 // if (!CField::has(this->field_ref.getValue()))1517 // ERROR("CField::getDirectFieldReference(void)",1518 // << "[ ref_name = " << this->field_ref.getValue() << "]"1519 // << " invalid field name !");1520 //1521 // return CField::get(this->field_ref.getValue());1522 // }1523 //1524 // //----------------------------------------------------------------1525 //1526 // CField* CField::getBaseFieldReference(void) const1527 // {1528 // return baseRefObject;1529 // }1530 //1531 // //----------------------------------------------------------------1532 //1533 // const std::vector<CField*>& CField::getAllReference(void) const1534 // {1535 // return refObject;1536 // }1537 //1538 // /*!1539 // \brief Searching for all reference of a field1540 // If a field refers to (an)other field(s), we will search for all its referenced parents.1541 // Moreover, if any father, direct or indirect (e.g: two levels up), has non-empty attributes,1542 // all its attributes will be added to the current field1543 // \param [in] apply Flag to specify whether current field uses attributes of its father1544 // in case the attribute is empty (true) or its attributes are replaced by ones of its father (false)1545 // */1546 // void CField::solveRefInheritance(bool apply)1547 // {1548 // std::set<CField *> sset;1549 // CField* refer_sptr;1550 // CField* refer_ptr = this;1551 //1552 // while (refer_ptr->hasDirectFieldReference())1553 // {1554 // refer_sptr = refer_ptr->getDirectFieldReference();1555 // refer_ptr = refer_sptr;1556 //1557 // if(sset.end() != sset.find(refer_ptr))1558 // {1559 // DEBUG (<< "Circular dependency stopped for field object on "1560 // << "\"" + refer_ptr->getId() + "\" !");1561 // break;1562 // }1563 //1564 // SuperClassAttribute::setAttributes(refer_ptr, apply);1565 // sset.insert(refer_ptr);1566 // }1567 // }1568 //1569 // /*!1570 // \brief Only on SERVER side. Remove all field_ref from current field1571 // On creating a new field on server side, redundant "field_ref" is still kept in the attribute list1572 // of the current field. This function removes this from current field1573 // */1574 // void CField::removeRefInheritance()1575 // {1576 // if (this->field_ref.isEmpty()) return;1577 // this->clearAttribute("field_ref");1578 // }1579 //1580 // void CField::solveBaseReference(void)1581 // {1582 // std::set<CField *> sset;1583 // CField* refer_sptr;1584 // CField* refer_ptr = this;1585 //1586 // if (this->hasDirectFieldReference()) baseRefObject = getDirectFieldReference();1587 // else baseRefObject = CField::get(this);1588 //1589 // while (refer_ptr->hasDirectFieldReference())1590 // {1591 // refer_sptr = refer_ptr->getDirectFieldReference();1592 // refer_ptr = refer_sptr;1593 //1594 // if(sset.end() != sset.find(refer_ptr))1595 // {1596 // DEBUG (<< "Circular dependency stopped for field object on "1597 // << "\"" + refer_ptr->getId() + "\" !");1598 // break;1599 // }1600 //1601 // sset.insert(refer_ptr);1602 // }1603 //1604 // if (hasDirectFieldReference()) baseRefObject->addReference(this);1605 // }1606 1015 } // namespace xios -
XIOS/trunk/src/node/field.hpp
r643 r645 78 78 CFile* getRelFile(void) const ; 79 79 80 func::CFunctor::ETimeType getOperationTimeType() const; 81 80 82 public : 81 83 82 84 StdSize getNStep(void) const; 83 85 84 const CDuration & getFreqOperation(void) const;85 const CDuration & getFreqWrite(void) const;86 87 boost::shared_ptr<CDate> getLastWriteDate(void) const;88 boost::shared_ptr<CDate> getLastOperationDate(void) const;89 90 boost::shared_ptr<func::CFunctor> getFieldOperation(void) const;91 92 CArray<double, 1> getData(void) const;93 86 template <int N> void getData(CArray<double, N>& _data) const; 94 87 … … 101 94 void resetNStepMax(); 102 95 103 template <int N> bool updateData(const CArray<double, N>& data);104 template <int N> bool updateFilteredData(CArray<double, N>& data);105 template<int N>106 void updateDataWithoutOperation(const CArray<double, N>& _data, CArray<double,1>& updatedData);107 bool updateDataFromExpression(const CArray<double, 1>& data);108 void setDataFromExpression(const CArray<double, 1>& _data) ;109 110 bool updateDataServer111 (const CDate & currDate,112 const std::deque< CArray<double, 1>* > storedClient);113 114 96 std::map<int, StdSize> getGridDataSize(); 115 97 116 98 public : 117 99 bool isActive(void) const; 118 bool active ;119 100 bool hasOutputFile ; 120 bool hasFieldOut ;121 101 122 102 /// Traitements /// 123 void processEnabledField(void) ;124 125 103 void solveGridReference(void); 126 void solve Operation(void);104 void solveServerOperation(void); 127 105 void solveCheckMaskIndex(bool doSendingIndex); 128 106 void solveAllReferenceEnabledField(bool doSending2Sever); 129 void buildAllExpressionEnabledField();130 107 void solveGridDomainAxisRef(bool checkAtt); 131 108 void solveTransformedGrid(); 132 CGrid* getGridRefOfBaseReference();133 109 134 110 void buildFilterGraph(CGarbageCollector& gc, bool enableOutput); … … 149 125 template <int N> void setData(const CArray<double, N>& _data) ; 150 126 static bool dispatchEvent(CEventServer& event) ; 151 void sendUpdateData(void) ;152 127 void sendUpdateData(const CArray<double,1>& data); 153 128 static void recvUpdateData(CEventServer& event) ; … … 170 145 void invertScaleFactorAddOffset(double scaleFactor, double addOffset); 171 146 void parse(xml::CXMLNode & node) ; 172 CArray<double,1>* getInstantData(void) ;173 147 174 148 void setVirtualVariableGroup(CVariableGroup* newVVariableGroup); … … 191 165 const std::pair<StdString, StdString>& getRefDomainAxisIds(); 192 166 193 const std::vector<CField*>& getFilterSources();194 void applyFilter(const CArray<double, 1>& dataToSend, CArray<double,1>& dataToReceive);195 void sendAndReceiveTransformedData(const std::map<int, CArray<int,1>* >& localIndexToSend,196 const CArray<double, 1>& dataSrc,197 const std::map<int,std::vector<std::vector<std::pair<int,double> > > >& localIndexToReceive,198 CArray<double,1>& dataDest);199 167 public : 200 168 /// Propriétés privées /// … … 203 171 CGrid* grid ; 204 172 CFile* file; 205 CField* fieldOut ; 206 207 CDuration freq_operation, freq_write; 173 208 174 CDuration freq_operation_srv, freq_write_srv; 209 175 210 176 StdSize nstep, nstepMax; 211 177 bool isEOF; 212 boost::shared_ptr<CDate> last_Write, last_operation; 213 boost::shared_ptr<CDate> lastlast_Write_srv,last_Write_srv, last_operation_srv; 178 boost::shared_ptr<CDate> lastlast_Write_srv, last_Write_srv, last_operation_srv; 214 179 CDate lastDataRequestedFromServer; 215 180 216 boost::shared_ptr<func::CFunctor> foperation;217 181 map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; 218 182 219 CArray<double, 1> data;220 CArray<double, 1> instantData;221 CArray<double, 1> filteredData;222 bool hasInstantData ;223 183 map<int, CArray<double,1>* > data_srv ; 224 bool isOnceOperation ;225 bool isFirstOperation ;226 184 string content ; 227 185 228 list< pair<CField *,int> > fieldDependency ;229 void buildExpression(void) ;230 void addDependency(CField* field, int slotId) ;231 void resetSlots(void) ;232 vector<bool> slots ;233 CDate* slotUpdateDate ;234 CFieldNode * expression ;235 bool hasExpression ;236 bool slotsFull(void) ;237 void setSlot(int slotId);238 bool processed ;239 186 bool areAllReferenceSolved; 240 bool areAllExpressionBuilt;241 187 std::pair<StdString,StdString> domAxisIds_; 242 188 bool isReadDataRequestPending; 243 std::vector<CField*> filterSources_; 189 244 190 DECLARE_REF_FUNC(Field,field) 245 191 246 192 private: 193 //! The type of operation attached to the field 194 func::CFunctor::ETimeType operationTimeType; 195 247 196 //! The output pin of the filter providing the instant data for the field 248 197 boost::shared_ptr<COutputPin> instantDataFilter; -
XIOS/trunk/src/node/field_impl.hpp
r640 r645 23 23 ERROR("void CField::setData(const CArray<double, N>& _data)", 24 24 << "Impossible to receive data from the model for a field [ id = " << getId() << " ] with a reference or an arithmetic operation."); 25 26 /*if (hasInstantData)27 {28 grid->inputField(_data, instantData);29 for(list< pair<CField *,int> >::iterator it=fieldDependency.begin(); it!=fieldDependency.end(); ++it) it->first->setSlot(it->second);30 }31 32 if (!hasExpression)33 {34 const std::vector<CField*>& refField=getAllReference();35 std::vector<CField*>::const_iterator it = refField.begin(), end = refField.end(),36 itFilterSrc, iteFilterSrc;37 38 for (; it != end; it++)39 {40 const std::vector<CField*>& fieldFilterSources = (*it)->getFilterSources();41 if (!fieldFilterSources.empty())42 {43 itFilterSrc = fieldFilterSources.begin();44 iteFilterSrc = fieldFilterSources.end();45 for (; itFilterSrc != iteFilterSrc; ++itFilterSrc)46 {47 (*itFilterSrc)->updateDataWithoutOperation(_data, (*itFilterSrc)->data);48 if ((*it)->filteredData.numElements() != (*it)->grid->storeIndex_client.numElements())49 {50 (*it)->filteredData.resize((*it)->grid->storeIndex_client.numElements());51 }52 (*it)->applyFilter((*itFilterSrc)->data, (*it)->filteredData);53 }54 if ((*it)->hasOutputFile || (*it)->hasFieldOut) (*it)->updateFilteredData((*it)->filteredData);55 }56 else57 {58 (*it)->setData(_data);59 }60 }61 if (hasOutputFile || hasFieldOut) updateData(_data);62 }*/63 25 } 64 65 void CField::setDataFromExpression(const CArray<double, 1>& _data)66 {67 if (hasInstantData)68 {69 instantData=_data;70 for(list< pair<CField *,int> >::iterator it=fieldDependency.begin(); it!=fieldDependency.end(); ++it) it->first->setSlot(it->second);71 }72 73 if (!hasExpression)74 {75 const std::vector<CField*>& refField=getAllReference();76 std::vector<CField*>::const_iterator it = refField.begin(), end = refField.end();77 78 for (; it != end; it++) (*it)->setDataFromExpression(_data);79 if (hasOutputFile || hasFieldOut) updateDataFromExpression(_data);80 }81 }82 83 template<int N>84 void CField::updateDataWithoutOperation(const CArray<double, N>& _data, CArray<double,1>& updatedData)85 {86 if (updatedData.numElements() != this->grid->storeIndex_client.numElements())87 {88 updatedData.resize(this->grid->storeIndex_client.numElements());89 this->grid->inputField(_data, updatedData);90 }91 }92 93 template<int N>94 bool CField::updateFilteredData(CArray<double, N>& filteredData)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() != filteredData.numElements())114 {115 this->data.resize(filteredData.numElements());116 }117 118 (*this->foperation)(filteredData);119 120 *last_operation = currDate;121 info(50) << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl;122 }123 124 doWrite = (writeDate < (currDate + freq_operation));125 if (isOnceOperation)126 {127 if(isFirstOperation)128 {129 doWrite=true;130 isFirstOperation=false;131 }132 else doWrite=false;133 }134 135 if (doWrite)136 {137 this->foperation->final();138 *last_Write = writeDate;139 if (hasOutputFile)140 {141 info(50) << "(*last_Write = currDate) : " << *last_Write << " = " << currDate << std::endl;142 CTimer::get("XIOS Send Data").resume();143 sendUpdateData();144 CTimer::get("XIOS Send Data").suspend();145 }146 147 // if (hasFieldOut)148 // {149 // fieldOut->setDataFromExpression(data);150 // }151 return (true);152 }153 154 return (false);155 }156 157 template <int N>158 bool CField::updateData(const CArray<double, N>& _data)159 {160 CContext* context=CContext::getCurrent();161 const CDate & currDate = context->getCalendar()->getCurrentDate();162 const CDate opeDate = *last_operation + freq_operation;163 const CDate writeDate = *last_Write + freq_write;164 bool doOperation, doWrite;165 166 167 info(50) << "CField::updateData " << currDate << " : send data to " << this->getBaseFieldId() << std::endl;168 info(50) << "Next operation " << opeDate<<std::endl;169 170 doOperation = (opeDate <= currDate);171 if (isOnceOperation)172 if (isFirstOperation) doOperation=true;173 else doOperation=false;174 175 if (doOperation)176 {177 if (this->data.numElements() != this->grid->storeIndex_client.numElements())178 {179 this->data.resize(this->grid->storeIndex_client.numElements());180 }181 182 CArray<double,1> input(data.numElements());183 this->grid->inputField(_data, input);184 (*this->foperation)(input);185 186 *last_operation = currDate;187 info(50) << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl;188 }189 190 doWrite = (writeDate < (currDate + freq_operation));191 if (isOnceOperation)192 {193 if(isFirstOperation)194 {195 doWrite=true;196 isFirstOperation=false;197 }198 else doWrite=false;199 }200 201 if (doWrite)202 {203 this->foperation->final();204 *last_Write = writeDate;205 if (hasOutputFile)206 {207 info(50) << "(*last_Write = currDate) : " << *last_Write << " = " << currDate << std::endl;208 CTimer::get("XIOS Send Data").resume();209 sendUpdateData();210 CTimer::get("XIOS Send Data").suspend();211 }212 213 if (hasFieldOut)214 {215 fieldOut->setDataFromExpression(data);216 }217 return (true);218 }219 220 return (false);221 }222 223 bool CField::updateDataFromExpression(const CArray<double, 1>& _data)224 {225 CContext* context=CContext::getCurrent();226 const CDate & currDate = context->getCalendar()->getCurrentDate();227 const CDate opeDate = *last_operation + freq_operation;228 const CDate writeDate = *last_Write + freq_write;229 bool doOperation, doWrite;230 231 232 info(50) << "CField::updateData " << currDate << " : send data to " << this->getBaseFieldId() << std::endl;233 info(50) << "Next operation " << opeDate<<std::endl;234 235 doOperation = (opeDate <= currDate);236 if (isOnceOperation)237 if (isFirstOperation) doOperation=true;238 else doOperation=false;239 240 if (doOperation)241 {242 if (this->data.numElements() != this->grid->storeIndex_client.numElements())243 {244 this->data.resize(this->grid->storeIndex_client.numElements());245 }246 247 (*this->foperation)(_data);248 249 *last_operation = currDate;250 info(50) << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl;251 }252 253 doWrite = (writeDate < (currDate + freq_operation));254 if (isOnceOperation)255 {256 if(isFirstOperation)257 {258 doWrite=true;259 isFirstOperation=false;260 }261 else doWrite=false;262 }263 264 if (doWrite)265 {266 this->foperation->final();267 *last_Write = writeDate;268 if (hasOutputFile)269 {270 info(50) << "(*last_Write = currDate) : " << *last_Write << " = " << currDate << std::endl;271 CTimer::get("XIOS Send Data").resume();272 sendUpdateData();273 CTimer::get("XIOS Send Data").suspend();274 }275 276 if (hasFieldOut)277 {278 fieldOut->setDataFromExpression(data);279 }280 return (true);281 }282 283 return (false);284 }285 26 286 27 template <int N> … … 294 35 ERROR("void CField::getData(CArray<double, N>& _data) const", 295 36 << "Impossible to access field data, all the records of the field [ id = " << getId() << " ] have been already read."); 296 297 /*CContext* context = CContext::getCurrent();298 const CDate& currentDate = context->getCalendar()->getCurrentDate();299 300 while (isReadDataRequestPending)301 context->checkBuffersAndListen();302 303 if (isEOF)304 ERROR("void CField::getData(CArray<double, N>& _data) const",305 << "Impossible to access field data, all the records of the field [ id = " << getId() << " ] have been already read.");306 307 grid->outputField(instantData, _data);*/308 37 } 309 38 else -
XIOS/trunk/src/node/file.cpp
r640 r645 572 572 //---------------------------------------------------------------- 573 573 574 // void CFile::processEnabledFile(void)575 // {576 // if (output_freq.isEmpty()) ERROR("void CFile::processEnabledFile(void)",577 // <<"File attribute <<output_freq>> is undefined");578 // solveFieldRefInheritance(true) ;579 // getEnabledFields() ;580 // processEnabledFields() ;581 // }582 583 // void CFile::processEnabledFields(void)584 // {585 // for (unsigned int i = 0; i < this->enabledFields.size(); i++)586 // {587 // this->enabledFields[i]->processEnabledField() ;588 // }589 // }590 591 574 /*! 592 575 \brief Resolve all reference of active fields. … … 607 590 608 591 /*! 609 \brief Contruct all expression related to active fields.610 Each field can do some expressions which appear on the xml file, and itself can be611 a result of an expression among some other fields. This function builds all possible expression612 relating to active fields.613 */614 void CFile::buildAllExpressionOfEnabledFields()615 {616 int size = this->enabledFields.size();617 for (int i = 0; i < size; ++i)618 {619 this->enabledFields[i]->buildAllExpressionEnabledField();620 }621 }622 623 /*!624 592 * Constructs the filter graph for each active field. 625 593 * … … 670 638 671 639 //---------------------------------------------------------------- 672 673 void CFile::solveEFGridRef(void)674 {675 for (unsigned int i = 0; i < this->enabledFields.size(); i++)676 this->enabledFields[i]->solveGridReference();677 }678 679 //----------------------------------------------------------------680 681 void CFile::solveEFOperation(void)682 {683 for (unsigned int i = 0; i < this->enabledFields.size(); i++)684 this->enabledFields[i]->solveOperation();685 }686 687 void CFile::solveEFExpression(void)688 {689 for (unsigned int i = 0; i < this->enabledFields.size(); i++)690 this->enabledFields[i]->buildExpression();691 }692 640 693 641 /*! -
XIOS/trunk/src/node/file.hpp
r640 r645 103 103 // Some processing on file 104 104 void solveFieldRefInheritance(bool apply); 105 void solveEFGridRef(void);106 void solveEFOperation(void);107 void solveEFExpression(void);108 105 void processEnabledFile(void) ; 109 void processEnabledFields(void) ;110 106 void solveAllRefOfEnabledFields(bool sendToServer); 111 void buildAllExpressionOfEnabledFields();112 107 void buildFilterGraphOfEnabledFields(CGarbageCollector& gc); 113 108 void prefetchEnabledReadModeFields(); -
XIOS/trunk/src/output/nc4_data_output.cpp
r633 r645 827 827 } 828 828 829 bool wtime = !(!field->operation.isEmpty() && field-> foperation->timeType() == func::CFunctor::once);829 bool wtime = !(!field->operation.isEmpty() && field->getOperationTimeType() == func::CFunctor::once); 830 830 831 831 if (wtime) … … 836 836 // << "_" << field->getRelFile()->output_freq.getValue(); 837 837 //oss 838 if (field-> foperation->timeType() == func::CFunctor::instant) coodinates.push_back(string("time_instant"));839 else if (field-> foperation->timeType() == func::CFunctor::centered) coodinates.push_back(string("time_centered"));838 if (field->getOperationTimeType() == func::CFunctor::instant) coodinates.push_back(string("time_instant")); 839 else if (field->getOperationTimeType() == func::CFunctor::centered) coodinates.push_back(string("time_centered")); 840 840 dims.push_back(timeid); 841 841 } … … 1136 1136 StdOStringStream oss; 1137 1137 string timeAxisId ; 1138 if (field-> foperation->timeType() == func::CFunctor::instant) timeAxisId="time_instant" ;1139 else if (field-> foperation->timeType() == func::CFunctor::centered) timeAxisId="time_centered" ;1138 if (field->getOperationTimeType() == func::CFunctor::instant) timeAxisId="time_instant" ; 1139 else if (field->getOperationTimeType() == func::CFunctor::centered) timeAxisId="time_centered" ; 1140 1140 1141 1141 StdString timeBoundId("time_counter_bounds"); 1142 1142 1143 1143 StdString timeAxisBoundId; 1144 if (field-> foperation->timeType() == func::CFunctor::instant) timeAxisBoundId="time_instant_bounds" ;1145 else if (field-> foperation->timeType() == func::CFunctor::centered) timeAxisBoundId="time_centered_bounds" ;1144 if (field->getOperationTimeType() == func::CFunctor::instant) timeAxisBoundId="time_instant_bounds" ; 1145 else if (field->getOperationTimeType() == func::CFunctor::centered) timeAxisBoundId="time_centered_bounds" ; 1146 1146 1147 1147 CArray<double,1> time_data(1) ; … … 1150 1150 CArray<double,1> time_data_bound(2); 1151 1151 1152 bool wtime = !(!field->operation.isEmpty() && (field-> foperation->timeType() == func::CFunctor::once));1152 bool wtime = !(!field->operation.isEmpty() && (field->getOperationTimeType() == func::CFunctor::once)); 1153 1153 1154 1154 if (wtime) 1155 1155 { 1156 1156 time_counter(0)= (Time(*field->last_Write_srv) + Time(*field->lastlast_Write_srv)) / 2; 1157 if (field-> foperation->timeType() == func::CFunctor::instant)1157 if (field->getOperationTimeType() == func::CFunctor::instant) 1158 1158 time_data(0) = Time(*field->last_Write_srv); 1159 else if (field-> foperation->timeType() == func::CFunctor::centered) time_data(0) = time_counter(0);1159 else if (field->getOperationTimeType() == func::CFunctor::centered) time_data(0) = time_counter(0); 1160 1160 1161 1161 time_counter_bound(0) = Time(*field->lastlast_Write_srv); 1162 1162 time_counter_bound(1) = Time(*field->last_Write_srv); 1163 if (field-> foperation->timeType() == func::CFunctor::instant)1163 if (field->getOperationTimeType() == func::CFunctor::instant) 1164 1164 time_data_bound(0) = time_data_bound(1) = Time(*field->last_Write_srv); 1165 else if (field-> foperation->timeType() == func::CFunctor::centered)1165 else if (field->getOperationTimeType() == func::CFunctor::centered) 1166 1166 { 1167 1167 time_data_bound(0) = time_counter_bound(0); … … 1253 1253 StdOStringStream oss; 1254 1254 1255 // if (field->operation.getValue().compare("once") == 0) return ; 1256 if (field->foperation->timeType() == func::CFunctor::once) return ; 1255 if (field->getOperationTimeType() == func::CFunctor::once) return ; 1257 1256 1258 1257 // oss << "time_" << field->operation.getValue() … … 1260 1259 1261 1260 // StdString axisid = oss.str(); 1262 // if (field-> foperation->timeType() == func::CFunctor::centered) axisid="time_centered" ;1263 // else if (field-> foperation->timeType() == func::CFunctor::instant) axisid="time_instant" ;1261 // if (field->getOperationTimeType() == func::CFunctor::centered) axisid="time_centered" ; 1262 // else if (field->getOperationTimeType() == func::CFunctor::instant) axisid="time_instant" ; 1264 1263 1265 1264 StdString axisid("time_centered") ; … … 1268 1267 StdString timeBoundId("axis_nbounds"); 1269 1268 1270 if (field-> foperation->timeType() == func::CFunctor::instant)1269 if (field->getOperationTimeType() == func::CFunctor::instant) 1271 1270 { 1272 1271 axisid = "time_instant";
Note: See TracChangeset
for help on using the changeset viewer.