File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* ***************************************************************************
2
+ * This file include most-utilized functions that manipulate on the
3
+ * RRGraph object
4
+ ***************************************************************************/
5
+ #include < tuple>
6
+ #include " rr_graph_obj_util.h"
7
+
8
+ /* ***************************************************************************
9
+ * Find the switches interconnecting two nodes
10
+ * Return a vector of switch ids
11
+ ***************************************************************************/
12
+ std::vector<RRSwitchId> find_rr_graph_switches (const RRGraph& rr_graph,
13
+ const RRNodeId& from_node,
14
+ const RRNodeId& to_node) {
15
+ std::vector<RRSwitchId> switches;
16
+ std::vector<RREdgeId> edges = rr_graph.find_edges (from_node, to_node);
17
+ if (true == edges.empty ()) {
18
+ /* edge is open, we return an empty vector of switches */
19
+ return switches;
20
+ }
21
+
22
+ /* Reach here, edge list is not empty, find switch id one by one
23
+ * and update the switch list
24
+ */
25
+ for (auto edge : edges) {
26
+ switches.push_back (rr_graph.edge_switch (edge));
27
+ }
28
+
29
+ return switches;
30
+ }
Original file line number Diff line number Diff line change
1
+ #ifndef RR_GRAPH_OBJ_UTIL_H
2
+ #define RR_GRAPH_OBJ_UTIL_H
3
+
4
+ /* Include header files which include data structures used by
5
+ * the function declaration
6
+ */
7
+ #include " rr_graph_obj.h"
8
+
9
+ /* Get node-to-node switches in a RRGraph */
10
+ std::vector<RRSwitchId> find_rr_graph_switches (const RRGraph& rr_graph,
11
+ const RRNodeId& from_node,
12
+ const RRNodeId& to_node);
13
+
14
+ #endif
You can’t perform that action at this time.
0 commit comments