Changeset 2026


Ignore:
Timestamp:
02/01/21 11:54:16 (10 months ago)
Author:
yushan
Message:

Graph intermediate commit to a tmp branch.

Location:
XIOS/dev/dev_trunk_graph/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_trunk_graph/src/attribute_enum_impl.hpp

    r2019 r2026  
    1010namespace xios 
    1111{ 
    12   /// ////////////////////// Dfinitions ////////////////////// /// 
     12  /// ////////////////////// Definitions ////////////////////// /// 
    1313  template <class T> 
    1414  CAttributeEnum<T>::CAttributeEnum(const StdString & id) 
  • XIOS/dev/dev_trunk_graph/src/filter/pass_through_filter.cpp

    r2023 r2026  
    1919    if(this->graphEnabled) 
    2020    { 
    21       if(data[0]->graphPackage->currentField->getId() == this->graphPackage->inFields[0]->getId()) 
     21      if(data[0]->graphPackage && data[0]->graphPackage->currentField->getId() == this->graphPackage->inFields[0]->getId()) 
    2222      { 
    2323        std::cout<<"PASS THROUGH FILTER OMITTED "<<this<<std::endl; 
     
    3131        data[0]->graphPackage = new CGraphDataPackage; 
    3232        data[0]->graphPackage->fromFilter = -1; 
     33        data[0]->graphPackage->currentField = this->graphPackage->inFields[0]; 
    3334      } 
    3435 
     
    5253      std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); 
    5354       
    54        
    5555      data[0]->graphPackage->fromFilter = this->graphPackage->filterId; 
    5656         
  • XIOS/dev/dev_trunk_graph/src/filter/transform_filter.cpp

    r2023 r2026  
    2222    if (packet->status == CDataPacket::NO_ERROR)  
    2323    { 
    24       cout<<"transformeFilter = "<<this<<" and graphEnabled = "<<this->graphEnabled<<std::endl; 
    2524      buildWorkflowGraph(data, packet, algorithm_); 
    2625       
     
    5049      packet->graphPackage->current_filter_name = data[0]->graphPackage->current_filter_name; 
    5150      packet->graphPackage->contextId = data[0]->graphPackage->contextId;           
    52       packet->graphPackage->currentField = data[0]->graphPackage->currentField;//this->graphPackage->inFields[0]; 
    5351     
    54       CWorkflowGraph::addNode("Spatial transform filter "+algorithm->getAlgoName(), 4, false, 1, packet); 
    55       CWorkflowGraph::addEdge(packet->graphPackage->fromFilter, this->graphPackage->filterId, packet); 
    56        
    57        
    58        
    59       packet->graphPackage->fromFilter = this->graphPackage->filterId; 
    60       packet->graphPackage->currentField = this->graphPackage->inFields[0]; 
    61       std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); 
     52      int tmp_from = packet->graphPackage->fromFilter; 
     53      if(this->graphPackage->show) 
     54      { 
     55        packet->graphPackage->currentField = data[0]->graphPackage->currentField->getDirectFieldReference();//this->graphPackage->inFields[0]; 
     56        CWorkflowGraph::addNode("Spatial transform filter "+algorithm->getAlgoName(), 4, false, 1, packet); 
     57        CWorkflowGraph::addEdge(packet->graphPackage->fromFilter, this->graphPackage->filterId, packet); 
     58        packet->graphPackage->fromFilter = this->graphPackage->filterId; 
     59        packet->graphPackage->currentField = this->graphPackage->inFields[0]; 
     60        std::rotate(this->graphPackage->inFields.begin(), this->graphPackage->inFields.begin() + 1, this->graphPackage->inFields.end()); 
     61      } 
     62      else 
     63      { 
     64        packet->graphPackage->currentField = this->graphPackage->inFields[0]; 
     65        if(CXios::isClient) CWorkflowGraph::vectorOfNodes_->at(tmp_from).filter_name += algorithm->getAlgoName(); 
     66        else                CWorkflowGraph::vectorOfNodes_srv_->at(tmp_from).filter_name += algorithm->getAlgoName(); 
     67         
     68      }      
    6269    } 
    6370  } 
  • XIOS/dev/dev_trunk_graph/src/graph_package.hpp

    r2021 r2026  
    1111    std::vector< CField* > inFields; 
    1212    StdString contextId; 
     13    bool show; 
     14 
     15    CGraphPackage(): show(true) {} 
    1316  }; 
    1417  struct CGraphDataPackage 
     
    2023    int distanceFromStart=-1; 
    2124    StdString contextId; 
     25    bool show; 
    2226 
    23     CGraphDataPackage(): fromFilter(-1) {} 
     27    CGraphDataPackage(): fromFilter(-1), show(true) {} 
    2428  };  
    2529} // namespace xios 
  • XIOS/dev/dev_trunk_graph/src/node/field.cpp

    r2023 r2026  
    554554    { 
    555555      inputFilter = std::shared_ptr<CPassThroughFilter>(new CPassThroughFilter(gc));  
    556       if(buildGraph_) 
     556      /*if(buildGraph_) 
    557557      { 
    558558        std::cout<<"============== field "<<this->getId()<<" calls a pass through filter ============== "<<inputFilter<<" ***** "<<CXios::isClient<<std::endl; 
     
    560560        inputFilter->graphPackage = new CGraphPackage; 
    561561        inputFilter->graphPackage->inFields.push_back(this); 
    562       } 
     562      }*/ 
    563563    } 
    564564      
     
    570570      { 
    571571        (*fieldRef).build_workflow_graph.set(build_workflow_graph);  
    572         inputFilter->label_field_id = fieldRef->getId();  
     572        //inputFilter->label_field_id = fieldRef->getId();  
    573573      }     
    574574      else 
     
    642642        inputFilter->graphPackage = new CGraphPackage; 
    643643        inputFilter->graphPackage->inFields.push_back(this); 
     644        inputFilter->label_field_id = getDirectFieldReference()->getId();  
    644645      } 
    645646    } 
  • XIOS/dev/dev_trunk_graph/src/node/grid.cpp

    r2023 r2026  
    16941694  TRY 
    16951695  { 
     1696    static bool transformationGoing = false; 
    16961697    registerAlgorithmTransformation() ; // needed to enable self-registration of the transformations 
    16971698                                        // big mystery why it doesn't work witout that... 
     
    17001701    std::shared_ptr<CFilter> inputFilter = std::shared_ptr<CPassThroughFilter>(new CPassThroughFilter(gc)); 
    17011702    std::shared_ptr<CFilter> outputFilter = inputFilter ; 
    1702     /*cout<<"***************CGrid::buildTransformationGraph***************"<<field->getId()<<" CGrid::buildTransformationGraph"<<endl; 
    1703     inputFilter->graphEnabled = true; 
     1703    cout<<"***************CGrid::buildTransformationGraph Pass through filter ***************"<<transformationGoing<<field->getId()<<endl; 
     1704    /*inputFilter->graphEnabled = true; 
    17041705    inputFilter->graphPackage = new CGraphPackage; 
    17051706    inputFilter->graphPackage->inFields.push_back(field); 
     
    19951996          transformFilter->graphPackage = new CGraphPackage; 
    19961997          transformFilter->graphPackage->inFields.push_back(field); 
     1998          transformFilter->graphPackage->show = !transformationGoing; 
    19971999        } 
    19982000         
     
    20122014      if (hasRemainTransform) 
    20132015      { 
     2016        transformationGoing = true; 
    20142017        gridSrc=newGrid ; 
    2015         pair<shared_ptr<CFilter>, shared_ptr<CFilter> > filters = this->buildTransformationGraph(gc, isSource, gridSrc, detectMissingValues, defaultValue, newGrid) ; 
     2018        CField *field_bis = field; 
     2019        pair<shared_ptr<CFilter>, shared_ptr<CFilter> > filters = this->buildTransformationGraph(gc, isSource, gridSrc, detectMissingValues, defaultValue, newGrid, graphEnabled, field_bis) ; 
    20162020        outputFilter->connectOutput(filters.first,0) ; 
    20172021        outputFilter=filters.second ; 
    20182022      } 
     2023      transformationGoing = false; 
    20192024    } 
    20202025      
  • XIOS/dev/dev_trunk_graph/src/node/grid.hpp

    r2021 r2026  
    215215      public: 
    216216         pair<shared_ptr<CFilter>, shared_ptr<CFilter> > buildTransformationGraph(CGarbageCollector& gc, bool isSource, CGrid* gridSrc, double detectMissingValues, 
    217                                                                                   double defaultValue, CGrid*& newGrid, bool graphEnabled=false, CField* field=nullptr) ; 
     217                                                                                  double defaultValue, CGrid*& newGrid, bool graphEnabled=false, CField* field=0) ; 
    218218      private: 
    219219        CGridAlgorithm* gridAlgorithm_ = nullptr ; 
  • XIOS/dev/dev_trunk_graph/src/transformation/algorithm_transformation_transfer.hpp

    r2021 r2026  
    1717      virtual void apply(int dimBefore, int dimAfter, const CArray<double,1>& dataIn, CArray<double,1>& dataOut); 
    1818      virtual void computeRecvElement(CLocalView* srcView, CLocalView* dstView) ; 
    19       virtual StdString getAlgoName() {return "CAlgorithm transformation Transfer";} 
     19      virtual StdString getAlgoName() {return "\\nCAlgorithm transformation Transfer";} 
    2020    
    2121    protected: 
  • XIOS/dev/dev_trunk_graph/src/transformation/domain_algorithm/domain_algorithm_expand.hpp

    r2019 r2026  
    2828 
    2929  static bool registerTrans(); 
     30  virtual StdString getAlgoName() {return "\\nexpand_domain";} 
    3031 
    3132protected: 
  • XIOS/dev/dev_trunk_graph/src/workflow_graph.cpp

    r2019 r2026  
    55{ 
    66 
    7   std::unordered_map <int, graph_info_box_node> *CWorkflowGraph::mapFilters_ptr_with_info = 0; 
    8  
    9   std::unordered_map <int, graph_info_box_edge > *CWorkflowGraph::mapFieldToFilters_ptr_with_info = 0; 
    10  
    11   std::unordered_map <size_t, int> *CWorkflowGraph::mapHashFilterID_ptr = 0; 
    12    
    13   std::unordered_map <StdString, int > *CWorkflowGraph::mapContext_ptr = 0; 
     7   
    148 
    159 
     
    2620  bool CWorkflowGraph::serverGraphBuilt = false; 
    2721 
    28   int CWorkflowGraph::filterIdGenerator = 0; 
    29   int CWorkflowGraph::edgeIdGenerator = 0; 
    30  
    31  
    32   vector <StdString> CWorkflowGraph::filters; 
    33   vector <StdString> CWorkflowGraph::fields; 
    34   vector <pair<int, int> > CWorkflowGraph::fieldsToFilters; 
     22 
    3523 
    3624  bool CWorkflowGraph::build_begin = false; 
     
    4331//****************************************************** 
    4432 
    45    
     33  void CWorkflowGraph::outputWorkflowGraph_client_stdout() 
     34  { 
     35    std::cout<<"\n\nbuild workflow graph ..."<<std::endl; 
     36    for(int i=0; i<vectorOfNodes_->size(); i++) 
     37    { 
     38      std::cout<<"Node["<<i<<"] is "<<(*vectorOfNodes_)[i].filter_name<<std::endl; 
     39    } 
     40   
     41    for(int i=0; i<vectorOfEdges_->size(); i++) 
     42    { 
     43      std::cout<<"Edge["<<i<<"] from "<<(*vectorOfEdges_)[i].from<<" to "<<(*vectorOfEdges_)[i].to<<std::endl; 
     44    } 
     45    std::cout<<"\nend workflow graph ...\n\n"<<std::endl; 
     46  } 
     47   
     48  void CWorkflowGraph::outputWorkflowGraph_server_stdout() 
     49  { 
     50    std::cout<<"\n\nServer side : build workflow graph ..."<<std::endl; 
     51    for(int i=0; i<vectorOfNodes_srv_->size(); i++) 
     52    { 
     53      std::cout<<"Node["<<i<<"] is "<<(*vectorOfNodes_srv_)[i].filter_name<<std::endl; 
     54    } 
     55   
     56    for(int i=0; i<vectorOfEdges_srv_->size(); i++) 
     57    { 
     58      std::cout<<"Edge["<<i<<"] from "<<(*vectorOfEdges_srv_)[i].from<<" to "<<(*vectorOfEdges_srv_)[i].to<<std::endl; 
     59    } 
     60    std::cout<<"\nend workflow graph ...\n\n"<<std::endl; 
     61  } 
     62 
    4663 
    4764  void CWorkflowGraph::drawWorkFlowGraph_client() 
     
    5067    if(vectorOfNodes_ && vectorOfEdges_)  
    5168    { 
    52       std::cout<<"\n\nbuild workflow graph ..."<<std::endl; 
    53       for(int i=0; i<vectorOfNodes_->size(); i++) 
    54       { 
    55         std::cout<<"Node["<<i<<"] is "<<(*vectorOfNodes_)[i].filter_name<<std::endl; 
    56       } 
    57        
    58       for(int i=0; i<vectorOfEdges_->size(); i++) 
    59       { 
    60         std::cout<<"Edge["<<i<<"] from "<<(*vectorOfEdges_)[i].from<<" to "<<(*vectorOfEdges_)[i].to<<std::endl; 
    61       } 
    62       std::cout<<"\nend workflow graph ...\n\n"<<std::endl; 
    63        
     69      //outputWorkflowGraph_client_stdout(); 
    6470      outputWorkflowGraph_client(); 
    6571    } 
     
    7480    if(vectorOfNodes_srv_ && vectorOfEdges_srv_)  
    7581    { 
    76       std::cout<<"\n\nServer side : build workflow graph ..."<<std::endl; 
    77       for(int i=0; i<vectorOfNodes_srv_->size(); i++) 
    78       { 
    79         std::cout<<"Node["<<i<<"] is "<<(*vectorOfNodes_srv_)[i].filter_name<<std::endl; 
    80       } 
    81        
    82       for(int i=0; i<vectorOfEdges_srv_->size(); i++) 
    83       { 
    84         std::cout<<"Edge["<<i<<"] from "<<(*vectorOfEdges_srv_)[i].from<<" to "<<(*vectorOfEdges_srv_)[i].to<<std::endl; 
    85       } 
    86       std::cout<<"\nend workflow graph ...\n\n"<<std::endl; 
    87        
     82      //outputWorkflowGraph_server_stdout(); 
    8883      outputWorkflowGraph_server(); 
    8984    } 
     
    109104      edge_obj.timestamp = packet->timestamp; 
    110105      edge_obj.field = packet->graphPackage->currentField; 
     106      edge_obj.show = true; 
    111107      for(int i=0; i<vectorOfContexts_->size(); i++) 
    112108      { 
     
    135131      edge_obj.timestamp = packet->timestamp; 
    136132      edge_obj.field = packet->graphPackage->currentField; 
     133      edge_obj.show = true; 
    137134      for(int i=0; i<vectorOfContexts_srv_->size(); i++) 
    138135      { 
     
    276273      outfiles[ctx] << "\"from\":"<<vectorOfEdges_->at(i).from<<","<<std::endl; 
    277274      outfiles[ctx] << "\"to\":"<<vectorOfEdges_->at(i).to<<","<<std::endl; 
    278       outfiles[ctx] << "\"label\":"<<"\""<<vectorOfEdges_->at(i).field->getId()<<"\\n"<<vectorOfEdges_->at(i).date<<"\","<<std::endl; 
     275      if(vectorOfEdges_->at(i).show) outfiles[ctx] << "\"label\":"<<"\""<<vectorOfEdges_->at(i).field->getId()<<"\\n"<<vectorOfEdges_->at(i).date<<"\","<<std::endl; 
     276      else outfiles[ctx] << "\"label\":"<<"\"\\n"<<vectorOfEdges_->at(i).date<<"\","<<std::endl; 
    279277      outfiles[ctx] << "\"context\":"<<"\""<<vectorOfEdges_->at(i).context_id<<"\","<<std::endl; 
    280278      outfiles[ctx] << "\"attributes\":"<<"\""<<vectorOfEdges_->at(i).attributes<<"\","<<std::endl; 
     
    328326      outfiles[ctx] << "\"from\":"<<vectorOfEdges_srv_->at(i).from<<","<<std::endl; 
    329327      outfiles[ctx] << "\"to\":"<<vectorOfEdges_srv_->at(i).to<<","<<std::endl; 
    330       outfiles[ctx] << "\"label\":"<<"\""<<vectorOfEdges_srv_->at(i).field->getId()<<"\\n"<<vectorOfEdges_srv_->at(i).date<<"\","<<std::endl; 
     328      if(vectorOfEdges_srv_->at(i).show) outfiles[ctx] << "\"label\":"<<"\""<<vectorOfEdges_srv_->at(i).field->getId()<<"\\n"<<vectorOfEdges_srv_->at(i).date<<"\","<<std::endl; 
     329      else                               outfiles[ctx] << "\"label\":"<<"\"\\n"<<vectorOfEdges_srv_->at(i).date<<"\","<<std::endl; 
    331330      outfiles[ctx] << "\"context\":"<<"\""<<vectorOfEdges_srv_->at(i).context_id<<"\","<<std::endl; 
    332331      outfiles[ctx] << "\"attributes\":"<<"\""<<vectorOfEdges_srv_->at(i).attributes<<"\","<<std::endl; 
  • XIOS/dev/dev_trunk_graph/src/workflow_graph.hpp

    r2023 r2026  
    1313{ 
    1414  class CField; 
    15  
    16    
    17   struct graph_info_box_node 
    18   { 
    19  
    20     StdString filter_name; 
    21     int filter_class; 
    22     bool filter_filled; 
    23     int expected_entry_nb; 
    24     CDate date; 
    25     Time timestamp; 
    26     StdString transform_type; 
    27     StdString attributes; 
    28     StdString field_id; 
    29     bool inputs_complete; 
    30     int filter_tag; 
    31     int clusterID; 
    32     int distance; 
    33     StdString node_context_id; 
    34   }; 
    35  
    36   struct graph_info_box_edge 
    37   { 
    38     int from; 
    39     int to; 
    40     StdString field_id; 
    41     StdString field_name; 
    42     StdString grid_id; 
    43     CDate date; 
    44     Time timestamp; 
    45     CField *field; 
    46     StdString attributes; 
    47     StdString edge_context_id; 
    48   }; 
    4915 
    5016  struct graph_node_object 
     
    6733    int context; 
    6834    StdString label_field_id; 
     35    bool show; 
     36 
     37 
     38    graph_node_object():show(true){} 
     39 
    6940  }; 
    7041 
     
    8354    StdString context_id; 
    8455    int context; 
     56    bool show; 
     57     
     58    graph_edge_object():show(true){} 
    8559  }; 
    8660 
     
    10377      static std::vector<StdString> *vectorOfContexts_srv_;  
    10478 
     79      // these variables are not yet used 
    10580      static bool clientGraphBuilt; 
    10681      static bool serverGraphBuilt; 
     82      static bool build_begin; 
    10783 
    108       static int filterIdGenerator; 
    109       static int edgeIdGenerator; 
    11084 
    11185      static void drawWorkFlowGraph_client(); 
     
    11589      static void addNode(StdString filterName, int filter_class, bool filter_filled, int entry_nb, CDataPacketPtr packet); 
    11690      static void addEdge(int from, int to, CDataPacketPtr packet); 
    117       static int getNodeSize(); 
     91       
     92      // write to file the graph info 
    11893      static void outputWorkflowGraph_client(); 
    11994      static void outputWorkflowGraph_server(); 
     95       
     96      // output on screen the graph info 
     97      static void outputWorkflowGraph_client_stdout(); 
     98      static void outputWorkflowGraph_server_stdout(); 
     99 
     100      static int  getNodeSize(); 
    120101 
    121102 
    122       static std::unordered_map <int, graph_info_box_node> *mapFilters_ptr_with_info; 
    123103 
    124       static std::unordered_map <int, graph_info_box_edge> *mapFieldToFilters_ptr_with_info; 
     104       
    125105 
    126       static std::unordered_map <size_t, int> *mapHashFilterID_ptr; 
    127        
    128       static std::unordered_map <StdString, int> *mapContext_ptr; 
    129  
    130  
    131       static bool build_begin; 
    132  
    133       static void addNode2(int nodeID, StdString filterName, int filter_class, bool filter_filled, int entry_nb, CDataPacketPtr packet); 
    134       static void addEdge2(int from, int to, CDataPacketPtr packet); 
    135       static void allocNodeEdge(); 
    136106 
    137107    private: 
Note: See TracChangeset for help on using the changeset viewer.