Seabreeze : add fonction build_branch(Contact* ct) to help build a branch and pass all the 'unecessary' contacts

This commit is contained in:
HoangAnhP 2022-06-13 17:14:58 +02:00
parent d593683394
commit e9147299b0
2 changed files with 24 additions and 0 deletions

View File

@ -136,6 +136,29 @@ namespace Seabreeze {
}
}
Contact* Elmore::build_branch ( Contact* ct ) {
int count = 0;
checker.insert(ct);
for ( Component* cp : ct->getSlaveComponents() ) {
count += (dynamic_cast<Segment*>(cp)) ? 1 : 0;
}
if ( count == 0 )
cerr << "Something is not right here : Contact " << ct << " is isolated ?" << endl;
else if ( count != 2 )
return ct;
for ( Component* cp : ct->getSlaveComponents() ) {
Segment* sm = dynamic_cast<Segment*>(cp);
if ( not sm ) continue;
Contact* cct = dynamic_cast<Contact*>(sm->getOppositeAnchor(ct));
if ( not cct || find(checker.begin(), checker.end(), cct) != checker.end() )
continue;
else
build_branch(cct);
}
}
void Elmore::clearTree ()
{
_tree->clear();

View File

@ -35,6 +35,7 @@ namespace Seabreeze {
void contFromNet ( Net* net );
void buildTree ( RoutingPad* rp );
void build_from_node ( Node* source );
Contact* build_branch ( Contact* ct );
void clearTree ();
Tree* getTree ();
inline const set<Contact*>& get_conts () const;