@@ -1456,15 +1456,15 @@ bool PadDirectConnectionStraps::refineShapes(
14561456 return GridComponent::refineShapes(all_shapes, all_obstructions);
14571457 }
14581458
1459- std::vector<Shape* > refine;
1459+ std::vector<ShapePtr > refine;
14601460 for (const auto& [layer, shapes] : getShapes()) {
14611461 for (const auto& shape : shapes) {
14621462 if (!strapViaIsObstructed(
14631463 shape.get(), all_shapes, all_obstructions, false)) {
14641464 continue;
14651465 }
14661466
1467- refine.push_back(shape.get() );
1467+ refine.push_back(shape);
14681468 }
14691469 }
14701470
@@ -1475,37 +1475,24 @@ bool PadDirectConnectionStraps::refineShapes(
14751475 const auto [first, last] = std::ranges::unique(refine.begin(), refine.end());
14761476 refine.erase(first, last);
14771477
1478- for (auto* refine_shape : refine) {
1479- std::unique_ptr<Shape> shape = refine_shape->copy();
1480- removeShape(refine_shape);
1478+ for (const auto& refine_shape : refine) {
1479+ std::unique_ptr<Shape> shape(refine_shape->copy());
1480+ const auto& target_pin = target_pin_shape_[refine_shape.get()];
1481+ removeShape(refine_shape.get());
14811482
1482- // remove shape from all_shapes and all_obstructions
1483- auto* layer = shape->getLayer();
1484- auto find_shape = [&refine_shape](const ShapePtr& other) {
1485- return other.get() == refine_shape;
1486- };
14871483 // remove from all_shapes
1488- auto& layer_shapes = all_shapes[layer];
1489- auto find_all_shapes_itr = layer_shapes.qbegin(bgi::satisfies(find_shape));
1490- if (find_all_shapes_itr != layer_shapes.qend()) {
1491- layer_shapes.remove(*find_all_shapes_itr);
1492- }
1493- // remove from all_obstructions
1494- auto& layer_obstruction = all_obstructions[layer];
1495- auto find_all_obstructions_itr
1496- = layer_obstruction.qbegin(bgi::satisfies(find_shape));
1497- if (find_all_obstructions_itr != layer_obstruction.qend()) {
1498- layer_obstruction.remove(*find_all_obstructions_itr);
1499- }
1484+ auto* layer = shape->getLayer();
1485+ all_shapes[layer].remove(refine_shape);
1486+ all_obstructions[layer].remove(refine_shape);
15001487
15011488 const TechLayer tech_layer(layer);
15021489 for (int width : {getWidth(), tech_layer.getMinWidth()}) {
15031490 setWidth(width);
15041491
1505- if (refineShape(shape.get(),
1506- target_pin_shape_[refine_shape],
1507- all_shapes,
1508- all_obstructions)) {
1492+ if (refineShape(shape.get(), target_pin, all_shapes, all_obstructions)) {
1493+ // add shape to all_shapes and all_obstructions
1494+ getObstructions(all_obstructions);
1495+ getShapes(all_shapes);
15091496 break;
15101497 }
15111498 }
@@ -1517,8 +1504,8 @@ bool PadDirectConnectionStraps::refineShapes(
15171504bool PadDirectConnectionStraps::refineShape(
15181505 Shape* shape,
15191506 const odb::Rect& pin_shape,
1520- Shape::ShapeTreeMap& all_shapes,
1521- Shape::ObstructionTreeMap& all_obstructions)
1507+ const Shape::ShapeTreeMap& all_shapes,
1508+ const Shape::ObstructionTreeMap& all_obstructions)
15221509{
15231510 const TechLayer tech_layer(shape->getLayer());
15241511
@@ -1549,7 +1536,7 @@ bool PadDirectConnectionStraps::refineShape(
15491536 new_rect.set_xhi(check_loc + getWidth());
15501537 }
15511538
1552- std::unique_ptr<Shape> new_shape = shape->copy();
1539+ std::unique_ptr<Shape> new_shape( shape->copy() );
15531540 new_shape->setRect(new_rect);
15541541
15551542 debugPrint(getLogger(),
@@ -1581,10 +1568,6 @@ bool PadDirectConnectionStraps::refineShape(
15811568 continue;
15821569 }
15831570
1584- // add shape to all_shapes and all_obstructions
1585- getObstructions(all_obstructions);
1586- getShapes(all_shapes);
1587-
15881571 return true;
15891572 }
15901573 }
0 commit comments