Ignore:
Timestamp:
07/17/15 13:58:13 (9 years ago)
Author:
rlacroix
Message:

Use the filter infrastructure to handle the temporal operations.

Add a temporal filter to do so.

File:
1 edited

Legend:

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

    r642 r643  
    2121#include "filter_expr_node.hpp" 
    2222#include "lex_parser.hpp" 
     23#include "temporal_filter.hpp" 
    2324 
    2425namespace xios{ 
     
    810811       { 
    811812         fileWriterFilter = boost::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 
    812          instantDataFilter->connectOutput(fileWriterFilter, 0); 
     813         getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 
    813814       } 
    814815     } 
     
    834835 
    835836     return clientSourceFilter; 
     837   } 
     838 
     839   /*! 
     840    * Returns the temporal filter corresponding to the field's temporal operation 
     841    * for the specified operation frequency. The filter is created if it does not 
     842    * exist, otherwise it is reused. 
     843    * 
     844    * \param gc the garbage collector to use 
     845    * \param outFreq the operation frequency, i.e. the frequency at which the output data will be computed 
     846    * \return the output pin corresponding to the requested temporal filter 
     847    */ 
     848   boost::shared_ptr<COutputPin> CField::getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq) 
     849   { 
     850     std::map<CDuration, boost::shared_ptr<COutputPin> >::iterator it = temporalDataFilters.find(outFreq); 
     851 
     852     if (it == temporalDataFilters.end()) 
     853     { 
     854       if (operation.isEmpty()) 
     855         ERROR("void CField::getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq)", 
     856               << "An operation must be defined for field \"" << getId() << "\"."); 
     857 
     858       if (freq_op.isEmpty()) 
     859         freq_op.setValue(TimeStep); 
     860       if (freq_offset.isEmpty()) 
     861         freq_offset.setValue(NoneDu); 
     862 
     863       const bool ignoreMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     864 
     865       boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 
     866                                                                             CContext::getCurrent()->getCalendar()->getInitDate(), 
     867                                                                             freq_op, freq_offset, outFreq, 
     868                                                                             ignoreMissingValue, ignoreMissingValue ? default_value : 0.0)); 
     869       instantDataFilter->connectOutput(temporalFilter, 0); 
     870 
     871       it = temporalDataFilters.insert(std::make_pair(outFreq, temporalFilter)).first; 
     872     } 
     873 
     874     return it->second; 
    836875   } 
    837876 
Note: See TracChangeset for help on using the changeset viewer.