Changeset 436


Ignore:
Timestamp:
06/06/13 17:31:28 (6 years ago)
Author:
ymipsl
Message:

bug fix :

  • freq_op is now by default of 1 timestep (1ts)
  • once operation is now working as required

YM

Location:
XIOS/trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/duration.cpp

    r424 r436  
    3434         if(duration.hour   != 0.0) { testValue = false; sout << duration.hour   << "h " ; } 
    3535         if(duration.minute != 0.0) { testValue = false; sout << duration.minute << "mi "; } 
    36          if(duration.second != 0.0 || testValue)       { sout << duration.second << "s " ; } 
     36         if(duration.second != 0.0) { testValue = false; sout << duration.second << "s " ; } 
    3737         if(duration.timestep != 0.0 || testValue)       { sout << duration.timestep << "ts " ; } 
    3838 
     
    106106 
    107107      //----------------------------------------------------------------- 
    108  
     108      CDuration & CDuration::solveTimeStep(const CCalendar & c) 
     109      { 
     110        CDuration timeStep=c.getTimeStep() ; 
     111        second +=timeStep.second ;  
     112        minute +=timeStep.minute ;  
     113        hour +=timeStep.hour ;  
     114        day +=timeStep.day ;  
     115        month +=timeStep.month ;  
     116        year +=timeStep.year ;  
     117        timestep = 0 ; 
     118        return (*this); 
     119      } 
     120                
     121         
    109122      CDuration & CDuration::resolve(const CCalendar & c) 
    110123      { 
  • XIOS/trunk/src/duration.hpp

    r424 r436  
    2828            /// Traitement /// 
    2929            struct _duration & resolve(const CCalendar & calendar); 
    30  
     30            struct _duration & solveTimeStep(const CCalendar & c) ; 
    3131            /// Autres /// 
    3232            StdString toString(void) const; 
  • XIOS/trunk/src/node/field.cpp

    r421 r436  
    362362      StdString id = this->getBaseFieldReference()->getId(); 
    363363      CContext* context = CContext::getCurrent(); 
    364  
    365       if (operation.isEmpty() || freq_op.isEmpty() || this->file->output_freq.isEmpty()) 
     364       
     365      if (freq_op.isEmpty()) freq_op=string("1ts") ; 
     366       
     367      if (operation.isEmpty()  || this->file->output_freq.isEmpty()) 
    366368      { 
    367369         ERROR("CField::solveOperation(void)", 
     
    411413         const CDuration toffset = this->freq_operation - freq_offset_ - context->getCalendar()->getTimeStep();  
    412414         *this->last_operation   = *this->last_operation - toffset;   
    413            
     415       
     416        if (operation.get()=="once") isOnceOperation=true ; 
     417        else isOnceOperation=false; 
     418        isFirstOperation=true; 
     419       
     420        cout<<"Operation : "<<operation<<" isOnce "<<isOnceOperation<<endl;           
    414421#define DECLARE_FUNCTOR(MType, mtype)              \ 
    415422   if  (operation.getValue().compare(#mtype) == 0) \ 
     
    427434               << "The operation is not defined !"); 
    428435      } 
     436       
     437 
    429438   } 
    430439    
  • XIOS/trunk/src/node/field.hpp

    r369 r436  
    149149         CArray<double, 1> data; 
    150150         map<int, CArray<double,1>* > data_srv ; 
     151         bool isOnceOperation ; 
     152         bool isFirstOperation ; 
    151153 
    152154   }; // class CField 
  • XIOS/trunk/src/node/field_impl.hpp

    r369 r436  
    2828      const CDate & currDate = context->getCalendar()->getCurrentDate(); 
    2929      const CDate opeDate      = *last_operation + freq_operation; 
    30       const CDate writeDate    = *last_Write     + freq_write;        
     30      const CDate writeDate    = *last_Write     + freq_write; 
     31      bool doOperation, doWrite;  
     32          
    3133 
    3234    
    3335      info(50) << "CField::updateData " << currDate <<  " : send data to " << this->getBaseFieldId() << std::endl; 
    3436      info(50) << "Next operation "  << opeDate<<std::endl; 
    35  
    36       if (opeDate <= currDate) 
     37       
     38      doOperation = (opeDate <= currDate) ; 
     39      if (isOnceOperation) 
     40        if (isFirstOperation) doOperation=true ; 
     41        else doOperation=false ; 
     42       
     43      if (doOperation) 
    3744      { 
    3845         if (this->data.numElements() != this->grid->storeIndex_client.numElements()) 
     
    4956      } 
    5057       
    51       if (writeDate < (currDate + freq_operation)) 
     58       
     59      doWrite = (writeDate < (currDate + freq_operation)) ; 
     60      if (isOnceOperation) 
     61      {  
     62        if(isFirstOperation)  
     63        { 
     64          doWrite=true ; 
     65          isFirstOperation=false ; 
     66        } 
     67        else doWrite=false ; 
     68      } 
     69       
     70      if (doWrite) 
    5271      { 
    5372         this->foperation->final(); 
Note: See TracChangeset for help on using the changeset viewer.