Changeset 1876 for XIOS/trunk/src/filter


Ignore:
Timestamp:
05/12/20 16:36:29 (4 years ago)
Author:
yushan
Message:

trunk : Bug fixed in workflow graph. wrong connection happens when a chain of arithmetic operations is applied on a field.

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

Legend:

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

    r1768 r1876  
    1111    , op(operatorExpr.getOpScalarField(op)) 
    1212    , value(value) 
    13   {  
    14     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    15   }; 
     13  { }; 
    1614 
    1715  std::tuple<int, int, int> CScalarFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
     
    2523      CWorkflowGraph::allocNodeEdge(); 
    2624 
    27       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
     25      size_t filterhash = std::hash<StdString>{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); 
    2826 
    2927      // first round 
     
    3432        int edgeID = InvalidableObject::edgeIdGenerator++; 
    3533 
    36         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
     34        CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); 
    3735        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    3836        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
     
    9997    , op(operatorExpr.getOpFieldScalar(op)) 
    10098    , value(value) 
    101   {  
    102     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    103   }; 
     99  {  }; 
    104100 
    105101  std::tuple<int, int, int> CFieldScalarArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
    106102  { 
    107103    bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    108     // bool building_graph = true; 
    109104    int unique_filter_id; 
    110105    bool firstround; 
     
    114109      CWorkflowGraph::allocNodeEdge(); 
    115110 
    116       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
     111      size_t filterhash = std::hash<StdString>{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); 
    117112 
    118113      // first round 
     
    123118        int edgeID = InvalidableObject::edgeIdGenerator++; 
    124119 
    125         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
     120        CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); 
    126121        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    127122        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
     
    171166    std::tuple<int, int, int> graph = buildGraph(data); 
    172167 
    173     if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 
    174     if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 
    175     if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 
    176  
     168    if(std::get<0>(graph)) 
     169    {   
     170      packet->src_filterID = std::get<2>(graph); 
     171      if(std::get<1>(graph)) packet->distance = data[0]->distance+1; 
     172      else  packet->distance = data[0]->distance+1; 
     173    } 
     174     
    177175    packet->field = this->field; 
    178176 
     
    186184    : CFilter(gc, 2, this) 
    187185    , op(operatorExpr.getOpFieldField(op)) 
    188   {  
    189     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    190   }; 
     186  { }; 
    191187 
    192188  std::tuple<int, int, int> CFieldFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
     
    202198      CWorkflowGraph::allocNodeEdge(); 
    203199 
    204       // std::cout<<"CFieldFieldArithmeticFilter::apply filter tag = "<<this->tag<<std::endl; 
    205  
    206       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
     200 
     201      size_t filterhash = std::hash<StdString>{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); 
    207202 
    208203      // first round 
     
    213208        int edgeID = InvalidableObject::edgeIdGenerator++; 
    214209     
    215         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
     210        CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); 
    216211        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    217212        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
     
    251246          (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ;  
    252247          (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
     248          data[0]->distance=max(data[0]->distance, (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].distance); 
    253249        } 
    254250        if(data[1]->src_filterID != unique_filter_id) 
     
    258254          (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 
    259255          (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
     256          data[1]->distance=max(data[1]->distance, (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].distance);    
    260257        } 
    261258         
     
    275272 
    276273    if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 
    277     if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 
    278     if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 
     274    if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = max(data[0]->distance+1, data[1]->distance+1); 
     275    if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = max(data[0]->distance, data[1]->distance); 
    279276     
    280277    packet->field = this->field; 
  • XIOS/trunk/src/filter/data_packet.hpp

    r1704 r1876  
    2727    Time timestamp;         //!< Timestamp of the data 
    2828    StatusCode status;      //!< Status of the packet 
    29     int src_filterID; 
     29    int src_filterID=0; 
    3030    std::vector<int> filterIDoutputs; 
    31     CField *field; 
    32     int distance; 
     31    CField *field=nullptr; 
     32    int distance=-1; 
    3333     
    3434    /*! 
  • XIOS/trunk/src/filter/source_filter.cpp

    r1704 r1876  
    2727  void CSourceFilter::buildGraph(CDataPacketPtr packet) 
    2828  { 
    29     bool building_graph = this->tag ? packet->timestamp >= this->field->field_graph_start && packet->timestamp <= this->field->field_graph_end : false; 
     29    bool filter_interval=false; 
     30    if (this->field) 
     31    { 
     32      if(this->field->field_graph_start == -1 && this->field->field_graph_end == -1) filter_interval = true; 
     33      else filter_interval = packet->timestamp >= this->field->field_graph_start && packet->timestamp <= this->field->field_graph_end; 
     34    } 
     35    bool building_graph = this->tag ? filter_interval : false; 
    3036    if(building_graph) 
    3137    { 
  • XIOS/trunk/src/filter/temporal_filter.cpp

    r1704 r1876  
    8585    bool BG = buildGraph(data); 
    8686 
    87     CDataPacketPtr packet; 
     87    CDataPacketPtr packet=0; 
    8888 
    8989    if (data[0]->status != CDataPacket::END_OF_STREAM) 
  • XIOS/trunk/src/filter/ternary_arithmetic_filter.cpp

    r1768 r1876  
    1212    , value2(value2) 
    1313  {  
    14     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    1514    /* Nothing to do */  
    1615  }; 
     
    2625      CWorkflowGraph::allocNodeEdge(); 
    2726 
    28       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
     27      size_t filterhash = std::hash<StdString>{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); 
    2928 
    3029      // first round 
     
    3534        int edgeID = InvalidableObject::edgeIdGenerator++; 
    3635 
    37         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
     36        CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); 
    3837        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    3938        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
     
    101100    , value2(value2) 
    102101  {  
    103     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    104102    /* Nothing to do */  
    105103  }; 
     
    115113      CWorkflowGraph::allocNodeEdge(); 
    116114 
    117       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
     115      size_t filterhash = std::hash<StdString>{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); 
    118116 
    119117      // first round 
     
    124122        int edgeID = InvalidableObject::edgeIdGenerator++; 
    125123 
    126         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
     124        CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); 
    127125        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    128126        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
     
    189187    , value(value) 
    190188  {  
    191     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    192189    /* Nothing to do */  
    193190  }; 
     
    204201      CWorkflowGraph::allocNodeEdge(); 
    205202 
    206       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
     203      size_t filterhash = std::hash<StdString>{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); 
    207204 
    208205      // first round 
     
    213210        int edgeID = InvalidableObject::edgeIdGenerator++; 
    214211     
    215         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
     212        CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); 
    216213        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    217214        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
     
    301298    , value2(value2) 
    302299  {  
    303     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    304300    /* Nothing to do */  
    305301  }; 
     
    315311      CWorkflowGraph::allocNodeEdge(); 
    316312 
    317       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
     313      size_t filterhash = std::hash<StdString>{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); 
    318314 
    319315      // first round 
     
    324320        int edgeID = InvalidableObject::edgeIdGenerator++; 
    325321 
    326         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
     322        CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); 
    327323        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    328324        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
     
    390386    , value(value) 
    391387  {  
    392     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    393388    /* Nothing to do */  
    394389  }; 
     
    405400      CWorkflowGraph::allocNodeEdge(); 
    406401 
    407       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
     402      size_t filterhash = std::hash<StdString>{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); 
    408403 
    409404      // first round 
     
    414409        int edgeID = InvalidableObject::edgeIdGenerator++; 
    415410     
    416         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
     411        CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); 
    417412        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    418413        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
     
    499494    , value(value) 
    500495  {  
    501     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    502496    /* Nothing to do */  
    503497  }; 
     
    514508      CWorkflowGraph::allocNodeEdge(); 
    515509 
    516       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
     510      size_t filterhash = std::hash<StdString>{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); 
    517511 
    518512      // first round 
     
    523517        int edgeID = InvalidableObject::edgeIdGenerator++; 
    524518     
    525         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
     519        CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); 
    526520        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    527521        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
     
    608602    , op(operatorExpr.getOpFieldFieldField(op)) 
    609603  {  
    610     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    611604    /* Nothing to do */  
    612605  }; 
     
    623616      CWorkflowGraph::allocNodeEdge(); 
    624617 
    625       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
     618      size_t filterhash = std::hash<StdString>{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); 
    626619 
    627620      // first round 
     
    632625        int edgeID = InvalidableObject::edgeIdGenerator++; 
    633626     
    634         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
     627        CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); 
    635628        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    636629        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
  • XIOS/trunk/src/filter/unary_arithmetic_filter.cpp

    r1704 r1876  
    99    : CFilter(gc, 1, this) 
    1010    , op(operatorExpr.getOpField(op)) 
    11   {  
    12     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    13   }; 
     11  { }; 
    1412 
    1513  std::tuple<int, int, int> CUnaryArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
     
    2220    { 
    2321      CWorkflowGraph::allocNodeEdge(); 
    24       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
     22      size_t filterhash = std::hash<StdString>{}(this->field->content+to_string(data[0]->timestamp)+this->field->getId()); 
    2523 
    2624      // first round 
     
    3028        this->filterID = InvalidableObject::filterIdGenerator++; 
    3129        int edgeID = InvalidableObject::edgeIdGenerator++; 
    32  
    33         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
     30        CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+this->field->content+")", 3, 1, 0, data[0]); 
    3431        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    3532        (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
Note: See TracChangeset for help on using the changeset viewer.