Ignore:
Timestamp:
09/11/19 10:22:09 (5 years ago)
Author:
yushan
Message:

Introducing the new graph functionality. Attribute build_workflow_graph=.TRUE. is used in the field definition section in the xml file to enable the workflow graph of the field and other fields referecing to it. A more detailed document will be available soon on the graph fuctionality.

File:
1 edited

Legend:

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

    r1523 r1704  
    22#include "functor_type.hpp" 
    33#include "calendar_util.hpp" 
     4#include "workflow_graph.hpp" 
     5#include "file.hpp" 
    46 
    57namespace xios 
     
    2224                        this->samplingOffset.second, this->samplingOffset.timestep) 
    2325    , initDate(initDate) 
    24 //    , nextSamplingDate(initDate + (this->samplingOffset + initDate.getRelCalendar().getTimeStep())) 
    2526    , nextSamplingDate(initDate + offsetMonth + ( offsetAllButMonth + initDate.getRelCalendar().getTimeStep())) 
    2627    , nbOperationDates(1) 
     
    2829//    , nextOperationDate(initDate + opFreq + this->samplingOffset) 
    2930    , isFirstOperation(true) 
     31    , temp_op(opId) 
    3032  { 
    3133  } 
    3234 
     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 
    3383  CDataPacketPtr CTemporalFilter::apply(std::vector<CDataPacketPtr> data) 
    3484  { 
     85    bool BG = buildGraph(data); 
     86 
    3587    CDataPacketPtr packet; 
    3688 
     
    4395      { 
    4496        usePacket = (data[0]->date >= nextSamplingDate); 
    45 //        outputResult = (data[0]->date + samplingFreq > nextOperationDate); 
    4697        outputResult = (data[0]->date  > initDate + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth); 
    4798        copyLess = (isInstantOperation && usePacket && outputResult); 
     
    80131 
    81132        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        } 
    83144      } 
    84145    } 
Note: See TracChangeset for help on using the changeset viewer.