Changeset 702


Ignore:
Timestamp:
09/22/15 10:09:54 (9 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/trunk/src/node/file.cpp

    r692 r702  
    220220      lastSync  = currentDate; 
    221221      lastSplit = currentDate; 
     222      if (!split_freq.isEmpty()) 
     223      { 
     224        if (context->registryIn->foundKey("splitStart") && context->registryIn->foundKey("splitEnd")) 
     225        { 
     226          CDate savedSplitStart(*context->getCalendar()), savedSplitEnd(*context->getCalendar()); 
     227          context->registryIn->getKey("splitStart", savedSplitStart); 
     228          context->registryIn->getKey("splitEnd",   savedSplitEnd); 
     229 
     230          if (savedSplitStart <= lastSplit && lastSplit <= savedSplitEnd) 
     231            lastSplit = savedSplitStart; 
     232        } 
     233      } 
    222234      isOpen = false; 
    223235 
     
    336348         if (!split_freq.isEmpty()) 
    337349         { 
     350           CDate splitEnd = lastSplit + split_freq - 1 * Second; 
     351 
    338352           string splitFormat; 
    339353           if (split_freq_format.isEmpty()) 
     
    347361           } 
    348362           else splitFormat = split_freq_format; 
    349            oss << "_" << lastSplit.getStr(splitFormat) 
    350                << "-" << (lastSplit + split_freq.getValue() - 1 * Second).getStr(splitFormat); 
     363 
     364           oss << "_" << lastSplit.getStr(splitFormat) << "-" << splitEnd.getStr(splitFormat); 
     365 
     366           context->registryOut->setKey("splitStart", lastSplit); 
     367           context->registryOut->setKey("splitEnd",   splitEnd); 
    351368         } 
    352369 
Note: See TracChangeset for help on using the changeset viewer.