Changeset 645


Ignore:
Timestamp:
07/17/15 13:58:14 (9 years ago)
Author:
rlacroix
Message:

Cleanup: Remove now deprecated code.

Location:
XIOS/trunk/src
Files:
3 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/context.cpp

    r640 r645  
    388388    if (hasClient) 
    389389    { 
    390       //this->buildAllExpressionOfEnabledFields(); 
    391       //buildAllExpressionOfFieldsWithReadAccess(); 
    392390      this->buildFilterGraphOfEnabledFields(); 
    393391      buildFilterGraphOfFieldsWithReadAccess(); 
     
    421419     { 
    422420       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(); 
    432421     } 
    433422   } 
     
    476465  { 
    477466    for (size_t i = 0; i < fieldsWithReadAccess.size(); ++i) 
    478     { 
    479467      fieldsWithReadAccess[i]->solveAllReferenceEnabledField(false); 
    480       // Ensure that the instant data will be properly saved 
    481       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(); 
    489468  } 
    490469 
  • XIOS/trunk/src/node/context.hpp

    r640 r645  
    103103         // Some functions to process context 
    104104         void findAllEnabledFields(void); 
    105          void processEnabledFiles(void); 
    106105         void solveAllInheritance(bool apply=true); 
    107106         void findEnabledFiles(void); 
     
    111110         void createFileHeader(void ); 
    112111         void solveAllRefOfEnabledFields(bool sendToServer); 
    113          void buildAllExpressionOfEnabledFields(); 
    114112         void buildFilterGraphOfEnabledFields(); 
    115113         void startPrefetchingOfEnabledReadModeFiles(); 
     
    117115         void findFieldsWithReadAccess(void); 
    118116         void solveAllRefOfFieldsWithReadAccess(); 
    119          void buildAllExpressionOfFieldsWithReadAccess(); 
    120117         void buildFilterGraphOfFieldsWithReadAccess(); 
    121118         void postProcessing(); 
     
    227224        // virtual void toBinary  (StdOStream & os) const; 
    228225        // virtual void fromBinary(StdIStream & is); 
    229         // void solveAllGridRef(void); 
    230         // void solveAllOperation(void); 
    231         // void solveAllExpression(void); 
    232         // void solveFieldRefInheritance(bool apply); 
    233  
    234226   }; // class CContext 
    235227 
  • XIOS/trunk/src/node/field.cpp

    r644 r645  
    3232      , refObject(), baseRefObject() 
    3333      , 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) 
    4037      , isReadDataRequestPending(false) 
    41       , filterSources_() 
    4238   { setVirtualVariableGroup(); } 
    4339 
     
    4642      , refObject(), baseRefObject() 
    4743      , 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) 
    5447      , isReadDataRequestPending(false) 
    55       , filterSources_() 
    5648   { setVirtualVariableGroup(); } 
    5749 
    5850   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   {} 
    6852 
    6953  //---------------------------------------------------------------- 
     
    9579      this->getVirtualVariableGroup()->solveDescInheritance(apply, NULL); 
    9680   } 
    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  //---------------------------------------------------------------- 
    12783 
    12884  bool CField::dispatchEvent(CEventServer& event) 
     
    163119      } 
    164120    } 
    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     else 
    198     { 
    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; 
    214121  } 
    215122 
     
    467374    std::map<int, CArray<double,1> > data; 
    468375 
     376    bool isEOF = false; 
     377 
    469378    for (int i = 0; i < ranks.size(); i++) 
    470379    { 
     
    484393      serverSourceFilter->streamDataFromServer(lastDataRequestedFromServer, data); 
    485394 
    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       else 
    501         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  
    519395    isReadDataRequestPending = false; 
    520396  } 
     
    553429   } 
    554430 
     431   func::CFunctor::ETimeType CField::getOperationTimeType() const 
     432   { 
     433     return operationTimeType; 
     434   } 
     435 
     436   //---------------------------------------------------------------- 
     437 
    555438   void CField::incrementNStep(void) 
    556439   { 
     
    570453   //---------------------------------------------------------------- 
    571454 
    572    const CDuration& CField::getFreqOperation(void) const 
    573    { 
    574       return this->freq_operation; 
    575    } 
    576  
    577    //---------------------------------------------------------------- 
    578  
    579    const CDuration& CField::getFreqWrite(void) const 
    580    { 
    581       return this->freq_write; 
    582    } 
    583  
    584    //---------------------------------------------------------------- 
    585  
    586    boost::shared_ptr<func::CFunctor> CField::getFieldOperation(void) const 
    587    { 
    588       return this->foperation; 
    589    } 
    590  
    591455   bool CField::isActive(void) const 
    592456   { 
    593457      return !this->refObject.empty(); 
    594    } 
    595  
    596    //---------------------------------------------------------------- 
    597  
    598    CArray<double, 1> CField::getData(void) const 
    599    { 
    600       return(this->data); 
    601    } 
    602  
    603    //---------------------------------------------------------------- 
    604  
    605    boost::shared_ptr<CDate> CField::getLastWriteDate(void) const 
    606    { 
    607       return(this->last_Write); 
    608    } 
    609  
    610    //---------------------------------------------------------------- 
    611  
    612    boost::shared_ptr<CDate> CField::getLastOperationDate(void) const 
    613    { 
    614       return(this->last_operation); 
    615458   } 
    616459 
     
    637480          if (hasDirectFieldReference()) getDirectFieldReference()->solveAllReferenceEnabledField(false); 
    638481        } 
    639  
    640         solveOperation(); 
     482        else if (context->hasServer) 
     483          solveServerOperation(); 
     484 
    641485        solveGridReference(); 
     486 
     487        lastDataRequestedFromServer.setRelCalendar(*context->getCalendar()); 
    642488     } 
    643489     solveGridDomainAxisRef(doSending2Sever); 
     
    654500   } 
    655501 
    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   { 
    674506      CContext* context = CContext::getCurrent(); 
    675507 
    676508      if (!context->hasServer || !hasOutputFile) return; 
    677509 
    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); 
    691512 
    692513      if (freq_offset.isEmpty()) 
    693514        freq_offset.setValue(NoneDu); 
    694515 
    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; 
    740532 
    741533#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) \ 
    745535      { \ 
    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      } 
    756538 
    757539#include "functor_type.conf" 
    758540 
    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(); 
    763546   } 
    764547 
     
    974757   } 
    975758 
    976    CGrid* CField::getGridRefOfBaseReference() 
    977    { 
    978      solveRefInheritance(true); 
    979      solveBaseReference(); 
    980      baseRefObject->solveGridReference(); 
    981  
    982      return baseRefObject->grid; 
    983    } 
    984  
    985759   void CField::solveTransformedGrid() 
    986760   { 
     
    988762         && grid_ref.getValue() != getDirectFieldReference()->grid_ref.getValue() && !grid->isTransformed()) 
    989763       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 destination 
    1039         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 transformations 
    1063      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 fields 
    1083      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; 
    1110764   } 
    1111765 
     
    1221875      } 
    1222876    } 
    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   } 
    1348877 
    1349878   /*! 
     
    14841013 
    14851014   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) const 
    1495 //   { 
    1496 //     return !this->field_ref.isEmpty(); 
    1497 //   } 
    1498 // 
    1499 //   //---------------------------------------------------------------- 
    1500 // 
    1501 //   const StdString& CField::getBaseFieldId(void) const 
    1502 //   { 
    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) const 
    1512 //   { 
    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) const 
    1527 //   { 
    1528 //      return baseRefObject; 
    1529 //   } 
    1530 // 
    1531 //   //---------------------------------------------------------------- 
    1532 // 
    1533 //   const std::vector<CField*>& CField::getAllReference(void) const 
    1534 //   { 
    1535 //      return refObject; 
    1536 //   } 
    1537 // 
    1538 //   /*! 
    1539 //   \brief Searching for all reference of a field 
    1540 //   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 field 
    1543 //   \param [in] apply Flag to specify whether current field uses attributes of its father 
    1544 //               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 field 
    1571 //   On creating a new field on server side, redundant "field_ref" is still kept in the attribute list 
    1572 //   of the current field. This function removes this from current field 
    1573 //   */ 
    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 //   } 
    16061015} // namespace xios 
  • XIOS/trunk/src/node/field.hpp

    r643 r645  
    7878         CFile* getRelFile(void) const ; 
    7979 
     80         func::CFunctor::ETimeType getOperationTimeType() const; 
     81 
    8082      public : 
    8183 
    8284         StdSize getNStep(void) const; 
    8385 
    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; 
    9386         template <int N> void getData(CArray<double, N>& _data) const; 
    9487 
     
    10194         void resetNStepMax(); 
    10295 
    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 updateDataServer 
    111                (const CDate & currDate, 
    112                 const std::deque< CArray<double, 1>* > storedClient); 
    113  
    11496         std::map<int, StdSize> getGridDataSize(); 
    11597 
    11698       public : 
    11799         bool isActive(void) const; 
    118          bool active ; 
    119100         bool hasOutputFile ; 
    120          bool hasFieldOut ; 
    121101 
    122102         /// Traitements /// 
    123          void processEnabledField(void) ; 
    124  
    125103         void solveGridReference(void); 
    126          void solveOperation(void); 
     104         void solveServerOperation(void); 
    127105         void solveCheckMaskIndex(bool doSendingIndex); 
    128106         void solveAllReferenceEnabledField(bool doSending2Sever); 
    129          void buildAllExpressionEnabledField(); 
    130107         void solveGridDomainAxisRef(bool checkAtt); 
    131108         void solveTransformedGrid(); 
    132          CGrid* getGridRefOfBaseReference(); 
    133109 
    134110         void buildFilterGraph(CGarbageCollector& gc, bool enableOutput); 
     
    149125        template <int N> void setData(const CArray<double, N>& _data) ; 
    150126        static bool dispatchEvent(CEventServer& event) ; 
    151         void sendUpdateData(void) ; 
    152127        void sendUpdateData(const CArray<double,1>& data); 
    153128        static void recvUpdateData(CEventServer& event) ; 
     
    170145        void invertScaleFactorAddOffset(double scaleFactor, double addOffset); 
    171146        void parse(xml::CXMLNode & node) ; 
    172         CArray<double,1>* getInstantData(void)  ; 
    173147 
    174148        void setVirtualVariableGroup(CVariableGroup* newVVariableGroup); 
     
    191165        const std::pair<StdString, StdString>& getRefDomainAxisIds(); 
    192166 
    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); 
    199167      public : 
    200168         /// Propriétés privées /// 
     
    203171         CGrid*  grid ; 
    204172         CFile*  file; 
    205          CField* fieldOut ; 
    206  
    207          CDuration freq_operation, freq_write; 
     173 
    208174         CDuration freq_operation_srv, freq_write_srv; 
    209175 
    210176         StdSize nstep, nstepMax; 
    211177         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; 
    214179         CDate lastDataRequestedFromServer; 
    215180 
    216          boost::shared_ptr<func::CFunctor> foperation; 
    217181         map<int,boost::shared_ptr<func::CFunctor> > foperation_srv; 
    218182 
    219          CArray<double, 1> data; 
    220          CArray<double, 1> instantData; 
    221          CArray<double, 1> filteredData; 
    222          bool hasInstantData ; 
    223183         map<int, CArray<double,1>* > data_srv ; 
    224          bool isOnceOperation ; 
    225          bool isFirstOperation ; 
    226184         string content ; 
    227185 
    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 ; 
    239186         bool areAllReferenceSolved; 
    240          bool areAllExpressionBuilt; 
    241187         std::pair<StdString,StdString> domAxisIds_; 
    242188         bool isReadDataRequestPending; 
    243          std::vector<CField*> filterSources_; 
     189 
    244190         DECLARE_REF_FUNC(Field,field) 
    245191 
    246192      private: 
     193         //! The type of operation attached to the field 
     194         func::CFunctor::ETimeType operationTimeType; 
     195 
    247196         //! The output pin of the filter providing the instant data for the field 
    248197         boost::shared_ptr<COutputPin> instantDataFilter; 
  • XIOS/trunk/src/node/field_impl.hpp

    r640 r645  
    2323      ERROR("void CField::setData(const CArray<double, N>& _data)", 
    2424            << "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         else 
    57         { 
    58           (*it)->setData(_data); 
    59         } 
    60       } 
    61       if (hasOutputFile || hasFieldOut) updateData(_data); 
    62     }*/ 
    6325  } 
    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    } 
    28526 
    28627  template <int N> 
     
    29435        ERROR("void CField::getData(CArray<double, N>& _data) const", 
    29536              << "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);*/ 
    30837    } 
    30938    else 
  • XIOS/trunk/src/node/file.cpp

    r640 r645  
    572572   //---------------------------------------------------------------- 
    573573 
    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  
    591574   /*! 
    592575   \brief Resolve all reference of active fields. 
     
    607590 
    608591   /*! 
    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 be 
    611    a result of an expression among some other fields. This function builds all possible expression 
    612    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    /*! 
    624592    * Constructs the filter graph for each active field. 
    625593    * 
     
    670638 
    671639   //---------------------------------------------------------------- 
    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    } 
    692640 
    693641   /*! 
  • XIOS/trunk/src/node/file.hpp

    r640 r645  
    103103         // Some processing on file 
    104104         void solveFieldRefInheritance(bool apply); 
    105          void solveEFGridRef(void); 
    106          void solveEFOperation(void); 
    107          void solveEFExpression(void); 
    108105         void processEnabledFile(void) ; 
    109          void processEnabledFields(void) ; 
    110106         void solveAllRefOfEnabledFields(bool sendToServer); 
    111          void buildAllExpressionOfEnabledFields(); 
    112107         void buildFilterGraphOfEnabledFields(CGarbageCollector& gc); 
    113108         void prefetchEnabledReadModeFields(); 
  • XIOS/trunk/src/output/nc4_data_output.cpp

    r633 r645  
    827827         } 
    828828 
    829          bool wtime   = !(!field->operation.isEmpty() && field->foperation->timeType() == func::CFunctor::once); 
     829         bool wtime   = !(!field->operation.isEmpty() && field->getOperationTimeType() == func::CFunctor::once); 
    830830 
    831831         if (wtime) 
     
    836836           //     << "_" << field->getRelFile()->output_freq.getValue(); 
    837837          //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")); 
    840840            dims.push_back(timeid); 
    841841         } 
     
    11361136         StdOStringStream oss; 
    11371137         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" ; 
    11401140 
    11411141         StdString timeBoundId("time_counter_bounds"); 
    11421142 
    11431143         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" ; 
    11461146 
    11471147         CArray<double,1> time_data(1) ; 
     
    11501150         CArray<double,1> time_data_bound(2); 
    11511151 
    1152         bool wtime   = !(!field->operation.isEmpty() && (field->foperation->timeType() == func::CFunctor::once)); 
     1152        bool wtime   = !(!field->operation.isEmpty() && (field->getOperationTimeType() == func::CFunctor::once)); 
    11531153 
    11541154        if (wtime) 
    11551155        { 
    11561156          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) 
    11581158            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); 
    11601160 
    11611161          time_counter_bound(0) = Time(*field->lastlast_Write_srv); 
    11621162          time_counter_bound(1) = Time(*field->last_Write_srv); 
    1163           if (field->foperation->timeType() == func::CFunctor::instant) 
     1163          if (field->getOperationTimeType() == func::CFunctor::instant) 
    11641164            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) 
    11661166          { 
    11671167            time_data_bound(0) = time_counter_bound(0); 
     
    12531253         StdOStringStream oss; 
    12541254 
    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 ; 
    12571256 
    12581257//         oss << "time_" << field->operation.getValue() 
     
    12601259 
    12611260//         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" ; 
    12641263 
    12651264         StdString axisid("time_centered") ; 
     
    12681267         StdString timeBoundId("axis_nbounds"); 
    12691268 
    1270          if (field->foperation->timeType() == func::CFunctor::instant) 
     1269         if (field->getOperationTimeType() == func::CFunctor::instant) 
    12711270         { 
    12721271            axisid = "time_instant"; 
Note: See TracChangeset for help on using the changeset viewer.