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/dev/XIOS_DEV_CMIP6/src/node/context.cpp

    r1349 r1357  
    18331833   void CContext::updateCalendar(int step) 
    18341834   { 
    1835       info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 
    1836       calendar->update(step); 
    1837       info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; 
    1838 #ifdef XIOS_MEMTRACK_LIGHT 
    1839       info(50) << " Current memory used by XIOS : "<<  MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<<step<<" of context "<<this->getId()<<endl ; 
    1840 #endif 
    1841       //if (hasClient)  
    1842       if (hasClient && !hasServer) // For now we only use server level 1 to read data 
     1835      int prevStep = calendar->getStep(); 
     1836 
     1837      if (prevStep < step) 
    18431838      { 
    1844         doPostTimestepOperationsForEnabledReadModeFiles(); 
    1845         garbageCollector.invalidate(calendar->getCurrentDate()); 
     1839        info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 
     1840        calendar->update(step); 
     1841        info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; 
     1842  #ifdef XIOS_MEMTRACK_LIGHT 
     1843        info(50) << " Current memory used by XIOS : "<<  MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<<step<<" of context "<<this->getId()<<endl ; 
     1844  #endif 
     1845 
     1846        if (hasClient && !hasServer) // For now we only use server level 1 to read data 
     1847        { 
     1848          doPostTimestepOperationsForEnabledReadModeFiles(); 
     1849          garbageCollector.invalidate(calendar->getCurrentDate()); 
     1850        } 
    18461851      } 
     1852      else if (prevStep == step) 
     1853        info(50) << "updateCalendar: already at step " << step << ", no operation done." << endl; 
     1854      else // if (prevStep > step) 
     1855        ERROR("void CContext::updateCalendar(int step)", 
     1856              << "Illegal calendar update: previous step was " << prevStep << ", new step " << step << "is in the past!") 
    18471857   } 
    18481858 
Note: See TracChangeset for help on using the changeset viewer.