Changeset 756


Ignore:
Timestamp:
10/23/15 10:49:19 (5 years ago)
Author:
rlacroix
Message:

Support freq_offset for fields in files in read mode.

In theory the first record of a file being read is available at timestep 0, this allows to delay the availability of the data to a later timestep.

Use a temporary solution for now until this can be properly integrated in a temporal filter.

Location:
XIOS/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/filter/source_filter.cpp

    r650 r756  
    22#include "grid.hpp" 
    33#include "exception.hpp" 
     4#include "calendar_util.hpp" 
    45 
    56namespace xios 
    67{ 
    7   CSourceFilter::CSourceFilter(CGrid* grid) 
     8  CSourceFilter::CSourceFilter(CGrid* grid, const CDuration offset /*= NoneDu*/) 
    89    : grid(grid) 
     10    , offset(offset) 
    911  { 
    1012    if (!grid) 
     
    1618  void CSourceFilter::streamData(CDate date, const CArray<double, N>& data) 
    1719  { 
     20    date = date + offset; // this is a temporary solution, it should be part of a proper temporal filter 
     21 
    1822    CDataPacketPtr packet(new CDataPacket); 
    1923    packet->date = date; 
     
    3337  void CSourceFilter::streamDataFromServer(CDate date, const std::map<int, CArray<double, 1> >& data) 
    3438  { 
     39    date = date + offset; // this is a temporary solution, it should be part of a proper temporal filter 
     40 
    3541    CDataPacketPtr packet(new CDataPacket); 
    3642    packet->date = date; 
  • XIOS/trunk/src/filter/source_filter.hpp

    r643 r756  
    2020       * 
    2121       * \param grid the grid to which the data is attached 
     22       * \param offset the offset applied to the timestamp of all packets 
    2223       */ 
    23       CSourceFilter(CGrid* grid); 
     24      CSourceFilter(CGrid* grid, const CDuration offset = NoneDu); 
    2425 
    2526      /*! 
     
    5354    private: 
    5455      CGrid* grid; //!< The grid attached to the data the filter can accept 
     56      const CDuration offset; //!< The offset applied to the timestamp of all packets 
    5557  }; // class CSourceFilter 
    5658} // namespace xios 
  • XIOS/trunk/src/node/field.cpp

    r746 r756  
    611611       // Check if the data is to be read from a file 
    612612       else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) 
    613          instantDataFilter = serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(grid)); 
     613         instantDataFilter = serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(grid, 
     614                                                                                                     freq_offset.isEmpty() ? NoneDu : freq_offset)); 
    614615       else // The data might be passed from the model 
    615616         instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(grid)); 
Note: See TracChangeset for help on using the changeset viewer.