diff --git a/src/db/db/dbBoxScanner.h b/src/db/db/dbBoxScanner.h index 5c9372fe8..e8c46c693 100644 --- a/src/db/db/dbBoxScanner.h +++ b/src/db/db/dbBoxScanner.h @@ -621,8 +621,9 @@ public: // below m_scanner_thr elements use the brute force approach which is faster in that case for (iterator_type1 i = m_pp1.begin (); i != m_pp1.end (); ++i) { + box_type b1 = bc1 (*i->first); for (iterator_type2 j = m_pp2.begin (); j != m_pp2.end (); ++j) { - if (bs_boxes_overlap (bc1 (*i->first), bc2 (*j->first), enl)) { + if (bs_boxes_overlap (b1, bc2 (*j->first), enl)) { rec.add (i->first, i->second, j->first, j->second); if (rec.stop ()) { return false; diff --git a/src/db/db/dbHierNetworkProcessor.cc b/src/db/db/dbHierNetworkProcessor.cc index 5261a708d..f3db932aa 100644 --- a/src/db/db/dbHierNetworkProcessor.cc +++ b/src/db/db/dbHierNetworkProcessor.cc @@ -103,9 +103,21 @@ interaction_test (const db::PolygonRef &a, const db::PolygonRef &b, const Trans { // TODO: this could be part of db::interact (including transformation) if (a.obj ().is_box () && b.obj ().is_box ()) { - return db::interact (a.obj ().box ().transformed (b.trans ().inverted () * a.trans ()), b.obj ().box ().transformed (trans)); + return db::interact (a.obj ().box ().transformed (a.trans ()), b.obj ().box ().transformed (trans * Trans (b.trans ()))); } else { - return db::interact (a.obj ().transformed (b.trans ().inverted () * a.trans ()), b.obj ().transformed (trans)); + return db::interact (a.obj ().transformed (a.trans ()), b.obj ().transformed (trans * Trans (b.trans ()))); + } +} + +template +static bool +interaction_test (const db::PolygonRef &a, const db::PolygonRef &b, const db::unit_trans &) +{ + // TODO: this could be part of db::interact (including transformation) + if (a.obj ().is_box () && b.obj ().is_box ()) { + return db::interact (a.obj ().box ().transformed (a.trans ()), b.obj ().box ().transformed (b.trans ())); + } else { + return db::interact (a.obj ().transformed (a.trans ()), b.obj ().transformed (b.trans ())); } } @@ -265,12 +277,11 @@ local_cluster::interacts (const local_cluster &other, const db::ICplxTrans { const_cast *> (this)->ensure_sorted (); - if (! other.bbox ().touches (bbox ())) { + box_type common = other.bbox ().transformed (trans) & bbox (); + if (common.empty ()) { return false; } - box_type common = other.bbox () & bbox (); - db::box_scanner2 scanner; transformed_box bc_t (trans); db::box_convert bc; @@ -586,6 +597,11 @@ public: // .. nothing yet .. } + const box_type &operator() (const db::CellInst &cell_inst) const + { + return (*this) (cell_inst.cell_index ()); + } + const box_type &operator() (db::cell_index_type cell_index) const { typename std::map::const_iterator b = m_cache.find (cell_index); @@ -601,7 +617,7 @@ public: const db::Cell &cell = mp_layout->cell (cell_index); for (db::Cell::const_iterator inst = cell.begin (); ! inst.at_end (); ++inst) { const db::CellInstArray &inst_array = inst->cell_inst (); - box += inst_array.raw_bbox () * (*this) (inst_array.object ().cell_index ()); + box += inst_array.bbox (*this); } return m_cache.insert (std::make_pair (cell_index, box)).first->second; @@ -741,10 +757,10 @@ private: void add_pair (const db::Instance &i1, const std::vector &p1, const db::ICplxTrans &t1, const db::Instance &i2, const std::vector &p2, const db::ICplxTrans &t2) { box_type bb1 = (*mp_cbc) (i1.cell_index ()); - box_type b1 = (i1.cell_inst ().raw_bbox () * bb1).transformed (t1); + box_type b1 = i1.cell_inst ().bbox (*mp_cbc).transformed (t1); box_type bb2 = (*mp_cbc) (i2.cell_index ()); - box_type b2 = (i2.cell_inst ().raw_bbox () * bb2).transformed (t2); + box_type b2 = i2.cell_inst ().bbox (*mp_cbc).transformed (t2); if (! b1.touches (b2)) { return; @@ -878,7 +894,7 @@ private: box_type b1 = c1.bbox (); box_type bb2 = (*mp_cbc) (i2.cell_index ()); - box_type b2 = (i2.cell_inst ().raw_bbox () * bb2).transformed (t2); + box_type b2 = i2.cell_inst ().bbox (*mp_cbc).transformed (t2); if (! b1.touches (b2)) { return; @@ -1043,7 +1059,7 @@ struct cell_inst_clusters_box_converter box_type operator() (const db::Instance &inst) const { - return inst.cell_inst ().raw_bbox () * (*mp_cbc) (inst.cell_index ()); + return inst.cell_inst ().bbox (*mp_cbc); } private: diff --git a/src/db/unit_tests/dbHierNetworkProcessorTests.cc b/src/db/unit_tests/dbHierNetworkProcessorTests.cc index c18d6291e..3ca36d282 100644 --- a/src/db/unit_tests/dbHierNetworkProcessorTests.cc +++ b/src/db/unit_tests/dbHierNetworkProcessorTests.cc @@ -552,3 +552,13 @@ TEST(41_HierClusters) { run_hc_test (_this, "hc_test_l2.gds", "hc_test_au2.gds"); } + +TEST(42_HierClusters) +{ + run_hc_test (_this, "hc_test_l3.gds", "hc_test_au3.gds"); +} + +TEST(43_HierClusters) +{ + run_hc_test (_this, "hc_test_l4.gds", "hc_test_au4.gds"); +} diff --git a/testdata/algo/hc_test_au3.gds b/testdata/algo/hc_test_au3.gds new file mode 100644 index 000000000..c1998d1e4 Binary files /dev/null and b/testdata/algo/hc_test_au3.gds differ diff --git a/testdata/algo/hc_test_au4.gds b/testdata/algo/hc_test_au4.gds new file mode 100644 index 000000000..57d1aa7c0 Binary files /dev/null and b/testdata/algo/hc_test_au4.gds differ diff --git a/testdata/algo/hc_test_l3.gds b/testdata/algo/hc_test_l3.gds new file mode 100644 index 000000000..f0b6251fa Binary files /dev/null and b/testdata/algo/hc_test_l3.gds differ diff --git a/testdata/algo/hc_test_l4.gds b/testdata/algo/hc_test_l4.gds new file mode 100644 index 000000000..933c5ecee Binary files /dev/null and b/testdata/algo/hc_test_l4.gds differ