Ignore:
Timestamp:
12/11/14 16:07:42 (9 years ago)
Author:
rlacroix
Message:

Convert more attributes to use the new duration type:

  • field: freq_op and freq_offset
  • file: output_freq, sync_freq and split_freq.

Remember that you now have to use the "xios_duration" type instead of strings to get/set those attributes through the Fortran interface.

File:
1 edited

Legend:

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

    r528 r538  
    189189     CContext* context = CContext::getCurrent() ; 
    190190     CDate& currentDate=context->calendar->getCurrentDate() ; 
    191      if (! sync_freq.isEmpty()) 
     191     if (!sync_freq.isEmpty()) 
    192192     { 
    193        if (*lastSync+syncFreq < currentDate) 
     193       if (*lastSync + sync_freq.getValue() < currentDate) 
    194194       { 
    195195         *lastSync=currentDate ; 
     
    207207      CContextServer* server=context->server ; 
    208208 
    209       if (! sync_freq.isEmpty()) syncFreq = CDuration::FromString(sync_freq.getValue()); 
    210       if (! split_freq.isEmpty()) splitFreq = CDuration::FromString(split_freq.getValue()); 
    211       if (! output_freq.isEmpty()) outputFreq = CDuration::FromString(output_freq.getValue()); 
    212209      lastSync=new CDate(currentDate) ; 
    213210      lastSplit=new CDate(currentDate) ; 
     
    253250     CContext* context = CContext::getCurrent() ; 
    254251     CDate& currentDate=context->calendar->getCurrentDate() ; 
    255      if (! sync_freq.isEmpty()) 
     252     if (!sync_freq.isEmpty()) 
    256253     { 
    257        if (*lastSync+syncFreq <= currentDate) 
     254       if (*lastSync + sync_freq.getValue() <= currentDate) 
    258255       { 
    259256         *lastSync=currentDate ; 
     
    275272      CContext* context = CContext::getCurrent() ; 
    276273      CDate& currentDate=context->calendar->getCurrentDate() ; 
    277       if (! split_freq.isEmpty()) 
     274      if (!split_freq.isEmpty()) 
    278275      { 
    279         if (currentDate > *lastSplit+splitFreq) 
     276        if (currentDate > *lastSplit + split_freq.getValue()) 
    280277        { 
    281           *lastSplit=*lastSplit+splitFreq ; 
     278          *lastSplit = *lastSplit + split_freq.getValue(); 
    282279          std::vector<CField*>::iterator it, end = this->enabledFields.end(); 
    283280          for (it = this->enabledFields.begin() ;it != end; it++)  (*it)->resetNStep() ; 
     
    304301         oss << filename; 
    305302         if (!name_suffix.isEmpty()) oss << name_suffix.getValue(); 
    306 //         if (!split_freq.isEmpty()) oss<<"_"<<lastSplit->getStryyyymmdd()<<"-"<< (*lastSplit+(splitFreq-1*Second)).getStryyyymmdd(); 
    307 //         if (!split_freq.isEmpty()) oss<<"_"<<lastSplit->getStr("%y_%mo_%d")<<"-"<< (*lastSplit+(splitFreq-1*Second)).getStr("%y_%mo_%d"); 
     303 
    308304         if (!split_freq.isEmpty()) 
    309305         { 
     
    311307           if (split_freq_format.isEmpty()) 
    312308           { 
    313              if (splitFreq.second!=0) splitFormat="%y%mo%d%h%mi%s"; 
    314              else if (splitFreq.minute!=0) splitFormat="%y%mo%d%h%mi"; 
    315              else if (splitFreq.hour!=0) splitFormat="%y%mo%d%h"; 
    316              else if (splitFreq.day!=0) splitFormat="%y%mo%d"; 
    317              else if (splitFreq.month!=0) splitFormat="%y%mo"; 
    318              else splitFormat="%y"; 
     309             if (split_freq.getValue().second != 0) splitFormat = "%y%mo%d%h%mi%s"; 
     310             else if (split_freq.getValue().minute != 0) splitFormat = "%y%mo%d%h%mi"; 
     311             else if (split_freq.getValue().hour != 0) splitFormat = "%y%mo%d%h"; 
     312             else if (split_freq.getValue().day != 0) splitFormat = "%y%mo%d"; 
     313             else if (split_freq.getValue().month != 0) splitFormat = "%y%mo"; 
     314             else splitFormat = "%y"; 
    319315           } 
    320316           else splitFormat=split_freq_format ; 
    321            oss<<"_"<<lastSplit->getStr(splitFormat)<<"-"<< (*lastSplit+(splitFreq-1*Second)).getStr(splitFormat); 
     317           oss << "_" << lastSplit->getStr(splitFormat) 
     318               << "-" << (*lastSplit + (split_freq.getValue() - 1 * Second)).getStr(splitFormat); 
    322319         } 
    323320 
Note: See TracChangeset for help on using the changeset viewer.