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

backup for trunk with graph

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 
Note: See TracChangeset for help on using the changeset viewer.