Changeset 1704


Ignore:
Timestamp:
09/11/19 10:22:09 (15 months 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.

Location:
XIOS/trunk
Files:
6 added
79 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/GENERIC_TESTCASE/context_atm.xml

    r1676 r1704  
    289289   
    290290  <field_definition level="1" prec="8" operation="instant" freq_op="1ts" enabled=".true." default_value="1.e+20" detect_missing_value="true"> 
    291     <field id="field2D" grid_ref="grid2D"/> 
    292     <field id="field3D" grid_ref="grid3D" /> 
     291    <field id="field2D" grid_ref="grid2D" /> 
     292    <field id="field3D" grid_ref="grid3D" build_workflow_graph="true" /> 
    293293    <field id="pressure" grid_ref="grid3D"  /> 
    294     <field id="field3D_recv" read_access="true" grid_ref="grid3D"  field_ref="field3D"/> 
     294    <field id="field3D_recv" read_access="true" grid_ref="grid3D"  field_ref="field3D" /> 
    295295    <field id="field3D_resend" grid_ref="grid3D" /> 
    296296 
     
    363363  <file_definition  type="one_file" > 
    364364     
    365     <file id="atm_output" output_freq="1ts" type="one_file" enabled="true"> 
     365    <file id="atm_output" output_freq="4ts" type="one_file" enabled="true"> 
    366366<!--      <field field_ref="field3D" /> 
    367367      <field field_ref="field2D" />  
     
    385385 
    386386    <file id="atm_output_other" output_freq="1ts" type="one_file" enabled="true"> 
    387        <field field_ref="other_field3D" enabled="false"/> 
     387       <field field_ref="other_field3D" enabled="true"/> 
    388388       <field field_ref="other_field2D" enabled="true"/>  
    389        <field field_ref="other_field_X" enabled="false"/> 
    390        <field field_ref="other_field_Y" enabled="false"/> 
    391        <field field_ref="other_field_XY" enabled="false"/> 
    392        <field field_ref="other_field_Z" enabled="false"/> 
    393        <field field_ref="other_field_XYZ" enabled="false"/> 
    394        <field field_ref="other_field_XZ" enabled="false"/> 
    395        <field field_ref="other_field_YZ" enabled="false"/> 
     389       <field field_ref="other_field_X" enabled="true"/> 
     390       <field field_ref="other_field_Y" enabled="true"/> 
     391       <field field_ref="other_field_XY" enabled="true"/> 
     392       <field field_ref="other_field_Z" enabled="true"/> 
     393       <field field_ref="other_field_XYZ" enabled="true"/> 
     394       <field field_ref="other_field_XZ" enabled="true"/> 
     395       <field field_ref="other_field_YZ" enabled="true"/> 
    396396    </file> 
    397397 
     
    407407       <field field_ref="field_YZW" enabled="true"/> 
    408408    </file> 
     409     
    409410 
    410411    <file id="atm_output_reorder" output_freq="1ts" enabled="false" > 
  • XIOS/trunk/GENERIC_TESTCASE/iodef.xml

    r1676 r1704  
    66 
    77      <variable id="timestep"> 1h </variable> 
    8       <variable id="domain"> gaussian </variable> 
     8      <variable id="domain"> lmdz </variable> 
    99      <variable id="domain_mask"> true </variable> 
    1010      <variable id="axis_mask"> true </variable> 
  • XIOS/trunk/bld.cfg

    r1510 r1704  
    4646#bld::target test_remap.exe 
    4747bld::target xios_server.exe  
     48bld::target generic_testcase.exe  
    4849#bld::target test_regular.exe 
    4950#bld::target test_xios2_cmip6.exe 
    5051#bld::target test_new_features.exe test_unstruct_complete.exe  
    51 #bld::target test_remap.exe 
    52 #bld::target test_complete.exe 
    53 #bld::target test_client.exe 
     52bld::target test_remap.exe 
     53bld::target test_complete.exe 
     54bld::target test_client.exe 
    5455#bld::target test_unstruct_complete.exe 
    5556#bld::target test_unstructured.exe 
  • XIOS/trunk/inputs/iodef.xml

    r1202 r1704  
    77 
    88   <field_definition level="1" enabled=".TRUE."> 
    9      <field id="field_A"  operation="average" freq_op="3600s" grid_ref="grid_A"/> 
     9     <field id="field_A"  operation="average" freq_op="3600s" grid_ref="grid_A" /> 
     10     <field id="field_B"  operation="average" freq_op="3600s" grid_ref="grid_A"/> 
     11     <field id="field_C"  operation="average" freq_op="3600s" grid_ref="grid_A" /> 
    1012     <field id="field_Axis"  operation="average" freq_op="3600s" axis_ref="axis_A"/> 
    1113     <field id="field_Domain"  operation="average" freq_op="3600s" domain_ref="domain_A"/> 
     
    1517 
    1618 
    17    <file_definition type="one_file" par_access="collective" output_freq="1h" output_level="10" enabled=".FALSE."> 
    18       <file id="output" name="output" enabled=".TRUE."> 
     19   <file_definition type="one_file" par_access="collective" output_freq="1h" output_level="10" > 
     20       
     21     <file id="output2" name="output2" output_freq="4h" enabled=".FALSE."> 
     22        <field id="field_G" field_ref="field_A" name="field_G_zoom" grid_ref="grid_A_zoom" build_workflow_graph=".TRUE." build_workflow_graph_start="1h" build_workflow_graph_end="8h" />         
     23        <!-- <field field_ref="field_Scalar" name="field_A_scalar" build_workflow_graph=".TRUE."/>         --> 
     24     </file> 
     25 
     26 
     27     <file id="output1" name="output1" output_freq="24h" enabled=".TRUE."> 
    1928        <!-- <field field_ref="field_Domain" name="field_A" /> --> 
    20         <field field_ref="field_A" name="field_A" />  
    21         <field field_ref="field_A_zoom" name="field_B" /> 
     29        <field id="field_F" field_ref="field_A" name="field_24h" grid_ref="grid_A" build_workflow_graph=".TRUE." build_workflow_graph_start="4h" build_workflow_graph_end="24h"  />         
     30         
     31     </file>   
     32 
     33     <file id="output" name="output" enabled=".TRUE."> 
     34        <!-- <field field_ref="field_Domain" name="field_A" /> --> 
     35        <!-- <field field_ref="field_A" name="field_A_name"  build_workflow_graph=".FALSE." />  --> 
     36        <!-- <field field_ref="field_B" name="field_B_name"  build_workflow_graph=".FALSE."/>  --> 
     37        <!-- <field field_ref="field_C" name="field_C_name"  enabled=".TRUE." />  --> 
     38        <!-- <field id="field_D" field_ref="field_A" operation="instant" build_workflow_graph=".TRUE." name="field_D_name" build_workflow_graph_start="1h" build_workflow_graph_end="2h" > sqrt(field_A) </field> --> 
     39        <field id="field_E" field_ref="field_A" operation="instant" build_workflow_graph=".TRUE." name="field_E_name" build_workflow_graph_start="1h" build_workflow_graph_end="4h" > field_A + field_B + field_C</field> 
     40        <!-- <field field_ref="field_A_zoom" name="field_B" build_workflow_graph=".TRUE."/> --> 
    2241     </file> 
    23      <file id="output1" name="output1" enabled=".TRUE."> 
    24         <!-- <field field_ref="field_Domain" name="field_A" /> --> 
    25         <field field_ref="field_A" name="field_A" />         
    26      </file>  
    27      <file id="output2" name="output2" enabled=".TRUE."> 
    28         <!-- <field field_ref="field_Domain" name="field_A" /> --> 
    29         <field field_ref="field_Scalar" name="field_A" />         
    30      </file> 
     42 
     43      
    3144 <!--     <file id="output_s" name="output_s" mode="read" > 
    3245       <field id="field" name="field_A" grid_ref="grid_Scalar" operation="instant" /> 
     
    7992        <variable_group id="parameters" > 
    8093          <variable id="using_server" type="bool">false</variable> 
    81           <variable id="info_level" type="int">50</variable> 
     94          <variable id="info_level" type="int">80</variable> 
    8295          <variable id="print_file" type="bool">true</variable> 
    8396        </variable_group> 
  • XIOS/trunk/src/attribute.hpp

    r1622 r1704  
    4242            virtual void fromString(const StdString & str) = 0; 
    4343            virtual StdString dump(void) const = 0; 
     44            virtual StdString dump4graph(void) const = 0; 
    4445            virtual bool isEqual(const CAttribute& ) = 0; 
    4546 
  • XIOS/trunk/src/attribute_array.hpp

    r1622 r1704  
    5656            virtual bool fromBuffer(CBufferIn& buffer) { return _fromBuffer(buffer); } 
    5757            virtual string dump(void) const { return _dump();} 
     58            virtual string dump4graph(void) const { return _dump4graph();} 
    5859 
    5960            virtual void generateCInterface(ostream& oss,const string& className) ; 
     
    7172          StdString _toString(void) const; 
    7273          StdString _dump(void) const; 
     74          StdString _dump4graph(void) const; 
    7375          void _fromString(const StdString & str); 
    7476          bool _toBuffer  (CBufferOut& buffer) const; 
  • XIOS/trunk/src/attribute_array_impl.hpp

    r1622 r1704  
    138138    } 
    139139 
     140    template <typename T_numtype, int N_rank> 
     141    StdString CAttributeArray<T_numtype,N_rank>::_dump4graph(void) const 
     142    { 
     143      StdOStringStream oss; 
     144      if (! isEmpty() && this->hasId() && (this->numElements()!=0)) 
     145        oss << this->getName() << "=" << CArray<T_numtype, N_rank>::dump() << ""; 
     146      return (oss.str()); 
     147    } 
     148 
    140149 
    141150      template <typename T_numtype, int N_rank> 
  • XIOS/trunk/src/attribute_enum.hpp

    r1622 r1704  
    6363            virtual void fromString(const StdString & str) { if (str==resetInheritanceStr) { reset(); _canInherite=false ;}  else _fromString(str);} 
    6464            virtual StdString dump(void) const { return _toString();} 
     65            virtual StdString dump4graph(void) const { return _dump4graph();} 
    6566 
    6667            virtual bool toBuffer  (CBufferOut& buffer) const { return _toBuffer(buffer);}  
     
    7980          bool isEqual_(const CAttributeEnum& attr ); 
    8081          StdString _toString(void) const; 
     82          StdString _dump4graph(void) const; 
    8183          void _fromString(const StdString & str); 
    8284          bool _toBuffer  (CBufferOut& buffer) const; 
  • XIOS/trunk/src/attribute_enum_impl.hpp

    r1219 r1704  
    149149  } 
    150150 
     151template <class T> 
     152  StdString CAttributeEnum<T>::_dump4graph(void) const 
     153  { 
     154     StdOStringStream oss; 
     155     if (!CEnum<T>::isEmpty() && this->hasId()) 
     156        oss << this->getName() << "=" << CEnum<T>::toString() << "</br>"; 
     157     return (oss.str()); 
     158  } 
     159 
    151160  template <class T> 
    152161  void CAttributeEnum<T>::_fromString(const StdString & str) 
  • XIOS/trunk/src/attribute_map.cpp

    r1622 r1704  
    4848            { 
    4949              str.append(att.second->dump()); 
     50              str.append(" "); 
     51            } 
     52            else if (str.length() == maxNbChar) 
     53            { 
     54              str.append("..."); 
     55            } 
     56          } 
     57        } 
     58        return str; 
     59      } 
     60 
     61 
     62 
     63      StdString CAttributeMap::record4graphXiosAttributes(void) const 
     64      { 
     65        int maxNbChar = 250; 
     66        StdString str; 
     67        typedef std::pair<StdString, CAttribute*> StdStrAttPair; 
     68        auto it = SuperClassMap::begin(), end = SuperClassMap::end(); 
     69        for (; it != end; it++) 
     70        { 
     71          const StdStrAttPair& att = *it; 
     72          if (!att.second->isEmpty()) 
     73          { 
     74            if (str.length() < maxNbChar) 
     75            { 
     76              str.append(att.second->dump4graph()); 
    5077              str.append(" "); 
    5178            } 
  • XIOS/trunk/src/attribute_map.hpp

    r1622 r1704  
    3939            void clearAllAttributes(void); 
    4040            StdString dumpXiosAttributes(void) const; 
     41            StdString record4graphXiosAttributes(void) const; 
    4142 
    4243            void clearAttribute(const StdString& key); 
  • XIOS/trunk/src/attribute_template.hpp

    r1622 r1704  
    7575//            virtual void fromBinary(StdIStream & is); 
    7676            virtual StdString dump(void) const { return _dump();} 
     77            virtual StdString dump4graph(void) const { return _dump4graph();} 
    7778 
    7879            virtual bool toBuffer  (CBufferOut& buffer) const { return _toBuffer(buffer);} 
     
    100101          StdString _toString(void) const; 
    101102          StdString _dump(void) const; 
     103          StdString _dump4graph(void) const; 
    102104          void _fromString(const StdString & str); 
    103105          bool _toBuffer  (CBufferOut& buffer) const; 
  • XIOS/trunk/src/attribute_template_impl.hpp

    r1622 r1704  
    208208         if (!CType<T>::isEmpty() && this->hasId()) 
    209209            oss << this->getName() << "=\"" << CType<T>::dump() << "\""; 
     210         return (oss.str()); 
     211      } 
     212 
     213      template <class T> 
     214         StdString CAttributeTemplate<T>::_dump4graph(void) const 
     215      { 
     216         StdOStringStream oss; 
     217         if (!CType<T>::isEmpty() && this->hasId()) 
     218            oss << this->getName() << "=" << CType<T>::dump() << "</br>"; 
    210219         return (oss.str()); 
    211220      } 
  • XIOS/trunk/src/config/field_attribute.conf

    r1524 r1704  
    4040DECLARE_ATTRIBUTE(StdString, cell_methods) 
    4141DECLARE_ENUM4(cell_methods_mode,  overwrite, prefix, suffix, none) 
     42 
     43 
     44DECLARE_ATTRIBUTE(bool,      build_workflow_graph) 
     45DECLARE_ATTRIBUTE(CDuration, build_workflow_graph_start) 
     46DECLARE_ATTRIBUTE(CDuration, build_workflow_graph_end) 
  • XIOS/trunk/src/cxios.cpp

    r1639 r1704  
    1111#include "memtrack.hpp" 
    1212#include "registry.hpp" 
     13 
     14#include "graphviz.hpp" 
    1315 
    1416namespace xios 
     
    135137       globalRegistry->toFile("xios_registry.bin") ; 
    136138       delete globalRegistry ; 
     139       CGraphviz::buildWorkflowGraphVisjs_with_info(); 
    137140     } 
    138141 
  • XIOS/trunk/src/filter/binary_arithmetic_filter.cpp

    r804 r1704  
    11#include "binary_arithmetic_filter.hpp" 
     2#include "workflow_graph.hpp" 
     3#include "yacc_var.hpp" 
     4#include "file.hpp" 
     5 
    26 
    37namespace xios 
     
    711    , op(operatorExpr.getOpScalarField(op)) 
    812    , value(value) 
    9   { /* Nothing to do */ }; 
     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 
    1076 
    1177  CDataPacketPtr CScalarFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    1682    packet->status = data[0]->status; 
    1783 
     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; 
     91 
    1892    if (packet->status == CDataPacket::NO_ERROR) 
    1993      packet->data.reference(op(value, data[0]->data)); 
     
    26100    , op(operatorExpr.getOpFieldScalar(op)) 
    27101    , value(value) 
    28   { /* Nothing to do */ }; 
     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  } 
    29164 
    30165  CDataPacketPtr CFieldScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    35170    packet->status = data[0]->status; 
    36171 
     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; 
     179 
    37180    if (packet->status == CDataPacket::NO_ERROR) 
    38181      packet->data.reference(op(data[0]->data, value)); 
     
    44187    : CFilter(gc, 2, this) 
    45188    , op(operatorExpr.getOpFieldField(op)) 
    46   { /* Nothing to do */ }; 
     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  } 
    47268 
    48269  CDataPacketPtr CFieldFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    51272    packet->date = data[0]->date; 
    52273    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     
    53283 
    54284    if (data[0]->status != CDataPacket::NO_ERROR) 
     
    64294    return packet; 
    65295  } 
     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 
    66302} // namespace xios 
  • XIOS/trunk/src/filter/binary_arithmetic_filter.hpp

    r1542 r1704  
    66#include "operator_expr.hpp" 
    77#include <unordered_map> 
     8#include <tuple> 
    89 
    910namespace xios 
     
    2324       */ 
    2425      CScalarFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value); 
     26      StdString virtual GetName(void); 
     27 
    2528 
    2629    protected: 
     
    3538       */ 
    3639      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     40      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
     41       
     42 
    3743  }; // class CScalarFieldArithmeticFilter 
    3844 
     
    5157       */ 
    5258      CFieldScalarArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value); 
     59      StdString virtual GetName(void); 
     60 
    5361 
    5462    protected: 
     
    6371       */ 
    6472      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     73      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    6574  }; // class CFieldScalarArithmeticFilter 
    6675 
     
    7887       */ 
    7988      CFieldFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op); 
     89      StdString virtual GetName(void); 
     90 
    8091 
    8192    protected: 
     
    89100       */ 
    90101      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     102      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    91103  }; // class CFieldFieldArithmeticFilter 
    92104} // namespace xios 
  • XIOS/trunk/src/filter/data_packet.hpp

    r1542 r1704  
    99namespace xios 
    1010{ 
     11  class CField; 
    1112  /*! 
    1213   * A packet corresponds to a timestamped array of data. 
     
    2627    Time timestamp;         //!< Timestamp of the data 
    2728    StatusCode status;      //!< Status of the packet 
    28  
     29    int src_filterID; 
     30    std::vector<int> filterIDoutputs; 
     31    CField *field; 
     32    int distance; 
     33     
    2934    /*! 
    3035     * Creates a deep copy of the packet. 
  • XIOS/trunk/src/filter/file_writer_filter.cpp

    r1637 r1704  
    33#include "field.hpp" 
    44#include "utils.hpp" 
     5#include "workflow_graph.hpp" 
     6#include "graphviz.hpp" 
    57 
    68namespace xios 
     
    1517  } 
    1618 
     19  void CFileWriterFilter::buildGraph(std::vector<CDataPacketPtr> data) 
     20  { 
     21    bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph: false; 
     22     
     23    if(building_graph) 
     24    { 
     25      this->filterID = InvalidableObject::filterIdGenerator++; 
     26      int edgeID = InvalidableObject::edgeIdGenerator++; 
     27 
     28      CWorkflowGraph::allocNodeEdge(); 
     29      StdString namestring = to_string(this->field->name); 
     30      namestring.erase(0, 6); 
     31      namestring.erase(namestring.length()-1, 1); 
     32 
     33      CWorkflowGraph::addNode(this->filterID, namestring + "\\n("+this->field->file->getId()+".nc)", 6, 0, 1, data[0]); 
     34 
     35      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
     36      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
     37      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].clusterID =1; 
     38      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
     39 
     40      if(CXios::isClient && CWorkflowGraph::build_begin)  
     41      { 
     42 
     43        CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
     44 
     45        (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0 ; 
     46      } 
     47      else CWorkflowGraph::build_begin=true; 
     48    } 
     49  } 
     50 
    1751  void CFileWriterFilter::onInputReady(std::vector<CDataPacketPtr> data) 
    1852  { 
     53    buildGraph(data); 
     54     
    1955    const bool detectMissingValue = ( !field->default_value.isEmpty() && 
    2056                               ( (!field->detect_missing_value.isEmpty() || field->detect_missing_value == true) 
  • XIOS/trunk/src/filter/file_writer_filter.hpp

    r1358 r1704  
    33 
    44#include "input_pin.hpp" 
     5#include "file.hpp" 
     6#include "duration.hpp" 
    57 
    68namespace xios 
     
    1416  { 
    1517    public: 
     18      int tag; 
     19      Time start_graph; 
     20      Time end_graph; 
     21      CField* field; //<! The associated field 
     22      int filterID; 
     23      int distance; 
     24 
    1625      /*! 
    1726       * Constructs the filter (with one input slot) associated to the specified field 
     
    2231       */ 
    2332      CFileWriterFilter(CGarbageCollector& gc, CField* field); 
     33 
     34      inline StdString GetName(void) {return "File writer filter";}; 
     35 
    2436 
    2537      /*! 
     
    4456       */ 
    4557      void virtual onInputReady(std::vector<CDataPacketPtr> data); 
     58      void virtual buildGraph(std::vector<CDataPacketPtr> data); 
    4659 
    4760    private: 
    48       CField* field; //<! The associated field 
    4961      std::map<Time, CDataPacketPtr> packets; //<! The stored packets 
    5062  }; // class CFileWriterFilter 
  • XIOS/trunk/src/filter/filter.cpp

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

    r1358 r1704  
    2525       */ 
    2626      CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine); 
     27 
     28      StdString virtual GetName(void); 
    2729 
    2830      /*! 
     
    6264      bool virtual isDataExpected(const CDate& date) const; 
    6365 
     66       
     67       
     68 
     69      int filterID; 
     70      StdString expression; 
     71 
    6472    protected: 
    6573      IFilterEngine* engine; //!< The filter engine, might be the filter itself 
  • XIOS/trunk/src/filter/garbage_collector.cpp

    r1021 r1704  
    33namespace xios 
    44{ 
     5  int InvalidableObject::filterIdGenerator = 0; 
     6 
     7  int InvalidableObject::edgeIdGenerator = 0; 
     8 
     9  int InvalidableObject::clusterIdGenerator = 0; 
     10   
    511  void CGarbageCollector::registerObject(InvalidableObject* Object, Time timestamp) 
    612  { 
  • XIOS/trunk/src/filter/garbage_collector.hpp

    r1021 r1704  
    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     
    2233  }; // struct InvalidableObject 
    2334 
  • XIOS/trunk/src/filter/input_pin.cpp

    r1021 r1704  
    33#include "garbage_collector.hpp" 
    44#include "exception.hpp" 
     5#include "workflow_graph.hpp" 
    56 
    67namespace xios 
     
    1112    , triggers(slotsCount) 
    1213    , hasTriggers(false) 
    13   { /* Nothing to do */ } 
     14  {  } 
     15 
     16  StdString CInputPin::GetName(void) 
     17  { 
     18    return StdString("Input pin"); 
     19  } 
    1420 
    1521  void CInputPin::setInput(size_t inputSlot, CDataPacketPtr packet) 
  • XIOS/trunk/src/filter/input_pin.hpp

    r1358 r1704  
    2626       */ 
    2727      CInputPin(CGarbageCollector& gc, size_t slotsCount); 
     28       
     29      StdString virtual GetName(void); 
    2830 
    2931      /*! 
  • XIOS/trunk/src/filter/output_pin.cpp

    r1542 r1704  
    11#include "output_pin.hpp" 
    22#include "exception.hpp" 
     3#include "workflow_graph.hpp" 
    34 
    45namespace xios 
     
    78    : gc(gc) 
    89    , manualTrigger(manualTrigger) 
    9   { /* Nothing to do */ } 
     10  {  } 
     11 
     12  StdString COutputPin::GetName(void) 
     13  { 
     14    return StdString("Output pin"); 
     15  } 
    1016 
    1117  void COutputPin::connectOutput(std::shared_ptr<CInputPin> inputPin, size_t inputSlot) 
     
    101107    outputPackets.erase(outputPackets.begin(), outputPackets.lower_bound(timestamp)); 
    102108  } 
     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 
    103131} // namespace xios 
  • XIOS/trunk/src/filter/output_pin.hpp

    r1542 r1704  
    44#include "garbage_collector.hpp" 
    55#include "input_pin.hpp" 
     6#include "duration.hpp" 
    67 
    78namespace xios 
    89{ 
     10  class CField; 
     11  class CInputPin; 
     12  class CFilter; 
     13  class CDuration; 
    914  /*! 
    1015   * An output pin handles the connections with downstream filters. 
     
    1318  { 
    1419    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 
    1530      /*! 
    1631       * Constructs an ouput pin with manual or automatic trigger 
     
    2237      COutputPin(CGarbageCollector& gc, bool manualTrigger = false); 
    2338 
     39      StdString virtual GetName(void); 
     40       
    2441      /*! 
    2542       * Connects to a specific slot of the input pin of a downstream filter. 
     
    6683      void virtual invalidate(Time timestamp); 
    6784 
     85      void virtual setParentFiltersTag(); 
     86 
     87 
    6888    protected: 
    6989      /*! 
  • XIOS/trunk/src/filter/pass_through_filter.cpp

    r641 r1704  
    11#include "pass_through_filter.hpp" 
     2#include "workflow_graph.hpp" 
     3#include "field.hpp" 
     4#include "file.hpp" 
    25 
    36namespace xios 
     
    58  CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc) 
    69    : CFilter(gc, 1, this) 
    7   { /* Nothing to do */ } 
     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  } 
    847 
    948  CDataPacketPtr CPassThroughFilter::apply(std::vector<CDataPacketPtr> data) 
    1049  { 
     50    if(CXios::isClient) buildGraph(data); 
    1151    return data[0]; 
    1252  } 
  • XIOS/trunk/src/filter/pass_through_filter.hpp

    r641 r1704  
    2020      CPassThroughFilter(CGarbageCollector& gc); 
    2121 
     22      inline StdString GetName(void) {return StdString("Pass through filter");}; 
     23 
    2224    protected: 
    2325      /*! 
     
    2830       */ 
    2931      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     32      void virtual buildGraph(std::vector<CDataPacketPtr> data); 
    3033  }; // class CPassThroughFilter 
    3134} // namespace xios 
  • XIOS/trunk/src/filter/source_filter.cpp

    r1637 r1704  
    44#include "calendar_util.hpp" 
    55#include <limits>  
     6#include "workflow_graph.hpp" 
    67 
    78namespace xios 
     
    2324            "Impossible to construct a source filter without providing a grid."); 
    2425  } 
     26 
     27  void CSourceFilter::buildGraph(CDataPacketPtr packet) 
     28  { 
     29    bool building_graph = this->tag ? packet->timestamp >= this->field->field_graph_start && packet->timestamp <= this->field->field_graph_end : false; 
     30    if(building_graph) 
     31    { 
     32      this->filterID = InvalidableObject::filterIdGenerator++;   
     33      packet->src_filterID=this->filterID; 
     34      packet->field = this->field; 
     35      packet->distance = 1; 
     36       
     37     
     38      CWorkflowGraph::allocNodeEdge(); 
     39 
     40      CWorkflowGraph::addNode(this->filterID, "Source Filter ", 1, 1, 0, packet); 
     41      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
     42      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].field_id = this->field->getId(); 
     43      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = 1; 
     44 
     45      CWorkflowGraph::build_begin = true; 
     46    } 
     47 
     48  } 
     49 
    2550 
    2651  template <int N> 
     
    5984      } 
    6085    } 
     86 
     87    if(CXios::isClient) buildGraph(packet); 
     88     
     89 
    6190 
    6291    onOutputReady(packet); 
  • XIOS/trunk/src/filter/source_filter.hpp

    r1637 r1704  
    3535                    double defaultValue = 0.0); 
    3636 
     37      inline StdString GetName(void) {return StdString("Source filter");}; 
     38 
    3739      /*! 
    3840       * Transforms the data received from the model into a packet and send it 
     
    4547      template <int N> 
    4648      void streamData(CDate date, const CArray<double, N>& data); 
     49 
     50      void virtual buildGraph(CDataPacketPtr packet); 
    4751 
    4852      /*! 
     
    6266       */ 
    6367      void signalEndOfStream(CDate date); 
     68      int filterID; 
    6469 
    6570    private: 
  • XIOS/trunk/src/filter/spatial_transform_filter.cpp

    r1645 r1704  
    44#include "context_client.hpp" 
    55#include "timer.hpp" 
     6#include "workflow_graph.hpp" 
     7#include "file.hpp" 
    68 
    79namespace xios 
     
    6466  { 
    6567    CSpatialTransformFilterEngine* spaceFilter = static_cast<CSpatialTransformFilterEngine*>(engine); 
    66     CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue); 
     68    CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue, this->tag, this->start_graph, this->end_graph, this->field); 
    6769    if (outputPacket) 
    6870      onOutputReady(outputPacket); 
     
    9698  { 
    9799    CSpatialTransformFilterEngine* spaceFilter = static_cast<CSpatialTransformFilterEngine*>(engine); 
    98     CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue); 
     100    CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue, this->tag, this->start_graph, this->end_graph, this->field); 
    99101 
    100102    if (outputPacket) 
     
    121123        packet->data.resize(tmpData.numElements()); 
    122124        packet->data = tmpData; 
     125        packet->field = this->field; 
    123126        onOutputReady(packet); 
    124127        tmpData.resize(0) ; 
     
    159162  } 
    160163 
    161   CDataPacketPtr CSpatialTransformFilterEngine::applyFilter(std::vector<CDataPacketPtr> data, double defaultValue) 
    162   { 
     164  bool CSpatialTransformFilterEngine::buildGraph(std::vector<CDataPacketPtr> data, int tag, Time start_graph, Time end_graph, CField *field) 
     165  { 
     166    bool building_graph = tag ? data[0]->timestamp >= start_graph && data[0]->timestamp <= end_graph : false; 
     167    if(building_graph) 
     168    { 
     169      this->filterID = InvalidableObject::filterIdGenerator++; 
     170      int edgeID = InvalidableObject::edgeIdGenerator++;     
     171 
     172      CWorkflowGraph::allocNodeEdge(); 
     173 
     174      CWorkflowGraph::addNode(this->filterID, "Spatial Transform Filter", 4, 1, 1, data[0]); 
     175      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = data[0]->distance+1; 
     176      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = field->record4graphXiosAttributes(); 
     177      if(field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +field->file->record4graphXiosAttributes(); 
     178 
     179 
     180      if(CWorkflowGraph::build_begin) 
     181      { 
     182        CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]); 
     183 
     184        (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0; 
     185      } 
     186      else CWorkflowGraph::build_begin = true; 
     187    } 
     188 
     189    return building_graph; 
     190  } 
     191 
     192  CDataPacketPtr CSpatialTransformFilterEngine::applyFilter(std::vector<CDataPacketPtr> data, double defaultValue, int tag, Time start_graph, Time end_graph, CField *field) 
     193  { 
     194     
     195    bool BG = buildGraph(data, tag, start_graph, end_graph, field); 
     196 
    163197    CDataPacketPtr packet(new CDataPacket); 
    164198    packet->date = data[0]->date; 
     
    177211      if (0 != packet->data.numElements()) 
    178212        (packet->data)(0) = defaultValue; 
    179       apply(data[0]->data, packet->data); 
    180     } 
     213      if(BG) apply(data[0]->data, packet->data, this->filterID); 
     214      else apply(data[0]->data, packet->data); 
     215    } 
     216 
     217    if(BG) packet->src_filterID=this->filterID; 
     218    if(BG) packet->distance=data[0]->distance+1; 
     219    packet->field = field; 
    181220 
    182221    return packet; 
    183222  } 
    184223 
    185   void CSpatialTransformFilterEngine::apply(const CArray<double, 1>& dataSrc, CArray<double,1>& dataDest) 
     224  void CSpatialTransformFilterEngine::apply(const CArray<double, 1>& dataSrc, CArray<double,1>& dataDest, int filterID) 
    186225  { 
    187226    CTimer::get("CSpatialTransformFilterEngine::apply").resume();  
     
    296335        const std::vector<std::pair<int,double> >& localIndex_p = itRecv->second; 
    297336        int srcRank = itRecv->first; 
     337 
     338        if(filterID >=0) // building_graph 
     339        { 
     340           (*CWorkflowGraph::mapFilters_ptr_with_info)[filterID].filter_name = (*itAlgo)->getName(); 
     341        }  
    298342        if (srcRank != rank) 
    299343        { 
  • XIOS/trunk/src/filter/spatial_transform_filter.hpp

    r1542 r1704  
    33 
    44#include "filter.hpp" 
     5#include "field.hpp" 
    56 
    67namespace xios 
     
    910  class CGridTransformation; 
    1011  class CSpatialTransformFilterEngine; 
     12 
     13  class CField; 
    1114 
    1215  /*! 
     
    2427       * \param [in] inputSlotsCount number of input, by default there is only one for field src 
    2528       */ 
    26       CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, double outputValue, size_t inputSlotsCount = 1); 
     29      CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, 
     30                              double outputValue, size_t inputSlotsCount = 1); 
     31 
     32      inline StdString GetName(void) {return StdString("Spatial transform filter");}; 
    2733 
    2834      /*! 
     
    9399  { 
    94100    public: 
     101 
     102      int filterID; 
     103      int tag; 
     104      CField *field; 
    95105      /*! 
    96106       * Returns the engine wrapping the specified grid transformation. 
     
    109119       * \return the result of the grid transformation 
    110120       */ 
    111       CDataPacketPtr applyFilter(std::vector<CDataPacketPtr> data, double defaultValue = 0); 
     121      CDataPacketPtr applyFilter(std::vector<CDataPacketPtr> data, double defaultValue = 0, int tag=0, Time start_graph=0, Time end_graph=-1, CField *field=0); 
     122      bool buildGraph(std::vector<CDataPacketPtr> data, int tag=0, Time start_graph=0, Time end_graph=-1, CField *field=0); 
    112123 
    113124       /*! 
     
    136147       * \param dataDest the resulting transformed data 
    137148       */ 
    138       void apply(const CArray<double, 1>& dataSrc, CArray<double,1>& dataDest); 
     149      void apply(const CArray<double, 1>& dataSrc, CArray<double,1>& dataDest, int filterID=-1); 
    139150 
    140151      CGridTransformation* gridTransformation; //!< The grid transformation used by the engine 
  • XIOS/trunk/src/filter/store_filter.cpp

    r1474 r1704  
    33#include "grid.hpp" 
    44#include "timer.hpp" 
     5#include "file.hpp" 
    56 
    67namespace xios 
     
    7677  template CDataPacket::StatusCode CStoreFilter::getData<7>(Time timestamp, CArray<double, 7>& data); 
    7778 
     79  void CStoreFilter::buildGraph(std::vector<CDataPacketPtr> data) 
     80  { 
     81    bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
     82 
     83    if(building_graph) 
     84    { 
     85      this->filterID = InvalidableObject::filterIdGenerator++; 
     86      int edgeID = InvalidableObject::edgeIdGenerator++; 
     87 
     88      CWorkflowGraph::allocNodeEdge(); 
     89  
     90      CWorkflowGraph::addNode(this->filterID, "Store Filter", 7, 0, 1, data[0]); 
     91      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = ++(data[0]->distance); 
     92      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
     93      if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes(); 
     94 
     95      // if(CXios::isClient) std::cout<<"CStoreFilter::apply filter tag = "<<this->tag<<std::endl; 
     96 
     97      if(CXios::isClient && CWorkflowGraph::build_begin)  
     98      { 
     99        CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]);; 
     100        (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0; 
     101      } 
     102      else CWorkflowGraph::build_begin = true; 
     103    } 
     104  } 
     105 
    78106  void CStoreFilter::onInputReady(std::vector<CDataPacketPtr> data) 
    79107  { 
     108    buildGraph(data); 
    80109 
    81110    CDataPacketPtr packet; 
  • XIOS/trunk/src/filter/store_filter.hpp

    r1358 r1704  
    33 
    44#include "input_pin.hpp" 
     5#include "workflow_graph.hpp" 
     6 
    57 
    68namespace xios 
     
    810  class CContext; 
    911  class CGrid; 
     12  class CField; 
    1013 
    1114  /*! 
     
    7376      void virtual invalidate(Time timestamp); 
    7477 
     78      int filterID; 
     79      int tag; 
     80      Time start_graph; 
     81      Time end_graph; 
     82      CField *field; 
     83      int distance; 
     84 
     85 
    7586    protected: 
    7687      /*! 
     
    8091       */ 
    8192      void virtual onInputReady(std::vector<CDataPacketPtr> data); 
     93      void virtual buildGraph(std::vector<CDataPacketPtr> data); 
    8294 
    8395    private: 
  • 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    } 
  • XIOS/trunk/src/filter/temporal_filter.hpp

    r1473 r1704  
    3131                      bool ignoreMissingValue = false); 
    3232 
     33      inline StdString GetName(void) {return StdString("Temporal filter");}; 
     34 
    3335      /*! 
    3436       * Applies the temporal operation to the input data and returns the result when it is ready. 
     
    3840       */ 
    3941      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     42      bool virtual buildGraph(std::vector<CDataPacketPtr> data); 
    4043 
    4144      /*! 
     
    5255       */ 
    5356      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; 
    5461 
    5562    private: 
  • XIOS/trunk/src/filter/ternary_arithmetic_filter.cpp

    r1162 r1704  
    11#include "ternary_arithmetic_filter.hpp" 
     2#include "workflow_graph.hpp" 
     3#include "yacc_var.hpp" 
     4#include "file.hpp" 
    25 
    36namespace xios 
     
    811    , value1(value1) 
    912    , value2(value2) 
    10   { /* Nothing to do */ }; 
     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  } 
    1175 
    1276  CDataPacketPtr CScalarScalarFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    1680    packet->timestamp = data[0]->timestamp; 
    1781    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; 
    1890 
    1991    if (packet->status == CDataPacket::NO_ERROR) 
     
    28100    , value1(value1) 
    29101    , value2(value2) 
    30   { /* Nothing to do */ }; 
     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  } 
    31164 
    32165  CDataPacketPtr CScalarFieldScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    36169    packet->timestamp = data[0]->timestamp; 
    37170    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; 
    38179 
    39180    if (packet->status == CDataPacket::NO_ERROR) 
     
    47188    , op(operatorExpr.getOpScalarFieldField(op)) 
    48189    , value(value) 
    49   { /* Nothing to do */ }; 
     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  } 
    50267 
    51268  CDataPacketPtr CScalarFieldFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    55272    packet->timestamp = data[0]->timestamp; 
    56273    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; 
    57282 
    58283    if (data[0]->status != CDataPacket::NO_ERROR) 
     
    75300    , value1(value1) 
    76301    , value2(value2) 
    77   { /* Nothing to do */ }; 
     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  } 
    78364 
    79365  CDataPacketPtr CFieldScalarScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    84370    packet->status = data[0]->status; 
    85371 
     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; 
     379 
    86380    if (packet->status == CDataPacket::NO_ERROR) 
    87381      packet->data.reference(op(data[0]->data, value1, value2)); 
     
    95389    , op(operatorExpr.getOpFieldScalarField(op)) 
    96390    , value(value) 
    97   { /* Nothing to do */ }; 
     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  } 
    98468 
    99469  CDataPacketPtr CFieldScalarFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    103473    packet->timestamp = data[0]->timestamp; 
    104474    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; 
    105483 
    106484    if (data[0]->status != CDataPacket::NO_ERROR) 
     
    120498    , op(operatorExpr.getOpFieldFieldScalar(op)) 
    121499    , value(value) 
    122   { /* Nothing to do */ }; 
     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  } 
    123578 
    124579  CDataPacketPtr CFieldFieldScalarArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    128583    packet->timestamp = data[0]->timestamp; 
    129584    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; 
    130593 
    131594    if (data[0]->status != CDataPacket::NO_ERROR) 
     
    145608    : CFilter(gc, 3, this) 
    146609    , op(operatorExpr.getOpFieldFieldField(op)) 
    147   { /* Nothing to do */ }; 
     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  } 
    148700 
    149701  CDataPacketPtr CFieldFieldFieldArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    153705    packet->timestamp = data[0]->timestamp; 
    154706    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; 
    155715 
    156716    if (data[0]->status != CDataPacket::NO_ERROR) 
  • XIOS/trunk/src/filter/ternary_arithmetic_filter.hpp

    r1162 r1704  
    55#include <string> 
    66#include "operator_expr.hpp" 
     7#include <tuple> 
    78 
    89namespace xios 
     
    3637       */ 
    3738      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     39      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    3840  }; // class CScalarScalarFieldArithmeticFilter 
    3941 
     
    6769       */ 
    6870      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     71      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    6972  }; // class CScalarScalarFieldArithmeticFilter 
    7073 
     
    9598       */ 
    9699      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     100      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    97101  }; // class CScalarScalarFieldArithmeticFilter 
    98102 
     
    127131       */ 
    128132      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     133      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    129134  }; // class CFieldScalarScalarArithmeticFilter 
    130135 
     
    156161       */ 
    157162      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     163      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    158164  }; // class CFieldScalarFieldArithmeticFilter 
    159165 
     
    185191       */ 
    186192      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     193      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    187194  }; // class CFieldFielScalardArithmeticFilter 
    188195 
     
    212219       */ 
    213220      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     221      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    214222  }; // class CFieldFielFieldArithmeticFilter 
    215223 
  • XIOS/trunk/src/filter/unary_arithmetic_filter.cpp

    r643 r1704  
    11#include "unary_arithmetic_filter.hpp" 
     2#include "workflow_graph.hpp" 
     3#include "yacc_var.hpp" 
     4#include "file.hpp" 
    25 
    36namespace xios 
     
    69    : CFilter(gc, 1, this) 
    710    , op(operatorExpr.getOpField(op)) 
    8   { /* Nothing to do */ }; 
     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  } 
    970 
    1071  CDataPacketPtr CUnaryArithmeticFilter::apply(std::vector<CDataPacketPtr> data) 
     
    1576    packet->status = data[0]->status; 
    1677 
     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 
    1786    if (packet->status == CDataPacket::NO_ERROR) 
    1887      packet->data.reference(op(data[0]->data)); 
  • XIOS/trunk/src/filter/unary_arithmetic_filter.hpp

    r642 r1704  
    3434       */ 
    3535      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     36      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data); 
    3637  }; // class CUnaryArithmeticFilter 
    3738} // namespace xios 
  • XIOS/trunk/src/node/field.cpp

    r1639 r1704  
    2424#include "spatial_transform_filter.hpp" 
    2525#include "file_server_writer_filter.hpp" 
     26#include "workflow_graph.hpp" 
    2627 
    2728namespace xios{ 
     
    4546      , mustAutoTrigger(false) 
    4647      , isEOF(false), nstepMaxRead(false) 
    47    { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 
     48   { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group"));  
     49     field_graph_start = -2; 
     50     field_graph_end = -2; 
     51   } 
    4852 
    4953   CField::CField(const StdString& id) 
     
    6367      , mustAutoTrigger(false) 
    6468      , isEOF(false), nstepMaxRead(false) 
    65    { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group")); } 
     69   { setVirtualVariableGroup(CVariableGroup::create(getId() + "_virtual_variable_group"));  
     70     field_graph_start = -2; 
     71     field_graph_end = -2; 
     72   } 
     73 
    6674 
    6775   CField::~CField(void) 
     
    11061114    *                     read by the client or/and written to a file 
    11071115    */ 
    1108    void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput) 
     1116   void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput, Time start_graph, Time end_graph) 
    11091117   TRY 
    11101118   {      
    1111     if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 
    1112     if (!isGridChecked) checkGridOfEnabledFields(); 
     1119     if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 
     1120     if (!isGridChecked) checkGridOfEnabledFields(); 
    11131121 
    11141122     const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     1123      
     1124     const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
     1125 
     1126      
    11151127     const double defaultValue  = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
    11161128 
    11171129     CContext* context = CContext::getCurrent(); 
     1130      
     1131     Time filter_start; 
     1132     if(!build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = context->calendar->getInitDate()+build_workflow_graph_start; 
     1133     else if(build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = 0; 
     1134     else filter_start = -1; 
     1135 
     1136     Time filter_end; 
     1137     if(!build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = context->calendar->getInitDate()+build_workflow_graph_end; 
     1138     else if(build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = 9223372036854775807; 
     1139     else filter_end = -1; 
     1140 
     1141     if(this->field_graph_start==-2) this->field_graph_start = filter_start; 
     1142     if(this->field_graph_end==-2) this->field_graph_end = filter_end;         // init 
     1143 
     1144     // if(CXios::isClient) std::cout<<"****************** buildFilterGraph : field_id = "<<this->getId()<<" BEFORE: this->field_graph_start = "<<this->field_graph_start<<" this->field_graph_end = "<<this->field_graph_end<<std::endl; 
     1145 
     1146     if(start_graph == -1) 
     1147     { 
     1148       //nothing 
     1149       // if(CXios::isClient) std::cout<<"buildFilterGraph field_id = "<<this->getId()<<" case1: this->field_graph_start = "<<this->field_graph_start<<std::endl; 
     1150     } 
     1151     else //if(start_graph != -1) 
     1152     { 
     1153       if(this->field_graph_start == -1) this->field_graph_start = start_graph; 
     1154       else this->field_graph_start = min(this->field_graph_start, start_graph); 
     1155 
     1156       // if(CXios::isClient) std::cout<<"buildFilterGraph field_id = "<<this->getId()<<" case2: this->field_graph_start = "<<this->field_graph_start<<std::endl; 
     1157     } 
     1158 
     1159 
     1160     if(end_graph == -1) 
     1161     { 
     1162       //nothing 
     1163       // if(CXios::isClient) std::cout<<"buildFilterGraph field_id = "<<this->getId()<<" case1: this->field_graph_end = "<<this->field_graph_end<<std::endl; 
     1164     } 
     1165     else 
     1166     { 
     1167       if(this->field_graph_end == -1) this->field_graph_end = end_graph; 
     1168       else this->field_graph_end = max(this->field_graph_end, end_graph); 
     1169 
     1170       // if(CXios::isClient) std::cout<<"buildFilterGraph field_id = "<<this->getId()<<" case2: this->field_graph_end = "<<this->field_graph_end<<std::endl; 
     1171     } 
     1172     
     1173 
     1174     filter_start = this->field_graph_start; 
     1175     filter_end = this->field_graph_end; 
     1176 
     1177 
     1178     // if(CXios::isClient) std::cout<<"****************** buildFilterGraph : field_id = "<<this->getId()<<" AFTER: this->field_graph_start = "<<this->field_graph_start<<" this->field_graph_end = "<<this->field_graph_end<<std::endl; 
     1179      
     1180 
     1181      
     1182      
     1183 
    11181184     bool hasWriterServer = context->hasServer && !context->hasClient; 
    11191185     bool hasIntermediateServer = context->hasServer && context->hasClient; 
     
    11591225         { 
    11601226           boost::scoped_ptr<IFilterExprNode> expr(parseExpr(getExpression() + '\0')); 
    1161            std::shared_ptr<COutputPin> filter = expr->reduce(gc, *this); 
     1227           std::shared_ptr<COutputPin> filter = expr->reduce(gc, *this, filter_start, filter_end); 
    11621228 
    11631229           // Check if a spatial transformation is needed 
     
    11681234             if (grid && grid != gridRef && grid->hasTransform()) 
    11691235             { 
    1170                  std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue);  
     1236               std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue); 
    11711237 
    11721238               filter->connectOutput(filters.first, 0); 
     
    11761242 
    11771243           instantDataFilter = filter; 
     1244           instantDataFilter->field = this; 
     1245           filter->tag = buildWorkflowGraph; 
     1246            
     1247           filter->start_graph = filter_start; 
     1248           filter->end_graph = filter_end; 
     1249 
     1250           for(int i=0; i<filter->parent_filters.size(); i++) 
     1251           { 
     1252             filter->tag = filter->tag || filter->parent_filters[i]->tag; 
     1253           } 
    11781254         } 
    11791255         // Check if we have a reference on another field 
    11801256         else if (!field_ref.isEmpty()) 
    1181            instantDataFilter = getFieldReference(gc); 
     1257         { 
     1258           instantDataFilter = getFieldReference(gc, filter_start, filter_end); 
     1259           instantDataFilter->tag = buildWorkflowGraph; 
     1260           instantDataFilter->start_graph = filter_start; 
     1261           instantDataFilter->end_graph = filter_end; 
     1262         } 
    11821263         // Check if the data is to be read from a file 
    11831264         else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) 
     
    11861267           instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false, freq_offset, true, 
    11871268                                                                                                       detectMissingValues, defaultValue)); 
     1269           instantDataFilter->tag = buildWorkflowGraph; 
     1270           instantDataFilter->start_graph = filter_start; 
     1271           instantDataFilter->end_graph = filter_end; 
     1272           instantDataFilter->field = this; 
     1273 
    11881274         } 
    11891275         else // The data might be passed from the model 
     
    11911277            if (check_if_active.isEmpty()) check_if_active = false;  
    11921278            instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, true, NoneDu, false, 
    1193                                                                                                         detectMissingValues, defaultValue)); 
     1279                                                                                                      detectMissingValues, defaultValue));  
     1280            instantDataFilter->tag = buildWorkflowGraph; 
     1281            instantDataFilter->start_graph = filter_start; 
     1282            instantDataFilter->end_graph = filter_end; 
     1283            instantDataFilter->field = this; 
     1284            // if(CXios::isClient) std::cout<<"***********************buildFilterGraph init source filter : field_id = "<<this->getId()<<" sourcefilter->start_graph = "<<clientSourceFilter->start_graph<<" sourcefilter->end_graph = "<<clientSourceFilter->end_graph<<std::endl; 
    11941285         } 
    11951286       } 
     
    12031294                                                                          detectMissingValues, defaultValue)); 
    12041295           instantDataFilter->connectOutput(storeFilter, 0); 
     1296 
     1297           storeFilter->tag = (instantDataFilter->tag || buildWorkflowGraph); 
     1298           instantDataFilter->start_graph = filter_start; 
     1299           instantDataFilter->end_graph = filter_end; 
     1300 
     1301           instantDataFilter->setParentFiltersTag(); 
     1302           storeFilter->start_graph = filter_start; 
     1303           storeFilter->end_graph = filter_end; 
     1304           storeFilter->field = this; 
     1305           storeFilter->distance = instantDataFilter->distance+1; 
    12051306         } 
    12061307 
     
    12091310           fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 
    12101311           getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 
     1312            
     1313           fileWriterFilter->tag = (getTemporalDataFilter(gc, file->output_freq)->tag || buildWorkflowGraph); 
     1314           getTemporalDataFilter(gc, file->output_freq)->start_graph = filter_start; 
     1315           getTemporalDataFilter(gc, file->output_freq)->end_graph = filter_end; 
     1316           getTemporalDataFilter(gc, file->output_freq)->tag = buildWorkflowGraph; 
     1317           getTemporalDataFilter(gc, file->output_freq)->setParentFiltersTag(); 
     1318           fileWriterFilter->start_graph = filter_start; 
     1319           fileWriterFilter->end_graph = filter_end; 
     1320           fileWriterFilter->distance = getTemporalDataFilter(gc, file->output_freq)->distance+1; 
     1321 
     1322           // std::cout<<"CFileWriterFilter filter start = "<<filter_start<<" end = "<<filter_end<<" field = "<<this->getId()<<std::endl; 
     1323 
    12111324         } 
    12121325       } 
     
    12221335    * \return the output pin corresponding to the field reference 
    12231336    */ 
    1224    std::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc) 
     1337   std::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc, Time start_graph, Time end_graph) 
    12251338   TRY 
    12261339   { 
     
    12301343 
    12311344     CField* fieldRef = CField::get(field_ref); 
    1232      fieldRef->buildFilterGraph(gc, false); 
     1345     fieldRef->buildFilterGraph(gc, false, start_graph, end_graph); 
     1346     const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
     1347 
     1348     CContext* context = CContext::getCurrent(); 
     1349 
     1350     Time filter_start; 
     1351     if(!build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = context->calendar->getInitDate()+build_workflow_graph_start; 
     1352     else if(build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = 0; 
     1353     else filter_start = -1; 
     1354 
     1355     Time filter_end; 
     1356     if(!build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = context->calendar->getInitDate()+build_workflow_graph_end; 
     1357     else if(build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = 9223372036854775807; 
     1358     else filter_end = -1; 
     1359 
     1360     if(this->field_graph_start==-2) this->field_graph_start = filter_start; 
     1361     if(this->field_graph_end==-2) this->field_graph_end = filter_end;         // init 
     1362 
     1363     // if(CXios::isClient) std::cout<<"getFieldReference field_id = "<<this->getId()<<" BEFORE: this->field_graph_start = "<<this->field_graph_start<<" this->field_graph_end = "<<this->field_graph_end<<std::endl; 
     1364 
     1365     if(start_graph == -1) 
     1366     { 
     1367       //nothing 
     1368       // if(CXios::isClient) std::cout<<"getFieldReference field_id = "<<this->getId()<<" case1: this->field_graph_start = "<<this->field_graph_start<<std::endl; 
     1369     } 
     1370     else //if(start_graph != -1) 
     1371     { 
     1372       if(this->field_graph_start == -1) this->field_graph_start = start_graph; 
     1373       else this->field_graph_start = min(this->field_graph_start, start_graph); 
     1374 
     1375       // if(CXios::isClient) std::cout<<"getFieldReference field_id = "<<this->getId()<<" case2: this->field_graph_start = "<<this->field_graph_start<<std::endl; 
     1376     } 
     1377 
     1378     if(end_graph == -1) 
     1379     { 
     1380       //nothing 
     1381       // if(CXios::isClient) std::cout<<"getFieldReference field_id = "<<this->getId()<<" case1: this->field_graph_end = "<<this->field_graph_end<<std::endl; 
     1382     } 
     1383     else 
     1384     { 
     1385       if(this->field_graph_end == -1) this->field_graph_end = end_graph; 
     1386       else this->field_graph_end = max(this->field_graph_end, end_graph); 
     1387 
     1388       // if(CXios::isClient) std::cout<<"getFieldReference field_id = "<<this->getId()<<" case2: this->field_graph_end = "<<this->field_graph_end<<std::endl; 
     1389     } 
     1390 
     1391     filter_start = this->field_graph_start; 
     1392     filter_end = this->field_graph_end; 
     1393 
     1394     // if(CXios::isClient) std::cout<<"getFieldReference field_id = "<<this->getId()<<" AFTER: this->field_graph_start = "<<this->field_graph_start<<" this->field_graph_end = "<<this->field_graph_end<<std::endl; 
     1395 
    12331396 
    12341397     std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters; 
     
    12391402       double defaultValue  = hasMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0);                                 
    12401403       filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue); 
     1404 
     1405       fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 
     1406 
     1407      
     1408 
     1409       filters.second->parent_filters.resize(1); 
     1410       filters.second->parent_filters[0]= fieldRef->getInstantDataFilter(); 
     1411 
     1412       filters.second->tag = (buildWorkflowGraph || filters.second->parent_filters[0]->tag); 
     1413        
     1414       filters.second->start_graph = filter_start; 
     1415       filters.second->end_graph = filter_end; 
     1416       filters.second->field = this; 
     1417        
    12411418     } 
    12421419     else 
     1420     { 
    12431421       filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 
    12441422 
    1245      fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 
     1423       fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 
     1424      
     1425 
     1426       filters.second->parent_filters.resize(1); 
     1427       filters.second->parent_filters[0]= fieldRef->getInstantDataFilter(); 
     1428 
     1429       filters.second->tag = (buildWorkflowGraph || filters.second->parent_filters[0]->tag); 
     1430 
     1431       filters.second->start_graph = filter_start; 
     1432       filters.second->end_graph = filter_end; 
     1433       filters.second->field = this; 
     1434 
     1435     } 
    12461436 
    12471437     return filters.second; 
     
    12581448    * \return the output pin corresponding to a self reference 
    12591449    */ 
    1260    std::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc) 
    1261    TRY 
    1262    { 
     1450   std::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc, Time start_graph, Time end_graph) 
     1451   TRY 
     1452   { 
     1453     if(CXios::isClient) std::cout<<"getSelfReference field_id = "<<this->getId()<<" start_graph = "<<start_graph<<" end_graph = "<<end_graph<<std::endl; 
     1454 
    12631455     if (instantDataFilter || !hasExpression()) 
    12641456       ERROR("COutputPin* CField::getSelfReference(CGarbageCollector& gc)", 
    12651457             "Impossible to add a self reference to a field which has already been parsed or which does not have an expression."); 
     1458      
     1459     bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
    12661460 
    12671461     if (!selfReferenceFilter) 
     
    13001494     } 
    13011495 
     1496     selfReferenceFilter->tag = buildWorkflowGraph; 
     1497     selfReferenceFilter->field = this; 
    13021498     return selfReferenceFilter; 
    13031499   } 
     
    13171513   { 
    13181514     std::map<CDuration, std::shared_ptr<COutputPin> >::iterator it = temporalDataFilters.find(outFreq); 
     1515     const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
     1516 
     1517     CContext* context = CContext::getCurrent(); 
     1518 
    13191519 
    13201520     if (it == temporalDataFilters.end()) 
     
    13321532 
    13331533       instantDataFilter->connectOutput(temporalFilter, 0); 
     1534       // temporalFilter->tag = buildWorkflowGraph; 
     1535        
     1536       temporalFilter->parent_filters.resize(1); 
     1537       temporalFilter->parent_filters[0] = instantDataFilter; 
     1538        
     1539 
     1540       if(temporalFilter->parent_filters[0]->tag) temporalFilter->tag=true; 
     1541 
     1542       // temporalFilter->start_graph = filter_start; 
     1543       // temporalFilter->end_graph = filter_end; 
     1544       temporalFilter->field = this; 
    13341545 
    13351546       it = temporalDataFilters.insert(std::make_pair(outFreq, temporalFilter)).first; 
     
    13671578 
    13681579       const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); 
     1580       bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
    13691581       std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 
    1370                                                                              CContext::getCurrent()->getCalendar()->getInitDate(), 
    1371                                                                              freq_op, freq_offset, outFreq, detectMissingValues)); 
     1582                                                                           CContext::getCurrent()->getCalendar()->getInitDate(), 
     1583                                                                           freq_op, freq_offset, outFreq, detectMissingValues)); 
    13721584 
    13731585       selfReferenceFilter->connectOutput(temporalFilter, 0); 
     1586       temporalFilter->tag = buildWorkflowGraph; 
     1587       temporalFilter->field = this; 
     1588 
    13741589       return temporalFilter ; 
    13751590     } 
  • XIOS/trunk/src/node/field.hpp

    r1637 r1704  
    77#include "functor.hpp" 
    88#include "functor_type.hpp" 
     9#include "filter.hpp" 
    910#include "duration.hpp" 
    1011#include "date.hpp" 
     
    139140         void checkTimeAttributes(CDuration* freqOp=NULL); 
    140141 
    141          void buildFilterGraph(CGarbageCollector& gc, bool enableOutput); 
     142         void buildFilterGraph(CGarbageCollector& gc, bool enableOutput, Time start_graph=-1, Time end_graph=-1); 
    142143         size_t getGlobalWrittenSize(void) ; 
    143144          
    144145          
    145          std::shared_ptr<COutputPin> getFieldReference(CGarbageCollector& gc); 
    146          std::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc); 
     146         std::shared_ptr<COutputPin> getFieldReference(CGarbageCollector& gc, Time start_graph=-1, Time end_graph=-1); 
     147         std::shared_ptr<COutputPin> getSelfReference(CGarbageCollector& gc, Time start_graph=-1, Time end_graph=-1); 
    147148         std::shared_ptr<COutputPin> getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); 
    148149         std::shared_ptr<COutputPin> getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); 
     
    243244         bool hasTimeCentered; 
    244245 
     246         Time field_graph_start; 
     247         Time field_graph_end; 
     248 
    245249 
    246250         DECLARE_REF_FUNC(Field,field) 
  • XIOS/trunk/src/parse_expr/filter_expr_node.cpp

    r1575 r1704  
    1212 
    1313   
    14   std::shared_ptr<COutputPin> CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 
     14  std::shared_ptr<COutputPin> CFilterFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 
    1515  { 
    1616    std::shared_ptr<COutputPin> outputPin; 
     
    4040                << "Use the keyword \"this\" if you want to reference the input data sent to this field."); 
    4141 
    42         field->buildFilterGraph(gc, false); 
     42        // field->buildFilterGraph(gc, false); 
     43        field->buildFilterGraph(gc, false, start_graph, end_graph); 
    4344        outputPin = field->getInstantDataFilter(); 
    4445      } 
     
    5556 
    5657 
    57   std::shared_ptr<COutputPin> CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 
     58  std::shared_ptr<COutputPin> CFilterTemporalFieldExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 
    5859  { 
    5960    std::shared_ptr<COutputPin> outputPin; 
     
    104105  } 
    105106 
    106   std::shared_ptr<COutputPin> CFilterUnaryOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 
    107   { 
     107  std::shared_ptr<COutputPin> CFilterUnaryOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 
     108  { 
     109    std::shared_ptr<COutputPin> ch = child->reduce(gc, thisField, start_graph, end_graph); 
     110 
    108111    std::shared_ptr<CUnaryArithmeticFilter> filter(new CUnaryArithmeticFilter(gc, opId)); 
    109     child->reduce(gc, thisField)->connectOutput(filter, 0); 
     112    ch->connectOutput(filter, 0); 
     113 
     114    (filter->parent_filters).resize(1); 
     115    (filter->parent_filters)[0] = ch; 
     116 
     117    filter->tag = ch->tag; 
     118    filter->start_graph = ch->start_graph; 
     119    filter->end_graph = ch->end_graph; 
     120    filter->field = &thisField; 
     121 
     122 
    110123    return filter; 
    111124  } 
     
    121134  } 
    122135 
    123   std::shared_ptr<COutputPin> CFilterScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 
    124   { 
     136  std::shared_ptr<COutputPin> CFilterScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 
     137  { 
     138    std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); 
    125139    std::shared_ptr<CScalarFieldArithmeticFilter> filter(new CScalarFieldArithmeticFilter(gc, opId, child1->reduce())); 
    126     child2->reduce(gc, thisField)->connectOutput(filter, 0); 
     140    ch2->connectOutput(filter, 0); 
     141     
     142    (filter->parent_filters).resize(1); 
     143    (filter->parent_filters)[0] = ch2; 
     144 
     145    filter->tag = ch2->tag; 
     146    filter->start_graph = ch2->start_graph; 
     147    filter->end_graph = ch2->end_graph; 
     148    filter->field = &thisField; 
     149 
    127150    return filter; 
    128151  } 
     
    138161  } 
    139162 
    140   std::shared_ptr<COutputPin> CFilterFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 
    141   { 
     163  std::shared_ptr<COutputPin> CFilterFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 
     164  { 
     165    std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); 
     166 
    142167    std::shared_ptr<CFieldScalarArithmeticFilter> filter(new CFieldScalarArithmeticFilter(gc, opId, child2->reduce())); 
    143     child1->reduce(gc, thisField)->connectOutput(filter, 0); 
     168    ch1->connectOutput(filter, 0); 
     169 
     170    (filter->parent_filters).resize(1); 
     171    (filter->parent_filters)[0] = ch1; 
     172 
     173    filter->tag = ch1->tag; 
     174    filter->start_graph = ch1->start_graph; 
     175    filter->end_graph = ch1->end_graph; 
     176    filter->field = &thisField; 
     177 
    144178    return filter; 
    145179  } 
     
    155189  } 
    156190 
    157   std::shared_ptr<COutputPin> CFilterFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 
    158   { 
     191  std::shared_ptr<COutputPin> CFilterFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 
     192  { 
     193    std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); 
     194    std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); 
     195 
    159196    std::shared_ptr<CFieldFieldArithmeticFilter> filter(new CFieldFieldArithmeticFilter(gc, opId)); 
    160     child1->reduce(gc, thisField)->connectOutput(filter, 0); 
    161     child2->reduce(gc, thisField)->connectOutput(filter, 1); 
     197    ch1->connectOutput(filter, 0); 
     198    ch2->connectOutput(filter, 1);  
     199 
     200    (filter->parent_filters).resize(2); 
     201    (filter->parent_filters)[0] = ch1; 
     202    (filter->parent_filters)[1] = ch2; 
     203 
     204    filter->tag = (ch1->tag || ch2->tag); 
     205    filter->start_graph = ch1->tag? ch1->start_graph : (ch2->tag? ch2->start_graph: -1); 
     206    filter->end_graph = ch1->tag? ch1->end_graph : (ch2->tag? ch2->end_graph: -1); 
     207 
     208    filter->field = &thisField; 
     209 
     210 
    162211    return filter; 
    163212  } 
     
    177226  } 
    178227 
    179   std::shared_ptr<COutputPin> CFilterScalarScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 
    180   { 
     228  std::shared_ptr<COutputPin> CFilterScalarScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 
     229  { 
     230    std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph); 
     231 
    181232    std::shared_ptr<CScalarScalarFieldArithmeticFilter> filter(new CScalarScalarFieldArithmeticFilter(gc, opId, child1->reduce(),child2->reduce())); 
    182     child3->reduce(gc, thisField)->connectOutput(filter, 0); 
     233    ch3->connectOutput(filter, 0); 
     234     
     235    (filter->parent_filters).resize(1); 
     236    (filter->parent_filters)[0] = ch3; 
     237 
     238    filter->tag = ch3->tag; 
     239    filter->start_graph = ch3->start_graph; 
     240    filter->end_graph = ch3->end_graph; 
     241    filter->field = &thisField; 
     242 
    183243    return filter; 
    184244  } 
     
    196256  } 
    197257 
    198   std::shared_ptr<COutputPin> CFilterScalarFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 
    199   { 
     258  std::shared_ptr<COutputPin> CFilterScalarFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 
     259  { 
     260    std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); 
     261 
    200262    std::shared_ptr<CScalarFieldScalarArithmeticFilter> filter(new CScalarFieldScalarArithmeticFilter(gc, opId, child1->reduce(),child3->reduce())); 
    201     child2->reduce(gc, thisField)->connectOutput(filter, 0); 
     263    ch2->connectOutput(filter, 0); 
     264 
     265    (filter->parent_filters).resize(1); 
     266    (filter->parent_filters)[0] = ch2; 
     267 
     268    filter->tag = ch2->tag; 
     269    filter->start_graph = ch2->start_graph; 
     270    filter->end_graph = ch2->end_graph; 
     271    filter->field = &thisField; 
     272 
    202273    return filter; 
    203274  } 
     
    215286  } 
    216287 
    217   std::shared_ptr<COutputPin> CFilterScalarFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 
    218   { 
     288  std::shared_ptr<COutputPin> CFilterScalarFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 
     289  { 
     290    std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); 
     291    std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph); 
     292 
    219293    std::shared_ptr<CScalarFieldFieldArithmeticFilter> filter(new CScalarFieldFieldArithmeticFilter(gc, opId, child1->reduce())); 
    220     child2->reduce(gc, thisField)->connectOutput(filter, 0); 
    221     child3->reduce(gc, thisField)->connectOutput(filter, 1); 
     294    ch2->connectOutput(filter, 0); 
     295    ch3->connectOutput(filter, 1); 
     296 
     297    (filter->parent_filters).resize(2); 
     298    (filter->parent_filters)[0] = ch2; 
     299    (filter->parent_filters)[1] = ch3; 
     300 
     301    filter->tag = (ch3->tag || ch2->tag); 
     302    filter->start_graph = ch3->tag? ch3->start_graph : (ch2->tag? ch2->start_graph: -1); 
     303    filter->end_graph = ch3->tag? ch3->end_graph : (ch2->tag? ch2->end_graph: -1); 
     304    filter->field = &thisField; 
     305 
    222306    return filter; 
    223307  } 
     
    236320  } 
    237321 
    238   std::shared_ptr<COutputPin> CFilterFieldScalarScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 
    239   { 
     322  std::shared_ptr<COutputPin> CFilterFieldScalarScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 
     323  { 
     324    std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); 
     325 
    240326    std::shared_ptr<CFieldScalarScalarArithmeticFilter> filter(new CFieldScalarScalarArithmeticFilter(gc, opId, child2->reduce(),child3->reduce())); 
    241     child1->reduce(gc, thisField)->connectOutput(filter, 0); 
     327    ch1->connectOutput(filter, 0); 
     328 
     329    (filter->parent_filters).resize(1); 
     330    (filter->parent_filters)[0] = ch1; 
     331 
     332    filter->tag = ch1->tag; 
     333    filter->start_graph = ch1->start_graph; 
     334    filter->end_graph = ch1->end_graph; 
     335    filter->field = &thisField; 
     336 
    242337    return filter; 
    243338  } 
     
    256351  } 
    257352 
    258   std::shared_ptr<COutputPin> CFilterFieldScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 
    259   { 
     353  std::shared_ptr<COutputPin> CFilterFieldScalarFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 
     354  { 
     355    std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); 
     356    std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph); 
     357 
    260358    std::shared_ptr<CFieldScalarFieldArithmeticFilter> filter(new CFieldScalarFieldArithmeticFilter(gc, opId, child2->reduce())); 
    261     child1->reduce(gc, thisField)->connectOutput(filter, 0); 
    262     child3->reduce(gc, thisField)->connectOutput(filter, 1); 
     359    ch1->connectOutput(filter, 0); 
     360    ch3->connectOutput(filter, 1); 
     361 
     362    (filter->parent_filters).resize(2); 
     363    (filter->parent_filters)[0] = ch1; 
     364    (filter->parent_filters)[1] = ch3; 
     365 
     366    filter->tag = (ch3->tag || ch1->tag); 
     367    filter->start_graph = ch3->tag? ch3->start_graph : (ch1->tag? ch1->start_graph: -1); 
     368    filter->end_graph = ch3->tag? ch3->end_graph : (ch1->tag? ch1->end_graph: -1); 
     369    filter->field = &thisField; 
     370 
    263371    return filter; 
    264372  } 
     
    277385  } 
    278386 
    279   std::shared_ptr<COutputPin> CFilterFieldFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 
    280   { 
     387  std::shared_ptr<COutputPin> CFilterFieldFieldScalarOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 
     388  { 
     389    std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); 
     390    std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); 
     391 
    281392    std::shared_ptr<CFieldFieldScalarArithmeticFilter> filter(new CFieldFieldScalarArithmeticFilter(gc, opId, child3->reduce())); 
    282     child1->reduce(gc, thisField)->connectOutput(filter, 0); 
    283     child2->reduce(gc, thisField)->connectOutput(filter, 1); 
     393    ch1->connectOutput(filter, 0); 
     394    ch2->connectOutput(filter, 1); 
     395 
     396    (filter->parent_filters).resize(2); 
     397    (filter->parent_filters)[0] = ch1; 
     398    (filter->parent_filters)[1] = ch2; 
     399 
     400    filter->tag = (ch2->tag || ch1->tag); 
     401    filter->start_graph = ch2->tag? ch2->start_graph : (ch1->tag? ch1->start_graph: -1); 
     402    filter->end_graph = ch2->tag? ch2->end_graph : (ch1->tag? ch1->end_graph: -1); 
     403    filter->field = &thisField; 
    284404    return filter; 
    285405  } 
     
    297417  } 
    298418 
    299   std::shared_ptr<COutputPin> CFilterFieldFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField) const 
    300   { 
     419  std::shared_ptr<COutputPin> CFilterFieldFieldFieldOpExprNode::reduce(CGarbageCollector& gc, CField& thisField, Time start_graph, Time end_graph) const 
     420  { 
     421    std::shared_ptr<COutputPin> ch1 = child1->reduce(gc, thisField, start_graph, end_graph); 
     422    std::shared_ptr<COutputPin> ch2 = child2->reduce(gc, thisField, start_graph, end_graph); 
     423    std::shared_ptr<COutputPin> ch3 = child3->reduce(gc, thisField, start_graph, end_graph); 
     424 
    301425    std::shared_ptr<CFieldFieldFieldArithmeticFilter> filter(new CFieldFieldFieldArithmeticFilter(gc, opId)); 
    302     child1->reduce(gc, thisField)->connectOutput(filter, 0); 
    303     child2->reduce(gc, thisField)->connectOutput(filter, 1); 
    304     child3->reduce(gc, thisField)->connectOutput(filter, 2); 
     426    std::cout<<"std::shared_ptr<CFieldFieldFieldArithmeticFilter> filter(new CFieldFieldFieldArithmeticFilter(gc, opId))" <<std::endl; 
     427    ch1->connectOutput(filter, 0); 
     428    ch2->connectOutput(filter, 1); 
     429    ch3->connectOutput(filter, 2); 
     430 
     431    (filter->parent_filters).resize(3); 
     432    (filter->parent_filters)[0] = ch1; 
     433    (filter->parent_filters)[1] = ch2; 
     434    (filter->parent_filters)[2] = ch3; 
     435 
     436 
     437    filter->tag = (ch1->tag || ch1->tag || ch3->tag); 
     438    filter->start_graph = ch1->tag? ch1->start_graph : (ch2->tag? ch2->start_graph: (ch3->tag? ch3->start_graph: -1)); 
     439    filter->end_graph = ch1->tag? ch1->end_graph : (ch2->tag? ch2->end_graph: (ch3->tag? ch3->end_graph: -1)); 
     440    filter->field = &thisField; 
     441 
     442 
    305443    return filter; 
    306444  } 
  • XIOS/trunk/src/parse_expr/filter_expr_node.hpp

    r1542 r1704  
    55#include <boost/smart_ptr/scoped_ptr.hpp> 
    66#include "scalar_expr_node.hpp" 
     7 
     8#include "duration.hpp" 
    79 
    810namespace xios 
     
    2527     * \return the output pin of the filter producing the result of the expression  
    2628     */ 
    27     virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const = 0; 
     29    virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const = 0; 
    2830  }; 
    2931 
     
    4244      CFilterFieldExprNode(const std::string& fieldId); 
    4345 
    44       virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; 
     46      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 
    4547 
    4648    private: 
     
    6365      CFilterTemporalFieldExprNode(const std::string& fieldId); 
    6466 
    65       virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; 
     67      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 
    6668 
    6769    private: 
     
    8688      CFilterUnaryOpExprNode(const std::string& opId, IFilterExprNode* child); 
    8789 
    88       virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; 
     90      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 
    8991 
    9092    private: 
     
    111113      CFilterScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2); 
    112114 
    113       virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; 
     115      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 
    114116 
    115117    private: 
     
    137139      CFilterFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2); 
    138140 
    139       virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; 
     141      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 
    140142 
    141143    private: 
     
    162164      CFilterFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2); 
    163165 
    164       virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; 
     166      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 
    165167 
    166168    private: 
     
    190192      CFilterScalarScalarFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3); 
    191193 
    192       virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; 
     194      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 
    193195 
    194196    private: 
     
    219221      CFilterScalarFieldScalarOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3); 
    220222 
    221       virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; 
     223      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 
    222224 
    223225    private: 
     
    248250      CFilterScalarFieldFieldOpExprNode(IScalarExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3); 
    249251 
    250       virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; 
     252      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 
    251253 
    252254    private: 
     
    278280      CFilterFieldScalarScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IScalarExprNode* child3); 
    279281 
    280       virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; 
     282      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 
    281283 
    282284    private: 
     
    307309      CFilterFieldScalarFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IScalarExprNode* child2, IFilterExprNode* child3); 
    308310 
    309       virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; 
     311      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 
    310312 
    311313    private: 
     
    335337      CFilterFieldFieldScalarOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IScalarExprNode* child3); 
    336338 
    337       virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; 
     339      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 
    338340 
    339341    private: 
     
    364366      CFilterFieldFieldFieldOpExprNode(IFilterExprNode* child1, const std::string& opId, IFilterExprNode* child2, IFilterExprNode* child3); 
    365367 
    366       virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField) const; 
     368      virtual std::shared_ptr<COutputPin> reduce(CGarbageCollector& gc, CField& thisField, Time start_graph=-1, Time end_graph=-1) const; 
    367369 
    368370    private: 
  • XIOS/trunk/src/parse_expr/yacc_parser.cpp

    r1158 r1704  
    7070#include "exception.hpp" 
    7171 
     72#include "yacc_var.hpp" 
     73 
    7274using namespace std; 
    7375using namespace xios; 
     
    8486  size_t globalReadOffset = 0; 
    8587 
     88  std::string *xios::yacc_globalInputText_ptr = 0; 
     89 
    8690  int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead) 
    8791  { 
     92    yacc_globalInputText_ptr = &globalInputText; 
     93    //*yacc_globalInputText_ptr = globalInputText; 
     94 
     95    std::cout<<"========= yacc_globalInputText_ptr = "<<*yacc_globalInputText_ptr<<std::endl; 
     96     
    8897    size_t numBytesToRead = maxBytesToRead; 
    8998    size_t bytesRemaining = globalInputText.length()-globalReadOffset; 
  • XIOS/trunk/src/test/test_client.f90

    r1202 r1704  
    132132  PRINT*,"field field_A is active ? ",xios_field_is_active("field_A") 
    133133  ! CALL xios_recv_field("field", scalar) 
    134   DO ts=1,4 
     134  DO ts=1,24 
    135135    CALL xios_update_calendar(ts) 
    136136    CALL xios_send_field("field_A",field_A) 
    137     CALL xios_send_field("field_Axis",axisValue) 
     137    CALL xios_send_field("field_B",field_A) 
     138    CALL xios_send_field("field_C",field_A) 
     139    ! CALL xios_send_field("field_Axis",axisValue) 
    138140    ! CALL xios_send_field("field_Axis",lval) 
    139     CALL xios_send_field("field_Domain",field_domain) 
    140     CALL xios_send_field("field_Scalar",scalar) 
     141    ! CALL xios_send_field("field_Domain",field_domain) 
     142    ! CALL xios_send_field("field_Scalar",scalar) 
    141143    CALL wait_us(5000) ; 
    142144  ENDDO 
  • XIOS/trunk/src/transformation/Functions/average_reduction.hpp

    r1260 r1704  
    3333  virtual ~CAverageReductionAlgorithm() {} 
    3434 
     35  virtual StdString getName() {return "Average reduction";} 
     36 
    3537protected: 
    3638  CArray<double,1> weights_; 
  • XIOS/trunk/src/transformation/Functions/extract.hpp

    r1260 r1704  
    3131  virtual ~CExtractReductionAlgorithm() {} 
    3232 
     33  virtual StdString getName() {return "Extract reduction";} 
     34 
    3335public: 
    3436  static bool registerTrans(); 
  • XIOS/trunk/src/transformation/Functions/max_reduction.hpp

    r1260 r1704  
    3131  virtual ~CMaxReductionAlgorithm() {} 
    3232 
     33  virtual StdString getName() {return "Max reduction";} 
     34 
    3335public: 
    3436  static bool registerTrans(); 
  • XIOS/trunk/src/transformation/Functions/min_reduction.hpp

    r1260 r1704  
    3131  virtual ~CMinReductionAlgorithm() {} 
    3232 
     33  virtual StdString getName() {return "Min reduction";} 
     34 
    3335public: 
    3436  static bool registerTrans(); 
  • XIOS/trunk/src/transformation/Functions/reduction.hpp

    r1260 r1704  
    5757  virtual ~CReductionAlgorithm() {} 
    5858 
     59  virtual StdString getName() {return "Reduction";} 
     60 
    5961protected: 
    6062  typedef CReductionAlgorithm* (*CreateOperationCallBack)(); 
  • XIOS/trunk/src/transformation/Functions/sum_reduction.hpp

    r1260 r1704  
    3131  virtual ~CSumReductionAlgorithm() {} 
    3232 
     33  virtual StdString getName() {return "Sum reduction";} 
     34 
    3335public: 
    3436  static bool registerTrans(); 
  • XIOS/trunk/src/transformation/axis_algorithm_duplicate_scalar.hpp

    r1314 r1704  
    3333  static bool registerTrans(); 
    3434 
     35  virtual StdString getName() {return "Axis Trans. Filter \\n Duplicate Scalar";} 
     36 
    3537protected: 
    3638  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
  • XIOS/trunk/src/transformation/axis_algorithm_extract.hpp

    r1558 r1704  
    2727 
    2828  static bool registerTrans(); 
     29 
     30  virtual StdString getName() {return "Axis Trans. Filter \\n Extract";} 
     31 
    2932protected: 
    3033  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
  • XIOS/trunk/src/transformation/axis_algorithm_extract_domain.hpp

    r1260 r1704  
    3939 
    4040  static bool registerTrans(); 
     41 
     42  virtual StdString getName() {return "Axis Trans. Filter \\n Extract Domain";} 
     43 
    4144protected: 
    4245  enum ExtractDirection { 
  • XIOS/trunk/src/transformation/axis_algorithm_interpolate.hpp

    r933 r1704  
    3232 
    3333  static bool registerTrans(); 
     34 
     35  virtual StdString getName() {return "Axis Trans. Filter \\n Interpolation";} 
     36 
    3437protected: 
    3538  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
  • XIOS/trunk/src/transformation/axis_algorithm_inverse.hpp

    r933 r1704  
    3131  static bool registerTrans(); 
    3232 
     33  virtual StdString getName() {return "Axis Trans. Filter \\n Inverse";} 
     34 
    3335protected: 
    3436  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
  • XIOS/trunk/src/transformation/axis_algorithm_reduce_axis.hpp

    r1314 r1704  
    3939 
    4040  static bool registerTrans(); 
     41 
     42  virtual StdString getName() {return "Axis Trans. Filter \\n Reduce Axis";} 
    4143protected: 
    4244   
  • XIOS/trunk/src/transformation/axis_algorithm_reduce_domain.hpp

    r1299 r1704  
    4040 
    4141  static bool registerTrans(); 
     42 
     43  virtual StdString getName() {return "Axis Trans. Filter \\n Reduce Domain";} 
     44 
    4245protected: 
    4346  enum ReduceDirection { 
  • XIOS/trunk/src/transformation/axis_algorithm_temporal_splitting.hpp

    r1275 r1704  
    3434  static bool registerTrans(); 
    3535 
     36  virtual StdString getName() {return "Axis Trans. Filter \\n Temporal Splitting";} 
     37 
    3638protected: 
    3739  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
  • XIOS/trunk/src/transformation/axis_algorithm_transformation.hpp

    r1275 r1704  
    3131  virtual ~CAxisAlgorithmTransformation(); 
    3232 
     33  virtual StdString getName() {return "Axis Trans. Filter \\n Transformation";} 
     34 
    3335protected: 
    3436  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
  • XIOS/trunk/src/transformation/axis_algorithm_zoom.hpp

    r1559 r1704  
    2727 
    2828  static bool registerTrans(); 
     29 
     30  virtual StdString getName() {return "Axis Trans. Filter \\n Zoom";} 
     31 
    2932protected: 
    3033  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
  • XIOS/trunk/src/transformation/domain_algorithm_compute_connectivity.hpp

    r944 r1704  
    2828 
    2929  static bool registerTrans(); 
     30 
     31  virtual StdString getName() {return "Domain Trans. Filter \\n Compute Connectivity";} 
     32 
    3033protected: 
    3134  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
  • XIOS/trunk/src/transformation/domain_algorithm_expand.hpp

    r1158 r1704  
    2828 
    2929  static bool registerTrans(); 
     30 
     31  virtual StdString getName() {return "Domain Trans. Filter \\n Expand";} 
    3032 
    3133protected: 
  • XIOS/trunk/src/transformation/domain_algorithm_extract.hpp

    r1549 r1704  
    2323 
    2424  static bool registerTrans(); 
     25 
     26  virtual StdString getName() {return "Domain Trans. Filter \\n Extract";} 
    2527protected: 
    2628  void updateDomainAttributes(); 
  • XIOS/trunk/src/transformation/domain_algorithm_generate_rectilinear.hpp

    r1410 r1704  
    3333  virtual ~CDomainAlgorithmGenerateRectilinear() {} 
    3434 
     35  virtual StdString getName() {return "Domain Trans. Filter \\n Generate Rectilinear";} 
     36 
    3537protected: 
    3638  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
  • XIOS/trunk/src/transformation/domain_algorithm_interpolate.hpp

    r1641 r1704  
    3939 
    4040  static bool registerTrans(); 
     41 
     42  virtual StdString getName() {return "Domain Trans. Filter \\n Interpolation";} 
     43 
    4144protected: 
    4245  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
  • XIOS/trunk/src/transformation/domain_algorithm_reorder.hpp

    r1457 r1704  
    2626  static bool registerTrans(); 
    2727 
     28  virtual StdString getName() {return "Domain Trans. Filter \\n Reorder";} 
     29 
    2830protected: 
    2931  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
  • XIOS/trunk/src/transformation/domain_algorithm_transformation.hpp

    r888 r1704  
    2727  virtual ~CDomainAlgorithmTransformation(); 
    2828 
     29  virtual StdString getName() {return "Domain Trans. Filter \\n Transformation";} 
     30 
    2931protected: 
    3032  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >&); 
  • XIOS/trunk/src/transformation/domain_algorithm_zoom.hpp

    r1553 r1704  
    2323 
    2424  static bool registerTrans(); 
     25 
     26  virtual StdString getName() {return "Domain Trans. Filter \\n Zoom";} 
    2527protected: 
    2628  void updateDomainAttributes(); 
  • XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp

    r1637 r1704  
    7373                     std::vector<bool>& flagInitial,                      
    7474                     bool ignoreMissingValue, bool firstPass); 
     75 
     76  virtual StdString getName() {return "Generic Trans. Filter";} 
    7577 
    7678  /*! 
  • XIOS/trunk/src/transformation/scalar_algorithm_extract_axis.hpp

    r1260 r1704  
    3939  static bool registerTrans(); 
    4040 
     41  virtual StdString getName() {return "Scalar Trans. Filter \\n Extract Axis";} 
     42 
    4143protected: 
    4244  int pos_; 
  • XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.cpp

    r1622 r1704  
    1313#include "grid.hpp" 
    1414#include "grid_transformation_factory_impl.hpp" 
    15 #include "reduction.hpp" 
    1615 
    1716#include "reduction.hpp" 
  • XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.hpp

    r1260 r1704  
    4040 
    4141  static bool registerTrans(); 
     42 
     43  virtual StdString getName() {return "Scalar Trans. Filter \\n Reduce Axis";} 
     44 
    4245protected: 
    4346  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
  • XIOS/trunk/src/transformation/scalar_algorithm_reduce_domain.hpp

    r1313 r1704  
    4040 
    4141  static bool registerTrans(); 
     42 
     43  virtual StdString getName() {return "Scalar Trans. Filter \\n Reduce Domain";} 
     44 
    4245protected: 
    4346  bool local ; 
  • XIOS/trunk/src/transformation/scalar_algorithm_reduce_scalar.hpp

    r1314 r1704  
    3535 
    3636  static bool registerTrans(); 
     37 
     38  virtual StdString getName() {return "Scalar Trans. Filter \\n Reduce Scalar";} 
     39 
    3740protected: 
    3841  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
  • XIOS/trunk/src/transformation/scalar_algorithm_transformation.hpp

    r888 r1704  
    3131  virtual ~CScalarAlgorithmTransformation(); 
    3232 
     33  virtual StdString getName() {return "Scalar Trans. Filter \\n Transformation";} 
     34 
    3335protected: 
    3436  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); 
Note: See TracChangeset for help on using the changeset viewer.