Changeset 1668


Ignore:
Timestamp:
05/22/19 17:26:47 (5 years ago)
Author:
yushan
Message:

MARK: branch merged with trunk @1663. static graph OK with EP

Location:
XIOS/dev/dev_trunk_omp
Files:
4 added
28 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_trunk_omp/inputs/COMPLETE/context_surface.xml

    r1173 r1668  
    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=".TRUE." /> 
    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 --> 
  • XIOS/dev/dev_trunk_omp/inputs/iodef.xml

    r1646 r1668  
    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_trunk_omp/src/config/field_attribute.conf

    r1524 r1668  
    1919DECLARE_ATTRIBUTE(bool,      indexed_output) 
    2020DECLARE_ATTRIBUTE(bool,      check_if_active) 
     21DECLARE_ATTRIBUTE(bool,      build_workflow_graph) 
    2122 
    2223DECLARE_ATTRIBUTE(StdString, domain_ref, false) 
  • XIOS/dev/dev_trunk_omp/src/cxios.cpp

    r1665 r1668  
    1515using namespace ep_lib; 
    1616#endif 
    17  
     17#include "graphviz.hpp" 
    1818namespace xios 
    1919{ 
     
    172172       globalRegistry->toFile("xios_registry.bin") ; 
    173173       delete globalRegistry ; 
     174        
     175       CGraphviz::buildStaticWorkflowGraph(); 
    174176     } 
    175177 
  • XIOS/dev/dev_trunk_omp/src/filter/file_server_writer_filter.cpp

    r1358 r1668  
    2828    return true; 
    2929  } 
     30 
     31  int CFileServerWriterFilter::getFilterId(void) 
     32  { 
     33    return filterId; 
     34  } 
     35 
    3036} // namespace xios 
  • XIOS/dev/dev_trunk_omp/src/filter/file_server_writer_filter.hpp

    r1358 r1668  
    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 
    3944    protected: 
    4045      /*! 
     
    4853      CField* field; //<! The associated field 
    4954      std::map<Time, CDataPacketPtr> packets; //<! The stored packets 
     55      int filterId;            //<! Filter's id needed in case of building a workflow 
     56 
    5057  }; // class CFileServerWriterFilter 
    5158} // namespace xios 
  • XIOS/dev/dev_trunk_omp/src/filter/file_writer_filter.cpp

    r1646 r1668  
    33#include "field.hpp" 
    44#include "utils.hpp" 
     5#include "workflow_graph.hpp" 
    56 
    67namespace xios 
    78{ 
    8   CFileWriterFilter::CFileWriterFilter(CGarbageCollector& gc, CField* field) 
     9  CFileWriterFilter::CFileWriterFilter(CGarbageCollector& gc, CField* field, bool buildWorkflowGraph /* =false */) 
    910    : CInputPin(gc, 1) 
    1011    , field(field) 
     
    1314      ERROR("CFileWriterFilter::CFileWriterFilter(CField* field)", 
    1415            "The field cannot be null."); 
     16    if (buildWorkflowGraph) 
     17    { 
     18      filterId = InvalidableObject::count; 
     19      InvalidableObject::count++; 
     20    } 
    1521  } 
    1622 
     
    4652    return true; 
    4753  } 
     54 
     55  int CFileWriterFilter::getFilterId(void) 
     56  { 
     57    return filterId; 
     58  } 
     59 
    4860} // namespace xios 
  • XIOS/dev/dev_trunk_omp/src/filter/file_writer_filter.hpp

    r1358 r1668  
    2020       * \param gc the associated garbage collector 
    2121       * \param field the associated field 
     22       * \param[in] buildWorkflowGraph indicates whether the workflow will be visualized 
    2223       */ 
    23       CFileWriterFilter(CGarbageCollector& gc, CField* field); 
     24      CFileWriterFilter(CGarbageCollector& gc, CField* field, bool buildWorkflowGraph = false); 
     25 
     26      inline StdString GetName(void) {return StdString("File writer filter");}; 
    2427 
    2528      /*! 
     
    3740      bool virtual isDataExpected(const CDate& date) const; 
    3841 
     42      /*! 
     43       * Returns filter's id needed in case of building workflow graph 
     44       */ 
     45      int getFilterId(); 
     46 
    3947    protected: 
    4048      /*! 
     
    4856      CField* field; //<! The associated field 
    4957      std::map<Time, CDataPacketPtr> packets; //<! The stored packets 
     58      int filterId;                           //<! Filter's id needed in case of building a workflow 
     59 
    5060  }; // class CFileWriterFilter 
    5161} // namespace xios 
  • XIOS/dev/dev_trunk_omp/src/filter/filter.cpp

    r1358 r1668  
    33namespace xios 
    44{ 
    5   CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine) 
     5  CFilter::CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine, bool buildWorkflowGraph /*= false*/) 
    66    : CInputPin(gc, inputSlotsCount) 
    7     , COutputPin(gc) 
     7    , COutputPin(gc, false, buildWorkflowGraph) 
    88    , engine(engine) 
    99    , inputSlotCount(inputSlotCount) 
    1010  { /* Nothing to do */ } 
     11 
     12  StdString CFilter::GetName(void)    { return StdString("Filter"); } 
    1113 
    1214  void CFilter::onInputReady(std::vector<CDataPacketPtr> data) 
  • XIOS/dev/dev_trunk_omp/src/filter/filter.hpp

    r1358 r1668  
    2323       * \param inputSlotsCount the number of input slots 
    2424       * \param engine the filter engine 
     25       * \param buildWorkflowGraph indicates whether data will be visualized 
    2526       */ 
    26       CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine); 
     27      CFilter(CGarbageCollector& gc, size_t inputSlotsCount, IFilterEngine* engine, bool buildWorkflowGraph = false); 
     28 
     29      StdString virtual GetName(void); 
    2730 
    2831      /*! 
  • XIOS/dev/dev_trunk_omp/src/filter/garbage_collector.cpp

    r1021 r1668  
    33namespace xios 
    44{ 
     5 
     6  int InvalidableObject::count = 0; 
     7  #pragma omp threadprivate(InvalidableObject::count) 
     8   
    59  void CGarbageCollector::registerObject(InvalidableObject* Object, Time timestamp) 
    610  { 
  • XIOS/dev/dev_trunk_omp/src/filter/garbage_collector.hpp

    r1021 r1668  
    2020     */ 
    2121    void virtual invalidate(Time timestamp) = 0; 
     22   
     23    static int count; //!< Counter used to identify a filter in case building workflow graph 
     24    #pragma omp threadprivate(count) 
     25     
    2226  }; // struct InvalidableObject 
    2327 
  • XIOS/dev/dev_trunk_omp/src/filter/input_pin.cpp

    r1021 r1668  
    33#include "garbage_collector.hpp" 
    44#include "exception.hpp" 
     5#include "workflow_graph.hpp" 
    56 
    67namespace xios 
     
    1112    , triggers(slotsCount) 
    1213    , hasTriggers(false) 
    13   { /* Nothing to do */ } 
     14  {   } 
     15 
     16  StdString CInputPin::GetName(void) 
     17  { 
     18    return StdString("Input pin"); 
     19  } 
    1420 
    1521  void CInputPin::setInput(size_t inputSlot, CDataPacketPtr packet) 
     
    7783    inputs.erase(inputs.begin(), inputs.lower_bound(timestamp)); 
    7884  } 
     85 
     86  int CInputPin::getFilterId(void) 
     87  { 
     88    return -1; 
     89  } 
     90 
    7991} // namespace xios 
  • XIOS/dev/dev_trunk_omp/src/filter/input_pin.hpp

    r1358 r1668  
    2626       */ 
    2727      CInputPin(CGarbageCollector& gc, size_t slotsCount); 
     28       
     29      StdString virtual GetName(void); 
    2830 
    2931      /*! 
     
    7981       */ 
    8082      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(); 
    8189 
    8290    protected: 
  • XIOS/dev/dev_trunk_omp/src/filter/output_pin.cpp

    r1542 r1668  
    11#include "output_pin.hpp" 
    22#include "exception.hpp" 
     3#include "workflow_graph.hpp" 
    34 
    45namespace xios 
    56{ 
    6   COutputPin::COutputPin(CGarbageCollector& gc, bool manualTrigger /*= false*/) 
     7  COutputPin::COutputPin(CGarbageCollector& gc, bool manualTrigger /*= false*/, bool buildWorkflowGraph /* =false */) 
    78    : gc(gc) 
    89    , manualTrigger(manualTrigger) 
    9   { /* Nothing to do */ } 
     10    , buildWorkflowGraph(buildWorkflowGraph) 
     11  { 
     12    if (buildWorkflowGraph) 
     13    { 
     14      filterId = InvalidableObject::count; 
     15      InvalidableObject::count++; 
     16    } 
     17  } 
     18 
     19  StdString COutputPin::GetName(void) 
     20  { 
     21    return StdString("Output pin"); 
     22  } 
    1023 
    1124  void COutputPin::connectOutput(std::shared_ptr<CInputPin> inputPin, size_t inputSlot) 
     
    2639      ERROR("void COutputPin::onOutputReady(CDataPacketPtr packet)", 
    2740            "The packet cannot be null."); 
     41 
     42    if (buildWorkflowGraph) 
     43    { 
     44        if(CWorkflowGraph::mapFilterTimestamps_ptr==0) CWorkflowGraph::mapFilterTimestamps_ptr = new std::unordered_map <int, vector<Time> >; 
     45      if(CWorkflowGraph::timestamps_ptr==0) CWorkflowGraph::timestamps_ptr = new set<Time>; 
     46      (*CWorkflowGraph::mapFilterTimestamps_ptr)[this->getFilterId()].push_back(packet->timestamp); 
     47        CWorkflowGraph::timestamps_ptr->insert(packet->timestamp); 
     48    } 
    2849 
    2950    if (manualTrigger) // Don't use canBeTriggered here, this function is virtual and can be overriden 
     
    101122    outputPackets.erase(outputPackets.begin(), outputPackets.lower_bound(timestamp)); 
    102123  } 
     124 
     125  int COutputPin::getFilterId(void) 
     126  { 
     127    return filterId; 
     128  } 
     129 
    103130} // namespace xios 
  • XIOS/dev/dev_trunk_omp/src/filter/output_pin.hpp

    r1542 r1668  
    1919       * \param gc the garbage collector associated with this ouput pin 
    2020       * \param slotsCount the number of slots 
     21       * \param buildWorkflowGraph indicates whether data will be visualized 
    2122       */ 
    22       COutputPin(CGarbageCollector& gc, bool manualTrigger = false); 
     23      COutputPin(CGarbageCollector& gc, bool manualTrigger = false, bool buildWorkflowGraph = false); 
    2324 
     25      StdString virtual GetName(void); 
     26       
    2427      /*! 
    2528       * Connects to a specific slot of the input pin of a downstream filter. 
     
    6669      void virtual invalidate(Time timestamp); 
    6770 
     71      /*! 
     72       * Returns filter's id needed in case of building workflow graph 
     73       */ 
     74      int getFilterId(); 
     75 
    6876    protected: 
    6977      /*! 
     
    97105      //! Output buffer, store the packets until the output is triggered 
    98106      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 
    99115  }; // class COutputPin 
    100116} // namespace xios 
  • XIOS/dev/dev_trunk_omp/src/filter/pass_through_filter.cpp

    r641 r1668  
    33namespace xios 
    44{ 
    5   CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc) 
    6     : CFilter(gc, 1, this) 
     5  CPassThroughFilter::CPassThroughFilter(CGarbageCollector& gc, bool buildWorkflowGraph /*= false*/) 
     6    : CFilter(gc, 1, this, buildWorkflowGraph) 
    77  { /* Nothing to do */ } 
    88 
  • XIOS/dev/dev_trunk_omp/src/filter/pass_through_filter.hpp

    r641 r1668  
    1717       * 
    1818       * \param gc the associated garbage collector 
     19       * \param buildWorkflowGraph indicates whether data will be visualized 
    1920       */ 
    20       CPassThroughFilter(CGarbageCollector& gc); 
     21      CPassThroughFilter(CGarbageCollector& gc, bool buildWorkflowGraph = false); 
     22 
     23      inline StdString GetName(void) {return StdString("Pass through filter");}; 
    2124 
    2225    protected: 
  • XIOS/dev/dev_trunk_omp/src/filter/source_filter.cpp

    r1646 r1668  
    44#include "calendar_util.hpp" 
    55#include <limits>  
     6#include "workflow_graph.hpp" 
    67 
    78namespace xios 
     
    1112                               const CDuration offset /*= NoneDu*/, bool manualTrigger /*= false*/, 
    1213                               bool hasMissingValue /*= false*/, 
    13                                double defaultValue /*= 0.0*/) 
    14     : COutputPin(gc, manualTrigger) 
     14                               double defaultValue /*= 0.0*/, 
     15                               bool buildWorkflowGraph /*= false*/) 
     16    : COutputPin(gc, manualTrigger, buildWorkflowGraph) 
    1517    , grid(grid) 
    1618    , compression(compression) 
  • XIOS/dev/dev_trunk_omp/src/filter/source_filter.hpp

    r1646 r1668  
    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 
    2930       */ 
    3031      CSourceFilter(CGarbageCollector& gc, CGrid* grid, 
     
    3334                    const CDuration offset = NoneDu, bool manualTrigger = false, 
    3435                    bool hasMissingValue = false, 
    35                     double defaultValue = 0.0); 
     36                    double defaultValue = 0.0, 
     37                                        bool buildWorkflowGraph = false); 
     38 
     39      inline StdString GetName(void) {return StdString("Source filter");}; 
    3640 
    3741      /*! 
  • XIOS/dev/dev_trunk_omp/src/filter/spatial_transform_filter.cpp

    r1661 r1668  
    88using namespace ep_lib; 
    99#endif 
    10  
     10#include "workflow_graph.hpp" 
    1111namespace xios 
    1212{ 
    13   CSpatialTransformFilter::CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, double outputValue, size_t inputSlotsCount) 
    14     : CFilter(gc, inputSlotsCount, engine), outputDefaultValue(outputValue) 
     13  CSpatialTransformFilter::CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, 
     14                                                   double outputValue, size_t inputSlotsCount, bool buildWorkflowGraph /*= false*/) 
     15    : CFilter(gc, inputSlotsCount, engine, buildWorkflowGraph), outputDefaultValue(outputValue) 
    1516  { /* Nothing to do */ } 
    1617 
    1718  std::pair<std::shared_ptr<CSpatialTransformFilter>, std::shared_ptr<CSpatialTransformFilter> > 
    18   CSpatialTransformFilter::buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double missingValue) 
     19  CSpatialTransformFilter::buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double missingValue, 
     20                                            bool buildWorkflowGraph) 
    1921  { 
    2022    if (!srcGrid || !destGrid) 
     
    4143 
    4244      std::shared_ptr<CSpatialTransformFilter> filter ; 
    43       if( isSpatialTemporal) filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTemporalFilter(gc, engine, gridTransformation, defaultValue, inputCount)); 
    44       else filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTransformFilter(gc, engine, defaultValue, inputCount)); 
     45      if( isSpatialTemporal) 
     46        filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTemporalFilter(gc, engine, gridTransformation, defaultValue, inputCount, buildWorkflowGraph)); 
     47      else 
     48        filter = std::shared_ptr<CSpatialTransformFilter>(new CSpatialTransformFilter(gc, engine, defaultValue, inputCount, buildWorkflowGraph)); 
    4549 
    4650       
     
    4852        lastFilter = filter; 
    4953      else 
     54      { 
    5055        filter->connectOutput(firstFilter, 0); 
     56        if (buildWorkflowGraph) 
     57        { 
     58          if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 
     59          if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 
     60          int filterOut = (std::static_pointer_cast<COutputPin>(filter))->getFilterId(); 
     61          int filterIn = (std::static_pointer_cast<COutputPin>(firstFilter))->getFilterId(); 
     62          // PASS field's id here 
     63          (*CWorkflowGraph::mapFieldToFilters_ptr)["XXX"].push_back(filterOut); 
     64          (*CWorkflowGraph::mapFieldToFilters_ptr)["XXX"].push_back(filterIn); 
     65          (*CWorkflowGraph::mapFilters_ptr)[filterOut] = "Spatial transform filter"; 
     66          (*CWorkflowGraph::mapFilters_ptr)[filterIn] = "Spatial transform filter"; 
     67        } 
     68      } 
    5169 
    5270      firstFilter = filter; 
     
    7391  } 
    7492 
    75   CSpatialTemporalFilter::CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, double outputValue, size_t inputSlotsCount) 
    76     : CSpatialTransformFilter(gc, engine, outputValue, inputSlotsCount), record(0) 
     93  CSpatialTemporalFilter::CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, 
     94                                                  CGridTransformation* gridTransformation, double outputValue, 
     95                                                  size_t inputSlotsCount, bool buildWorkflowGraph) 
     96    : CSpatialTransformFilter(gc, engine, outputValue, inputSlotsCount, buildWorkflowGraph), record(0) 
    7797  { 
    7898      const CGridTransformationSelector::ListAlgoType& algoList = gridTransformation->getAlgoList() ; 
  • XIOS/dev/dev_trunk_omp/src/filter/spatial_transform_filter.hpp

    r1601 r1668  
    2323       * \param outputValue default value of output pin 
    2424       * \param [in] inputSlotsCount number of input, by default there is only one for field src 
     25       * \param buildWorkflowGraph indicates whether data will be visualized 
    2526       */ 
    26       CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, double outputValue, size_t inputSlotsCount = 1); 
     27      CSpatialTransformFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, 
     28                              double outputValue, size_t inputSlotsCount = 1, bool buildWorkflowGraph = false); 
     29 
     30      inline StdString GetName(void) {return StdString("Spatial transform filter");}; 
    2731 
    2832      /*! 
     
    3438       * \param hasMissingValue whether field source has missing value 
    3539       * \param defaultValue default value 
     40       * \param buildWorkflowGraph indicates whether data will be visualized 
    3641       * \return the first and the last filters of the filter graph 
    3742       */ 
    3843      static std::pair<std::shared_ptr<CSpatialTransformFilter>, std::shared_ptr<CSpatialTransformFilter> > 
    39       buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double defaultValue); 
     44      buildFilterGraph(CGarbageCollector& gc, CGrid* srcGrid, CGrid* destGrid, bool hasMissingValue, double defaultValue, bool buildWorkflowGraph = false); 
    4045 
    4146    protected: 
     
    6772       * \param outputValue default value of output pin 
    6873       * \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       * 
    6976       */ 
    70       CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, double outputValue, size_t inputSlotsCount = 1); 
     77      CSpatialTemporalFilter(CGarbageCollector& gc, CSpatialTransformFilterEngine* engine, CGridTransformation* gridTransformation, 
     78                            double outputValue, size_t inputSlotsCount = 1, bool buildWorkflowGraph = false); 
    7179 
    7280 
  • XIOS/dev/dev_trunk_omp/src/filter/store_filter.cpp

    r1646 r1668  
    138138    packets.erase(packets.begin(), packets.lower_bound(timestamp)); 
    139139  } 
     140 
     141  int CStoreFilter::getFilterId(void) 
     142  { 
     143    return filterId; 
     144  } 
     145 
    140146} // namespace xios 
  • XIOS/dev/dev_trunk_omp/src/filter/store_filter.hpp

    r1358 r1668  
    7373      void virtual invalidate(Time timestamp); 
    7474 
     75      /*! 
     76       * Returns filter's id needed in case of building workflow graph 
     77       */ 
     78      int getFilterId(); 
     79 
    7580    protected: 
    7681      /*! 
     
    8893      const double missingValue; //!< The value to use to replace missing values 
    8994      std::map<Time, CDataPacketPtr> packets; //<! The stored packets 
     95      int filterId;                     //!< Filter's id needed in case of building a workflow 
     96 
    9097  }; // class CStoreFilter 
    9198} // namespace xios 
  • XIOS/dev/dev_trunk_omp/src/filter/temporal_filter.cpp

    r1601 r1668  
    99  CTemporalFilter::CTemporalFilter(CGarbageCollector& gc, const std::string& opId, 
    1010                                   const CDate& initDate, const CDuration samplingFreq, const CDuration samplingOffset, const CDuration opFreq, 
    11                                    bool ignoreMissingValue /*= false*/) 
    12     : CFilter(gc, 1, this) 
     11                                   bool ignoreMissingValue /*= false*/, bool buildWorkflowGraph /*= false*/) 
     12    : CFilter(gc, 1, this, buildWorkflowGraph) 
    1313    , functor(createFunctor(opId, ignoreMissingValue, tmpData)) 
    1414    , isOnceOperation(functor->timeType() == func::CFunctor::once) 
  • XIOS/dev/dev_trunk_omp/src/filter/temporal_filter.hpp

    r1473 r1668  
    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); 
     31                      bool ignoreMissingValue = false, bool buildWorkflowGraph = false); 
     32 
     33      inline StdString GetName(void) {return StdString("Temporal filter");}; 
    3234 
    3335      /*! 
  • XIOS/dev/dev_trunk_omp/src/node/field.cpp

    r1665 r1668  
    2424#include "spatial_transform_filter.hpp" 
    2525#include "file_server_writer_filter.hpp" 
     26#include "workflow_graph.hpp" 
    2627 
    2728namespace xios{ 
     
    11201121 
    11211122     const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
     1123     const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
    11221124     const double defaultValue  = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); 
    11231125 
     
    11711173           if (!field_ref.isEmpty()) 
    11721174           { 
    1173              CGrid* gridRef = CField::get(field_ref)->grid; 
     1175             CField* fieldRef = CField::get(field_ref); 
     1176             fieldRef->build_workflow_graph.setValue(buildWorkflowGraph); 
     1177             CGrid* gridRef = fieldRef->grid; 
    11741178 
    11751179             if (grid && grid != gridRef && grid->hasTransform()) 
    11761180             { 
    1177                  std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, detectMissingValues, defaultValue);  
     1181               std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters = CSpatialTransformFilter::buildFilterGraph(gc, gridRef, grid, 
     1182                                                                                         detectMissingValues, defaultValue, buildWorkflowGraph); 
    11781183 
    11791184               filter->connectOutput(filters.first, 0); 
     1185 
     1186               if (buildWorkflowGraph) 
     1187               { 
     1188                 if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 
     1189                 if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 
     1190                 int filterOut = filter->getFilterId(); 
     1191                 int filterIn = (std::static_pointer_cast<COutputPin>(filters.second))->getFilterId(); 
     1192                 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterOut); 
     1193                 (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterIn); 
     1194                 (*CWorkflowGraph::mapFilters_ptr)[filterOut] = filter->GetName(); 
     1195                 (*CWorkflowGraph::mapFilters_ptr)[filterIn] = filters.second->GetName(); 
     1196               } 
    11801197               filter = filters.second; 
    11811198             } 
     
    11861203         // Check if we have a reference on another field 
    11871204         else if (!field_ref.isEmpty()) 
     1205         { 
     1206           CField::get(field_ref)->build_workflow_graph.setValue(buildWorkflowGraph); 
    11881207           instantDataFilter = getFieldReference(gc); 
     1208         } 
    11891209         // Check if the data is to be read from a file 
    11901210         else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) 
     
    11921212           checkTimeAttributes(); 
    11931213           instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false, freq_offset, true, 
    1194                                                                                                        detectMissingValues, defaultValue)); 
     1214                                                                                                       detectMissingValues, defaultValue, buildWorkflowGraph)); 
    11951215         } 
    11961216         else // The data might be passed from the model 
     
    11981218            if (check_if_active.isEmpty()) check_if_active = false;  
    11991219            instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, true, NoneDu, false, 
    1200                                                                                                         detectMissingValues, defaultValue)); 
     1220                                                                                                      detectMissingValues, defaultValue, buildWorkflowGraph)); 
     1221            if (buildWorkflowGraph)  
     1222            { 
     1223              if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 
     1224              (*CWorkflowGraph::mapFilters_ptr)[instantDataFilter->getFilterId()] = instantDataFilter->GetName(); 
     1225            }   
    12011226         } 
    12021227       } 
     
    12141239         if (file && (file->mode.isEmpty() || file->mode == CFile::mode_attr::write)) 
    12151240         { 
    1216            fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this)); 
     1241           fileWriterFilter = std::shared_ptr<CFileWriterFilter>(new CFileWriterFilter(gc, this, buildWorkflowGraph)); 
    12171242           getTemporalDataFilter(gc, file->output_freq)->connectOutput(fileWriterFilter, 0); 
     1243           if (buildWorkflowGraph) 
     1244           { 
     1245             if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 
     1246             if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 
     1247             int filterOut = getTemporalDataFilter(gc, file->output_freq)->getFilterId(); 
     1248             int filterIn = fileWriterFilter->getFilterId(); 
     1249             (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterOut); 
     1250             (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterIn); 
     1251             (*CWorkflowGraph::mapFilters_ptr)[filterOut] = "Temporal filter"; 
     1252             (*CWorkflowGraph::mapFilters_ptr)[filterIn] = fileWriterFilter->GetName(); 
     1253           } 
    12181254         } 
    12191255       } 
     
    12381274     CField* fieldRef = CField::get(field_ref); 
    12391275     fieldRef->buildFilterGraph(gc, false); 
     1276     bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
    12401277 
    12411278     std::pair<std::shared_ptr<CFilter>, std::shared_ptr<CFilter> > filters; 
     
    12451282       bool hasMissingValue = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    12461283       double defaultValue  = hasMissingValue ? default_value : (!default_value.isEmpty() ? default_value : 0.0);                                 
    1247        filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue); 
     1284       filters = CSpatialTransformFilter::buildFilterGraph(gc, fieldRef->grid, grid, hasMissingValue, defaultValue, buildWorkflowGraph); 
    12481285     } 
    12491286     else 
    1250        filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc)); 
     1287     { 
     1288       filters.first = filters.second = std::shared_ptr<CFilter>(new CPassThroughFilter(gc, buildWorkflowGraph)); 
     1289     } 
    12511290 
    12521291     fieldRef->getInstantDataFilter()->connectOutput(filters.first, 0); 
    12531292 
     1293     if (buildWorkflowGraph) 
     1294     { 
     1295       if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 
     1296       if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 
     1297       int filterOut = fieldRef->instantDataFilter->getFilterId(); 
     1298       int filterIn = (std::static_pointer_cast<COutputPin>(filters.first))->getFilterId(); 
     1299       (*CWorkflowGraph::mapFieldToFilters_ptr)[fieldRef->getId()].push_back(filterOut); 
     1300       (*CWorkflowGraph::mapFieldToFilters_ptr)[fieldRef->getId()].push_back(filterIn); 
     1301       (*CWorkflowGraph::mapFilters_ptr)[filterOut] = fieldRef->getInstantDataFilter()->GetName(); 
     1302       (*CWorkflowGraph::mapFilters_ptr)[filterIn] = filters.first->GetName(); 
     1303     } 
    12541304     return filters.second; 
    12551305   } 
     
    13241374   { 
    13251375     std::map<CDuration, std::shared_ptr<COutputPin> >::iterator it = temporalDataFilters.find(outFreq); 
     1376     const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
    13261377 
    13271378     if (it == temporalDataFilters.end()) 
     
    13341385 
    13351386       const bool detectMissingValues = (!detect_missing_value.isEmpty()  && detect_missing_value == true); 
    1336        std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 
    1337                                                                              CContext::getCurrent()->getCalendar()->getInitDate(), 
    1338                                                                              freq_op, freq_offset, outFreq, detectMissingValues)); 
     1387       std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, CContext::getCurrent()->getCalendar()->getInitDate(), 
     1388                                                                             freq_op, freq_offset, outFreq, 
     1389                                                                             detectMissingValues, buildWorkflowGraph)); 
    13391390 
    13401391       instantDataFilter->connectOutput(temporalFilter, 0); 
     1392 
     1393       if (buildWorkflowGraph) 
     1394       { 
     1395         if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 
     1396         if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 
     1397         int filterOut = instantDataFilter->getFilterId(); 
     1398         int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId(); 
     1399         (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterOut); 
     1400         (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterIn); 
     1401         (*CWorkflowGraph::mapFilters_ptr)[filterOut] = getInstantDataFilter()->GetName(); 
     1402         (*CWorkflowGraph::mapFilters_ptr)[filterIn] = temporalFilter->GetName(); 
     1403       } 
    13411404 
    13421405       it = temporalDataFilters.insert(std::make_pair(outFreq, temporalFilter)).first; 
     
    13741437 
    13751438       const bool detectMissingValues = (!detect_missing_value.isEmpty() && detect_missing_value == true); 
     1439       const bool buildWorkflowGraph = (!build_workflow_graph.isEmpty() && build_workflow_graph == true); 
    13761440       std::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 
    1377                                                                              CContext::getCurrent()->getCalendar()->getInitDate(), 
    1378                                                                              freq_op, freq_offset, outFreq, detectMissingValues)); 
     1441                                                                           CContext::getCurrent()->getCalendar()->getInitDate(), 
     1442                                                                           freq_op, freq_offset, outFreq, 
     1443                                                                           detectMissingValues, buildWorkflowGraph)); 
    13791444 
    13801445       selfReferenceFilter->connectOutput(temporalFilter, 0); 
     1446       if (buildWorkflowGraph) 
     1447 
     1448       { 
     1449         if(CWorkflowGraph::mapFilters_ptr==0) CWorkflowGraph::mapFilters_ptr = new std::unordered_map <int, StdString>; 
     1450         if(CWorkflowGraph::mapFieldToFilters_ptr==0) CWorkflowGraph::mapFieldToFilters_ptr = new std::unordered_map <StdString, vector <int> >; 
     1451         int filterOut = selfReferenceFilter->getFilterId(); 
     1452         int filterIn = (std::static_pointer_cast<COutputPin>(temporalFilter))->getFilterId(); 
     1453         (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterOut); 
     1454         (*CWorkflowGraph::mapFieldToFilters_ptr)[this->getId()].push_back(filterIn); 
     1455         (*CWorkflowGraph::mapFilters_ptr)[filterOut] = selfReferenceFilter->GetName(); 
     1456         (*CWorkflowGraph::mapFilters_ptr)[filterIn] = temporalFilter->GetName(); 
     1457       } 
     1458 
    13811459       return temporalFilter ; 
    13821460     } 
  • XIOS/dev/dev_trunk_omp/src/node/field.hpp

    r1646 r1668  
    77#include "functor.hpp" 
    88#include "functor_type.hpp" 
     9#include "filter.hpp" 
    910#include "duration.hpp" 
    1011#include "date.hpp" 
Note: See TracChangeset for help on using the changeset viewer.