diff --git a/src/db/db/dbHierProcessor.cc b/src/db/db/dbHierProcessor.cc index 87ca8a900..fc96f6cd9 100644 --- a/src/db/db/dbHierProcessor.cc +++ b/src/db/db/dbHierProcessor.cc @@ -189,12 +189,19 @@ public: typedef typename Ref::shape_type shape_type; typedef typename Ref::trans_type ref_trans_type; - shape_reference_translator_with_trans_from_shape_ref (db::Layout *target_layout, const Trans &trans) - : mp_layout (target_layout), m_trans (trans), m_ref_trans (trans), m_bare_trans (Trans (m_ref_trans.inverted ()) * trans) + shape_reference_translator_with_trans_from_shape_ref (db::Layout *target_layout) + : mp_layout (target_layout) { // .. nothing yet .. } + void set_trans (const Trans &trans) + { + m_trans = trans; + m_ref_trans = ref_trans_type (trans); + m_bare_trans = Trans (m_ref_trans.inverted ()) * trans; + } + Ref operator() (const Ref &ref) const { typename std::unordered_map >::const_iterator m = m_cache.find (ref.ptr ()); @@ -234,8 +241,8 @@ class shape_reference_translator_with_trans : public shape_reference_translator_with_trans_from_shape_ref { public: - shape_reference_translator_with_trans (db::Layout *target_layout, const Trans &trans) - : shape_reference_translator_with_trans_from_shape_ref (target_layout, trans) + shape_reference_translator_with_trans (db::Layout *target_layout) + : shape_reference_translator_with_trans_from_shape_ref (target_layout) { // .. nothing yet .. } @@ -247,12 +254,16 @@ class shape_reference_translator_with_trans public: typedef Sh shape_type; - shape_reference_translator_with_trans (db::Layout * /*target_layout*/, const Trans &trans) - : m_trans (trans) + shape_reference_translator_with_trans (db::Layout * /*target_layout*/) { // .. nothing yet .. } + void set_trans (const Trans &trans) + { + m_trans = trans; + } + shape_type operator() (const shape_type &s) const { return s.transformed (m_trans); @@ -353,13 +364,20 @@ local_processor_cell_context::propagate (unsigned int output_layer, return; } + db::Layout *subject_layout = 0; + shape_reference_translator_with_trans rt (subject_layout); + for (typename std::vector >::const_iterator d = m_drops.begin (); d != m_drops.end (); ++d) { tl_assert (d->parent_context != 0); tl_assert (d->parent != 0); - db::Layout *subject_layout = d->parent->layout (); - shape_reference_translator_with_trans rt (subject_layout, d->cell_inst); + if (subject_layout != d->parent->layout ()) { + subject_layout = d->parent->layout (); + rt = shape_reference_translator_with_trans (subject_layout); + } + + rt.set_trans (d->cell_inst); std::vector new_refs; new_refs.reserve (res.size ()); for (typename std::unordered_set::const_iterator r = res.begin (); r != res.end (); ++r) { @@ -1203,6 +1221,8 @@ private: db::box_convert inst_bc (*mp_subject_layout, m_subject_layer); db::Box rbox = db::box_convert () (ref); + db::shape_reference_translator_with_trans rt (mp_subject_layout); + for (db::CellInstArray::iterator n = inst->begin_touching (safe_box_enlarged (rbox, dist - 1, dist - 1), inst_bc); ! n.at_end (); ++n) { db::ICplxTrans tn = inst->complex_trans (*n); @@ -1211,7 +1231,7 @@ private: if (! cbox.empty ()) { db::ICplxTrans tni = tn.inverted (); - db::shape_reference_translator_with_trans rt (mp_subject_layout, tni); + rt.set_trans (tni); std::set *shapes = 0;