Changeset 460 for XIOS/trunk/src/node/field.cpp
- Timestamp:
- 01/20/14 11:16:48 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/field.cpp
r459 r460 25 25 , last_Write(), last_operation() 26 26 , foperation(), hasInstantData(false), hasExpression(false) 27 , active(false) , hasOutputFile(false), slotUpdateDate(NULL)27 , active(false) , hasOutputFile(false),hasFieldOut(false), slotUpdateDate(NULL) 28 28 , processed(false) 29 29 { /* Ne rien faire de plus */ } … … 37 37 , last_Write(), last_operation() 38 38 , foperation(), hasExpression(false) 39 , active(false), hasOutputFile(false), slotUpdateDate(NULL)39 , active(false), hasOutputFile(false), hasFieldOut(false), slotUpdateDate(NULL) 40 40 , processed(false) 41 41 { /* Ne rien faire de plus */ } … … 387 387 using namespace func; 388 388 389 if (!hasOutputFile ) return ;389 if (!hasOutputFile && !hasFieldOut) return ; 390 390 391 391 StdString id ; … … 418 418 if (context->hasServer) 419 419 { 420 this->freq_operation_srv = 421 CDuration::FromString(this->file->output_freq.getValue()); 422 this->freq_write_srv = 423 CDuration::FromString(this->file->output_freq.getValue()); 420 if (hasOutputFile) 421 { 422 this->freq_operation_srv =CDuration::FromString(this->file->output_freq.getValue()); 423 this->freq_write_srv = CDuration::FromString(this->file->output_freq.getValue()); 424 } 424 425 this->lastlast_Write_srv = boost::shared_ptr<CDate> 425 426 (new CDate(context->getCalendar()->getInitDate())); … … 431 432 // boost::shared_ptr<func::CFunctor>(new CInstant(this->data_srv)); 432 433 433 const CDuration toffset = this->freq_operation_srv - freq_offset_ - context->getCalendar()->getTimeStep(); 434 *this->last_operation_srv = *this->last_operation_srv - toffset; 434 if (hasOutputFile) 435 { 436 const CDuration toffset = this->freq_operation_srv - freq_offset_ - context->getCalendar()->getTimeStep(); 437 *this->last_operation_srv = *this->last_operation_srv - toffset; 438 } 435 439 } 436 440 … … 438 442 // { 439 443 this->freq_operation = CDuration::FromString(freq_op.getValue()); 440 this->freq_write = CDuration::FromString(this->file->output_freq.getValue()); 444 if (hasOutputFile) this->freq_write = CDuration::FromString(this->file->output_freq.getValue()); 445 if (hasFieldOut) 446 { 447 this->freq_write = CDuration::FromString(this->fieldOut->freq_op.getValue()); 448 } 441 449 this->last_Write = boost::shared_ptr<CDate> 442 450 (new CDate(context->getCalendar()->getInitDate())); … … 665 673 expression=CFieldNode::newNode(simpleExpr) ; 666 674 delete simpleExpr ; 667 set<string> fieldIds ; 668 expression->getFieldIds(fieldIds) ; 669 for (set<string>::iterator it=fieldIds.begin() ; it!=fieldIds.end();++it) if (*it!="this") CField::get(*it)->processEnabledField() ; 670 671 expression->reduce(this) ; 672 673 slots.resize(fieldIds.size()) ; 675 set<string> instantFieldIds ; 676 map<string,CField*> associatedInstantFieldIds ; 677 expression->getInstantFieldIds(instantFieldIds) ; 678 for (set<string>::iterator it=instantFieldIds.begin() ; it!=instantFieldIds.end();++it) 679 { 680 if (*it!="this") 681 { 682 if (CField::has(*it)) 683 { 684 CField* field=CField::get(*it) ; 685 field->processEnabledField() ; 686 associatedInstantFieldIds[*it]=field ; 687 } 688 else ERROR("void CField::buildExpression(void)",<<" Field "<<*it<<" does not exist") ; 689 } 690 } 691 692 set<string> averageFieldIds ; 693 map<string,CField*> associatedAverageFieldIds ; 694 695 expression->getAverageFieldIds(averageFieldIds) ; 696 for (set<string>::iterator it=averageFieldIds.begin() ; it!=averageFieldIds.end();++it) 697 { 698 if (CField::has(*it)) 699 { 700 CFieldGroup* root=CFieldGroup::get("field_definition") ; 701 CField* averageField=root->createChild() ; 702 CField* instantField=root->createChild() ; 703 averageField->field_ref=*it ; 704 averageField->hasFieldOut=true ; 705 averageField->fieldOut=instantField ; 706 instantField->freq_op=freq_op ; 707 averageField-> processEnabledField() ; 708 cout<<" outputfreq of averageField "<< freq_op <<" "<<instantField->freq_op<<" "<< averageField->freq_write << endl ; 709 instantField->SuperClassAttribute::setAttributes(averageField, true); 710 instantField->field_ref.reset() ; 711 instantField->operation.reset() ; 712 713 instantField-> processEnabledField() ; 714 associatedAverageFieldIds[*it]=instantField ; 715 } 716 else ERROR("void CField::buildExpression(void)",<<" Field "<<*it<<" does not exist") ; 717 } 718 719 expression->reduce(this,associatedInstantFieldIds,associatedAverageFieldIds) ; 720 721 slots.resize(instantFieldIds.size()+averageFieldIds.size()) ; 674 722 resetSlots() ; 675 723 int slotId=0 ;
Note: See TracChangeset
for help on using the changeset viewer.