Changeset 1686


Ignore:
Timestamp:
07/31/19 13:51:01 (5 years ago)
Author:
yushan
Message:

backup for trunk with graph

Location:
XIOS/dev/dev_olga
Files:
4 added
92 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/bld.cfg

    r1654 r1686  
    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/dev/dev_olga/inputs/COMPLETE/context_atmosphere.xml

    r787 r1686  
    1010  <file_definition type="multiple_file" par_access="collective" output_freq="6h" sync_freq="6h" output_level="10" enabled=".TRUE."> 
    1111    <file id="output_atmosphere" name="output_atmosphere"> 
    12       <field field_ref="field_A_atm" /> 
     12      <field field_ref="field_A_atm" build_workflow_graph=".TRUE." /> 
    1313    </file> 
    1414    <file id="output_atmosphere_zoom" name="output_atmosphere_zoom"> 
    15       <field field_ref="field_A_atm_zoom" name="field_A_atm_zoom" /> 
     15      <field field_ref="field_A_atm_zoom" name="field_A_atm_zoom"  build_workflow_graph=".TRUE."/> 
    1616    </file> 
    1717  </file_definition> 
  • XIOS/dev/dev_olga/inputs/COMPLETE/context_surface.xml

    r1173 r1686  
    2020        <variable id="my_attribute5" type="double">100.201</variable> 
    2121      </field> 
    22       <field field_ref="field_A_srf_K" /> 
     22      <field field_ref="field_A_srf_K" build_workflow_graph=".FALSE."/> 
    2323      <field field_ref="field_A_srf_K_2" name="field_A_srf_K_2" /> <!-- Should be identical to field_A_srf_K --> 
    2424      <field field_ref="field_A_srf_K" name="field_A_srf_K_3">field_A_srf_K</field> <!-- Should be identical to field_A_srf_K --> 
     
    2828      <field field_ref="field_A_srf" name="field_A_srf_max" operation="maximum" /> 
    2929      <field field_ref="field_A_srf" name="field_A_srf_prec4" prec="8" /> 
    30       <field field_ref="field_A_srf_max" name="field_A_srf_mean_max" long_name="Average of hourly maximum over 6h" operation="average" freq_op="1h"> @field_A_srf_max </field> 
     30      <field field_ref="field_A_srf_max" name="field_A_srf_mean_max" build_workflow_graph=".FALSE." long_name="Average of hourly maximum over 6h" operation="average" freq_op="1h"> @field_A_srf_max </field> 
    3131      <variable id="my_global_attribute" type="string">file_6h</variable> 
    3232    </file> 
    3333 
    34     <file type="one_file" id="output_surface_1d" name="output_surface_1d" output_freq="1d" enabled="TRUE"> 
     34    <file type="one_file" id="output_surface_1d" name="output_surface_1d" output_freq="1d" enabled="FALSE"> 
    3535      <field field_ref="field_A_srf" indexed_output="TRUE"> 
    3636        <variable id="my_attribute1" type="string">surf_att</variable> 
     
    4343      <field field_ref="field_A_srf" name="field_A_srf_max" operation="maximum" /> 
    4444      <field field_ref="field_A_srf" name="field_A_srf_prec4" prec="8" /> 
    45       <field field_ref="field_A_srf_max" name="field_A_srf_mean_max" long_name="Average of hourly maximum over 1d" operation="average" freq_op="1h"> @field_A_srf_max </field> 
     45      <field field_ref="field_A_srf_max" name="field_A_srf_mean_max" build_workflow_graph=".TRUE." long_name="Average of hourly maximum over 1d" operation="average" freq_op="1h"> @field_A_srf_max </field> 
    4646      <variable id="my_global_attribute" type="string" >file_1d</variable> 
    4747    </file> 
  • XIOS/dev/dev_olga/inputs/REMAP/iodef.xml

    r1136 r1686  
    3434      <file_group id="write_files" > 
    3535        <file id="output_2D" name="output_2D" > 
    36           <field field_ref="src_field_2D" name="field_src" /> 
    37           <field field_ref="src_field_2D" name="field_dst_regular_0"  domain_ref="dst_domain_regular_pole" default_value="10.e+5"/> 
    38           <field field_ref="dst_field_2D" name="field_dst_regular_1" /> 
    39           <field field_ref="dst_field_2D_regular_pole" name="field_dst_regular_2" /> 
    40           <field field_ref="dst_field_2D_clone" name="field_dst_regular_3" /> 
     36          <field field_ref="src_field_2D" name="field_src" build_workflow_graph=".TRUE." /> 
     37          <field field_ref="src_field_2D" name="field_dst_regular_0"  domain_ref="dst_domain_regular_pole" default_value="10.e+5" build_workflow_graph=".TRUE."/> 
     38          <field field_ref="dst_field_2D" name="field_dst_regular_1" build_workflow_graph=".TRUE."/> 
     39          <field field_ref="dst_field_2D_regular_pole" name="field_dst_regular_2" build_workflow_graph=".TRUE."/> 
     40          <field field_ref="dst_field_2D_clone" name="field_dst_regular_3" build_workflow_graph=".TRUE."/> 
    4141        </file>  
    4242       <file id="output_3D" name="output_3D" > 
  • XIOS/dev/dev_olga/inputs/iodef.xml

    r1202 r1686  
    1818      <file id="output" name="output" enabled=".TRUE."> 
    1919        <!-- <field field_ref="field_Domain" name="field_A" /> --> 
    20         <field field_ref="field_A" name="field_A" />  
     20        <field field_ref="field_A" name="field_A" build_workflow_graph=".TRUE." />  
    2121        <field field_ref="field_A_zoom" name="field_B" /> 
    2222     </file> 
  • XIOS/dev/dev_olga/src/attribute.hpp

    r1612 r1686  
    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/dev/dev_olga/src/attribute_array.hpp

    r1612 r1686  
    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/dev/dev_olga/src/attribute_array_impl.hpp

    r1612 r1686  
    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/dev/dev_olga/src/attribute_enum.hpp

    r1612 r1686  
    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/dev/dev_olga/src/attribute_enum_impl.hpp

    r1219 r1686  
    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/dev/dev_olga/src/attribute_map.cpp

    r1612 r1686  
    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/dev/dev_olga/src/attribute_map.hpp

    r1612 r1686  
    3939            void clearAllAttributes(void); 
    4040            StdString dumpXiosAttributes(void) const; 
     41            StdString record4graphXiosAttributes(void) const; 
    4142 
    4243            void clearAttribute(const StdString& key); 
  • XIOS/dev/dev_olga/src/attribute_template.hpp

    r1612 r1686  
    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/dev/dev_olga/src/attribute_template_impl.hpp

    r1612 r1686  
    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/dev/dev_olga/src/config/field_attribute.conf

    r1653 r1686  
    1919DECLARE_ATTRIBUTE(bool,      indexed_output) 
    2020DECLARE_ATTRIBUTE(bool,      check_if_active) 
    21 DECLARE_ATTRIBUTE(bool,      build_workflow_graph) 
    2221 
    2322DECLARE_ATTRIBUTE(StdString, domain_ref, false) 
     
    4140DECLARE_ATTRIBUTE(StdString, cell_methods) 
    4241DECLARE_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/dev/dev_olga/src/cxios.cpp

    r1653 r1686  
    1111#include "memtrack.hpp" 
    1212#include "registry.hpp" 
     13 
    1314#include "graphviz.hpp" 
    1415 
     
    136137       globalRegistry->toFile("xios_registry.bin") ; 
    137138       delete globalRegistry ; 
    138         
    139        CGraphviz::buildStaticWorkflowGraph(); 
     139       CGraphviz::buildWorkflowGraphVisjs_with_info(); 
    140140     } 
    141141 
  • XIOS/dev/dev_olga/src/distribution_client.cpp

    r1596 r1686  
    608608 
    609609} // namespace xios 
    610  
  • XIOS/dev/dev_olga/src/filter/binary_arithmetic_filter.cpp

    r804 r1686  
    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/dev/dev_olga/src/filter/binary_arithmetic_filter.hpp

    r1542 r1686  
    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/dev/dev_olga/src/filter/data_packet.hpp

    r1542 r1686  
    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/dev/dev_olga/src/filter/file_server_writer_filter.cpp

    r1654 r1686  
    1616  void CFileServerWriterFilter::onInputReady(std::vector<CDataPacketPtr> data) 
    1717  { 
    18     field->writeUpdateData(data[0]->data);     
     18    field->writeUpdateData(data[0]->data); 
    1919  } 
    2020 
     
    2828    return true; 
    2929  } 
    30  
    31   int CFileServerWriterFilter::getFilterId(void) 
    32   { 
    33     return filterId; 
    34   } 
    35  
    3630} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/file_server_writer_filter.hpp

    r1653 r1686  
    3737      bool virtual isDataExpected(const CDate& date) const; 
    3838 
    39       /*! 
    40        * Returns filter's id needed in case of building workflow graph 
    41        */ 
    42       int getFilterId(); 
    43  
    4439    protected: 
    4540      /*! 
     
    5146 
    5247    private: 
    53       CField* field;           //<! The associated field 
     48      CField* field; //<! The associated field 
    5449      std::map<Time, CDataPacketPtr> packets; //<! The stored packets 
    55       int filterId;            //<! Filter's id needed in case of building a workflow 
    56  
    5750  }; // class CFileServerWriterFilter 
    5851} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/file_writer_filter.cpp

    r1654 r1686  
    44#include "utils.hpp" 
    55#include "workflow_graph.hpp" 
     6#include "graphviz.hpp" 
    67 
    78namespace xios 
    89{ 
    9   CFileWriterFilter::CFileWriterFilter(CGarbageCollector& gc, CField* field, bool buildWorkflowGraph /* =false */) 
     10  CFileWriterFilter::CFileWriterFilter(CGarbageCollector& gc, CField* field) 
    1011    : CInputPin(gc, 1) 
    1112    , field(field) 
     
    1415      ERROR("CFileWriterFilter::CFileWriterFilter(CField* field)", 
    1516            "The field cannot be null."); 
    16     if (buildWorkflowGraph) 
     17  } 
     18 
     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) 
    1724    { 
    18       filterId = InvalidableObject::count; 
    19       InvalidableObject::count++; 
     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); 
     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; 
    2048    } 
    2149  } 
     
    2351  void CFileWriterFilter::onInputReady(std::vector<CDataPacketPtr> data) 
    2452  { 
     53    buildGraph(data); 
     54     
    2555    const bool detectMissingValue = ( !field->default_value.isEmpty() && 
    2656                               ( (!field->detect_missing_value.isEmpty() || field->detect_missing_value == true) 
     
    4171 
    4272    field->sendUpdateData(dataArray); 
    43  
    4473  } 
    4574 
     
    5382    return true; 
    5483  } 
    55  
    56   int CFileWriterFilter::getFilterId(void) 
    57   { 
    58     return filterId; 
    59   } 
    60  
    6184} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/file_writer_filter.hpp

    r1654 r1686  
    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 
     
    2029       * \param gc the associated garbage collector 
    2130       * \param field the associated field 
    22        * \param[in] buildWorkflowGraph indicates whether the workflow will be visualized 
    2331       */ 
    24       CFileWriterFilter(CGarbageCollector& gc, CField* field, bool buildWorkflowGraph = false); 
     32      CFileWriterFilter(CGarbageCollector& gc, CField* field); 
    2533 
    26       inline StdString GetName(void) {return StdString("File writer filter");}; 
     34      inline StdString GetName(void) {return "File writer filter";}; 
     35 
    2736 
    2837      /*! 
     
    4049      bool virtual isDataExpected(const CDate& date) const; 
    4150 
    42       /*! 
    43        * Returns filter's id needed in case of building workflow graph 
    44        */ 
    45       int getFilterId(); 
    46  
    4751    protected: 
    4852      /*! 
     
    5256       */ 
    5357      void virtual onInputReady(std::vector<CDataPacketPtr> data); 
     58      void virtual buildGraph(std::vector<CDataPacketPtr> data); 
    5459 
    5560    private: 
    56       CField* field;                          //<! The associated field 
    5761      std::map<Time, CDataPacketPtr> packets; //<! The stored packets 
    58       int filterId;                           //<! Filter's id needed in case of building a workflow 
    59  
    6062  }; // class CFileWriterFilter 
    6163} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/filter.cpp

    r1653 r1686  
    33namespace xios 
    44{ 
    5   CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine, bool buildWorkflowGraph /*= false*/) 
     5  CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine) 
    66    : CInputPin(gc, inputSlotsCount) 
    7     , COutputPin(gc, false, buildWorkflowGraph) 
     7    , COutputPin(gc, false) 
    88    , engine(engine) 
    99    , inputSlotCount(inputSlotCount) 
  • XIOS/dev/dev_olga/src/filter/filter.hpp

    r1653 r1686  
    2323       * \param inputSlotsCount the number of input slots 
    2424       * \param engine the filter engine 
    25        * \param buildWorkflowGraph indicates whether data will be visualized 
    2625       */ 
    27       CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine, bool buildWorkflowGraph = false); 
     26      CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine); 
    2827 
    2928      StdString virtual GetName(void); 
     
    6564      bool virtual isDataExpected(const CDate& date) const; 
    6665 
     66       
     67       
     68 
     69      int filterID; 
     70      StdString expression; 
     71 
    6772    protected: 
    6873      IFilterEngine* engine; //!< The filter engine, might be the filter itself 
  • XIOS/dev/dev_olga/src/filter/garbage_collector.cpp

    r1653 r1686  
    33namespace xios 
    44{ 
     5  int InvalidableObject::filterIdGenerator = 0; 
    56 
    6   int InvalidableObject::count = 0; 
     7  int InvalidableObject::edgeIdGenerator = 0; 
     8 
     9  int InvalidableObject::clusterIdGenerator = 0; 
    710   
    811  void CGarbageCollector::registerObject(InvalidableObject* Object, Time timestamp) 
  • XIOS/dev/dev_olga/src/filter/garbage_collector.hpp

    r1653 r1686  
    2121    void virtual invalidate(Time timestamp) = 0; 
    2222   
    23     static int count; //!< Counter used to identify a filter in case building workflow graph 
     23     
     24 
     25    static int filterIdGenerator; 
     26 
     27    static int edgeIdGenerator; 
     28 
     29    static int clusterIdGenerator; 
     30 
     31     
    2432     
    2533  }; // struct InvalidableObject 
  • XIOS/dev/dev_olga/src/filter/input_pin.cpp

    r1653 r1686  
    1212    , triggers(slotsCount) 
    1313    , hasTriggers(false) 
    14   {   } 
     14  {  } 
    1515 
    1616  StdString CInputPin::GetName(void) 
     
    8383    inputs.erase(inputs.begin(), inputs.lower_bound(timestamp)); 
    8484  } 
    85  
    86   int CInputPin::getFilterId(void) 
    87   { 
    88     return -1; 
    89   } 
    90  
    9185} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/input_pin.hpp

    r1654 r1686  
    8181       */ 
    8282      void virtual invalidate(Time timestamp); 
    83        
    84       /*! 
    85        * Returns filter's id needed in case of building workflow graph 
    86        * This function should never be called from this class, instead functions defined in derived classes or in class COutputPin should be used 
    87        */ 
    88       int virtual getFilterId(); 
    8983 
    9084    protected: 
     
    130124      //! Whether some triggers have been set 
    131125      bool hasTriggers; 
    132  
    133126  }; // class CInputPin 
    134127} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/output_pin.cpp

    r1654 r1686  
    55namespace xios 
    66{ 
    7   COutputPin::COutputPin(CGarbageCollector& gc, bool manualTrigger /*= false*/, bool buildWorkflowGraph /* =false */) 
     7  COutputPin::COutputPin(CGarbageCollector& gc, bool manualTrigger /*= false*/) 
    88    : gc(gc) 
    99    , manualTrigger(manualTrigger) 
    10     , buildWorkflowGraph(buildWorkflowGraph) 
    11   { 
    12     if (buildWorkflowGraph) 
    13     { 
    14       filterId = InvalidableObject::count; 
    15       InvalidableObject::count++; 
    16     } 
    17   } 
     10  {  } 
    1811 
    1912  StdString COutputPin::GetName(void) 
     
    4033            "The packet cannot be null."); 
    4134 
    42     if (buildWorkflowGraph) 
    43     { 
    44         CWorkflowGraph::mapFilterTimestamps[this->getFilterId()].push_back(packet->timestamp); 
    45         CWorkflowGraph::timestamps.insert(packet->timestamp); 
    46     } 
    47  
    4835    if (manualTrigger) // Don't use canBeTriggered here, this function is virtual and can be overriden 
    4936    { 
     
    5239    } 
    5340    else 
    54     { 
    5541      deliverOuput(packet); 
    56     } 
    5742  } 
    5843 
     
    123108  } 
    124109 
    125   int COutputPin::getFilterId(void) 
     110  void COutputPin::setParentFiltersTag() 
    126111  { 
    127     return filterId; 
     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    } 
    128126  } 
    129127 
     128 
     129 
     130 
    130131} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/output_pin.hpp

    r1654 r1686  
    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 
     
    1934       * \param gc the garbage collector associated with this ouput pin 
    2035       * \param slotsCount the number of slots 
    21        * \param buildWorkflowGraph indicates whether data will be visualized 
    2236       */ 
    23       COutputPin(CGarbageCollector& gc, bool manualTrigger = false, bool buildWorkflowGraph = false); 
     37      COutputPin(CGarbageCollector& gc, bool manualTrigger = false); 
    2438 
    2539      StdString virtual GetName(void); 
     
    6983      void virtual invalidate(Time timestamp); 
    7084 
    71       /*! 
    72        * Returns filter's id needed in case of building workflow graph 
    73        */ 
    74       int getFilterId(); 
     85      void virtual setParentFiltersTag(); 
     86 
    7587 
    7688    protected: 
     
    97109      CGarbageCollector& gc; //!< The garbage collector associated to the output pin 
    98110 
    99       //! Whether the ouput should be triggered manually 
     111      //!< Whether the ouput should be triggered manually 
    100112      bool manualTrigger; 
    101113 
    102       //! The list of connected filters and the corresponding slot numbers 
     114      //!< The list of connected filters and the corresponding slot numbers 
    103115      std::vector<std::pair<std::shared_ptr<CInputPin>, size_t> > outputs; 
    104116 
    105117      //! Output buffer, store the packets until the output is triggered 
    106118      std::map<Time, CDataPacketPtr> outputPackets; 
    107  
    108       //! Indicates whether the workflow will be visualized 
    109       bool buildWorkflowGraph; 
    110  
    111       //! Filter's id needed in case of building a workflow graph 
    112       int filterId; 
    113  
    114  
    115119  }; // class COutputPin 
    116120} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/pass_through_filter.cpp

    r1653 r1686  
    11#include "pass_through_filter.hpp" 
     2#include "workflow_graph.hpp" 
     3#include "field.hpp" 
     4#include "file.hpp" 
    25 
    36namespace xios 
    47{ 
    5   CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc, bool buildWorkflowGraph /*= false*/) 
    6     : CFilter(gc, 1, this, buildWorkflowGraph) 
    7   { /* Nothing to do */ } 
     8  CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc) 
     9    : CFilter(gc, 1, this) 
     10  {  
     11  } 
     12 
     13  void CPassThroughFilter::buildGraph(std::vector<CDataPacketPtr> data) 
     14  { 
     15    bool building_graph = this->tag ? data[0]->timestamp >= this->start_graph && data[0]->timestamp <= this->end_graph : false; 
     16    // bool building_graph = this->tag ? data[0]->timestamp >= this->field->field_graph_start && data[0]->timestamp <= this->field->field_graph_end : false; 
     17 
     18    if(building_graph) 
     19    { 
     20      // std::cout<<"CPassThroughFilter::apply field_id = "<<this->field->getId()<<" start = "<<start_graph<<" end = "<<end_graph<<std::endl; 
     21      this->filterID = InvalidableObject::filterIdGenerator++; 
     22      int edgeID = InvalidableObject::edgeIdGenerator++; 
     23 
     24      CWorkflowGraph::allocNodeEdge(); 
     25 
     26      CWorkflowGraph::addNode(this->filterID, "Pass Through Filter\\n("+data[0]->field->getId()+")", 2, 1, 1, data[0]); 
     27      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = ++(data[0]->distance); 
     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 
     42    } 
     43 
     44    data[0]->field = this->field; 
     45  } 
    846 
    947  CDataPacketPtr CPassThroughFilter::apply(std::vector<CDataPacketPtr> data) 
    1048  { 
     49    if(CXios::isClient) buildGraph(data); 
    1150    return data[0]; 
    1251  } 
  • XIOS/dev/dev_olga/src/filter/pass_through_filter.hpp

    r1653 r1686  
    1717       * 
    1818       * \param gc the associated garbage collector 
    19        * \param buildWorkflowGraph indicates whether data will be visualized 
    2019       */ 
    21       CPassThroughFilter(CGarbageCollector& gc, bool buildWorkflowGraph = false); 
     20      CPassThroughFilter(CGarbageCollector& gc); 
    2221 
    2322      inline StdString GetName(void) {return StdString("Pass through filter");}; 
     
    3130       */ 
    3231      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     32      void virtual buildGraph(std::vector<CDataPacketPtr> data); 
    3333  }; // class CPassThroughFilter 
    3434} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/source_filter.cpp

    r1654 r1686  
    1212                               const CDuration offset /*= NoneDu*/, bool manualTrigger /*= false*/, 
    1313                               bool hasMissingValue /*= false*/, 
    14                                double defaultValue /*= 0.0*/, 
    15                                bool buildWorkflowGraph /*= false*/) 
    16     : COutputPin(gc, manualTrigger, buildWorkflowGraph) 
     14                               double defaultValue /*= 0.0*/) 
     15    : COutputPin(gc, manualTrigger) 
    1716    , grid(grid) 
    1817    , compression(compression) 
     
    2524            "Impossible to construct a source filter without providing a grid."); 
    2625  } 
    27    
     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    
     31    if(building_graph) 
     32    { 
     33      this->filterID = InvalidableObject::filterIdGenerator++;   
     34      packet->src_filterID=this->filterID; 
     35      packet->field = this->field; 
     36      packet->distance = 1; 
     37       
     38     
     39      CWorkflowGraph::allocNodeEdge(); 
     40 
     41      CWorkflowGraph::addNode(this->filterID, "Source Filter ", 1, 1, 0, packet); 
     42      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes(); 
     43      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].field_id = this->field->getId(); 
     44      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].distance = 1; 
     45 
     46      CWorkflowGraph::build_begin = true; 
     47    } 
     48 
     49  } 
     50 
     51 
    2852  template <int N> 
    2953  void CSourceFilter::streamData(CDate date, const CArray<double, N>& data) 
     
    6185      } 
    6286    } 
     87 
     88    if(CXios::isClient) buildGraph(packet); 
     89     
     90 
    6391 
    6492    onOutputReady(packet); 
  • XIOS/dev/dev_olga/src/filter/source_filter.hpp

    r1654 r1686  
    2727       * \param hasMissingValue whether data has missing value 
    2828       * \param defaultValue missing value to detect 
    29        * \param[in] buildWorkflowGraph indicates whether the workflow will be visualized 
    3029       */ 
    3130      CSourceFilter(CGarbageCollector& gc, CGrid* grid, 
     
    3433                    const CDuration offset = NoneDu, bool manualTrigger = false, 
    3534                    bool hasMissingValue = false, 
    36                     double defaultValue = 0.0, 
    37                                         bool buildWorkflowGraph = false); 
     35                    double defaultValue = 0.0); 
    3836 
    3937      inline StdString GetName(void) {return StdString("Source filter");}; 
     
    4947      template <int N> 
    5048      void streamData(CDate date, const CArray<double, N>& data); 
     49 
     50      void virtual buildGraph(CDataPacketPtr packet); 
    5151 
    5252      /*! 
     
    6666       */ 
    6767      void signalEndOfStream(CDate date); 
     68      int filterID; 
    6869 
    6970    private: 
     
    7475      const bool compression ; //!< indicates if data need to be compressed : on client side : true, on server side : false 
    7576      const bool mask ;        //!< indicates whether grid mask should be applied (true for clients, false for servers) 
    76        
    7777  }; // class CSourceFilter 
    7878} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/spatial_transform_filter.cpp

    r1653 r1686  
    55#include "timer.hpp" 
    66#include "workflow_graph.hpp" 
     7#include "file.hpp" 
    78 
    89namespace xios 
    910{ 
    10   CSpatialTransformFilter::CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, 
    11                                                    double outputValue, size_t inputSlotsCount, bool buildWorkflowGraph /*= false*/) 
    12     : CFilter(gc, inputSlotsCount, engine, buildWorkflowGraph), outputDefaultValue(outputValue) 
     11  CSpatialTransformFilter::CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, double outputValue, size_t inputSlotsCount) 
     12    : CFilter(gc, inputSlotsCount, engine), outputDefaultValue(outputValue) 
    1313  { /* Nothing to do */ } 
    1414 
    1515  std::pair<std::shared_ptr<CSpatialTransformFilter>, std::shared_ptr<CSpatialTransformFilter> > 
    16   CSpatialTransformFilter::buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double missingValue, 
    17                                             bool buildWorkflowGraph) 
     16  CSpatialTransformFilter::buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double missingValue) 
    1817  { 
    1918    if (!srcGrid || !destGrid) 
     
    3231      double defaultValue  = (hasMissingValue) ? std::numeric_limits<double>::quiet_NaN() : 0.0; 
    3332 
     33 
    3434      const CGridTransformationSelector::ListAlgoType& algoList = gridTransformation->getAlgoList() ; 
    3535      CGridTransformationSelector::ListAlgoType::const_iterator it  ; 
     
    3939 
    4040      std::shared_ptr<CSpatialTransformFilter> filter ; 
    41       if( isSpatialTemporal) 
    42         filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTemporalFilter(gc, engine, gridTransformation, defaultValue, inputCount, buildWorkflowGraph)); 
    43       else 
    44         filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTransformFilter(gc, engine, defaultValue, inputCount, buildWorkflowGraph)); 
    45  
     41      if( isSpatialTemporal) filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTemporalFilter(gc, engine, gridTransformation, defaultValue, inputCount)); 
     42      else filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTransformFilter(gc, engine, defaultValue, inputCount)); 
     43 
     44       
    4645      if (!lastFilter) 
    4746        lastFilter = filter; 
    4847      else 
    49       { 
    5048        filter->connectOutput(firstFilter, 0); 
    51         if (buildWorkflowGraph) 
    52         { 
    53           int filterOut = (std::static_pointer_cast<COutputPin>(filter))->getFilterId(); 
    54           int filterIn = (std::static_pointer_cast<COutputPin>(firstFilter))->getFilterId(); 
    55           // PASS field's id here 
    56           CWorkflowGraph::mapFieldToFilters["XXX"].push_back(filterOut); 
    57           CWorkflowGraph::mapFieldToFilters["XXX"].push_back(filterIn); 
    58           CWorkflowGraph::mapFilters[filterOut] = "Spatial transform filter"; 
    59           CWorkflowGraph::mapFilters[filterIn] = "Spatial transform filter"; 
    60         } 
    61       } 
    6249 
    6350      firstFilter = filter; 
     
    7966  { 
    8067    CSpatialTransformFilterEngine* spaceFilter = static_cast<CSpatialTransformFilterEngine*>(engine); 
    81     CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue); 
     68    CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue, this->tag, this->start_graph, this->end_graph, this->field); 
    8269    if (outputPacket) 
    8370      onOutputReady(outputPacket); 
    8471  } 
    8572 
    86   CSpatialTemporalFilter::CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, 
    87                                                   CGridTransformation* gridTransformation, double outputValue, 
    88                                                   size_t inputSlotsCount, bool buildWorkflowGraph) 
    89     : CSpatialTransformFilter(gc, engine, outputValue, inputSlotsCount, buildWorkflowGraph), record(0) 
     73  CSpatialTemporalFilter::CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, double outputValue, size_t inputSlotsCount) 
     74    : CSpatialTransformFilter(gc, engine, outputValue, inputSlotsCount), record(0) 
    9075  { 
    9176      const CGridTransformationSelector::ListAlgoType& algoList = gridTransformation->getAlgoList() ; 
     
    11398  { 
    11499    CSpatialTransformFilterEngine* spaceFilter = static_cast<CSpatialTransformFilterEngine*>(engine); 
    115     CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue); 
     100    CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue, this->tag, this->start_graph, this->end_graph, this->field); 
    116101 
    117102    if (outputPacket) 
     
    138123        packet->data.resize(tmpData.numElements()); 
    139124        packet->data = tmpData; 
     125        packet->field = this->field; 
    140126        onOutputReady(packet); 
    141127        tmpData.resize(0) ; 
     
    176162  } 
    177163 
    178   CDataPacketPtr CSpatialTransformFilterEngine::applyFilter(std::vector<CDataPacketPtr> data, double defaultValue) 
    179   { 
     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 
    180197    CDataPacketPtr packet(new CDataPacket); 
    181198    packet->date = data[0]->date; 
     
    194211      if (0 != packet->data.numElements()) 
    195212        (packet->data)(0) = defaultValue; 
    196       apply(data[0]->data, packet->data); 
     213      if(BG) apply(data[0]->data, packet->data, this->filterID); 
     214      else apply(data[0]->data, packet->data); 
    197215    } 
    198216 
     
    200218  } 
    201219 
    202   void CSpatialTransformFilterEngine::apply(const CArray<double, 1>& dataSrc, CArray<double,1>& dataDest) 
     220  void CSpatialTransformFilterEngine::apply(const CArray<double, 1>& dataSrc, CArray<double,1>& dataDest, int filterID) 
    203221  { 
    204222    CTimer::get("CSpatialTransformFilterEngine::apply").resume();  
     
    313331        const std::vector<std::pair<int,double> >& localIndex_p = itRecv->second; 
    314332        int srcRank = itRecv->first; 
     333 
     334        if(filterID >=0) // building_graph 
     335        { 
     336           (*CWorkflowGraph::mapFilters_ptr_with_info)[filterID].filter_name = (*itAlgo)->getName(); 
     337        }  
    315338        if (srcRank != rank) 
    316339        { 
  • XIOS/dev/dev_olga/src/filter/spatial_transform_filter.hpp

    r1653 r1686  
    33 
    44#include "filter.hpp" 
     5#include "field.hpp" 
    56 
    67namespace xios 
     
    910  class CGridTransformation; 
    1011  class CSpatialTransformFilterEngine; 
     12 
     13  class CField; 
    1114 
    1215  /*! 
     
    2326       * \param outputValue default value of output pin 
    2427       * \param [in] inputSlotsCount number of input, by default there is only one for field src 
    25        * \param buildWorkflowGraph indicates whether data will be visualized 
    2628       */ 
    2729      CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, 
    28                               double outputValue, size_t inputSlotsCount = 1, bool buildWorkflowGraph = false); 
     30                              double outputValue, size_t inputSlotsCount = 1); 
    2931 
    3032      inline StdString GetName(void) {return StdString("Spatial transform filter");}; 
     
    3840       * \param hasMissingValue whether field source has missing value 
    3941       * \param defaultValue default value 
    40        * \param buildWorkflowGraph indicates whether data will be visualized 
    4142       * \return the first and the last filters of the filter graph 
    4243       */ 
    4344      static std::pair<std::shared_ptr<CSpatialTransformFilter>, std::shared_ptr<CSpatialTransformFilter> > 
    44       buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double defaultValue, bool buildWorkflowGraph = false); 
     45      buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double defaultValue); 
    4546 
    4647    protected: 
     
    7273       * \param outputValue default value of output pin 
    7374       * \param [in] inputSlotsCount number of input, by default there is only one for field src 
    74        * \param buildWorkflowGraph indicates whether data will be visualized 
    75        * 
    7675       */ 
    77       CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, 
    78                             double outputValue, size_t inputSlotsCount = 1, bool buildWorkflowGraph = false); 
     76      CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, double outputValue, size_t inputSlotsCount = 1); 
    7977 
    8078 
     
    10199  { 
    102100    public: 
     101 
     102      int filterID; 
     103      int tag; 
     104      CField *field; 
    103105      /*! 
    104106       * Returns the engine wrapping the specified grid transformation. 
     
    117119       * \return the result of the grid transformation 
    118120       */ 
    119       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); 
    120123 
    121124       /*! 
     
    144147       * \param dataDest the resulting transformed data 
    145148       */ 
    146       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); 
    147150 
    148151      CGridTransformation* gridTransformation; //!< The grid transformation used by the engine 
  • XIOS/dev/dev_olga/src/filter/store_filter.cpp

    r1654 r1686  
    33#include "grid.hpp" 
    44#include "timer.hpp" 
     5#include "file.hpp" 
    56 
    67namespace xios 
     
    2122      ERROR("CStoreFilter::CStoreFilter(CContext* context, CGrid* grid)", 
    2223            "Impossible to construct a store filter without providing a grid."); 
    23 //    filterId = InvalidableObject::count; 
    24 //    InvalidableObject::count++; 
    2524  } 
    2625 
     
    7877  template CDataPacket::StatusCode CStoreFilter::getData<7>(Time timestamp, CArray<double, 7>& data); 
    7978 
     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 
    80106  void CStoreFilter::onInputReady(std::vector<CDataPacketPtr> data) 
    81107  { 
     108    buildGraph(data); 
    82109 
    83110    CDataPacketPtr packet; 
     
    128155    packets.erase(packets.begin(), packets.lower_bound(timestamp)); 
    129156  } 
    130  
    131   int CStoreFilter::getFilterId(void) 
    132   { 
    133     return filterId; 
    134   } 
    135  
    136157} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/store_filter.hpp

    r1653 r1686  
    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 
    75       /*! 
    76        * Returns filter's id needed in case of building workflow graph 
    77        */ 
    78       int getFilterId(); 
     78      int filterID; 
     79      int tag; 
     80      Time start_graph; 
     81      Time end_graph; 
     82      CField *field; 
     83      int distance; 
     84 
    7985 
    8086    protected: 
     
    8591       */ 
    8692      void virtual onInputReady(std::vector<CDataPacketPtr> data); 
     93      void virtual buildGraph(std::vector<CDataPacketPtr> data); 
    8794 
    8895    private: 
    89       CGarbageCollector& gc;            //!< The garbage collector associated to the filter 
    90       CContext* context;                //!< The context to which the data belongs 
    91       CGrid* grid;                      //!< The grid attached to the data the filter can accept 
    92       const bool detectMissingValues;   //!< Whether missing values should be detected 
    93       const double missingValue;        //!< The value to use to replace missing values 
     96      CGarbageCollector& gc; //!< The garbage collector associated to the filter 
     97      CContext* context; //!< The context to which the data belongs 
     98      CGrid* grid; //!< The grid attached to the data the filter can accept 
     99      const bool detectMissingValues; //!< Whether missing values should be detected 
     100      const double missingValue; //!< The value to use to replace missing values 
    94101      std::map<Time, CDataPacketPtr> packets; //<! The stored packets 
    95       int filterId;                     //!< Filter's id needed in case of building a workflow 
    96  
    97102  }; // class CStoreFilter 
    98103} // namespace xios 
  • XIOS/dev/dev_olga/src/filter/temporal_filter.cpp

    r1653 r1686  
    22#include "functor_type.hpp" 
    33#include "calendar_util.hpp" 
     4#include "workflow_graph.hpp" 
     5#include "file.hpp" 
    46 
    57namespace xios 
     
    911  CTemporalFilter::CTemporalFilter(CGarbageCollector& gc, const std::string& opId, 
    1012                                   const CDate& initDate, const CDuration samplingFreq, const CDuration samplingOffset, const CDuration opFreq, 
    11                                    bool ignoreMissingValue /*= false*/, bool buildWorkflowGraph /*= false*/) 
    12     : CFilter(gc, 1, this, buildWorkflowGraph) 
     13                                   bool ignoreMissingValue /*= false*/) 
     14    : CFilter(gc, 1, this) 
    1315    , functor(createFunctor(opId, ignoreMissingValue, tmpData)) 
    1416    , isOnceOperation(functor->timeType() == func::CFunctor::once) 
     
    2527    , nbOperationDates(1) 
    2628    , nbSamplingDates(0) 
     29//    , nextOperationDate(initDate + opFreq + this->samplingOffset) 
    2730    , isFirstOperation(true) 
     31    , temp_op(opId) 
    2832  { 
    2933  } 
    3034 
     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 
    3183  CDataPacketPtr CTemporalFilter::apply(std::vector<CDataPacketPtr> data) 
    3284  { 
     85    bool BG = buildGraph(data); 
     86 
    3387    CDataPacketPtr packet; 
    3488 
     
    77131 
    78132        isFirstOperation = false; 
     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        } 
    79144      } 
    80145    } 
     
    90155  bool CTemporalFilter::isDataExpected(const CDate& date) const 
    91156  { 
     157//    return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date + samplingFreq > nextOperationDate); 
    92158    return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date > initDate + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth); 
    93159  } 
  • XIOS/dev/dev_olga/src/filter/temporal_filter.hpp

    r1653 r1686  
    2929      CTemporalFilter(CGarbageCollector& gc, const std::string& opId, 
    3030                      const CDate& initDate, const CDuration samplingFreq, const CDuration samplingOffset, const CDuration opFreq, 
    31                       bool ignoreMissingValue = false, bool buildWorkflowGraph = false); 
     31                      bool ignoreMissingValue = false); 
    3232 
    3333      inline StdString GetName(void) {return StdString("Temporal filter");}; 
     
    4040       */ 
    4141      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data); 
     42      bool virtual buildGraph(std::vector<CDataPacketPtr> data); 
    4243 
    4344      /*! 
     
    5455       */ 
    5556      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; 
    5661 
    5762    private: 
  • XIOS/dev/dev_olga/src/filter/ternary_arithmetic_filter.cpp

    r1162 r1686  
    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/dev/dev_olga/src/filter/ternary_arithmetic_filter.hpp

    r1162 r1686  
    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/dev/dev_olga/src/filter/unary_arithmetic_filter.cpp

    r643 r1686  
    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/dev/dev_olga/src/filter/unary_arithmetic_filter.hpp

    r642 r1686  
    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/dev/dev_olga/src/graphviz.cpp

    r1653 r1686  
    1111   * 
    1212   */ 
    13   void CGraphviz::buildStaticWorkflowGraph() 
     13  void CGraphviz::buildWorkflowGraphDot() 
    1414  TRY 
    1515  { 
    16     if (!CWorkflowGraph::mapFieldToFilters.empty()) 
     16    if (CWorkflowGraph::mapFieldToFilters_ptr_with_info !=0 && !CWorkflowGraph::mapFieldToFilters_ptr_with_info->empty()) 
    1717    { 
    1818      CWorkflowGraph::buildStaticWorkflow(); 
     
    5858          boost::make_label_writer(get(edge_name, g)), 
    5959          boost::make_graph_attributes_writer(graph_attr, vertex_attr, edge_attr)); 
     60          
    6061    } 
    6162  } 
    6263  CATCH 
     64 
     65 
     66 
     67 
     68  void CGraphviz::buildWorkflowGraphVisjs_with_info() 
     69  TRY 
     70  { 
     71    if (CWorkflowGraph::mapFilters_ptr_with_info !=0 && !CWorkflowGraph::mapFilters_ptr_with_info->empty()) 
     72    { 
     73      CWorkflowGraph::buildStaticWorkflow_with_info(); 
     74 
     75      StdString color_table[7] = {"black", "red", "blue", "green", "purple", "yellow", "gray"}; 
     76     
     77      std::ofstream fs_json; 
     78      fs_json.open ("graph_data.json", std::fstream::out); 
     79 
     80      fs_json << "{\"nodes\":["<<std::endl<<"      "; 
     81      static bool firstnode=true; 
     82      static bool firstedge=true; 
     83     
     84      for (auto it=CWorkflowGraph::mapFilters_ptr_with_info->begin(); it != CWorkflowGraph::mapFilters_ptr_with_info->end(); it++) 
     85      { 
     86        if(firstnode)  
     87        { 
     88          fs_json << "{\"id\": "<<it->first +1<<", "<<std::endl; 
     89          firstnode = false; 
     90        } 
     91        else 
     92        { 
     93          fs_json << ",{\"id\": "<<it->first +1<<", "<<std::endl; 
     94        } 
     95        if(it->second.filter_class == 1) // source filter 
     96          fs_json << "       \"label\": \""<<it->second.filter_name<<"\\n("<<it->second.field_id<<")\", "<<std::endl; 
     97        else 
     98          fs_json << "       \"label\": \""<<it->second.filter_name<<"\", "<<std::endl; 
     99        fs_json << "       \"class\": "<<it->second.filter_class<<", "<<std::endl; 
     100        fs_json << "       \"filled\": "<<it->second.filter_filled<<", "<<std::endl; 
     101        fs_json << "       \"type\": \""<<it->second.transform_type<<"\", "<<std::endl; 
     102        fs_json << "       \"entry\": "<<it->second.expected_entry_nb<<", "<<std::endl; 
     103        fs_json << "       \"inputs\": "<<it->second.inputs_complete<<", "<<std::endl; 
     104        fs_json << "       \"tag\": "<<it->second.filter_tag<<", "<<std::endl; 
     105        fs_json << "       \"cid\": "<<it->second.clusterID<<", "<<std::endl; 
     106        fs_json << "       \"distance\": "<<it->second.distance<<", "<<std::endl; 
     107        fs_json << "       \"attributes\": \""<<it->second.attributes<<"\"}"<<std::endl<<"      "; 
     108      } 
     109      fs_json << "    ],"<<std::endl; 
     110 
     111 
     112      fs_json << " \"edges\" : ["<<std::endl<<"      "; 
     113 
     114      for (auto it=CWorkflowGraph::mapFieldToFilters_ptr_with_info->begin(); it != CWorkflowGraph::mapFieldToFilters_ptr_with_info->end(); it++) 
     115      { 
     116        if(firstedge) 
     117        { 
     118          fs_json << "{\"id\": "<<it->first +1<<", "<<std::endl; 
     119          firstedge = false; 
     120        } 
     121        else 
     122        { 
     123          fs_json << ",{\"id\": "<<it->first +1<<", "<<std::endl; 
     124        } 
     125        fs_json << "       \"from\": "<<it->second.from+1<<", "<<std::endl; 
     126        fs_json << "       \"to\": "<<it->second.to+1<<", "<<std::endl; 
     127        fs_json << "       \"label\": \""<<it->second.field_id<<"\\n"<<it->second.date<<"\", "<<std::endl; 
     128        // fs_json << "       \"title\": \""<<"Show more information about this field"<<"\", "<<std::endl; 
     129        // fs_json << "       \"fid\": \""<<it->second.field_id<<"\", "<<std::endl; 
     130        // fs_json << "       \"fname\": \""<<it->second.field_name<<"\", "<<std::endl; 
     131        // fs_json << "       \"gid\": \""<<it->second.grid_id<<"\", "<<std::endl; 
     132        fs_json << "       \"date\": \""<<it->second.date<<"\", "<<std::endl; 
     133        fs_json << "       \"attributes\": \"id = "<<it->second.field_id<<"</br>"<<it->second.attributes<<"\"}"<<std::endl<<"      "; 
     134 
     135      } 
     136      fs_json << "    ]}"<<std::endl; 
     137 
     138      fs_json.close(); 
     139    } 
     140  } 
     141  CATCH 
     142 
     143 
     144 
     145  void CGraphviz::showStaticWorkflowGraph() 
     146  TRY 
     147  { 
     148    CWorkflowGraph::showStaticWorkflow(); 
     149  } 
     150  CATCH 
    63151} 
  • XIOS/dev/dev_olga/src/graphviz.hpp

    r1653 r1686  
    1616 
    1717      CGraphviz(); 
    18       static void buildStaticWorkflowGraph(); 
     18      static void buildWorkflowGraphDot(); 
     19      static void buildWorkflowGraphVisjs_with_info(); 
     20      static void showStaticWorkflowGraph(); 
    1921 
    2022    private: 
  • XIOS/dev/dev_olga/src/interface/fortran/ixios.F90

    r1590 r1686  
    88                      xios(get_year_length_in_seconds), xios(get_day_length_in_seconds) 
    99 
    10 USE icontext, ONLY : txios(context), xios(set_current_context), xios(is_valid_context) 
     10USE icontext, ONLY : txios(context), xios(set_current_context), xios(get_current_context), xios(is_valid_context) 
    1111 
    1212USE icontext_attr, ONLY : xios(set_context_attr), xios(get_context_attr), xios(is_defined_context_attr) 
  • XIOS/dev/dev_olga/src/io/onetcdf4_impl.hpp

    r1653 r1686  
    7676    memset (PtrArrayStr,' ',stringArrayLen*data.numElements()); 
    7777    size_t offset=0 ; 
     78 
     79// pb with iterator with blitz++ string array  with recent compiler 
     80/* 
    7881    Array<StdString,1>::const_iterator it, itb=data.begin(), ite=data.end() ; 
    7982    for(it=itb;it!=ite;++it, offset+=stringArrayLen) 
     
    8285      PtrArrayStr[offset+it->size()]='\0' ; 
    8386    } 
    84  
     87*/ 
     88     for(int i=0;i<data.numElements();i++,offset+=stringArrayLen) 
     89     { 
     90       data(i).copy(PtrArrayStr+offset,data(i).size()) ; 
     91       PtrArrayStr[offset+data(i).size()]='\0' ; 
     92     }  
    8593     CTimer::get("CONetCDF4::writeData writeData_").resume(); 
    8694     this->writeData_(grpid, varid, sstart, scount, PtrArrayStr); 
  • XIOS/dev/dev_olga/src/node/axis.cpp

    r1612 r1686  
    345345      Check the validity of data, fill in values if any, and apply mask. 
    346346   */ 
    347  
    348347   void CAxis::checkData() 
    349348   TRY 
     
    848847 
    849848      numberWrittenIndexes_[writtenCommSize] = nbWritten; 
    850       if (isDistributed()) 
     849 
     850      bool distributed_glo, distributed=isDistributed() ; 
     851      MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, writtenComm) ; 
     852      if (distributed_glo) 
    851853      { 
    852854              
  • XIOS/dev/dev_olga/src/node/domain.cpp

    r1612 r1686  
    226226      bool distributed =  !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) || 
    227227              (!i_index.isEmpty() && i_index.numElements() == ni_glo*nj_glo)); 
     228      bool distributed_glo ; 
    228229      distributed |= (1 == CContext::getCurrent()->client->clientSize); 
    229230 
     
    20612062 
    20622063      numberWrittenIndexes_[writtenCommSize] = nbWritten; 
    2063       if (isDistributed()) 
     2064      bool distributed_glo, distributed=isDistributed() ; 
     2065      MPI_Allreduce(&distributed,&distributed_glo, 1, MPI_INT, MPI_LOR, writtenComm) ; 
     2066       
     2067      if (distributed_glo) 
    20642068      { 
    20652069              
  • XIOS/dev/dev_olga/src/node/field.cpp

    r1654 r1686  
    4646      , mustAutoTrigger(false) 
    4747      , isEOF(false), nstepMaxRead(false) 
    48    { 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   } 
    4952 
    5053   CField::CField(const StdString& id) 
     
    6467      , mustAutoTrigger(false) 
    6568      , isEOF(false), nstepMaxRead(false) 
    66    { 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 
    6774 
    6875   CField::~CField(void) 
     
    11071114    *                     read by the client or/and written to a file 
    11081115    */ 
    1109    void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput) 
     1116   void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput, Time start_graph, Time end_graph) 
    11101117   TRY 
    11111118   {      
    1112      if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 
    1113      if (!isGridChecked) checkGridOfEnabledFields(); 
     1119    if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 
     1120    if (!isGridChecked) checkGridOfEnabledFields(); 
    11141121 
    11151122     const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     1123      
    11161124     const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
     1125 
     1126      
    11171127     const double defaultValue  = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
    11181128 
    11191129     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 
    11201184     bool hasWriterServer = context->hasServer && !context->hasClient; 
    11211185     bool hasIntermediateServer = context->hasServer && context->hasClient; 
     
    11241188     { 
    11251189        if (!instantDataFilter) 
    1126         { 
    11271190          instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false)); 
    1128         } 
     1191 
    11291192 
    11301193       // If the field data is to be read by the client or/and written to a file 
     
    11411204     { 
    11421205       if (!instantDataFilter) 
    1143        { 
    11441206         instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, false)); 
    1145        } 
     1207 
    11461208             // If the field data is to be read by the client or/and written to a file 
    11471209       if (enableOutput && !storeFilter && !fileWriterFilter) 
     
    11631225         { 
    11641226           boost::scoped_ptr<IFilterExprNode> expr(parseExpr(getExpression() + '\0')); 
    1165            std::shared_ptr<COutputPin> filter = expr->reduce(gc, *this); 
     1227           std::shared_ptr<COutputPin> filter = expr->reduce(gc, *this, filter_start, filter_end); 
    11661228 
    11671229           // Check if a spatial transformation is needed 
    11681230           if (!field_ref.isEmpty()) 
    11691231           { 
    1170              CField* fieldRef = CField::get(field_ref); 
    1171              fieldRef->build_workflow_graph.setValue(buildWorkflowGraph); 
    1172              CGrid* gridRef = fieldRef->grid; 
     1232             CGrid* gridRef = CField::get(field_ref)->grid; 
    11731233 
    11741234             if (grid && grid != gridRef && grid->hasTransform()) 
    11751235             { 
    1176                std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, 
    1177                                                                                          detectMissingValues, defaultValue, buildWorkflowGraph); 
     1236                 std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue);  
    11781237 
    11791238               filter->connectOutput(filters.first, 0); 
    1180  
    1181                if (buildWorkflowGraph) 
    1182                { 
    1183                  int filterOut = filter->getFilterId(); 
    1184                  int filterIn = (std::static_pointer_cast<COutputPin>(filters.second))->getFilterId(); 
    1185                  CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterOut); 
    1186                  CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterIn); 
    1187                  CWorkflowGraph::mapFilters[filterOut] = filter->GetName(); 
    1188                  CWorkflowGraph::mapFilters[filterIn] = filters.second->GetName(); 
    1189                } 
    11901239               filter = filters.second; 
    11911240             } 
     
    11931242 
    11941243           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           } 
    11951254         } 
    11961255         // Check if we have a reference on another field 
    11971256         else if (!field_ref.isEmpty()) 
    11981257         { 
    1199            CField::get(field_ref)->build_workflow_graph.setValue(buildWorkflowGraph); 
    1200            instantDataFilter = getFieldReference(gc); 
     1258           instantDataFilter = getFieldReference(gc, filter_start, filter_end); 
     1259           instantDataFilter->tag = buildWorkflowGraph; 
     1260           instantDataFilter->start_graph = filter_start; 
     1261           instantDataFilter->end_graph = filter_end; 
    12011262         } 
    12021263         // Check if the data is to be read from a file 
     
    12051266           checkTimeAttributes(); 
    12061267           instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false, freq_offset, true, 
    1207                                                                                                        detectMissingValues, defaultValue, buildWorkflowGraph)); 
     1268                                                                                                       detectMissingValues, defaultValue)); 
     1269           instantDataFilter->tag = buildWorkflowGraph; 
     1270           instantDataFilter->start_graph = filter_start; 
     1271           instantDataFilter->end_graph = filter_end; 
     1272           instantDataFilter->field = this; 
     1273 
    12081274         } 
    12091275         else // The data might be passed from the model 
     
    12111277            if (check_if_active.isEmpty()) check_if_active = false;  
    12121278            instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, true, NoneDu, false, 
    1213                                                                                                       detectMissingValues, defaultValue, buildWorkflowGraph)); 
    1214             if (buildWorkflowGraph) CWorkflowGraph::mapFilters[instantDataFilter->getFilterId()] = instantDataFilter->GetName(); 
     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; 
    12151285         } 
    12161286       } 
     
    12241294                                                                          detectMissingValues, defaultValue)); 
    12251295           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; 
    12261306         } 
    12271307 
    12281308         if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 
    12291309         { 
    1230            fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, buildWorkflowGraph)); 
     1310           fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 
    12311311           getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 
    1232            if (buildWorkflowGraph) 
    1233            { 
    1234              int filterOut = getTemporalDataFilter(gc, file->output_freq)->getFilterId(); 
    1235              int filterIn = fileWriterFilter->getFilterId(); 
    1236              CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterOut); 
    1237              CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterIn); 
    1238              CWorkflowGraph::mapFilters[filterOut] = "Temporal filter"; 
    1239              CWorkflowGraph::mapFilters[filterIn] = fileWriterFilter->GetName(); 
    1240            } 
     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 
    12411324         } 
    12421325       } 
     
    12521335    * \return the output pin corresponding to the field reference 
    12531336    */ 
    1254    std::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc) 
     1337   std::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc, Time start_graph, Time end_graph) 
    12551338   TRY 
    12561339   { 
     
    12601343 
    12611344     CField* fieldRef = CField::get(field_ref); 
    1262      fieldRef->buildFilterGraph(gc, false); 
    1263      bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
     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 
    12641396 
    12651397     std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters; 
     
    12691401       bool hasMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    12701402       double defaultValue  = hasMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0);                                 
    1271        filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue, buildWorkflowGraph); 
     1403       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        
    12721418     } 
    12731419     else 
    12741420     { 
    1275        filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc, buildWorkflowGraph)); 
    1276      } 
    1277  
    1278      fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 
    1279  
    1280      if (buildWorkflowGraph) 
    1281      { 
    1282        int filterOut = fieldRef->instantDataFilter->getFilterId(); 
    1283        int filterIn = (std::static_pointer_cast<COutputPin>(filters.first))->getFilterId(); 
    1284        CWorkflowGraph::mapFieldToFilters[fieldRef->getId()].push_back(filterOut); 
    1285        CWorkflowGraph::mapFieldToFilters[fieldRef->getId()].push_back(filterIn); 
    1286        CWorkflowGraph::mapFilters[filterOut] = fieldRef->getInstantDataFilter()->GetName(); 
    1287        CWorkflowGraph::mapFilters[filterIn] = filters.first->GetName(); 
    1288      } 
     1421       filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 
     1422 
     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     } 
     1436 
    12891437     return filters.second; 
    12901438   } 
     
    13001448    * \return the output pin corresponding to a self reference 
    13011449    */ 
    1302    std::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc) 
    1303    TRY 
    1304    { 
     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 
    13051455     if (instantDataFilter || !hasExpression()) 
    13061456       ERROR("COutputPin* CField::getSelfReference(CGarbageCollector& gc)", 
    13071457             "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); 
    13081460 
    13091461     if (!selfReferenceFilter) 
     
    13421494     } 
    13431495 
     1496     selfReferenceFilter->tag = buildWorkflowGraph; 
     1497     selfReferenceFilter->field = this; 
    13441498     return selfReferenceFilter; 
    13451499   } 
     
    13611515     const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
    13621516 
     1517     CContext* context = CContext::getCurrent(); 
     1518 
     1519     // Time filter_start; 
     1520     // if(!build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = context->calendar->getInitDate()+build_workflow_graph_start; 
     1521     // else if(build_workflow_graph_start.isEmpty() && buildWorkflowGraph) filter_start = 0; 
     1522     // else filter_start = -1; 
     1523 
     1524     // Time filter_end; 
     1525     // if(!build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = context->calendar->getInitDate()+build_workflow_graph_end; 
     1526     // else if(build_workflow_graph_end.isEmpty() && buildWorkflowGraph) filter_end = 9223372036854775807; 
     1527     // else filter_end = -1; 
     1528 
     1529     // filter_start = this->field_graph_start; 
     1530     // filter_end = this->field_graph_end; 
     1531 
     1532     // if(CXios::isClient) std::cout<<"getTemporalDataFilter field_id = "<<this->getId()<<" this->field_graph_start = "<<this->field_graph_start<<" this->field_graph_end = "<<this->field_graph_end<<std::endl; 
     1533 
    13631534     if (it == temporalDataFilters.end()) 
    13641535     { 
     
    13701541 
    13711542       const bool detectMissingValues = (!detect_missing_value.isEmpty()  && detect_missing_value == true); 
    1372        std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, CContext::getCurrent()->getCalendar()->getInitDate(), 
    1373                                                                              freq_op, freq_offset, outFreq, 
    1374                                                                              detectMissingValues, buildWorkflowGraph)); 
     1543       std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 
     1544                                                                             CContext::getCurrent()->getCalendar()->getInitDate(), 
     1545                                                                             freq_op, freq_offset, outFreq, detectMissingValues)); 
    13751546 
    13761547       instantDataFilter->connectOutput(temporalFilter, 0); 
    1377  
    1378        if (buildWorkflowGraph) 
    1379        { 
    1380          int filterOut = instantDataFilter->getFilterId(); 
    1381          int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId(); 
    1382          CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterOut); 
    1383          CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterIn); 
    1384          CWorkflowGraph::mapFilters[filterOut] = getInstantDataFilter()->GetName(); 
    1385          CWorkflowGraph::mapFilters[filterIn] = temporalFilter->GetName(); 
    1386        } 
     1548       // temporalFilter->tag = buildWorkflowGraph; 
     1549        
     1550       temporalFilter->parent_filters.resize(1); 
     1551       temporalFilter->parent_filters[0] = instantDataFilter; 
     1552        
     1553 
     1554       if(temporalFilter->parent_filters[0]->tag) temporalFilter->tag=true; 
     1555 
     1556       // temporalFilter->start_graph = filter_start; 
     1557       // temporalFilter->end_graph = filter_end; 
     1558       temporalFilter->field = this; 
    13871559 
    13881560       it = temporalDataFilters.insert(std::make_pair(outFreq, temporalFilter)).first; 
    13891561     } 
     1562 
    13901563     return it->second; 
    13911564   } 
     
    14191592 
    14201593       const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); 
    1421        const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
     1594       bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
    14221595       std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 
    1423                                                                            CContext::getCurrent()->getCalendar()->getInitDate(), 
    1424                                                                            freq_op, freq_offset, outFreq, 
    1425                                                                            detectMissingValues, buildWorkflowGraph)); 
     1596                                                                             CContext::getCurrent()->getCalendar()->getInitDate(), 
     1597                                                                             freq_op, freq_offset, outFreq, detectMissingValues)); 
    14261598 
    14271599       selfReferenceFilter->connectOutput(temporalFilter, 0); 
    1428        if (buildWorkflowGraph) 
    1429  
    1430        { 
    1431          int filterOut = selfReferenceFilter->getFilterId(); 
    1432          int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId(); 
    1433          CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterOut); 
    1434          CWorkflowGraph::mapFieldToFilters[this->getId()].push_back(filterIn); 
    1435          CWorkflowGraph::mapFilters[filterOut] = selfReferenceFilter->GetName(); 
    1436          CWorkflowGraph::mapFilters[filterIn] = temporalFilter->GetName(); 
    1437        } 
     1600       temporalFilter->tag = buildWorkflowGraph; 
     1601       temporalFilter->field = this; 
    14381602 
    14391603       return temporalFilter ; 
  • XIOS/dev/dev_olga/src/node/field.hpp

    r1653 r1686  
    140140         void checkTimeAttributes(CDuration* freqOp=NULL); 
    141141 
    142          void buildFilterGraph(CGarbageCollector& gc, bool enableOutput); 
     142         void buildFilterGraph(CGarbageCollector& gc, bool enableOutput, Time start_graph=-1, Time end_graph=-1); 
    143143         size_t getGlobalWrittenSize(void) ; 
    144144          
    145145          
    146          std::shared_ptr<COutputPin> getFieldReference(CGarbageCollector& gc); 
    147          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); 
    148148         std::shared_ptr<COutputPin> getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); 
    149149         std::shared_ptr<COutputPin> getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq); 
     
    244244         bool hasTimeCentered; 
    245245 
     246         Time field_graph_start; 
     247         Time field_graph_end; 
     248 
     249 
    246250         DECLARE_REF_FUNC(Field,field) 
    247251 
  • XIOS/dev/dev_olga/src/parse_expr/filter_expr_node.cpp

    r1577 r1686  
    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/dev/dev_olga/src/parse_expr/filter_expr_node.hpp

    r1542 r1686  
    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/dev/dev_olga/src/parse_expr/yacc_parser.cpp

    r1158 r1686  
    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/dev/dev_olga/src/test/test_client.f90

    r1202 r1686  
    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/dev/dev_olga/src/tracer.cpp

    r501 r1686  
    11#include "tracer.hpp" 
    2 #ifdef VTRACE 
     2 
     3#if defined(VTRACE) 
     4 
    35#include <vt_user.h> 
     6 
     7#elif defined(SCOREP) 
     8 
     9#include <scorep/SCOREP_User.h> 
     10 
     11#elif defined(ITAC) 
     12 
     13#include <VT.h> 
     14 
    415#endif 
     16 
    517#include <string> 
     18#include <map> 
     19#include <iostream> 
    620 
    721namespace xios 
    822{ 
    923  using namespace std ; 
     24 
     25  std::map<std::string,int> regionId ; 
     26  int count=0 ; 
    1027   
    1128  void traceOn(void) 
    1229  { 
    13 #ifdef VTRACE 
     30#if defined(VTRACE) 
    1431    VT_ON() ; 
     32#elif defined(SCOREP) 
     33    SCOREP_RECORDING_ON() ; 
     34#elif defined(ITAC) 
     35    VT_traceon() ; 
    1536#endif 
    1637  } 
     
    1839  void traceOff(void)  
    1940  { 
    20 #ifdef VTRACE 
     41#if defined(VTRACE) 
    2142    VT_OFF() ; 
     43#elif defined(SCOREP) 
     44    SCOREP_RECORDING_OFF() 
     45#elif defined(ITAC) 
     46    VT_traceoff()   ;   
    2247#endif 
    2348  } 
     
    2550  void traceBegin(const string& name) 
    2651  { 
    27 #ifdef VTRACE 
     52#if defined(VTRACE) 
    2853    VT_USER_START(name.c_str()) ; 
     54#elif defined(SCOREP) 
     55    SCOREP_USER_REGION_BY_NAME_BEGIN(name.c_str(),SCOREP_USER_REGION_TYPE_COMMON) 
     56 
     57#elif defined(ITAC) 
     58    int classhandle ; 
     59    auto it = regionId.find(name); 
     60    if (it==regionId.end()) 
     61    { 
     62      classhandle=count ; 
     63      count++ ; 
     64      VT_symdef (classhandle, name.c_str(), "XIOS") ; 
     65      regionId[name]=classhandle; 
     66    } 
     67    else classhandle = it->second ; 
     68    VT_begin(classhandle) ; 
     69    cout<<"VT_begin "<<name<<"  "<<classhandle<<endl ; 
     70 
    2971#endif 
     72 
    3073  } 
    3174   
    3275  void traceEnd(const string& name) 
    3376  { 
    34 #ifdef VTRACE 
     77#if defined (VTRACE) 
    3578    VT_USER_END(name.c_str()) ; 
     79#elif defined(SCOREP) 
     80    SCOREP_USER_REGION_BY_NAME_END(name.c_str()) 
     81#elif defined(ITAC) 
     82    int classhandle ; 
     83    auto it = regionId.find(name); 
     84    if (it==regionId.end()) 
     85    { 
     86      return ; 
     87      VT_classdef (name.c_str(), &classhandle) ; 
     88      regionId[name]=classhandle; 
     89    } 
     90    else classhandle = it->second ; 
     91    VT_end(classhandle) ;     
     92    cout<<"VT_end "<<name<<"  "<<classhandle<<endl ; 
     93 
    3694#endif 
    3795  } 
    3896   
     97    
    3998//  void marker(const string& name,const string& text) ; 
    4099   
  • XIOS/dev/dev_olga/src/transformation/Functions/average_reduction.hpp

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

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

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

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

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

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

    r1314 r1686  
    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/dev/dev_olga/src/transformation/axis_algorithm_extract.hpp

    r1558 r1686  
    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/dev/dev_olga/src/transformation/axis_algorithm_extract_domain.hpp

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

    r933 r1686  
    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/dev/dev_olga/src/transformation/axis_algorithm_inverse.hpp

    r933 r1686  
    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/dev/dev_olga/src/transformation/axis_algorithm_reduce_axis.hpp

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

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

    r1275 r1686  
    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/dev/dev_olga/src/transformation/axis_algorithm_transformation.hpp

    r1275 r1686  
    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/dev/dev_olga/src/transformation/axis_algorithm_zoom.hpp

    r1559 r1686  
    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/dev/dev_olga/src/transformation/domain_algorithm_compute_connectivity.hpp

    r944 r1686  
    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/dev/dev_olga/src/transformation/domain_algorithm_expand.hpp

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

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

    r1410 r1686  
    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/dev/dev_olga/src/transformation/domain_algorithm_interpolate.hpp

    r1480 r1686  
    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/dev/dev_olga/src/transformation/domain_algorithm_reorder.hpp

    r1457 r1686  
    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/dev/dev_olga/src/transformation/domain_algorithm_transformation.hpp

    r888 r1686  
    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/dev/dev_olga/src/transformation/domain_algorithm_zoom.hpp

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

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

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

    r1612 r1686  
    1313#include "grid.hpp" 
    1414#include "grid_transformation_factory_impl.hpp" 
    15 #include "reduction.hpp" 
    1615 
    1716#include "reduction.hpp" 
  • XIOS/dev/dev_olga/src/transformation/scalar_algorithm_reduce_axis.hpp

    r1260 r1686  
    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/dev/dev_olga/src/transformation/scalar_algorithm_reduce_domain.hpp

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

    r1314 r1686  
    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/dev/dev_olga/src/transformation/scalar_algorithm_transformation.hpp

    r888 r1686  
    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); 
  • XIOS/dev/dev_olga/src/workflow_graph.cpp

    r1654 r1686  
    44{ 
    55 
    6   std::unordered_map <StdString, vector <int > > CWorkflowGraph::mapFieldToFilters; 
    7   std::unordered_map <int, StdString> CWorkflowGraph::mapFilters; 
    8   std::unordered_map <int,vector<Time> > CWorkflowGraph::mapFilterTimestamps; 
    9   set<Time>  CWorkflowGraph::timestamps; 
     6  std::unordered_map <int, graph_info_box_node> *CWorkflowGraph::mapFilters_ptr_with_info = 0; 
     7 
     8  std::unordered_map <int, graph_info_box_edge > *CWorkflowGraph::mapFieldToFilters_ptr_with_info = 0; 
     9 
     10  std::unordered_map <size_t, int> *CWorkflowGraph::mapHashFilterID_ptr = 0; 
     11 
    1012 
    1113  vector <StdString> CWorkflowGraph::filters; 
    1214  vector <StdString> CWorkflowGraph::fields; 
    1315  vector <pair<int, int> > CWorkflowGraph::fieldsToFilters; 
     16 
     17  bool CWorkflowGraph::build_begin = false; 
    1418 
    1519  CWorkflowGraph::CWorkflowGraph() 
     
    2226  TRY 
    2327  { 
    24     // Create a list of filters (graph nodes) 
    25     size_t filterIdx = 0; 
    26     filters.resize(mapFilters.size()); 
    27     for (auto it=mapFilters.begin(); it != mapFilters.end(); it++) 
     28     
     29    if(mapFilters_ptr_with_info==0 || mapFieldToFilters_ptr_with_info==0)  
     30      std::cout<<"No graph information provided"<<std::endl; 
     31 
     32    else // Create a list of filters (graph nodes) 
    2833    { 
    29       filters[it->first]=it->second; 
    30     } 
     34      size_t filterIdx = 0; 
     35      filters.resize(mapFilters_ptr_with_info->size()); 
     36      fieldsToFilters.clear(); 
     37      fields.clear(); 
     38      for (auto it=mapFilters_ptr_with_info->begin(); it != mapFilters_ptr_with_info->end(); it++) 
     39      { 
     40        filters[it->first]=it->second.filter_name; 
     41      } 
    3142 
    32     // Create a list of fields and their filter connectivity (graph edges and edge-to-node connectivity) 
    33     for (auto it=mapFieldToFilters.begin(); it != mapFieldToFilters.end(); it++) 
    34     { 
    35       for (size_t i = 0; i < (it->second.size() - 1); i+=2) 
     43      // Create a list of fields and their filter connectivity (graph edges and edge-to-node connectivity) 
     44      for (auto it=mapFieldToFilters_ptr_with_info->begin(); it != mapFieldToFilters_ptr_with_info->end(); it++) 
    3645      { 
    37         fieldsToFilters.push_back(make_pair(it->second[i],it->second[i+1])); 
    38         fields.push_back(it->first); 
     46        fieldsToFilters.push_back(make_pair(it->second.from,it->second.to)); 
     47        fields.push_back(it->second.field_id + " "+it->second.date.toString()); 
    3948      } 
    4049    } 
     
    4251  CATCH 
    4352 
     53 
     54 
     55 
     56/*! 
     57   * Reorganize information collected by XIOS for visualization. 
     58   */ 
     59  void CWorkflowGraph::buildStaticWorkflow_with_info() 
     60  TRY 
     61  { 
     62    // showStaticWorkflow(); 
     63     
     64    if(mapFilters_ptr_with_info==0 || mapFieldToFilters_ptr_with_info==0)  
     65      std::cout<<"No graph information provided"<<std::endl; 
     66 
     67    else // Create a list of filters (graph nodes) 
     68    { 
     69      size_t filterIdx = 0; 
     70      filters.resize(mapFilters_ptr_with_info->size()); 
     71      fieldsToFilters.clear(); 
     72      fields.clear(); 
     73      for (auto it=mapFilters_ptr_with_info->begin(); it != mapFilters_ptr_with_info->end(); it++) 
     74      { 
     75        // std::cout<<"it->first = "<<it->first<<std::endl; 
     76        filters[it->first]=it->second.filter_name; 
     77      } 
     78 
     79      // Create a list of fields and their filter connectivity (graph edges and edge-to-node connectivity) 
     80      for (auto it=mapFieldToFilters_ptr_with_info->begin(); it != mapFieldToFilters_ptr_with_info->end(); it++) 
     81      { 
     82        fieldsToFilters.push_back(make_pair(it->second.from,it->second.to)); 
     83        fields.push_back(it->second.field_id + " "+it->second.date.toString()); 
     84      } 
     85    } 
     86  } 
     87  CATCH 
     88 
     89 
     90 
     91  void CWorkflowGraph::showStaticWorkflow() 
     92  TRY 
     93  { 
     94    if(mapFilters_ptr_with_info!=0 && !mapFilters_ptr_with_info->empty()) 
     95    for (auto it=mapFilters_ptr_with_info->begin(); it != mapFilters_ptr_with_info->end(); it++) 
     96    { 
     97      std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].filter_name="<<it->second.filter_name<<std::endl; 
     98      std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].filter_class="<<it->second.filter_class<<std::endl; 
     99      std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].filter_fillled="<<it->second.filter_filled<<std::endl; 
     100      std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].expected_entry_nb="<<it->second.expected_entry_nb<<std::endl; 
     101      std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].date="<<it->second.date<<std::endl; 
     102      std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].timestamp="<<it->second.timestamp<<std::endl; 
     103      std::cout<<"mapFilters_ptr_with_info["<<it->first<<"].transform_type="<<it->second.transform_type<<std::endl; 
     104    } 
     105    else std::cout<<"mapFilters_ptr_with_info empty"<<std::endl; 
     106 
     107    if(mapFieldToFilters_ptr_with_info!=0 && !mapFieldToFilters_ptr_with_info->empty()) 
     108    for (auto it=mapFieldToFilters_ptr_with_info->begin(); it != mapFieldToFilters_ptr_with_info->end(); it++) 
     109    { 
     110      std::cout<<"mapFieldToFilters_ptr_with_info["<<it->first<<"].from = "<<it->second.from<<std::endl; 
     111      std::cout<<"mapFieldToFilters_ptr_with_info["<<it->first<<"].to = "<<it->second.to<<std::endl; 
     112      std::cout<<"mapFieldToFilters_ptr_with_info["<<it->first<<"].field_id = "<<it->second.field_id<<std::endl; 
     113      std::cout<<"mapFieldToFilters_ptr_with_info["<<it->first<<"].field_name = "<<it->second.field_name<<std::endl; 
     114      std::cout<<"mapFieldToFilters_ptr_with_info["<<it->first<<"].date = "<<it->second.date<<std::endl; 
     115       
     116    } 
     117    else std::cout<<"mapFieldToFilters_ptr_with_info empty"<<std::endl; 
     118 
     119 
     120  } 
     121  CATCH 
     122 
     123 
     124  void CWorkflowGraph::addNode(int nodeID, StdString filterName, int filterClass, bool filterFilled, int entry_nb, CDataPacketPtr packet) 
     125  TRY 
     126  { 
     127    (*mapFilters_ptr_with_info)[nodeID].filter_name = filterName; 
     128    (*mapFilters_ptr_with_info)[nodeID].filter_class = filterClass; 
     129    (*mapFilters_ptr_with_info)[nodeID].filter_filled = filterFilled; 
     130    (*mapFilters_ptr_with_info)[nodeID].expected_entry_nb = entry_nb; 
     131    (*mapFilters_ptr_with_info)[nodeID].date = packet->date; 
     132    (*mapFilters_ptr_with_info)[nodeID].timestamp = packet->timestamp; 
     133  } 
     134  CATCH 
     135 
     136 
     137 
     138  void CWorkflowGraph::addEdge(int edgeID, int toID, CDataPacketPtr packet) 
     139  TRY 
     140  { 
     141    (*mapFieldToFilters_ptr_with_info)[edgeID].from = packet->src_filterID; 
     142    (*mapFieldToFilters_ptr_with_info)[edgeID].to = toID; 
     143    (*mapFieldToFilters_ptr_with_info)[edgeID].field_id = packet->field->getId(); 
     144    (*mapFieldToFilters_ptr_with_info)[edgeID].field_name = packet->field->name; 
     145    (*mapFieldToFilters_ptr_with_info)[edgeID].grid_id = packet->field->grid->getId(); 
     146    (*mapFieldToFilters_ptr_with_info)[edgeID].date = packet->date; 
     147    (*mapFieldToFilters_ptr_with_info)[edgeID].timestamp = packet->timestamp; 
     148    (*mapFieldToFilters_ptr_with_info)[edgeID].field = packet->field; 
     149    (*mapFieldToFilters_ptr_with_info)[edgeID].attributes = packet->field->record4graphXiosAttributes(); 
     150  } 
     151  CATCH 
     152 
     153 
     154  void CWorkflowGraph::allocNodeEdge() 
     155  TRY 
     156  { 
     157    if(mapFilters_ptr_with_info==0) mapFilters_ptr_with_info = new std::unordered_map <int, graph_info_box_node>; 
     158    if(mapFieldToFilters_ptr_with_info==0) mapFieldToFilters_ptr_with_info = new std::unordered_map <int, graph_info_box_edge >; 
     159    if(mapHashFilterID_ptr==0) mapHashFilterID_ptr = new std::unordered_map <size_t, int >; 
     160  } 
     161  CATCH 
     162 
    44163} 
  • XIOS/dev/dev_olga/src/workflow_graph.hpp

    r1653 r1686  
    44#include "xios_spl.hpp" 
    55#include "field.hpp" 
     6#include "grid.hpp" 
    67#include "garbage_collector.hpp" 
     8#include "date.hpp" 
     9#include "duration.hpp" 
     10 
    711 
    812namespace xios 
    913{ 
     14  class CField; 
     15 
     16  struct graph_info_box_node 
     17  { 
     18 
     19    StdString filter_name; 
     20    int filter_class; 
     21    bool filter_filled; 
     22    int expected_entry_nb; 
     23    CDate date; 
     24    Time timestamp; 
     25    StdString transform_type; 
     26    StdString attributes; 
     27    StdString field_id; 
     28    bool inputs_complete; 
     29    int filter_tag; 
     30    int clusterID; 
     31    int distance; 
     32  }; 
     33 
     34  struct graph_info_box_edge 
     35  { 
     36    int from; 
     37    int to; 
     38    StdString field_id; 
     39    StdString field_name; 
     40    StdString grid_id; 
     41    CDate date; 
     42    Time timestamp; 
     43    CField *field; 
     44    StdString attributes; 
     45     
     46  }; 
    1047 
    1148  class CWorkflowGraph 
     
    2158       * It is filled up during reconstruction of a workflow (in function CField::buildFilterGraph()). 
    2259      */ 
    23       static std::unordered_map <StdString, vector <int> > mapFieldToFilters; 
     60      // static std::unordered_map <StdString, vector <int> > *mapFieldToFilters_ptr; 
     61      // #pragma omp threadprivate(mapFieldToFilters_ptr) 
    2462 
    25       /*! Map between filter ids and filter types. 
    26        * It is filled up during reconstruction of a workflow (in function CField::buildFilterGraph()). 
    27        */ 
    28       static std::unordered_map <int, StdString> mapFilters; 
    2963 
    30       /*! Map between filters and timestamps. 
    31        * Timestamps are added into the map at the exit of a filter (in function COutputPin::onOutputReady) 
    32        */ 
    33       static std::unordered_map <int, vector<Time> > mapFilterTimestamps; 
    3464 
    35       /*! List of timestamps. 
    36        * Timestamps are added at the exit of a filter (in function COutputPin::onOutputReady) 
    37        */ 
    38       static set<Time> timestamps; 
     65      static std::unordered_map <int, graph_info_box_node> *mapFilters_ptr_with_info; 
     66 
     67      static std::unordered_map <int, graph_info_box_edge> *mapFieldToFilters_ptr_with_info; 
     68 
     69      static std::unordered_map <size_t, int> *mapHashFilterID_ptr; 
     70 
     71 
     72      static bool build_begin; 
     73 
     74      static void addNode(int nodeID, StdString filterName, int filter_class, bool filter_filled, int entry_nb, CDataPacketPtr packet); 
     75      static void addEdge(int edgeID, int toID, CDataPacketPtr packet); 
     76      static void allocNodeEdge(); 
    3977 
    4078    private: 
     
    5088 
    5189      static void buildStaticWorkflow(); 
     90      static void buildStaticWorkflow_with_info(); 
     91      static void showStaticWorkflow(); 
     92 
     93       
    5294 
    5395 
Note: See TracChangeset for help on using the changeset viewer.