Changeset 1704 for XIOS/trunk/src/filter/temporal_filter.cpp
- Timestamp:
- 09/11/19 10:22:09 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/filter/temporal_filter.cpp
r1523 r1704 2 2 #include "functor_type.hpp" 3 3 #include "calendar_util.hpp" 4 #include "workflow_graph.hpp" 5 #include "file.hpp" 4 6 5 7 namespace xios … … 22 24 this->samplingOffset.second, this->samplingOffset.timestep) 23 25 , initDate(initDate) 24 // , nextSamplingDate(initDate + (this->samplingOffset + initDate.getRelCalendar().getTimeStep()))25 26 , nextSamplingDate(initDate + offsetMonth + ( offsetAllButMonth + initDate.getRelCalendar().getTimeStep())) 26 27 , nbOperationDates(1) … … 28 29 // , nextOperationDate(initDate + opFreq + this->samplingOffset) 29 30 , isFirstOperation(true) 31 , temp_op(opId) 30 32 { 31 33 } 32 34 35 36 37 38 39 bool CTemporalFilter::buildGraph(std::vector<CDataPacketPtr> data) 40 { 41 bool building_graph=this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 42 43 if(building_graph) 44 { 45 if(this->filterIDoutputs.size()==0) this->filterID = InvalidableObject::filterIdGenerator++; 46 int edgeID = InvalidableObject::edgeIdGenerator++; 47 48 // std::cout<<"CTemporalFilter::apply filter tag = "<<this->tag<<" start = "<<this->start_graph<<" end = "<<this->end_graph<<std::endl; 49 50 CWorkflowGraph::allocNodeEdge(); 51 52 if(this->filterIDoutputs.size()==0) 53 { 54 CWorkflowGraph::addNode(this->filterID, "Temporal Filter\\n("+this->temp_op+")", 5, 1, 0, data[0]); 55 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].transform_type = this->temp_op; 56 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].inputs_complete = false ; 57 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].clusterID = 1 ; 58 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = (data[0]->distance); 59 60 61 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 62 if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 63 } 64 65 if(CWorkflowGraph::build_begin) 66 { 67 68 CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 69 70 (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 71 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb += 1 ; 72 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = max(data[0]->distance+1, (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance); 73 } 74 75 76 this->filterIDoutputs.push_back(data[0]->src_filterID); 77 } 78 79 return building_graph; 80 } 81 82 33 83 CDataPacketPtr CTemporalFilter::apply(std::vector<CDataPacketPtr> data) 34 84 { 85 bool BG = buildGraph(data); 86 35 87 CDataPacketPtr packet; 36 88 … … 43 95 { 44 96 usePacket = (data[0]->date >= nextSamplingDate); 45 // outputResult = (data[0]->date + samplingFreq > nextOperationDate);46 97 outputResult = (data[0]->date > initDate + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth); 47 98 copyLess = (isInstantOperation && usePacket && outputResult); … … 80 131 81 132 isFirstOperation = false; 82 // nextOperationDate = initDate + samplingFreq + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth; 133 134 packet->field = this->field; 135 136 if(BG) 137 { 138 packet->src_filterID=this->filterID; 139 packet->distance = data[0]->distance+1; 140 this->filterIDoutputs.clear(); 141 CWorkflowGraph::build_begin=true; 142 (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].inputs_complete = true ; 143 } 83 144 } 84 145 }
Note: See TracChangeset
for help on using the changeset viewer.