From 596080669da7ad1dc172db50c13a0b7009317a76 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 26 Oct 2021 23:10:29 +0200 Subject: [PATCH] WIP --- src/db/db/dbArray.h | 18 ++++------- src/db/db/dbHierProcessor.cc | 62 ++---------------------------------- src/db/db/dbTrans.h | 9 ++++++ src/db/db/gsiDeclDbTrans.cc | 10 +++++- 4 files changed, 28 insertions(+), 71 deletions(-) diff --git a/src/db/db/dbArray.h b/src/db/db/dbArray.h index 5834743c4..ba2efe78a 100644 --- a/src/db/db/dbArray.h +++ b/src/db/db/dbArray.h @@ -1697,7 +1697,7 @@ struct array * an appropriate basic_array object using a complex transformation. */ array (const Obj &obj, const complex_trans_type &ct, const vector_type &a, const vector_type &b, unsigned long amax, unsigned long bmax) - : m_obj (obj), m_trans (ct), mp_base (new regular_complex_array (ct.rcos (), ct.mag (), a, b, amax, bmax)) + : m_obj (obj), m_trans (ct), mp_base (ct.is_complex () ? new regular_complex_array (ct.rcos (), ct.mag (), a, b, amax, bmax) : new regular_array (a, b, amax, bmax)) { // .. nothing yet .. } @@ -1725,7 +1725,7 @@ struct array * it's own storage. */ array (const Obj &obj, const complex_trans_type &ct, ArrayRepository &rep, const vector_type &a, const vector_type &b, unsigned long amax, unsigned long bmax) - : m_obj (obj), m_trans (ct), mp_base (rep.insert (regular_complex_array (ct.rcos (), ct.mag (), a, b, amax, bmax))) + : m_obj (obj), m_trans (ct), mp_base (ct.is_complex () ? rep.insert (regular_complex_array (ct.rcos (), ct.mag (), a, b, amax, bmax)) : rep.insert (regular_array (a, b, amax, bmax))) { // .. nothing yet .. } @@ -1764,7 +1764,7 @@ struct array */ template array (const Obj &obj, const complex_trans_type &ct, Iter from, Iter to) - : m_obj (obj), m_trans (ct), mp_base (new iterated_complex_array (ct.rcos (), ct.mag (), from, to)) + : m_obj (obj), m_trans (ct), mp_base (ct.is_complex () ? new iterated_complex_array (ct.rcos (), ct.mag (), from, to) : new iterated_array (from, to)) { // .. nothing yet .. } @@ -1777,7 +1777,7 @@ struct array */ explicit array (const Obj &obj, const complex_trans_type &ct) - : m_obj (obj), m_trans (ct), mp_base (new single_complex_inst (ct.rcos (), ct.mag ())) + : m_obj (obj), m_trans (ct), mp_base (ct.is_complex () ? new single_complex_inst (ct.rcos (), ct.mag ()) : 0) { // .. nothing yet .. } @@ -1807,7 +1807,7 @@ struct array */ explicit array (const Obj &obj, const complex_trans_type &ct, ArrayRepository &rep) - : m_obj (obj), m_trans (ct), mp_base (rep.insert (single_complex_inst (ct.rcos (), ct.mag ()))) + : m_obj (obj), m_trans (ct), mp_base (ct.is_complex () ? rep.insert (single_complex_inst (ct.rcos (), ct.mag ())) : 0) { // .. nothing yet .. } @@ -1888,17 +1888,13 @@ struct array array_iterator begin_touching (const box_type &b, const BoxConv &bc) const { if (b.empty ()) { - if (mp_base) { - return array_iterator (m_trans, mp_base->begin_touching (box_type ())); - } else { - return array_iterator (m_trans, true); - } + return array_iterator (m_trans, true); } else if (b == box_type::world ()) { return begin (); } else if (mp_base) { box_type ob (bc (m_obj)); if (ob.empty ()) { - return array_iterator (m_trans, mp_base->begin_touching (box_type ())); + return array_iterator (m_trans, true); } else { if (mp_base->is_complex ()) { complex_trans_type ct = mp_base->complex_trans (simple_trans_type (m_trans)); diff --git a/src/db/db/dbHierProcessor.cc b/src/db/db/dbHierProcessor.cc index e8dc9dc1b..3b589f420 100644 --- a/src/db/db/dbHierProcessor.cc +++ b/src/db/db/dbHierProcessor.cc @@ -1076,6 +1076,9 @@ printf("@@@ check instance interactions %s (#%d, %s) <-> %s (#%d, %s)\n", std::unordered_map > > interactions_cache; +#if 0 +printf("@@@ -> #%d\n", int(inst1->size())); +#endif for (db::CellInstArray::iterator n = inst1->begin (); ! n.at_end (); ++n) { db::ICplxTrans tn1 = inst1->complex_trans (*n); @@ -1131,51 +1134,8 @@ printf("@@@ check instance interactions %s (#%d, %s) <-> %s (#%d, %s)\n", } } -// @@@ - bool has_intruder_tree_interactions (const db::Cell &subject_cell, const db::Cell &intruder_cell, const db::ICplxTrans &tni1, const db::ICplxTrans &tn21, const db::Box &cbox) - { - db::ICplxTrans tni2 = tn21.inverted () * tni1; - db::Box tbox2 = safe_box_enlarged (tni2 * cbox, -1, -1); - - if (! intruder_cell.shapes (m_intruder_layer).begin_touching (tbox2, ShapeIterator::All).at_end ()) { - - // we're overlapping with shapes from the intruder - do not recursive further - return true; - - } - - for (db::Cell::touching_iterator i = intruder_cell.begin_touching (tbox2); ! i.at_end (); ++i) { - - const db::Cell &ic = mp_intruder_layout->cell (i->cell_index ()); - - for (db::CellInstArray::iterator ia = i->begin_touching (tbox2, mp_intruder_layout); ! ia.at_end (); ++ia) { - - db::ICplxTrans it = i->complex_trans (*ia); - - db::Box ibox2 = tni2.inverted () * it * ic.bbox (m_intruder_layer).enlarged (db::Vector (m_dist, m_dist)); - db::Box ccbox = cbox & ibox2; - - if (! ccbox.empty () && ! db::RecursiveShapeIterator (*mp_subject_layout, subject_cell, m_subject_layer, safe_box_enlarged (tni1 * ccbox, -1, -1), false).at_end ()) { - if (has_intruder_tree_interactions (subject_cell, ic, tni1, tn21 * it, ccbox)) { - return true; - } - } - - } - - } - - return false; - } -// @@@ - void collect_intruder_tree_interactions (const db::Cell &subject_cell, const db::Cell &intruder_cell, const db::ICplxTrans &tni1, const db::ICplxTrans &tn21, const db::Box &cbox, std::list > &interactions) { -#if 0 - if (has_intruder_tree_interactions (subject_cell, intruder_cell, tni1, tn21, cbox)) { - interactions.push_back (std::make_pair (intruder_cell.cell_index (), tn21)); - } -#elif 1 db::ICplxTrans tni2 = tn21.inverted () * tni1; db::Box tbox2 = safe_box_enlarged (tni2 * cbox, -1, -1); @@ -1205,20 +1165,6 @@ printf("@@@ check instance interactions %s (#%d, %s) <-> %s (#%d, %s)\n", } } -#else - // not very strong, but already useful: the cells interact if there is a layer1 in cell1 - // in the common box and a layer2 in the cell2 in the common box - // NOTE: don't use overlap mode for the RecursiveShapeIterator as this would not capture dot-like - // objects like texts. Instead safe-shrink the search box and use touching mode ("false" for the last - // argument) - db::ICplxTrans tni2 = tn21.inverted () * tni1; - bool interacts = (! db::RecursiveShapeIterator (*mp_subject_layout, subject_cell, m_subject_layer, safe_box_enlarged (tni1 * cbox, -1, -1), false).at_end () && - ! db::RecursiveShapeIterator (*mp_intruder_layout, intruder_cell, m_intruder_layer, safe_box_enlarged (tni2 * cbox, -1, -1), false).at_end ()); - - if (interacts) { - interactions.push_back (std::make_pair (intruder_cell.cell_index (), tn21)); - } -#endif } }; @@ -1669,8 +1615,6 @@ printf("@@@ --- compute_contexts (%s @ %s)\n", mp_subject_layout->cell_name (sub } - std::list instance_heap; - for (std::set::const_iterator i = intruders.first.begin (); i != intruders.first.end (); ++i) { if (! inst_bci (*i).empty ()) { scanner.insert2 (i.operator-> (), ++id); diff --git a/src/db/db/dbTrans.h b/src/db/db/dbTrans.h index 93a6b08a7..c08915e74 100644 --- a/src/db/db/dbTrans.h +++ b/src/db/db/dbTrans.h @@ -2011,6 +2011,15 @@ public: m_mag = m_mag < 0.0 ? -m : m; } + /** + * @brief Returns a value indicating whether the transformation is a complex one + * The transformation can safely be converted to a simple transformation if this value is false. + */ + bool is_complex () const + { + return is_mag () || ! is_ortho (); + } + /** * @brief Test, if the transformation is mirroring */ diff --git a/src/db/db/gsiDeclDbTrans.cc b/src/db/db/gsiDeclDbTrans.cc index 0ebbb4d0b..a14eaa66b 100644 --- a/src/db/db/gsiDeclDbTrans.cc +++ b/src/db/db/gsiDeclDbTrans.cc @@ -916,7 +916,7 @@ struct cplx_trans_defs "@brief Gets the magnification\n" ) + method ("is_mag?", &C::is_mag, - "@brief Test, if the transformation is a magnifying one\n" + "@brief Tests, if the transformation is a magnifying one\n" "\n" "This is the recommended test for checking if the transformation represents\n" "a magnification.\n" @@ -925,6 +925,14 @@ struct cplx_trans_defs "@brief Sets the magnification\n" "@param m The new magnification" ) + + method ("is_complex?", &C::is_complex, + "@brief Return true if the transformation is a complex one\n" + "\n" + "If this value is false, the transformation can safely be converted to a simple transformation.\n" + "The return value is equivalent to 'is_mag || !is_ortho'.\n" + "\n" + "This method has been introduced in version 0.27.5." + ) + method ("R0", &trans_r0, "@brief A constant giving \"unrotated\" (unit) transformation\n" "The previous integer constant has been turned into a transformation in version 0.25."