@@ -721,6 +721,8 @@ InstFinder::InstFinder (bool point_mode, bool top_level_sel, bool full_arrays, b
721721 m_full_arrays (full_arrays),
722722 m_enclose_insts (enclose_inst),
723723 m_visible_layers (visible_layers),
724+ m_consider_ghost_cells (true ),
725+ m_consider_normal_cells (true ),
724726 mp_view (0 ),
725727 mp_progress (0 )
726728{
@@ -805,6 +807,12 @@ InstFinder::checkpoint ()
805807 }
806808}
807809
810+ bool
811+ InstFinder::consider_cell (const db::Cell &cell) const
812+ {
813+ return cell.is_ghost_cell () ? m_consider_ghost_cells : m_consider_normal_cells;
814+ }
815+
808816void
809817InstFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, const db::Box & /* scan_box*/ , const db::DCplxTrans &vp, const db::ICplxTrans &t, int level)
810818{
@@ -818,15 +826,18 @@ InstFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, const d
818826 ++*mp_progress;
819827
820828 // look for instances to check here ..
821- db::Cell::touching_iterator inst = cell.begin_touching (search_box);
822- while (! inst.at_end ()) {
829+ for (db::Cell::touching_iterator inst = cell.begin_touching (search_box); ! inst.at_end (); ++inst) {
823830
824831 const db::CellInstArray &cell_inst = inst->cell_inst ();
825832 const db::Cell &inst_cell = layout ().cell (cell_inst.object ().cell_index ());
826833
827834 ++*mp_progress;
828835
829- // just consider the instances exactly at the last level of
836+ if (! consider_cell (inst_cell)) {
837+ continue ;
838+ }
839+
840+ // just consider the instances exactly at the last level of
830841 // hierarchy (this is where the boxes are drawn) or of cells that
831842 // are hidden.
832843 if (level == max_level () - 1 || inst_cell.is_proxy () || inst_cell.is_ghost_cell () || mp_view->is_cell_hidden (inst_cell.cell_index (), m_cv_index)) {
@@ -887,29 +898,30 @@ InstFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, const d
887898
888899 }
889900
890- ++inst;
891-
892901 }
893902
894903 } else {
895904
896905 // look for instances to check here ..
897- db::Cell::touching_iterator inst = cell.begin_touching (search_box);
898- while (! inst.at_end ()) {
906+ for (db::Cell::touching_iterator inst = cell.begin_touching (search_box); ! inst.at_end (); ++inst) {
899907
900908 checkpoint ();
901909
902910 const db::CellInstArray &cell_inst = inst->cell_inst ();
903911 const db::Cell &inst_cell = layout ().cell (cell_inst.object ().cell_index ());
904912
913+ if (! consider_cell (inst_cell)) {
914+ continue ;
915+ }
916+
905917 // just consider the instances exactly at the last level of
906918 // hierarchy (this is where the boxes are drawn) or if of cells that
907919 // are hidden.
908920 if (level == max_level () - 1 || inst_cell.is_proxy () || inst_cell.is_ghost_cell () || mp_view->is_cell_hidden (inst_cell.cell_index (), m_cv_index)) {
909921
910922 db::box_convert <db::CellInst, false > bc (layout ());
911923 for (db::CellInstArray::iterator p = cell_inst.begin_touching (search_box, bc); ! p.at_end (); ++p) {
912-
924+
913925 checkpoint ();
914926
915927 bool match = false ;
@@ -1000,8 +1012,6 @@ InstFinder::visit_cell (const db::Cell &cell, const db::Box &search_box, const d
10001012
10011013 }
10021014
1003- ++inst;
1004-
10051015 }
10061016
10071017 }
0 commit comments