Ignore:
Timestamp:
07/02/19 11:42:27 (5 years ago)
Author:
yushan
Message:

MARK: Dynamic workflow graph developement. Branch up to date with trunk @1676. Using vis.js

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_trunk_omp/src/filter/temporal_filter.cpp

    r1677 r1679  
    1010  CTemporalFilter::CTemporalFilter(CGarbageCollector& gc, const std::string& opId, 
    1111                                   const CDate& initDate, const CDuration samplingFreq, const CDuration samplingOffset, const CDuration opFreq, 
    12                                    bool ignoreMissingValue /*= false*/, bool buildWorkflowGraph /*= false*/) 
    13     : CFilter(gc, 1, this, buildWorkflowGraph) 
     12                                   bool ignoreMissingValue /*= false*/) 
     13    : CFilter(gc, 1, this) 
    1414    , functor(createFunctor(opId, ignoreMissingValue, tmpData)) 
    1515    , isOnceOperation(functor->timeType() == func::CFunctor::once) 
     
    3333  CDataPacketPtr CTemporalFilter::apply(std::vector<CDataPacketPtr> data) 
    3434  { 
     35    bool building_graph=this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    3536    
    36     if(this->tag) 
     37    if(building_graph) 
    3738    { 
    3839      if(this->filterIDoutputs.size()==0) this->filterID = InvalidableObject::filterIdGenerator++; 
     40      int edgeID = InvalidableObject::edgeIdGenerator++; 
    3941       
    4042 
    41       std::cout<<"CTemporalFilter::apply filter tag = "<<this->tag<<std::endl; 
     43      std::cout<<"CTemporalFilter::apply filter tag = "<<this->tag<<" start = "<<this->start_graph<<" end = "<<this->end_graph<<std::endl; 
    4244 
    43       if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 
     45      if(CWorkflowGraph::mapFieldToFilters_ptr_with_info==0) CWorkflowGraph::mapFieldToFilters_ptr_with_info = new std::unordered_map <int, graph_info_box_edge >; 
    4446 
    45       StdString str = data[0]->fieldID +" ts=" + to_string(data[0]->timestamp); 
    46       (*CWorkflowGraph::mapFieldToFilters_ptr)[str].push_back(data[0]->src_filterID); 
    47       (*CWorkflowGraph::mapFieldToFilters_ptr)[str].push_back(this->filterID); 
    48         
    49      
    50       if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 
     47      if(CWorkflowGraph::build_begin) 
     48      { 
    5149 
    52       if(this->filterIDoutputs.size()==0) (*CWorkflowGraph::mapFilters_ptr)[this->filterID] = "Temporal Filter";   
     50        CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
     51 
     52        (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 
     53      } 
     54       
     55      if(CWorkflowGraph::mapFilters_ptr_with_info==0) CWorkflowGraph::mapFilters_ptr_with_info = new std::unordered_map <int, graph_info_box_node>; 
     56 
     57      if(this->filterIDoutputs.size()==0) 
     58      { 
     59        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_name = "Temporal Filter";    
     60        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_class = 3;    
     61        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_filled = 1;    
     62        // (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb = (initDate + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth) / data[0]->date +1 ;    
     63        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb =-1;    
     64        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].date = data[0]->date;    
     65        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].timestamp = data[0]->timestamp;    
     66      } 
     67 
    5368 
    5469      this->filterIDoutputs.push_back(data[0]->src_filterID);  
     
    102117 
    103118        isFirstOperation = false; 
    104         if(this->tag) packet->src_filterID=this->filterID; 
    105         packet->fieldID = this->output_field_id; 
    106         if(this->tag) this->filterIDoutputs.clear(); 
     119        if(building_graph) packet->src_filterID=this->filterID; 
     120        packet->field = this->field; 
     121        if(building_graph) this->filterIDoutputs.clear(); 
     122        if(building_graph) CWorkflowGraph::build_begin=true; 
    107123      } 
    108124    } 
Note: See TracChangeset for help on using the changeset viewer.