Skip to content

Commit aeb7ff6

Browse files
committed
grt: final clang-tidy fixes for cugr
Signed-off-by: Eder Monteiro <[email protected]>
1 parent 746c6c3 commit aeb7ff6

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/grt/src/cugr/src/GridGraph.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ GridGraph::GridGraph(const Design* design, const Constants& constants)
168168
IntervalT<int> edgeInterval(grid_centers_[direction][edge_index],
169169
grid_centers_[direction][edge_index + 1]);
170170
// Update cpacity
171-
std::vector<IntervalT<int>> usableIntervals(gridTrackRange.range() + 1,
172-
edgeInterval);
171+
std::vector<IntervalT<int>> usable_intervals(gridTrackRange.range() + 1,
172+
edgeInterval);
173173
for (auto& obstacle : obstaclesAtEdge[edge_index]) {
174174
IntervalT<int> affectedTrackRange
175175
= gridTrackRange.IntersectWith(obstacle->second);
@@ -183,20 +183,20 @@ GridGraph::GridGraph(const Design* design, const Constants& constants)
183183
if (obstacle->first[direction].low <= gridline
184184
&& obstacle->first[direction].high >= gridline) {
185185
// Completely blocked
186-
usableIntervals[tIdx] = {gridline, gridline};
186+
usable_intervals[tIdx] = {gridline, gridline};
187187
} else if (obstacle->first[direction].high < gridline) {
188-
usableIntervals[tIdx].low = std::max(
189-
usableIntervals[tIdx].low, obstacle->first[direction].high);
188+
usable_intervals[tIdx].low = std::max(
189+
usable_intervals[tIdx].low, obstacle->first[direction].high);
190190
} else if (obstacle->first[direction].low > gridline) {
191-
usableIntervals[tIdx].high = std::min(
192-
usableIntervals[tIdx].high, obstacle->first[direction].low);
191+
usable_intervals[tIdx].high = std::min(
192+
usable_intervals[tIdx].high, obstacle->first[direction].low);
193193
}
194194
}
195195
}
196196
CapacityT capacity = 0;
197-
for (int tIdx = 0; tIdx < usableIntervals.size(); tIdx++) {
198-
capacity += (CapacityT) usableIntervals[tIdx].range()
199-
/ edgeInterval.range();
197+
for (IntervalT<int>& usable_interval : usable_intervals) {
198+
capacity
199+
+= (CapacityT) usable_interval.range() / edgeInterval.range();
200200
}
201201
if (direction == MetalLayer::V) {
202202
graph_edges_[layer_index][gridIndex][edge_index].capacity = capacity;
@@ -736,7 +736,7 @@ void GridGraph::updateWireCostView(
736736
});
737737
}
738738

739-
void GridGraph::write(const std::string heatmap_file) const
739+
void GridGraph::write(const std::string& heatmap_file) const
740740
{
741741
printf("writing heatmap to file...");
742742
std::stringstream ss;

src/grt/src/cugr/src/GridGraph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class GridGraph
102102
const std::shared_ptr<GRTreeNode>& routing_tree) const;
103103

104104
// For visualization
105-
void write(std::string heatmap_file = "heatmap.txt") const;
105+
void write(const std::string& heatmap_file = "heatmap.txt") const;
106106

107107
private:
108108
const int lib_dbu_;

src/grt/src/cugr/src/MazeRoute.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ std::shared_ptr<SteinerTreeNode> MazeRoute::getSteinerTree() const
310310
// Check duplicate tree nodes
311311
SteinerTreeNode::preorder(
312312
tree, [&](const std::shared_ptr<SteinerTreeNode>& node) {
313-
for (auto child : node->getChildren()) {
313+
for (const auto& child : node->getChildren()) {
314314
if (node->x == child->x && node->y == child->y) {
315315
printf("Error: duplicate tree nodes encountered.");
316316
}

0 commit comments

Comments
 (0)