@@ -85,19 +85,19 @@ class tmg_conn_search::Impl
8585
8686 // Use deque so that emplace_back doesn't move prior elements so pointer
8787 // into these structures are safe.
88- std::deque<tcs_shape> _shapes ;
89- std::deque<tcs_level> _levels ;
90- std::array<tcs_level*, 32 > _root_for_level ;
88+ std::deque<tcs_shape> shapes_ ;
89+ std::deque<tcs_level> levels_ ;
90+ std::array<tcs_level*, 32 > root_for_level_ ;
9191
9292 // Used during searching
93- Rect _search_box ;
94- int _search_via {0 };
95- tcs_level* _search_bin {nullptr };
96- tcs_shape* _search_shape {nullptr };
93+ Rect search_box_ ;
94+ int search_via_ {0 };
95+ tcs_level* search_bin_ {nullptr };
96+ tcs_shape* search_shape_ {nullptr };
9797
9898 // Sorting happens after all the shapes have been added and the
9999 // first searchStart happens
100- bool _sorted {false };
100+ bool sorted_ {false };
101101
102102 static constexpr int sort_threshold = 1024 ;
103103};
@@ -109,27 +109,27 @@ tmg_conn_search::Impl::Impl()
109109
110110void tmg_conn_search::Impl::clear ()
111111{
112- _shapes .clear ();
113- _levels .clear ();
114- for (tcs_level*& level : _root_for_level ) {
115- level = &_levels .emplace_back ();
112+ shapes_ .clear ();
113+ levels_ .clear ();
114+ for (tcs_level*& level : root_for_level_ ) {
115+ level = &levels_ .emplace_back ();
116116 level->reset ();
117117 }
118- _sorted = false ;
118+ sorted_ = false ;
119119}
120120
121121void tmg_conn_search::Impl::addShape (const int level,
122122 const Rect& bounds,
123123 const int is_via,
124124 const int id)
125125{
126- tcs_shape* shape = &_shapes .emplace_back ();
126+ tcs_shape* shape = &shapes_ .emplace_back ();
127127 shape->level = level;
128128 shape->bounds = bounds;
129129 shape->is_via = is_via;
130130 shape->id = id;
131131 shape->next = nullptr ;
132- tcs_level* slev = _root_for_level .at (level);
132+ tcs_level* slev = root_for_level_ .at (level);
133133 if (slev->shape_list == nullptr ) {
134134 slev->shape_list = shape;
135135 slev->bounds = shape->bounds ;
@@ -145,91 +145,91 @@ void tmg_conn_search::Impl::searchStart(const int level,
145145 const Rect& bounds,
146146 const int is_via)
147147{
148- if (!_sorted ) {
148+ if (!sorted_ ) {
149149 sort ();
150150 }
151- _search_bin = _root_for_level .at (level);
152- _search_shape = _search_bin ->shape_list ;
153- _search_box = bounds;
154- _search_via = is_via;
151+ search_bin_ = root_for_level_ .at (level);
152+ search_shape_ = search_bin_ ->shape_list ;
153+ search_box_ = bounds;
154+ search_via_ = is_via;
155155}
156156
157157bool tmg_conn_search::Impl::searchNext (int * id)
158158{
159159 *id = -1 ;
160- if (!_search_bin ) {
160+ if (!search_bin_ ) {
161161 return false ;
162162 }
163163 // this is for speed for ordinary small nets
164- if (_search_via == 1 && !_search_bin ->parent && !_search_bin ->left
165- && !_search_bin ->right ) {
166- while (_search_shape ) {
167- if (_search_shape ->bounds .overlaps (_search_box )) {
168- *id = _search_shape ->id ;
169- _search_shape = _search_shape ->next ;
164+ if (search_via_ == 1 && !search_bin_ ->parent && !search_bin_ ->left
165+ && !search_bin_ ->right ) {
166+ while (search_shape_ ) {
167+ if (search_shape_ ->bounds .overlaps (search_box_ )) {
168+ *id = search_shape_ ->id ;
169+ search_shape_ = search_shape_ ->next ;
170170 return true ;
171171 }
172- _search_shape = _search_shape ->next ;
172+ search_shape_ = search_shape_ ->next ;
173173 }
174174 return false ;
175175 }
176176
177- while (_search_bin ) {
178- if (_search_bin ->bounds .intersects (_search_box )) {
179- while (_search_shape ) {
180- if (_search_via == 1 || _search_shape ->is_via == 1 ) {
181- if (!_search_shape ->bounds .overlaps (_search_box )) {
182- _search_shape = _search_shape ->next ;
177+ while (search_bin_ ) {
178+ if (search_bin_ ->bounds .intersects (search_box_ )) {
179+ while (search_shape_ ) {
180+ if (search_via_ == 1 || search_shape_ ->is_via == 1 ) {
181+ if (!search_shape_ ->bounds .overlaps (search_box_ )) {
182+ search_shape_ = search_shape_ ->next ;
183183 continue ;
184184 }
185185 } else {
186- if (!_search_shape ->bounds .intersects (_search_box )) {
187- _search_shape = _search_shape ->next ;
186+ if (!search_shape_ ->bounds .intersects (search_box_ )) {
187+ search_shape_ = search_shape_ ->next ;
188188 continue ;
189189 }
190190 // Skip wire segments that are abutting but staggered, eg
191191 // |-------
192192 // -----|
193193 // |-------
194194 // ------
195- if (_search_via == 0
196- && (_search_shape ->xMin () == _search_box .xMax ()
197- || _search_box .xMin () == _search_shape ->xMax ())) {
198- if ((_search_shape ->yMax () < _search_box .yMax ()
199- && _search_shape ->yMin () < _search_box .yMin ())
200- || (_search_shape ->yMax () > _search_box .yMax ()
201- && _search_shape ->yMin () > _search_box .yMin ())) {
202- _search_shape = _search_shape ->next ;
195+ if (search_via_ == 0
196+ && (search_shape_ ->xMin () == search_box_ .xMax ()
197+ || search_box_ .xMin () == search_shape_ ->xMax ())) {
198+ if ((search_shape_ ->yMax () < search_box_ .yMax ()
199+ && search_shape_ ->yMin () < search_box_ .yMin ())
200+ || (search_shape_ ->yMax () > search_box_ .yMax ()
201+ && search_shape_ ->yMin () > search_box_ .yMin ())) {
202+ search_shape_ = search_shape_ ->next ;
203203 continue ;
204204 }
205- } else if (_search_via == 0
206- && (_search_shape ->yMin () == _search_box .yMax ()
207- || _search_box .yMin () == _search_shape ->yMax ())) {
208- if ((_search_shape ->xMax () < _search_box .xMax ()
209- && _search_shape ->xMin () < _search_box .xMin ())
210- || (_search_shape ->xMax () > _search_box .xMax ()
211- && _search_shape ->xMin () > _search_box .xMin ())) {
212- _search_shape = _search_shape ->next ;
205+ } else if (search_via_ == 0
206+ && (search_shape_ ->yMin () == search_box_ .yMax ()
207+ || search_box_ .yMin () == search_shape_ ->yMax ())) {
208+ if ((search_shape_ ->xMax () < search_box_ .xMax ()
209+ && search_shape_ ->xMin () < search_box_ .xMin ())
210+ || (search_shape_ ->xMax () > search_box_ .xMax ()
211+ && search_shape_ ->xMin () > search_box_ .xMin ())) {
212+ search_shape_ = search_shape_ ->next ;
213213 continue ;
214214 }
215215 }
216216 }
217- *id = _search_shape ->id ;
218- _search_shape = _search_shape ->next ;
217+ *id = search_shape_ ->id ;
218+ search_shape_ = search_shape_ ->next ;
219219 return true ;
220220 }
221221 }
222- if (_search_bin ->left ) {
223- _search_bin = _search_bin ->left ;
224- _search_shape = _search_bin ->shape_list ;
222+ if (search_bin_ ->left ) {
223+ search_bin_ = search_bin_ ->left ;
224+ search_shape_ = search_bin_ ->shape_list ;
225225 } else {
226- while (_search_bin ->parent && _search_bin == _search_bin ->parent ->right ) {
227- _search_bin = _search_bin ->parent ;
226+ while (search_bin_ ->parent && search_bin_ == search_bin_ ->parent ->right ) {
227+ search_bin_ = search_bin_ ->parent ;
228228 }
229- _search_bin = _search_bin ->parent ;
230- if (_search_bin ) {
231- _search_bin = _search_bin ->right ;
232- _search_shape = _search_bin ->shape_list ;
229+ search_bin_ = search_bin_ ->parent ;
230+ if (search_bin_ ) {
231+ search_bin_ = search_bin_ ->right ;
232+ search_shape_ = search_bin_ ->shape_list ;
233233 }
234234 }
235235 }
@@ -261,10 +261,10 @@ void tmg_conn_search::Impl::sort_level(tcs_level* bin)
261261 if (bin->num_shapes < sort_threshold) {
262262 return ;
263263 }
264- tcs_level* left = &_levels .emplace_back ();
264+ tcs_level* left = &levels_ .emplace_back ();
265265 tcs_level_init (left, bin); // NOLINT(readability-suspicious-call-argument)
266266
267- tcs_level* right = &_levels .emplace_back ();
267+ tcs_level* right = &levels_ .emplace_back ();
268268 tcs_level_init (right, bin); // NOLINT(readability-suspicious-call-argument)
269269
270270 tcs_shape* shape = bin->shape_list ;
@@ -302,8 +302,8 @@ void tmg_conn_search::Impl::sort_level(tcs_level* bin)
302302
303303void tmg_conn_search::Impl::sort ()
304304{
305- _sorted = true ;
306- for (tcs_level* level : _root_for_level ) {
305+ sorted_ = true ;
306+ for (tcs_level* level : root_for_level_ ) {
307307 sort_level (level);
308308 }
309309}
0 commit comments