source: XIOS/dev/dev_trunk_omp/src/filter/pass_through_filter.cpp @ 1689

Last change on this file since 1689 was 1689, checked in by yushan, 2 years ago

dev for graph. up to date with trunk at r1684

File size: 2.0 KB
Line 
1#include "pass_through_filter.hpp"
2#include "workflow_graph.hpp"
3#include "field.hpp"
4#include "file.hpp"
5
6namespace xios
7{
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+1;
28
29      (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes = this->field->record4graphXiosAttributes();
30      if(this->field->file) (*CWorkflowGraph::mapFilters_ptr_with_info)[this->filterID].attributes += "</br>file attributes : </br>" +this->field->file->record4graphXiosAttributes();
31
32     
33      if(CWorkflowGraph::build_begin)
34      {
35        CWorkflowGraph::addEdge(edgeID, this->filterID, data[0]);
36        (*CWorkflowGraph::mapFilters_ptr_with_info)[data[0]->src_filterID].filter_filled = 0;
37      }
38      else CWorkflowGraph::build_begin = true;
39     
40      data[0]->src_filterID=this->filterID;
41      data[0]->distance++;
42
43    }
44
45    data[0]->field = this->field;
46  }
47
48  CDataPacketPtr CPassThroughFilter::apply(std::vector<CDataPacketPtr> data)
49  {
50    if(CXios::isClient) buildGraph(data);
51    return data[0];
52  }
53} // namespace xios
Note: See TracBrowser for help on using the repository browser.