Ignore:
Timestamp:
12/06/17 08:34:31 (6 years ago)
Author:
rlacroix
Message:

Add some extra checks when switching to the next timestep.

File:
1 edited

Legend:

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

    r1318 r1357  
    12021202   void CContext::updateCalendar(int step) 
    12031203   { 
    1204       info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 
    1205       calendar->update(step); 
    1206       info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; 
    1207 #ifdef XIOS_MEMTRACK_LIGHT 
    1208       info(50) << " Current memory used by XIOS : "<<  MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<<step<<" of context "<<this->getId()<<endl ; 
    1209 #endif 
    1210       if (hasClient) 
     1204      int prevStep = calendar->getStep(); 
     1205 
     1206      if (prevStep < step) 
    12111207      { 
    1212         doPostTimestepOperationsForEnabledReadModeFiles(); 
    1213         garbageCollector.invalidate(calendar->getCurrentDate()); 
     1208        info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 
     1209        calendar->update(step); 
     1210        info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; 
     1211  #ifdef XIOS_MEMTRACK_LIGHT 
     1212        info(50) << " Current memory used by XIOS : "<<  MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<<step<<" of context "<<this->getId()<<endl ; 
     1213  #endif 
     1214 
     1215        if (hasClient) 
     1216        { 
     1217          doPostTimestepOperationsForEnabledReadModeFiles(); 
     1218          garbageCollector.invalidate(calendar->getCurrentDate()); 
     1219        } 
    12141220      } 
     1221      else if (prevStep == step) 
     1222        info(50) << "updateCalendar: already at step " << step << ", no operation done." << endl; 
     1223      else // if (prevStep > step) 
     1224        ERROR("void CContext::updateCalendar(int step)", 
     1225              << "Illegal calendar update: previous step was " << prevStep << ", new step " << step << "is in the past!") 
    12151226   } 
    12161227 
Note: See TracChangeset for help on using the changeset viewer.