Changeset 1460 for XIOS/dev/branch_openmp/src/filter/temporal_filter.cpp
- Timestamp:
- 03/22/18 10:43:20 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/src/filter/temporal_filter.cpp
r1328 r1460 5 5 namespace xios 6 6 { 7 static func::CFunctor* createFunctor(const std::string& opId, bool ignoreMissingValue, double missingValue,CArray<double, 1>& tmpData);7 static func::CFunctor* createFunctor(const std::string& opId, bool ignoreMissingValue, CArray<double, 1>& tmpData); 8 8 9 9 CTemporalFilter::CTemporalFilter(CGarbageCollector& gc, const std::string& opId, 10 10 const CDate& initDate, const CDuration samplingFreq, const CDuration samplingOffset, const CDuration opFreq, 11 bool ignoreMissingValue /*= false*/ , double missingValue /*= 0.0*/)11 bool ignoreMissingValue /*= false*/) 12 12 : CFilter(gc, 1, this) 13 , functor(createFunctor(opId, ignoreMissingValue, missingValue,tmpData))13 , functor(createFunctor(opId, ignoreMissingValue, tmpData)) 14 14 , isOnceOperation(functor->timeType() == func::CFunctor::once) 15 15 , isInstantOperation(functor->timeType() == func::CFunctor::instant) … … 17 17 , samplingOffset(samplingOffset) 18 18 , opFreq(opFreq) 19 , nextSamplingDate(initDate + this->samplingOffset + initDate.getRelCalendar().getTimeStep()) 20 , nextOperationDate(initDate + this->samplingOffset + opFreq) 19 , offsetMonth({0, this->samplingOffset.month, 0, 0, 0, 0, 0}) 20 , offsetAllButMonth({this->samplingOffset.year, 0 , this->samplingOffset.day, 21 this->samplingOffset.hour, this->samplingOffset.minute, 22 this->samplingOffset.second, this->samplingOffset.timestep}) 23 , initDate(initDate) 24 , nextSamplingDate(initDate + (this->samplingOffset + initDate.getRelCalendar().getTimeStep())) 25 , nbOperationDates(1) 26 // , nextOperationDate(initDate + opFreq + this->samplingOffset) 21 27 , isFirstOperation(true) 22 28 { … … 35 41 { 36 42 usePacket = (data[0]->date >= nextSamplingDate); 37 outputResult = (data[0]->date + samplingFreq > nextOperationDate); 43 // outputResult = (data[0]->date + samplingFreq > nextOperationDate); 44 outputResult = (data[0]->date > initDate + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth); 38 45 copyLess = (isInstantOperation && usePacket && outputResult); 39 46 } … … 54 61 if (outputResult) 55 62 { 63 nbOperationDates ++; 56 64 if (!copyLess) 57 65 { … … 69 77 70 78 isFirstOperation = false; 71 nextOperationDate = nextOperationDate + samplingFreq + opFreq - samplingFreq;79 // nextOperationDate = initDate + samplingFreq + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth; 72 80 } 73 81 } … … 76 84 } 77 85 86 bool CTemporalFilter::mustAutoTrigger() const 87 { 88 return true; 89 } 90 78 91 bool CTemporalFilter::isDataExpected(const CDate& date) const 79 92 { 80 return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date + samplingFreq > nextOperationDate); 93 // return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date + samplingFreq > nextOperationDate); 94 return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date > initDate + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth); 81 95 } 82 96 83 static func::CFunctor* createFunctor(const std::string& opId, bool ignoreMissingValue, double missingValue,CArray<double, 1>& tmpData)97 static func::CFunctor* createFunctor(const std::string& opId, bool ignoreMissingValue, CArray<double, 1>& tmpData) 84 98 { 85 99 func::CFunctor* functor = NULL; 86 100 87 double defaultValue = ignoreMissingValue ? std::numeric_limits<double>::quiet_NaN() : missingValue;101 double defaultValue = std::numeric_limits<double>::quiet_NaN(); 88 102 89 103 #define DECLARE_FUNCTOR(MType, mtype) \
Note: See TracChangeset
for help on using the changeset viewer.