Changeset 800 for XIOS/branchs


Ignore:
Timestamp:
11/27/15 09:55:06 (5 years ago)
Author:
rlacroix
Message:

Allow restarting a simulation in append mode with file splitting enabled.

Make use of the new registry to save the start and end dates of the last output file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/branchs/xios-1.0/src/node/file.cpp

    r798 r800  
    180180      lastSync=new CDate(currentDate) ; 
    181181      lastSplit=new CDate(currentDate) ; 
     182      if (!split_freq.isEmpty()) 
     183      { 
     184        if (context->registryIn->foundKey("splitStart") && context->registryIn->foundKey("splitEnd")) 
     185        { 
     186          string savedSplitStartStr, savedSplitEndStr; 
     187          context->registryIn->getKey("splitStart", savedSplitStartStr); 
     188          context->registryIn->getKey("splitEnd",   savedSplitEndStr); 
     189 
     190          CDate savedSplitStart = CDate::FromString(savedSplitStartStr, *context->getCalendar()); 
     191          CDate savedSplitEnd = CDate::FromString(savedSplitEndStr, *context->getCalendar()); 
     192          if (savedSplitStart <= *lastSplit && *lastSplit <= savedSplitEnd) 
     193            *lastSplit = savedSplitStart; 
     194        } 
     195      } 
    182196      isOpen=false ; 
    183197 
     
    263277         if (!split_freq.isEmpty()) 
    264278         { 
     279           CDate splitEnd = *lastSplit + splitFreq - 1 * Second; 
     280 
    265281           string splitFormat ; 
    266282           if (split_freq_format.isEmpty()) 
     
    274290           } 
    275291           else splitFormat=split_freq_format ; 
    276            oss<<"_"<<lastSplit->getStr(splitFormat)<<"-"<< (*lastSplit + splitFreq - 1 * Second).getStr(splitFormat); 
     292           oss<<"_"<<lastSplit->getStr(splitFormat)<<"-"<< splitEnd.getStr(splitFormat); 
     293 
     294           string lastSplitStr = lastSplit->toString(), splitEndStr = splitEnd.toString(); 
     295           context->registryOut->setKey("splitStart", lastSplitStr); 
     296           context->registryOut->setKey("splitEnd",   splitEndStr); 
    277297         } 
    278298            
Note: See TracChangeset for help on using the changeset viewer.