Changeset 1119 for XIOS/trunk/src/filter


Ignore:
Timestamp:
05/05/17 08:58:33 (7 years ago)
Author:
rlacroix
Message:

Add the ability to check if an output field is active at the current timestep.

The "xios_field_is_active" function can now take an optional logical argument that can be used to enable this new behavior.

Location:
XIOS/trunk/src/filter
Files:
11 edited

Legend:

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

    r1018 r1119  
    3333    field->sendUpdateData(data[0]->data); 
    3434  } 
     35 
     36  bool CFileWriterFilter::isDataExpected(const CDate& date) const 
     37  { 
     38    return true; 
     39  } 
    3540} // namespace xios 
  • XIOS/trunk/src/filter/file_writer_filter.hpp

    r639 r1119  
    2323      CFileWriterFilter(CGarbageCollector& gc, CField* field); 
    2424 
     25      /*! 
     26       * Tests whether data is expected for the specified date. 
     27       * 
     28       * \param date the date associated to the data 
     29       */ 
     30      bool virtual isDataExpected(const CDate& date) const; 
     31 
    2532    protected: 
    2633      /*! 
  • XIOS/trunk/src/filter/filter.cpp

    r1006 r1119  
    4040    return (CInputPin::canBeTriggered() || COutputPin::canBeTriggered()); 
    4141  } 
     42 
     43  bool CFilter::isDataExpected(const CDate& date) const 
     44  { 
     45    return COutputPin::isDataExpected(date); 
     46  } 
    4247} // namespace xios 
  • XIOS/trunk/src/filter/filter.hpp

    r1006 r1119  
    4848      bool virtual canBeTriggered() const; 
    4949 
     50      /*! 
     51       * Tests whether data is expected for the specified date. 
     52       * 
     53       * \param date the date associated to the data 
     54       */ 
     55      bool virtual isDataExpected(const CDate& date) const; 
     56 
    5057    protected: 
    5158      IFilterEngine* engine; //!< The filter engine, might be the filter itself 
  • XIOS/trunk/src/filter/input_pin.hpp

    r1006 r1119  
    6060 
    6161      /*! 
     62       * Tests whether data is expected for the specified date. 
     63       * 
     64       * \param date the date associated to the data 
     65       */ 
     66      bool virtual isDataExpected(const CDate& date) const = 0; 
     67 
     68      /*! 
    6269       * Removes all pending packets which are older than the specified timestamp. 
    6370       * 
  • XIOS/trunk/src/filter/output_pin.cpp

    r1006 r1119  
    7373  } 
    7474 
     75  bool COutputPin::isDataExpected(const CDate& date) const 
     76  { 
     77    std::vector<std::pair<boost::shared_ptr<CInputPin>, size_t> >::const_iterator it, itEnd; 
     78    for (it = outputs.begin(), itEnd = outputs.end(); it != itEnd; ++it) 
     79    { 
     80      if (it->first->isDataExpected(date)) 
     81        return true; 
     82    } 
     83 
     84    return false; 
     85  } 
     86 
    7587  void COutputPin::invalidate(Time timestamp) 
    7688  { 
  • XIOS/trunk/src/filter/output_pin.hpp

    r1006 r1119  
    4646 
    4747      /*! 
     48       * Tests whether data is expected for the specified date. 
     49       * 
     50       * \param date the date associated to the data 
     51       */ 
     52      bool virtual isDataExpected(const CDate& date) const; 
     53 
     54      /*! 
    4855       * Removes all pending packets which are older than the specified timestamp. 
    4956       * 
  • XIOS/trunk/src/filter/store_filter.cpp

    r1029 r1119  
    8181  } 
    8282 
     83  bool CStoreFilter::isDataExpected(const CDate& date) const 
     84  { 
     85    return true; 
     86  } 
     87 
    8388  void CStoreFilter::invalidate(Time timestamp) 
    8489  { 
  • XIOS/trunk/src/filter/store_filter.hpp

    r1006 r1119  
    5050 
    5151      /*! 
     52       * Tests whether data is expected for the specified date. 
     53       * 
     54       * \param date the date associated to the data 
     55       */ 
     56      bool virtual isDataExpected(const CDate& date) const; 
     57 
     58      /*! 
    5259       * Removes all pending packets which are older than the specified timestamp. 
    5360       * 
  • XIOS/trunk/src/filter/temporal_filter.cpp

    r1018 r1119  
    7575    return packet; 
    7676  } 
     77 
     78  bool CTemporalFilter::isDataExpected(const CDate& date) const 
     79  { 
     80    return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date + samplingFreq > nextOperationDate); 
     81  } 
    7782} // namespace xios 
  • XIOS/trunk/src/filter/temporal_filter.hpp

    r643 r1119  
    4040      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    4141 
     42      /*! 
     43       * Tests whether data is expected for the specified date. 
     44       * 
     45       * \param date the date associated to the data 
     46       */ 
     47      bool virtual isDataExpected(const CDate& date) const; 
     48 
    4249    private: 
    4350      boost::scoped_ptr<func::CFunctor> functor; //!< The functor corresponding to the temporal operation 
Note: See TracChangeset for help on using the changeset viewer.