Changeset 1123


Ignore:
Timestamp:
05/05/17 08:58:36 (4 years ago)
Author:
rlacroix
Message:

Instant filter: Optimize the sampling when it is easy to do so.

This way the "xios_field_is_active" function can provide more useful information for the current timestamp even if the user did not specify "freq_op" and "freq_offset".

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

Legend:

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

    r1122 r1123  
    1212    : CFilter(gc, 1, this) 
    1313    , functor(createFunctor(opId, ignoreMissingValue, missingValue, tmpData)) 
    14     , samplingFreq(samplingFreq) 
     14    // If we can optimize the sampling when dealing with an instant functor we do it 
     15    , samplingFreq((functor->timeType() == func::CFunctor::instant && samplingFreq == TimeStep && samplingOffset == NoneDu) ? opFreq : samplingFreq) 
     16    , samplingOffset((functor->timeType() == func::CFunctor::instant && samplingFreq == TimeStep && samplingOffset == NoneDu) ? opFreq - initDate.getRelCalendar().getTimeStep() : samplingOffset) 
    1517    , opFreq(opFreq) 
    16     , nextSamplingDate(initDate + samplingOffset + initDate.getRelCalendar().getTimeStep()) 
    17     , nextOperationDate(initDate + samplingOffset + opFreq) 
     18    , nextSamplingDate(initDate + this->samplingOffset + initDate.getRelCalendar().getTimeStep()) 
     19    , nextOperationDate(initDate + this->samplingOffset + opFreq) 
    1820    , isFirstOperation(true) 
    1921    , isOnceOperation(functor->timeType() == func::CFunctor::once) 
  • XIOS/trunk/src/filter/temporal_filter.hpp

    r1122 r1123  
    5151      CArray<double, 1> tmpData; //!< The array of data used for temporary storage 
    5252      const CDuration samplingFreq; //!< The sampling frequency, i.e. the frequency at which the input data will be used 
     53      const CDuration samplingOffset; //!< The sampling offset, i.e. the offset after which the input data will be used 
    5354      const CDuration opFreq; //!< The operation frequency, i.e. the frequency at which the output data will be computed 
    5455      CDate nextSamplingDate; //!< The date of the next sampling 
Note: See TracChangeset for help on using the changeset viewer.