Ignore:
Timestamp:
01/22/21 12:00:29 (3 years ago)
Author:
yushan
Message:

Graph intermedia commit to a tmp branch

Location:
XIOS/dev/dev_trunk_graph/src/filter
Files:
22 added
19 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_trunk_graph/src/filter/binary_arithmetic_filter.cpp

    r1686 r2019  
    11#include "binary_arithmetic_filter.hpp" 
    2 #include "workflow_graph.hpp" 
    3 #include "yacc_var.hpp" 
    4 #include "file.hpp" 
    5  
    62 
    73namespace xios 
     
    117    , op(operatorExpr.getOpScalarField(op)) 
    128    , value(value) 
    13   {  
    14     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    15   }; 
    16  
    17   std::tuple<int, int, int> CScalarFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
    18   { 
    19     bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    20     // bool building_graph = true; 
    21     int unique_filter_id; 
    22     bool firstround; 
    23  
    24     if(building_graph) 
    25     { 
    26       CWorkflowGraph::allocNodeEdge(); 
    27  
    28       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
    29  
    30       // first round 
    31       if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 
    32       { 
    33         firstround = true; 
    34         this->filterID = InvalidableObject::filterIdGenerator++; 
    35         int edgeID = InvalidableObject::edgeIdGenerator++; 
    36  
    37         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
    38         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    39         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
    40  
    41  
    42         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    43         if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
    44        
    45  
    46         if(CWorkflowGraph::build_begin) 
    47         { 
    48           CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
    49           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    50  
    51           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 
    52         } 
    53         else CWorkflowGraph::build_begin = true; 
    54  
    55         (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID;  
    56         unique_filter_id = this->filterID; 
    57       } 
    58       // not first round 
    59       else  
    60       { 
    61         firstround=false; 
    62         unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 
    63         if(data[0]->src_filterID != unique_filter_id) 
    64         { 
    65           int edgeID = InvalidableObject::edgeIdGenerator++; 
    66           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]);   
    67           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ;  
    68           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    69         } 
    70       }   
    71     } 
    72  
    73     return std::make_tuple(building_graph, firstround, unique_filter_id); 
    74   } 
    75  
     9  { /* Nothing to do */ }; 
    7610 
    7711  CDataPacketPtr CScalarFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    8115    packet->timestamp = data[0]->timestamp; 
    8216    packet->status = data[0]->status; 
    83  
    84     std::tuple<int, int, int> graph = buildGraph(data); 
    85  
    86     if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 
    87     if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 
    88     if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 
    89  
    90     packet->field = this->field; 
    9117 
    9218    if (packet->status == CDataPacket::NO_ERROR) 
     
    10026    , op(operatorExpr.getOpFieldScalar(op)) 
    10127    , value(value) 
    102   {  
    103     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    104   }; 
    105  
    106   std::tuple<int, int, int> CFieldScalarArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
    107   { 
    108     bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    109     // bool building_graph = true; 
    110     int unique_filter_id; 
    111     bool firstround; 
    112  
    113     if(building_graph) 
    114     { 
    115       CWorkflowGraph::allocNodeEdge(); 
    116  
    117       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
    118  
    119       // first round 
    120       if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 
    121       { 
    122         firstround = true; 
    123         this->filterID = InvalidableObject::filterIdGenerator++; 
    124         int edgeID = InvalidableObject::edgeIdGenerator++; 
    125  
    126         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
    127         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    128         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
    129  
    130  
    131         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    132         if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
    133        
    134  
    135         if(CWorkflowGraph::build_begin) 
    136         { 
    137           CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
    138           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    139  
    140           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 
    141         } 
    142         else CWorkflowGraph::build_begin = true; 
    143  
    144         (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID;  
    145         unique_filter_id = this->filterID; 
    146       } 
    147       // not first round 
    148       else  
    149       { 
    150         firstround=false; 
    151         unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 
    152         if(data[0]->src_filterID != unique_filter_id) 
    153         { 
    154           int edgeID = InvalidableObject::edgeIdGenerator++; 
    155           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]);   
    156           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ;  
    157           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    158         } 
    159       }   
    160     } 
    161  
    162     return std::make_tuple(building_graph, firstround, unique_filter_id); 
    163   } 
     28  { /* Nothing to do */ }; 
    16429 
    16530  CDataPacketPtr CFieldScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    16934    packet->timestamp = data[0]->timestamp; 
    17035    packet->status = data[0]->status; 
    171  
    172     std::tuple<int, int, int> graph = buildGraph(data); 
    173  
    174     if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 
    175     if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 
    176     if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 
    177  
    178     packet->field = this->field; 
    17936 
    18037    if (packet->status == CDataPacket::NO_ERROR) 
     
    18744    : CFilter(gc, 2, this) 
    18845    , op(operatorExpr.getOpFieldField(op)) 
    189   {  
    190     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    191   }; 
    192  
    193   std::tuple<int, int, int> CFieldFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
    194   { 
    195     bool building_graph = this->tag ? ((data[0]->timestamp >= this->field->field_graph_start && data[0]->timestamp <= this->field->field_graph_end) && (data[0]->timestamp == data[1]->timestamp)) : false; 
    196  
    197     int unique_filter_id; 
    198  
    199     bool firstround; 
    200  
    201     if(building_graph) 
    202     {   
    203       CWorkflowGraph::allocNodeEdge(); 
    204  
    205       // std::cout<<"CFieldFieldArithmeticFilter::apply filter tag = "<<this->tag<<std::endl; 
    206  
    207       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
    208  
    209       // first round 
    210       if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 
    211       { 
    212         firstround = true; 
    213         this->filterID = InvalidableObject::filterIdGenerator++; 
    214         int edgeID = InvalidableObject::edgeIdGenerator++; 
    215      
    216         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
    217         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    218         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
    219  
    220         if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
    221      
    222         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    223         if(CWorkflowGraph::build_begin) 
    224         { 
    225  
    226           CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
    227           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    228  
    229           edgeID = InvalidableObject::edgeIdGenerator++; 
    230  
    231           CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); 
    232           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    233  
    234           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 
    235           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 
    236         } 
    237         CWorkflowGraph::build_begin = true; 
    238  
    239         (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID;  
    240         unique_filter_id = this->filterID; 
    241   
    242       } 
    243       // not first round 
    244       else  
    245       { 
    246         firstround = false; 
    247         unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 
    248         if(data[0]->src_filterID != unique_filter_id) 
    249         { 
    250           int edgeID = InvalidableObject::edgeIdGenerator++; 
    251           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]);  
    252           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ;  
    253           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    254         } 
    255         if(data[1]->src_filterID != unique_filter_id) 
    256         {  
    257           int edgeID = InvalidableObject::edgeIdGenerator++; 
    258           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]);   
    259           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 
    260           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    261         } 
    262          
    263       }   
    264     } 
    265  
    266     return std::make_tuple(building_graph, firstround, unique_filter_id); 
    267   } 
     46  { /* Nothing to do */ }; 
    26847 
    26948  CDataPacketPtr CFieldFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    27251    packet->date = data[0]->date; 
    27352    packet->timestamp = data[0]->timestamp; 
    274  
    275     std::tuple<int, int, int> graph = buildGraph(data); 
    276  
    277     if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 
    278     if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 
    279     if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 
    280      
    281     packet->field = this->field; 
    282      
    28353 
    28454    if (data[0]->status != CDataPacket::NO_ERROR) 
     
    29464    return packet; 
    29565  } 
    296  
    297   StdString CScalarFieldArithmeticFilter::GetName(void)    { return StdString("CScalarFieldArithmeticFilter"); } 
    298   StdString CFieldScalarArithmeticFilter::GetName(void)    { return StdString("CFieldScalarArithmeticFilter"); } 
    299   StdString CFieldFieldArithmeticFilter::GetName(void)     { return StdString("CFieldFieldArithmeticFilter"); } 
    300  
    301  
    30266} // namespace xios 
  • XIOS/dev/dev_trunk_graph/src/filter/binary_arithmetic_filter.hpp

    r1686 r2019  
    66#include "operator_expr.hpp" 
    77#include <unordered_map> 
    8 #include <tuple> 
    98 
    109namespace xios 
     
    2423       */ 
    2524      CScalarFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value); 
    26       StdString virtual GetName(void); 
    27  
    2825 
    2926    protected: 
     
    3835       */ 
    3936      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    40       std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    41        
    42  
    4337  }; // class CScalarFieldArithmeticFilter 
    4438 
     
    5751       */ 
    5852      CFieldScalarArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value); 
    59       StdString virtual GetName(void); 
    60  
    6153 
    6254    protected: 
     
    7163       */ 
    7264      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    73       std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    7465  }; // class CFieldScalarArithmeticFilter 
    7566 
     
    8778       */ 
    8879      CFieldFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op); 
    89       StdString virtual GetName(void); 
    90  
    9180 
    9281    protected: 
     
    10089       */ 
    10190      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    102       std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    10391  }; // class CFieldFieldArithmeticFilter 
    10492} // namespace xios 
  • XIOS/dev/dev_trunk_graph/src/filter/data_packet.hpp

    r1686 r2019  
    66#include "array_new.hpp" 
    77#include "date.hpp" 
     8#include "graph_package.hpp" 
    89 
    910namespace xios 
    1011{ 
    11   class CField; 
    1212  /*! 
    1313   * A packet corresponds to a timestamped array of data. 
     
    2323    }; 
    2424 
     25    CGraphDataPackage * graphPackage; 
     26 
    2527    CArray<double, 1> data; //!< Array containing the data 
    2628    CDate date;             //!< Date associated to the data 
    2729    Time timestamp;         //!< Timestamp of the data 
    2830    StatusCode status;      //!< Status of the packet 
    29     int src_filterID; 
    30     std::vector<int> filterIDoutputs; 
    31     CField *field; 
    32     int distance; 
    33      
     31 
    3432    /*! 
    3533     * Creates a deep copy of the packet. 
     
    3735     * \return a deep copy of the packet 
    3836     */ 
    39     CDataPacket* copy() const { 
     37    CDataPacket* copy() const  
     38    { 
    4039      CDataPacket* p = new CDataPacket; 
    4140      p->data.resize(data.shape()); 
     
    4443      p->timestamp = timestamp; 
    4544      p->status = status; 
     45      p->graphPackage = graphPackage; 
    4646      return p; 
    4747    }; 
     48 
     49 
     50    CDataPacket() : graphPackage(nullptr) {} 
     51 
    4852  }; // struct CDataPacket 
    4953 
  • XIOS/dev/dev_trunk_graph/src/filter/filter.cpp

    r1686 r2019  
    55  CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine) 
    66    : CInputPin(gc, inputSlotsCount) 
    7     , COutputPin(gc, false) 
     7    , COutputPin(gc) 
    88    , engine(engine) 
    99    , inputSlotCount(inputSlotCount) 
    1010  { /* Nothing to do */ } 
    11  
    12   StdString CFilter::GetName(void)    { return StdString("Filter"); } 
    1311 
    1412  void CFilter::onInputReady(std::vector<CDataPacketPtr> data) 
  • XIOS/dev/dev_trunk_graph/src/filter/filter.hpp

    r1686 r2019  
    2525       */ 
    2626      CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine); 
    27  
    28       StdString virtual GetName(void); 
    2927 
    3028      /*! 
     
    6462      bool virtual isDataExpected(const CDate& date) const; 
    6563 
    66        
    67        
    68  
    69       int filterID; 
    70       StdString expression; 
    71  
    7264    protected: 
    7365      IFilterEngine* engine; //!< The filter engine, might be the filter itself 
  • XIOS/dev/dev_trunk_graph/src/filter/garbage_collector.cpp

    r1686 r2019  
    33namespace xios 
    44{ 
    5   int InvalidableObject::filterIdGenerator = 0; 
    6  
    7   int InvalidableObject::edgeIdGenerator = 0; 
    8  
    9   int InvalidableObject::clusterIdGenerator = 0; 
    10    
    115  void CGarbageCollector::registerObject(InvalidableObject* Object, Time timestamp) 
    126  { 
  • XIOS/dev/dev_trunk_graph/src/filter/garbage_collector.hpp

    r1686 r2019  
    2020     */ 
    2121    void virtual invalidate(Time timestamp) = 0; 
    22    
    23      
    24  
    25     static int filterIdGenerator; 
    26  
    27     static int edgeIdGenerator; 
    28  
    29     static int clusterIdGenerator; 
    30  
    31      
    32      
    3322  }; // struct InvalidableObject 
    3423 
  • XIOS/dev/dev_trunk_graph/src/filter/input_pin.cpp

    r1686 r2019  
    33#include "garbage_collector.hpp" 
    44#include "exception.hpp" 
    5 #include "workflow_graph.hpp" 
    65 
    76namespace xios 
     
    1211    , triggers(slotsCount) 
    1312    , hasTriggers(false) 
    14   {  } 
    15  
    16   StdString CInputPin::GetName(void) 
    17   { 
    18     return StdString("Input pin"); 
    19   } 
     13  { /* Nothing to do */ } 
    2014 
    2115  void CInputPin::setInput(size_t inputSlot, CDataPacketPtr packet) 
  • XIOS/dev/dev_trunk_graph/src/filter/input_pin.hpp

    r1686 r2019  
    2626       */ 
    2727      CInputPin(CGarbageCollector& gc, size_t slotsCount); 
    28        
    29       StdString virtual GetName(void); 
    3028 
    3129      /*! 
  • XIOS/dev/dev_trunk_graph/src/filter/output_pin.cpp

    r1686 r2019  
    11#include "output_pin.hpp" 
    22#include "exception.hpp" 
    3 #include "workflow_graph.hpp" 
    43 
    54namespace xios 
     
    76  COutputPin::COutputPin(CGarbageCollector& gc, bool manualTrigger /*= false*/) 
    87    : gc(gc) 
    9     , manualTrigger(manualTrigger) 
    10   {  } 
    11  
    12   StdString COutputPin::GetName(void) 
    13   { 
    14     return StdString("Output pin"); 
    15   } 
     8    , manualTrigger(manualTrigger), graphEnabled(false) 
     9  { /* Nothing to do */ } 
    1610 
    1711  void COutputPin::connectOutput(std::shared_ptr<CInputPin> inputPin, size_t inputSlot) 
     
    107101    outputPackets.erase(outputPackets.begin(), outputPackets.lower_bound(timestamp)); 
    108102  } 
    109  
    110   void COutputPin::setParentFiltersTag() 
    111   { 
    112     for(int i=0; i<parent_filters.size(); i++) 
    113     { 
    114  
    115       if(parent_filters[i]->start_graph<0) parent_filters[i]->start_graph = start_graph; 
    116       else parent_filters[i]->start_graph = min(parent_filters[i]->start_graph, start_graph); 
    117  
    118  
    119       if(parent_filters[i]->end_graph<0) parent_filters[i]->end_graph = end_graph;   
    120       else parent_filters[i]->end_graph = max(parent_filters[i]->end_graph, end_graph); 
    121        
    122        
    123       parent_filters[i]->tag += tag; 
    124       parent_filters[i]->setParentFiltersTag(); 
    125     } 
    126   } 
    127  
    128  
    129  
    130  
    131103} // namespace xios 
  • XIOS/dev/dev_trunk_graph/src/filter/output_pin.hpp

    r1686 r2019  
    44#include "garbage_collector.hpp" 
    55#include "input_pin.hpp" 
    6 #include "duration.hpp" 
     6#include "graph_package.hpp" 
    77 
    88namespace xios 
    99{ 
    10   class CField; 
    11   class CInputPin; 
    12   class CFilter; 
    13   class CDuration; 
    1410  /*! 
    1511   * An output pin handles the connections with downstream filters. 
     
    1814  { 
    1915    public: 
    20       int tag; 
    21       Time start_graph; 
    22       Time end_graph; 
    23       CField *field; 
    24       int distance; 
    25  
    26  
    27  
    28       std::vector< std::shared_ptr<COutputPin> > parent_filters; 
    29  
    3016      /*! 
    3117       * Constructs an ouput pin with manual or automatic trigger 
     
    3723      COutputPin(CGarbageCollector& gc, bool manualTrigger = false); 
    3824 
    39       StdString virtual GetName(void); 
    40        
    4125      /*! 
    4226       * Connects to a specific slot of the input pin of a downstream filter. 
     
    8266       */ 
    8367      void virtual invalidate(Time timestamp); 
    84  
    85       void virtual setParentFiltersTag(); 
    86  
     68      CGraphPackage *graphPackage; 
     69      bool graphEnabled; 
    8770 
    8871    protected: 
  • XIOS/dev/dev_trunk_graph/src/filter/pass_through_filter.cpp

    r1688 r2019  
    11#include "pass_through_filter.hpp" 
    22#include "workflow_graph.hpp" 
    3 #include "field.hpp" 
    4 #include "file.hpp" 
     3#include <algorithm> 
    54 
    65namespace xios 
     
    87  CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc) 
    98    : CFilter(gc, 1, this) 
    10   {  
    11   } 
    12  
    13   void CPassThroughFilter::buildGraph(std::vector<CDataPacketPtr> data) 
    14   { 
    15     bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    16     // bool building_graph = this->tag ? data[0]->timestamp >= this->field->field_graph_start && data[0]->timestamp <= this->field->field_graph_end : false; 
    17  
    18     if(building_graph) 
    19     { 
    20       // std::cout<<"CPassThroughFilter::apply field_id = "<<this->field->getId()<<" start = "<<start_graph<<" end = "<<end_graph<<std::endl; 
    21       this->filterID = InvalidableObject::filterIdGenerator++; 
    22       int edgeID = InvalidableObject::edgeIdGenerator++; 
    23  
    24       CWorkflowGraph::allocNodeEdge(); 
    25  
    26       CWorkflowGraph::addNode(this->filterID, "Pass Through Filter\\n("+data[0]->field->getId()+")", 2, 1, 1, data[0]); 
    27       (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
    28  
    29       (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    30       if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
    31  
    32        
    33       if(CWorkflowGraph::build_begin) 
    34       { 
    35         CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
    36         (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0; 
    37       } 
    38       else CWorkflowGraph::build_begin = true; 
    39        
    40       data[0]->src_filterID=this->filterID; 
    41       data[0]->distance++; 
    42  
    43     } 
    44  
    45     data[0]->field = this->field; 
    46   } 
     9  { /* Nothing to do */ } 
    4710 
    4811  CDataPacketPtr CPassThroughFilter::apply(std::vector<CDataPacketPtr> data) 
    4912  { 
    50     if(CXios::isClient) buildGraph(data); 
     13    buildWorkflowGraph(data); 
    5114    return data[0]; 
    5215  } 
     16 
     17  void CPassThroughFilter::buildWorkflowGraph(std::vector<CDataPacketPtr> data) 
     18  { 
     19    if(this->graphEnabled) 
     20    { 
     21      this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); 
     22       
     23      if(!data[0]->graphPackage)  
     24      { 
     25        data[0]->graphPackage = new CGraphDataPackage; 
     26        data[0]->graphPackage->fromFilter = -1; 
     27      } 
     28           
     29      data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; 
     30      std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); 
     31       
     32      CWorkflowGraph::addNode("Pass through filter", 2, false, 1, data[0]); 
     33      CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); 
     34      data[0]->graphPackage->fromFilter = this->graphPackage->filterId; 
     35         
     36    }  
     37  } 
     38 
     39 
    5340} // namespace xios 
     41 
  • XIOS/dev/dev_trunk_graph/src/filter/pass_through_filter.hpp

    r1686 r2019  
    2020      CPassThroughFilter(CGarbageCollector& gc); 
    2121 
    22       inline StdString GetName(void) {return StdString("Pass through filter");}; 
    23  
    2422    protected: 
    2523      /*! 
     
    3028       */ 
    3129      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    32       void virtual buildGraph(std::vector<CDataPacketPtr> data); 
     30      void buildWorkflowGraph(std::vector<CDataPacketPtr> data); 
     31   
    3332  }; // class CPassThroughFilter 
    3433} // namespace xios 
  • XIOS/dev/dev_trunk_graph/src/filter/temporal_filter.cpp

    r1686 r2019  
    33#include "calendar_util.hpp" 
    44#include "workflow_graph.hpp" 
    5 #include "file.hpp" 
    65 
    76namespace xios 
     
    2726    , nbOperationDates(1) 
    2827    , nbSamplingDates(0) 
    29 //    , nextOperationDate(initDate + opFreq + this->samplingOffset) 
    3028    , isFirstOperation(true) 
    31     , temp_op(opId) 
    3229  { 
    3330  } 
    3431 
    35    
    36  
    37  
    38  
    39   bool CTemporalFilter::buildGraph(std::vector<CDataPacketPtr> data) 
     32  void CTemporalFilter::buildWorkflowGraph(std::vector<CDataPacketPtr> data) 
    4033  { 
    41     bool building_graph=this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    42     
    43     if(building_graph) 
     34    if(this->graphEnabled) 
    4435    { 
    45       if(this->filterIDoutputs.size()==0) this->filterID = InvalidableObject::filterIdGenerator++; 
    46       int edgeID = InvalidableObject::edgeIdGenerator++; 
     36      if(!data[0]->graphPackage) data[0]->graphPackage = new CGraphDataPackage; 
     37      data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; 
     38      std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); 
    4739       
    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(); 
     40      if(this->graphPackage->sourceFilterIds.size()==0) 
     41      {   
     42        this->graphPackage->filterId = CWorkflowGraph::getNodeSize(); 
     43        CWorkflowGraph::addNode("Temporal filter", 3, false, 0, data[0]); 
    6344      } 
    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);  
     45       
     46      CWorkflowGraph::addEdge(data[0]->graphPackage->fromFilter, this->graphPackage->filterId, data[0]); 
     47      data[0]->graphPackage->fromFilter = this->graphPackage->filterId; 
     48      this->graphPackage->sourceFilterIds.push_back(data[0]->graphPackage->fromFilter);     
    7749    } 
    7850 
    79     return building_graph; 
    8051  } 
    81  
    82  
    8352  CDataPacketPtr CTemporalFilter::apply(std::vector<CDataPacketPtr> data) 
    8453  { 
    85     bool BG = buildGraph(data); 
    86  
     54    buildWorkflowGraph(data); 
     55   
    8756    CDataPacketPtr packet; 
    8857 
     
    12695          packet->data.resize(tmpData.numElements()); 
    12796          packet->data = tmpData; 
     97          packet->graphPackage = data[0]->graphPackage; 
    12898        } 
    12999        else 
     
    132102        isFirstOperation = false; 
    133103         
    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         } 
    144104      } 
    145105    } 
     
    155115  bool CTemporalFilter::isDataExpected(const CDate& date) const 
    156116  { 
    157 //    return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date + samplingFreq > nextOperationDate); 
    158117    return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date > initDate + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth); 
    159118  } 
  • XIOS/dev/dev_trunk_graph/src/filter/temporal_filter.hpp

    r1686 r2019  
    3131                      bool ignoreMissingValue = false); 
    3232 
    33       inline StdString GetName(void) {return StdString("Temporal filter");}; 
    34  
    3533      /*! 
    3634       * Applies the temporal operation to the input data and returns the result when it is ready. 
     
    4038       */ 
    4139      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    42       bool virtual buildGraph(std::vector<CDataPacketPtr> data); 
     40 
     41      void buildWorkflowGraph(std::vector<CDataPacketPtr> data); 
    4342 
    4443      /*! 
     
    5554       */ 
    5655      bool virtual isDataExpected(const CDate& date) const; 
    57       std::vector<int > filterIDoutputs; 
    58       std::vector<std::pair<int, int> > filterIDoutputs_pair; 
    59  
    60       StdString temp_op; 
    6156 
    6257    private: 
  • XIOS/dev/dev_trunk_graph/src/filter/ternary_arithmetic_filter.cpp

    r1686 r2019  
    11#include "ternary_arithmetic_filter.hpp" 
    2 #include "workflow_graph.hpp" 
    3 #include "yacc_var.hpp" 
    4 #include "file.hpp" 
    52 
    63namespace xios 
     
    118    , value1(value1) 
    129    , value2(value2) 
    13   {  
    14     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    15     /* Nothing to do */  
    16   }; 
    17  
    18   std::tuple<int, int, int> CScalarScalarFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
    19   { 
    20     bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    21     int unique_filter_id; 
    22     bool firstround; 
    23  
    24     if(building_graph) 
    25     { 
    26       CWorkflowGraph::allocNodeEdge(); 
    27  
    28       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
    29  
    30       // first round 
    31       if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 
    32       { 
    33         firstround = true; 
    34         this->filterID = InvalidableObject::filterIdGenerator++; 
    35         int edgeID = InvalidableObject::edgeIdGenerator++; 
    36  
    37         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
    38         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    39         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
    40  
    41  
    42         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    43         if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
    44        
    45  
    46         if(CWorkflowGraph::build_begin) 
    47         { 
    48           CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
    49           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    50  
    51           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 
    52         } 
    53         else CWorkflowGraph::build_begin = true; 
    54  
    55         (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID;  
    56         unique_filter_id = this->filterID; 
    57       } 
    58       // not first round 
    59       else  
    60       { 
    61         firstround=false; 
    62         unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 
    63         if(data[0]->src_filterID != unique_filter_id) 
    64         { 
    65           int edgeID = InvalidableObject::edgeIdGenerator++; 
    66           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]);   
    67           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ;  
    68           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    69         } 
    70       }   
    71     } 
    72  
    73     return std::make_tuple(building_graph, firstround, unique_filter_id); 
    74   } 
     10  { /* Nothing to do */ }; 
    7511 
    7612  CDataPacketPtr CScalarScalarFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    8016    packet->timestamp = data[0]->timestamp; 
    8117    packet->status = data[0]->status; 
    82      
    83     std::tuple<int, int, int> graph = buildGraph(data); 
    84  
    85     if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 
    86     if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 
    87     if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 
    88  
    89     packet->field = this->field; 
    9018 
    9119    if (packet->status == CDataPacket::NO_ERROR) 
     
    10028    , value1(value1) 
    10129    , value2(value2) 
    102   {  
    103     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    104     /* Nothing to do */  
    105   }; 
    106  
    107   std::tuple<int, int, int> CScalarFieldScalarArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
    108   { 
    109     bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    110     int unique_filter_id; 
    111     bool firstround; 
    112  
    113     if(building_graph) 
    114     { 
    115       CWorkflowGraph::allocNodeEdge(); 
    116  
    117       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
    118  
    119       // first round 
    120       if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 
    121       { 
    122         firstround = true; 
    123         this->filterID = InvalidableObject::filterIdGenerator++; 
    124         int edgeID = InvalidableObject::edgeIdGenerator++; 
    125  
    126         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
    127         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    128         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
    129  
    130  
    131         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    132         if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
    133        
    134  
    135         if(CWorkflowGraph::build_begin) 
    136         { 
    137           CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
    138           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    139  
    140           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 
    141         } 
    142         else CWorkflowGraph::build_begin = true; 
    143  
    144         (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID;  
    145         unique_filter_id = this->filterID; 
    146       } 
    147       // not first round 
    148       else  
    149       { 
    150         firstround=false; 
    151         unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 
    152         if(data[0]->src_filterID != unique_filter_id) 
    153         { 
    154           int edgeID = InvalidableObject::edgeIdGenerator++; 
    155           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]);   
    156           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ;  
    157           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    158         } 
    159       }   
    160     } 
    161  
    162     return std::make_tuple(building_graph, firstround, unique_filter_id); 
    163   } 
     30  { /* Nothing to do */ }; 
    16431 
    16532  CDataPacketPtr CScalarFieldScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    16936    packet->timestamp = data[0]->timestamp; 
    17037    packet->status = data[0]->status; 
    171      
    172     std::tuple<int, int, int> graph = buildGraph(data); 
    173  
    174     if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 
    175     if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 
    176     if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 
    177  
    178     packet->field = this->field; 
    17938 
    18039    if (packet->status == CDataPacket::NO_ERROR) 
     
    18847    , op(operatorExpr.getOpScalarFieldField(op)) 
    18948    , value(value) 
    190   {  
    191     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    192     /* Nothing to do */  
    193   }; 
    194  
    195   std::tuple<int, int, int> CScalarFieldFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
    196   { 
    197     bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    198     int unique_filter_id; 
    199  
    200     bool firstround; 
    201  
    202     if(building_graph) 
    203     {   
    204       CWorkflowGraph::allocNodeEdge(); 
    205  
    206       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
    207  
    208       // first round 
    209       if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 
    210       { 
    211         firstround = true; 
    212         this->filterID = InvalidableObject::filterIdGenerator++; 
    213         int edgeID = InvalidableObject::edgeIdGenerator++; 
    214      
    215         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
    216         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    217         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
    218  
    219         if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
    220      
    221         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    222         if(CWorkflowGraph::build_begin) 
    223         { 
    224  
    225           CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
    226           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    227  
    228           edgeID = InvalidableObject::edgeIdGenerator++; 
    229  
    230           CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); 
    231           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    232  
    233           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 
    234           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 
    235         } 
    236         CWorkflowGraph::build_begin = true; 
    237  
    238         (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID;  
    239         unique_filter_id = this->filterID; 
    240   
    241       } 
    242       // not first round 
    243       else  
    244       { 
    245         firstround = false; 
    246         unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 
    247         if(data[0]->src_filterID != unique_filter_id) 
    248         { 
    249           int edgeID = InvalidableObject::edgeIdGenerator++; 
    250           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]);  
    251           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ;  
    252           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    253         } 
    254         if(data[1]->src_filterID != unique_filter_id) 
    255         {  
    256           int edgeID = InvalidableObject::edgeIdGenerator++; 
    257           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]);   
    258           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 
    259           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    260         } 
    261          
    262       }   
    263     } 
    264  
    265     return std::make_tuple(building_graph, firstround, unique_filter_id); 
    266   } 
     49  { /* Nothing to do */ }; 
    26750 
    26851  CDataPacketPtr CScalarFieldFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    27255    packet->timestamp = data[0]->timestamp; 
    27356    packet->status = data[0]->status; 
    274      
    275     std::tuple<int, int, int> graph = buildGraph(data); 
    276  
    277     if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 
    278     if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 
    279     if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 
    280  
    281     packet->field = this->field; 
    28257 
    28358    if (data[0]->status != CDataPacket::NO_ERROR) 
     
    30075    , value1(value1) 
    30176    , value2(value2) 
    302   {  
    303     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    304     /* Nothing to do */  
    305   }; 
    306  
    307   std::tuple<int, int, int> CFieldScalarScalarArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
    308   { 
    309     bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    310     int unique_filter_id; 
    311     bool firstround; 
    312  
    313     if(building_graph) 
    314     { 
    315       CWorkflowGraph::allocNodeEdge(); 
    316  
    317       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
    318  
    319       // first round 
    320       if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 
    321       { 
    322         firstround = true; 
    323         this->filterID = InvalidableObject::filterIdGenerator++; 
    324         int edgeID = InvalidableObject::edgeIdGenerator++; 
    325  
    326         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
    327         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    328         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
    329  
    330  
    331         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    332         if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
    333        
    334  
    335         if(CWorkflowGraph::build_begin) 
    336         { 
    337           CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
    338           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    339  
    340           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 
    341         } 
    342         else CWorkflowGraph::build_begin = true; 
    343  
    344         (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID;  
    345         unique_filter_id = this->filterID; 
    346       } 
    347       // not first round 
    348       else  
    349       { 
    350         firstround=false; 
    351         unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 
    352         if(data[0]->src_filterID != unique_filter_id) 
    353         { 
    354           int edgeID = InvalidableObject::edgeIdGenerator++; 
    355           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]);   
    356           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ;  
    357           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    358         } 
    359       }   
    360     } 
    361  
    362     return std::make_tuple(building_graph, firstround, unique_filter_id); 
    363   } 
     77  { /* Nothing to do */ }; 
    36478 
    36579  CDataPacketPtr CFieldScalarScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    36983    packet->timestamp = data[0]->timestamp; 
    37084    packet->status = data[0]->status; 
    371  
    372     std::tuple<int, int, int> graph = buildGraph(data); 
    373  
    374     if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 
    375     if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 
    376     if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 
    377  
    378     packet->field = this->field; 
    37985 
    38086    if (packet->status == CDataPacket::NO_ERROR) 
     
    38995    , op(operatorExpr.getOpFieldScalarField(op)) 
    39096    , value(value) 
    391   {  
    392     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    393     /* Nothing to do */  
    394   }; 
    395  
    396   std::tuple<int, int, int> CFieldScalarFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
    397   { 
    398     bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    399     int unique_filter_id; 
    400  
    401     bool firstround; 
    402  
    403     if(building_graph) 
    404     {   
    405       CWorkflowGraph::allocNodeEdge(); 
    406  
    407       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
    408  
    409       // first round 
    410       if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 
    411       { 
    412         firstround = true; 
    413         this->filterID = InvalidableObject::filterIdGenerator++; 
    414         int edgeID = InvalidableObject::edgeIdGenerator++; 
    415      
    416         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
    417         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    418         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
    419  
    420         if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
    421      
    422         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    423         if(CWorkflowGraph::build_begin) 
    424         { 
    425  
    426           CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
    427           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    428  
    429           edgeID = InvalidableObject::edgeIdGenerator++; 
    430  
    431           CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); 
    432           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    433  
    434           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 
    435           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 
    436         } 
    437         CWorkflowGraph::build_begin = true; 
    438  
    439         (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID;  
    440         unique_filter_id = this->filterID; 
    441   
    442       } 
    443       // not first round 
    444       else  
    445       { 
    446         firstround = false; 
    447         unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 
    448         if(data[0]->src_filterID != unique_filter_id) 
    449         { 
    450           int edgeID = InvalidableObject::edgeIdGenerator++; 
    451           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]);  
    452           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ;  
    453           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    454         } 
    455         if(data[1]->src_filterID != unique_filter_id) 
    456         {  
    457           int edgeID = InvalidableObject::edgeIdGenerator++; 
    458           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]);   
    459           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 
    460           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    461         } 
    462          
    463       }   
    464     } 
    465  
    466     return std::make_tuple(building_graph, firstround, unique_filter_id); 
    467   } 
     97  { /* Nothing to do */ }; 
    46898 
    46999  CDataPacketPtr CFieldScalarFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    473103    packet->timestamp = data[0]->timestamp; 
    474104    packet->status = data[0]->status; 
    475      
    476     std::tuple<int, int, int> graph = buildGraph(data); 
    477  
    478     if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 
    479     if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 
    480     if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 
    481  
    482     packet->field = this->field; 
    483105 
    484106    if (data[0]->status != CDataPacket::NO_ERROR) 
     
    498120    , op(operatorExpr.getOpFieldFieldScalar(op)) 
    499121    , value(value) 
    500   {  
    501     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    502     std::cout<<"expression = "<<expression; 
    503     /* Nothing to do */  
    504   }; 
    505  
    506   std::tuple<int, int, int> CFieldFieldScalarArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
    507   { 
    508     bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    509     int unique_filter_id; 
    510  
    511     bool firstround; 
    512  
    513     if(building_graph) 
    514     {   
    515       CWorkflowGraph::allocNodeEdge(); 
    516  
    517       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
    518  
    519       // first round 
    520       if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 
    521       { 
    522         firstround = true; 
    523         this->filterID = InvalidableObject::filterIdGenerator++; 
    524         int edgeID = InvalidableObject::edgeIdGenerator++; 
    525      
    526         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
    527         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    528         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
    529  
    530         if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
    531      
    532         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    533         if(CWorkflowGraph::build_begin) 
    534         { 
    535  
    536           CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
    537           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    538  
    539           edgeID = InvalidableObject::edgeIdGenerator++; 
    540  
    541           CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); 
    542           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    543  
    544           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 
    545           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 
    546         } 
    547         CWorkflowGraph::build_begin = true; 
    548  
    549         (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID;  
    550         unique_filter_id = this->filterID; 
    551   
    552       } 
    553       // not first round 
    554       else  
    555       { 
    556         firstround = false; 
    557         unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 
    558         if(data[0]->src_filterID != unique_filter_id) 
    559         { 
    560           int edgeID = InvalidableObject::edgeIdGenerator++; 
    561           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]);  
    562           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ;  
    563           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    564         } 
    565         if(data[1]->src_filterID != unique_filter_id) 
    566         {  
    567           int edgeID = InvalidableObject::edgeIdGenerator++; 
    568           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]);   
    569           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 
    570           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    571         } 
    572          
    573       }   
    574     } 
    575  
    576     return std::make_tuple(building_graph, firstround, unique_filter_id); 
    577   } 
     122  { /* Nothing to do */ }; 
    578123 
    579124  CDataPacketPtr CFieldFieldScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    583128    packet->timestamp = data[0]->timestamp; 
    584129    packet->status = data[0]->status; 
    585      
    586     std::tuple<int, int, int> graph = buildGraph(data); 
    587  
    588     if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 
    589     if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 
    590     if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 
    591  
    592     packet->field = this->field; 
    593130 
    594131    if (data[0]->status != CDataPacket::NO_ERROR) 
     
    608145    : CFilter(gc, 3, this) 
    609146    , op(operatorExpr.getOpFieldFieldField(op)) 
    610   {  
    611     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    612     /* Nothing to do */  
    613   }; 
    614  
    615   std::tuple<int, int, int> CFieldFieldFieldArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
    616   { 
    617     bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    618     int unique_filter_id; 
    619  
    620     bool firstround; 
    621  
    622     if(building_graph) 
    623     {   
    624       CWorkflowGraph::allocNodeEdge(); 
    625  
    626       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
    627  
    628       // first round 
    629       if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 
    630       { 
    631         firstround = true; 
    632         this->filterID = InvalidableObject::filterIdGenerator++; 
    633         int edgeID = InvalidableObject::edgeIdGenerator++; 
    634      
    635         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
    636         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    637         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
    638  
    639         if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
    640      
    641         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    642         if(CWorkflowGraph::build_begin) 
    643         { 
    644  
    645           CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
    646           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    647  
    648           edgeID = InvalidableObject::edgeIdGenerator++; 
    649  
    650           CWorkflowGraph::addEdge(edgeID, this->filterID, data[1]); 
    651           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    652  
    653           edgeID = InvalidableObject::edgeIdGenerator++; 
    654  
    655           CWorkflowGraph::addEdge(edgeID, this->filterID, data[2]); 
    656           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    657  
    658           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 
    659           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 
    660           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[2]->src_filterID].filter_filled = 0 ; 
    661         } 
    662         CWorkflowGraph::build_begin = true; 
    663  
    664         (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID;  
    665         unique_filter_id = this->filterID; 
    666   
    667       } 
    668       // not first round 
    669       else  
    670       { 
    671         firstround = false; 
    672         unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 
    673         if(data[0]->src_filterID != unique_filter_id) 
    674         { 
    675           int edgeID = InvalidableObject::edgeIdGenerator++; 
    676           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]);  
    677           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ;  
    678           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    679         } 
    680         if(data[1]->src_filterID != unique_filter_id) 
    681         {  
    682           int edgeID = InvalidableObject::edgeIdGenerator++; 
    683           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[1]);   
    684           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[1]->src_filterID].filter_filled = 0 ; 
    685           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    686         } 
    687         if(data[2]->src_filterID != unique_filter_id) 
    688         {  
    689           int edgeID = InvalidableObject::edgeIdGenerator++; 
    690           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[2]);   
    691           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[2]->src_filterID].filter_filled = 0 ; 
    692           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    693         } 
    694          
    695       }   
    696     } 
    697  
    698     return std::make_tuple(building_graph, firstround, unique_filter_id); 
    699   } 
     147  { /* Nothing to do */ }; 
    700148 
    701149  CDataPacketPtr CFieldFieldFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    705153    packet->timestamp = data[0]->timestamp; 
    706154    packet->status = data[0]->status; 
    707      
    708     std::tuple<int, int, int> graph = buildGraph(data); 
    709  
    710     if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 
    711     if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 
    712     if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 
    713  
    714     packet->field = this->field; 
    715155 
    716156    if (data[0]->status != CDataPacket::NO_ERROR) 
  • XIOS/dev/dev_trunk_graph/src/filter/ternary_arithmetic_filter.hpp

    r1686 r2019  
    55#include <string> 
    66#include "operator_expr.hpp" 
    7 #include <tuple> 
    87 
    98namespace xios 
     
    3736       */ 
    3837      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    39       std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    4038  }; // class CScalarScalarFieldArithmeticFilter 
    4139 
     
    6967       */ 
    7068      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    71       std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    7269  }; // class CScalarScalarFieldArithmeticFilter 
    7370 
     
    9895       */ 
    9996      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    100       std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    10197  }; // class CScalarScalarFieldArithmeticFilter 
    10298 
     
    131127       */ 
    132128      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    133       std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    134129  }; // class CFieldScalarScalarArithmeticFilter 
    135130 
     
    161156       */ 
    162157      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    163       std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    164158  }; // class CFieldScalarFieldArithmeticFilter 
    165159 
     
    191185       */ 
    192186      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    193       std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    194187  }; // class CFieldFielScalardArithmeticFilter 
    195188 
     
    219212       */ 
    220213      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    221       std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    222214  }; // class CFieldFielFieldArithmeticFilter 
    223215 
  • XIOS/dev/dev_trunk_graph/src/filter/unary_arithmetic_filter.cpp

    r1686 r2019  
    11#include "unary_arithmetic_filter.hpp" 
    2 #include "workflow_graph.hpp" 
    3 #include "yacc_var.hpp" 
    4 #include "file.hpp" 
    52 
    63namespace xios 
     
    96    : CFilter(gc, 1, this) 
    107    , op(operatorExpr.getOpField(op)) 
    11   {  
    12     expression.assign(*yacc_globalInputText_ptr, 0, yacc_globalInputText_ptr->size()-1); 
    13   }; 
    14  
    15   std::tuple<int, int, int> CUnaryArithmeticFilter::buildGraph(std::vector<CDataPacketPtr> data) 
    16   { 
    17     bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
    18     int unique_filter_id; 
    19     bool firstround; 
    20      
    21     if(building_graph) 
    22     { 
    23       CWorkflowGraph::allocNodeEdge(); 
    24       size_t filterhash = std::hash<StdString>{}(expression+to_string(data[0]->timestamp)+this->field->getId()); 
    25  
    26       // first round 
    27       if(CWorkflowGraph::mapHashFilterID_ptr->find(filterhash) == CWorkflowGraph::mapHashFilterID_ptr->end()) 
    28       { 
    29         firstround=true; 
    30         this->filterID = InvalidableObject::filterIdGenerator++; 
    31         int edgeID = InvalidableObject::edgeIdGenerator++; 
    32  
    33         CWorkflowGraph::addNode(this->filterID, "Arithmetic Filter\\n("+expression+")", 3, 1, 0, data[0]); 
    34         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].filter_tag = this->tag; 
    35         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
    36  
    37         (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
    38         if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
    39        
    40         if(CWorkflowGraph::build_begin) 
    41         { 
    42  
    43           CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
    44           (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].expected_entry_nb ++; 
    45  
    46           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ;  
    47         } 
    48         else CWorkflowGraph::build_begin = true; 
    49  
    50         (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash] = this->filterID;  
    51         unique_filter_id = this->filterID; 
    52       } 
    53       else  
    54       { 
    55         firstround=false; 
    56         unique_filter_id = (*CWorkflowGraph::mapHashFilterID_ptr)[filterhash]; 
    57         if(data[0]->src_filterID != unique_filter_id) 
    58         { 
    59           int edgeID = InvalidableObject::edgeIdGenerator++; 
    60           CWorkflowGraph::addEdge(edgeID, unique_filter_id, data[0]);  
    61           (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ;  
    62           (*CWorkflowGraph::mapFilters_ptr_with_info)[unique_filter_id].expected_entry_nb ++; 
    63         }    
    64       }  
    65    
    66     } 
    67  
    68     return std::make_tuple(building_graph, firstround, unique_filter_id); 
    69   } 
     8  { /* Nothing to do */ }; 
    709 
    7110  CDataPacketPtr CUnaryArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    7615    packet->status = data[0]->status; 
    7716 
    78     std::tuple<int, int, int> graph = buildGraph(data); 
    79  
    80     if(std::get<0>(graph)) packet->src_filterID = std::get<2>(graph); 
    81     if(std::get<0>(graph) && std::get<1>(graph)) packet->distance = data[0]->distance+1; 
    82     if(std::get<0>(graph) && !std::get<1>(graph)) packet->distance = data[0]->distance; 
    83  
    84     packet->field = this->field; 
    85  
    8617    if (packet->status == CDataPacket::NO_ERROR) 
    8718      packet->data.reference(op(data[0]->data)); 
  • XIOS/dev/dev_trunk_graph/src/filter/unary_arithmetic_filter.hpp

    r1686 r2019  
    3434       */ 
    3535      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
    36       std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    3736  }; // class CUnaryArithmeticFilter 
    3837} // namespace xios 
Note: See TracChangeset for help on using the changeset viewer.