16 #include <unordered_map>
21 : m_src(s), m_dst(d) {}
30 for (
int l = 0; l < nLinks; l++) {
31 unsigned int stage{}, lIdx{}, src{}, dst{}, nEntries{};
32 int height{},
width{};
34 inFile >> lIdx >> stage >> src >> dst >> height >>
width >> nEntries;
40 for (
int i = 0;
i < height;
i++) {
46 int vol_id = src / 1000;
48 if (vol_id == 13 || vol_id == 12 || vol_id == 14) {
55 if (vol_id == 13 || vol_id == 12 || vol_id == 14) {
60 std::map<int, std::vector<FasTrackConnection *>>::iterator
it =
64 std::vector<FasTrackConnection *>
v(1, pC);
65 m_connMap.insert(std::make_pair(stage, v));
67 (*it).second.push_back(pC);
73 std::list<const FasTrackConnection *> lConns;
75 std::map<int, std::vector<const FasTrackConnection *>> newConnMap;
78 std::copy(conn.second.begin(), conn.second.end(),
79 std::back_inserter(lConns));
84 while (!lConns.empty()) {
85 std::unordered_map<unsigned int, std::pair<int, int>>
88 for (
const auto &conn : lConns) {
89 auto entryIt = mCounter.find(conn->m_dst);
90 if (entryIt != mCounter.end()) {
91 (*entryIt).second.first++;
96 std::make_pair(conn->m_dst, std::make_pair(nDst, nSrc)));
99 entryIt = mCounter.find(conn->m_src);
100 if (entryIt != mCounter.end()) {
101 (*entryIt).second.second++;
106 std::make_pair(conn->m_src, std::make_pair(nDst, nSrc)));
112 std::set<unsigned int> zeroLayers;
114 for (
const auto &layerCounts : mCounter) {
115 if (layerCounts.second.second != 0) {
119 zeroLayers.insert(layerCounts.first);
124 std::vector<const FasTrackConnection *> theStage;
126 std::list<const FasTrackConnection *>::iterator cIt = lConns.begin();
128 while (cIt != lConns.end()) {
129 if (zeroLayers.find((*cIt)->m_dst) !=
131 theStage.push_back(*cIt);
132 cIt = lConns.erase(cIt);
137 newConnMap.insert(std::make_pair(stageCounter, theStage));
143 int currentStage = 0;
148 for (std::map<
int, std::vector<const FasTrackConnection *>>::reverse_iterator
149 it = newConnMap.rbegin();
150 it != newConnMap.rend(); ++
it, currentStage++) {
151 const std::vector<const FasTrackConnection *> &vConn = (*it).second;
156 std::map<unsigned int, std::vector<const FasTrackConnection *>> l1ConnMap;
158 for (
const auto *conn : vConn) {
159 unsigned int dst = conn->m_dst;
161 std::map<unsigned int, std::vector<const FasTrackConnection *>>::iterator
162 l1MapIt = l1ConnMap.find(dst);
163 if (l1MapIt != l1ConnMap.end()) {
164 (*l1MapIt).second.push_back(conn);
166 std::vector<const FasTrackConnection *>
v = {conn};
167 l1ConnMap.insert(std::make_pair(dst, v));
171 std::vector<LayerGroup> lgv;
173 lgv.reserve(l1ConnMap.size());
175 for (
const auto &l1Group : l1ConnMap) {
176 lgv.push_back(
LayerGroup(l1Group.first, l1Group.second));
187 for (std::map<
int, std::vector<FasTrackConnection *>>::iterator
it =
190 for (std::vector<FasTrackConnection *>::iterator cIt = (*it).second.begin();
191 cIt != (*it).second.end(); ++cIt) {