source: XIOS/dev/dev_trunk_graph/src/workflow_graph.hpp @ 2023

Last change on this file since 2023 was 2023, checked in by yushan, 8 months ago

Graph intermediate commit to a tmp branch.

File size: 3.7 KB
Line 
1#ifndef __WORKFLOW_GRAPH_HPP__
2#define __WORKFLOW_GRAPH_HPP__
3
4#include "xios_spl.hpp"
5#include "field.hpp"
6#include "grid.hpp"
7#include "garbage_collector.hpp"
8#include "date.hpp"
9#include "duration.hpp"
10#include "context.hpp"
11
12namespace xios
13{
14  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  };
49
50  struct graph_node_object
51  {
52    StdString filter_name;
53
54    int filter_class;
55    bool filter_filled;
56    int expected_entry_nb;
57    CDate date;
58    Time timestamp;
59    StdString transform_type;
60    StdString attributes;
61    StdString field_id;
62    bool inputs_complete;
63    int filter_tag;
64    int clusterID;
65    int distance;
66    StdString context_id;
67    int context;
68    StdString label_field_id;
69  };
70
71  struct graph_edge_object
72  {
73    int from;
74    int to;
75
76    StdString field_id;
77    StdString field_name;
78    StdString grid_id;
79    CDate date;
80    Time timestamp;
81    CField *field;
82    StdString attributes;
83    StdString context_id;
84    int context;
85  };
86
87  class CWorkflowGraph
88  {
89    public:
90
91      CWorkflowGraph();
92
93      /*! Map between fields identified by its id and their filters identified by an integer.
94       * It is filled up during reconstruction of a workflow (in function CField::buildFilterGraph()).
95      */
96
97      static std::vector<graph_node_object> *vectorOfNodes_;
98      static std::vector<graph_edge_object> *vectorOfEdges_; 
99      static std::vector<StdString> *vectorOfContexts_; 
100
101      static std::vector<graph_node_object> *vectorOfNodes_srv_;
102      static std::vector<graph_edge_object> *vectorOfEdges_srv_;
103      static std::vector<StdString> *vectorOfContexts_srv_; 
104
105      static bool clientGraphBuilt;
106      static bool serverGraphBuilt;
107
108      static int filterIdGenerator;
109      static int edgeIdGenerator;
110
111      static void drawWorkFlowGraph_client();
112      static void drawWorkFlowGraph_server();
113
114
115      static void addNode(StdString filterName, int filter_class, bool filter_filled, int entry_nb, CDataPacketPtr packet);
116      static void addEdge(int from, int to, CDataPacketPtr packet);
117      static int getNodeSize();
118      static void outputWorkflowGraph_client();
119      static void outputWorkflowGraph_server();
120
121
122      static std::unordered_map <int, graph_info_box_node> *mapFilters_ptr_with_info;
123
124      static std::unordered_map <int, graph_info_box_edge> *mapFieldToFilters_ptr_with_info;
125
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();
136
137    private:
138
139      //! List of fields marked for visualizing of their workflow
140      static vector <StdString> fields;
141
142      //! List of connected filters for fields for visualizing of their workflow
143      static vector <StdString> filters;
144
145      //! Fields to filters connectivity
146      static vector <pair<int, int> > fieldsToFilters;
147
148      static void buildStaticWorkflow();
149
150
151
152  };
153
154}
155
156#endif
157
Note: See TracBrowser for help on using the repository browser.