17 {
18
21
22 int nLinks{};
23
25
26
27
29 int height{},
width{};
31
32
33 for(
int l=0;
l<nLinks;
l++) {
36
37
38
39 for(
int i=0;
i<height;
i++) {
40
41 for(
int j=0;j<width;j++) inFile >>
dummy;
42 }
43
44 int srcvol_id =
src / 1000;
45 int dstvol_id = dst / 1000;
46
47 bool srcIsStrip = (srcvol_id == 13 || srcvol_id == 12 || srcvol_id == 14);
48 bool dstIsStrip = (dstvol_id == 13 || dstvol_id == 12 || dstvol_id == 14);
49 if (LRTmode) {
50 if ( !srcIsStrip || !dstIsStrip) {
51 delete pC;
52 continue;
53 }
54 } else {
55 if ( srcIsStrip || dstIsStrip) {
56 delete pC;
57 continue;
58 }
59 }
60
61 std::map<int, std::vector<GNNR3_FASTRACK_CONNECTION*> >::iterator
it =
m_connMap.find(stage);
62
64 std::vector<GNNR3_FASTRACK_CONNECTION*> v = {pC};
65 m_connMap.insert(std::make_pair(stage, v));
66 } else (*it).second.push_back(pC);
67 }
68
69
70
71 std::list<const GNNR3_FASTRACK_CONNECTION*> lConns;
72
73 std::map<int, std::vector<const GNNR3_FASTRACK_CONNECTION*> > newConnMap;
74
76 std::copy(
conn.second.begin(),
conn.second.end(), std::back_inserter(lConns));
77 }
78
79 int stageCounter = 0;
80
81 while(!lConns.empty()) {
82
83 std::unordered_map<unsigned int, std::pair<int, int> > mCounter;
84
85 for(const auto& conn : lConns) {
86 auto entryIt = mCounter.find(
conn->m_dst);
87 if(entryIt != mCounter.end()) {
88 (*entryIt).second.first++;
89 }
90 else {
91 int nDst = 1;
92 int nSrc = 0;
93 mCounter.insert(std::make_pair(
conn->m_dst, std::make_pair(nDst, nSrc)));
94 }
95
96 entryIt = mCounter.find(
conn->m_src);
97 if(entryIt != mCounter.end()) {
98 (*entryIt).second.second++;
99 }
100 else {
101 int nDst = 0;
102 int nSrc = 1;
103 mCounter.insert(std::make_pair(
conn->m_src, std::make_pair(nDst, nSrc)));
104 }
105 }
106
107
108
109 std::set<unsigned int> zeroLayers;
110
111 for(const auto& layerCounts : mCounter) {
112
113 if(layerCounts.second.second!=0) continue;
114
115 zeroLayers.insert(layerCounts.first);
116 }
117
118
119
120 std::vector<const GNNR3_FASTRACK_CONNECTION*> theStage;
121
122 std::list<const GNNR3_FASTRACK_CONNECTION*>::iterator cIt = lConns.begin();
123
124 while(cIt!=lConns.end()) {
125 if(zeroLayers.find((*cIt)->m_dst) != zeroLayers.end()) {
126 theStage.push_back(*cIt);
127 cIt = lConns.erase(cIt);
128 continue;
129 }
130 ++cIt;
131 }
132 newConnMap.insert(std::make_pair(stageCounter, theStage));
133 stageCounter++;
134 }
135
136
137
138 int currentStage = 0;
139
140
141
142 for(std::map<int, std::vector<const GNNR3_FASTRACK_CONNECTION*> >::reverse_iterator it = newConnMap.rbegin();it!=newConnMap.rend();++it, currentStage++) {
143
144 const std::vector<const GNNR3_FASTRACK_CONNECTION*> & vConn = (*it).second;
145
146
147
148 std::map<unsigned int, std::vector<const GNNR3_FASTRACK_CONNECTION*> > l1ConnMap;
149
150 for(const auto* conn : vConn) {
151
152 unsigned int dst =
conn->m_dst;
153
154 std::map<unsigned int, std::vector<const GNNR3_FASTRACK_CONNECTION*> >::iterator l1MapIt = l1ConnMap.find(dst);
155 if(l1MapIt != l1ConnMap.end())
156 (*l1MapIt).second.push_back(conn);
157 else {
158 std::vector<const GNNR3_FASTRACK_CONNECTION*>
v = {
conn};
159 l1ConnMap.insert(std::make_pair(dst, v));
160 }
161 }
162
163 std::vector<LayerGroup> lgv;
164
165 lgv.reserve(l1ConnMap.size());
166
167 for(const auto& l1Group : l1ConnMap) {
168 lgv.push_back(
LayerGroup(l1Group.first, l1Group.second));
169 }
170
172 }
173
174 newConnMap.clear();
175
176}
struct GNNR3_FasTrackConnection GNNR3_FASTRACK_CONNECTION
std::map< int, std::vector< GNNR3_FASTRACK_CONNECTION * > > m_connMap
std::map< int, std::vector< struct LayerGroup > > m_layerGroups
l
Printing final latex table to .tex output file.