Fix subgraph neighbor calculation
Subgraphs are not in any particular order so the entire set must be scanned, not starting at subgraph_it + 1
This commit is contained in:
parent
49d8c29608
commit
6ff1919ae0
|
@ -786,7 +786,6 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
|
|
||||||
for( auto subgraph : m_subgraphs )
|
for( auto subgraph : m_subgraphs )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( subgraph->m_strong_driver )
|
if( subgraph->m_strong_driver )
|
||||||
{
|
{
|
||||||
subgraph->m_dirty = true;
|
subgraph->m_dirty = true;
|
||||||
|
@ -995,7 +994,8 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<CONNECTION_SUBGRAPH*> candidate_subgraphs;
|
std::vector<CONNECTION_SUBGRAPH*> candidate_subgraphs;
|
||||||
std::copy_if( subgraph_it + 1, driver_subgraphs.end(), std::back_inserter( candidate_subgraphs ),
|
std::copy_if( driver_subgraphs.begin(), driver_subgraphs.end(),
|
||||||
|
std::back_inserter( candidate_subgraphs ),
|
||||||
[&] ( CONNECTION_SUBGRAPH* candidate )
|
[&] ( CONNECTION_SUBGRAPH* candidate )
|
||||||
{ return ( candidate->m_local_driver &&
|
{ return ( candidate->m_local_driver &&
|
||||||
candidate->m_sheet == sheet &&
|
candidate->m_sheet == sheet &&
|
||||||
|
@ -1024,8 +1024,8 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
|
|
||||||
if( candidate_connection->Name() == member->Name() )
|
if( candidate_connection->Name() == member->Name() )
|
||||||
{
|
{
|
||||||
wxLogTrace( "CONN", "%lu (%s) has neighbor %lu", subgraph->m_code,
|
wxLogTrace( "CONN", "%lu (%s) has neighbor %lu (%s)", subgraph->m_code,
|
||||||
connection->Name(), candidate->m_code );
|
connection->Name(), candidate->m_code, member->Name() );
|
||||||
subgraph->m_neighbor_map[member].push_back( candidate );
|
subgraph->m_neighbor_map[member].push_back( candidate );
|
||||||
candidate->m_neighbor_map[member].push_back( subgraph );
|
candidate->m_neighbor_map[member].push_back( subgraph );
|
||||||
}
|
}
|
||||||
|
@ -1037,7 +1037,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
|
|
||||||
for( auto pc : m_invisible_power_pins )
|
for( auto pc : m_invisible_power_pins )
|
||||||
{
|
{
|
||||||
if( pc->ConnectedItems().size() > 0 && !pc->GetLibPin()->GetParent()->IsPower() )
|
if( !pc->ConnectedItems().empty() && !pc->GetLibPin()->GetParent()->IsPower() )
|
||||||
{
|
{
|
||||||
// ERC will warn about this: user has wired up an invisible pin
|
// ERC will warn about this: user has wired up an invisible pin
|
||||||
continue;
|
continue;
|
||||||
|
@ -1051,8 +1051,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
|
|
||||||
if( !connection )
|
if( !connection )
|
||||||
{
|
{
|
||||||
pc->InitializeConnection( sheet );
|
connection = pc->InitializeConnection( sheet );
|
||||||
connection = pc->Connection( sheet );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1360,15 +1359,12 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
auto subsheet = child_subgraphs[i]->m_sheet;
|
auto subsheet = child_subgraphs[i]->m_sheet;
|
||||||
subsheet.push_back( sp->GetParent() );
|
subsheet.push_back( sp->GetParent() );
|
||||||
|
|
||||||
wxLogTrace( "CONN", "Propagating sheet pin %s on %s with connection %s to subsheet %s",
|
wxLogTrace( "CONN", "Propagating sheet pin %s on %lu (%s) to subsheet %s",
|
||||||
sp_name, child_subgraphs[i]->m_sheet.PathHumanReadable(),
|
sp_name, child_subgraphs[i]->m_code,
|
||||||
connection->Name(), subsheet.PathHumanReadable() );
|
connection->Name(), subsheet.PathHumanReadable() );
|
||||||
|
|
||||||
for( auto candidate : driver_subgraphs )
|
for( auto candidate : driver_subgraphs )
|
||||||
{
|
{
|
||||||
if( !candidate->m_dirty )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( candidate->m_sheet == subsheet )
|
if( candidate->m_sheet == subsheet )
|
||||||
{
|
{
|
||||||
SCH_ITEM* hier_label = nullptr;
|
SCH_ITEM* hier_label = nullptr;
|
||||||
|
@ -1382,12 +1378,9 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
|
|
||||||
if( hier_label )
|
if( hier_label )
|
||||||
{
|
{
|
||||||
wxLogTrace( "CONN", "Found child %s", static_cast<SCH_HIERLABEL*>( hier_label )->GetText() );
|
wxLogTrace( "CONN", "Found child %lu (%s)",
|
||||||
|
candidate->m_code,
|
||||||
// We found a subgraph that is a subsheet child of
|
static_cast<SCH_HIERLABEL*>( hier_label )->GetText() );
|
||||||
// our top-level subgraph, so let's mark it
|
|
||||||
|
|
||||||
candidate->m_dirty = false;
|
|
||||||
|
|
||||||
auto type = hier_label->Connection( subsheet )->Type();
|
auto type = hier_label->Connection( subsheet )->Type();
|
||||||
|
|
||||||
|
@ -1419,7 +1412,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
auto member = kv.first;
|
auto member = kv.first;
|
||||||
std::shared_ptr<SCH_CONNECTION> top_level_conn;
|
std::shared_ptr<SCH_CONNECTION> top_level_conn;
|
||||||
|
|
||||||
wxLogTrace( "CONN", "Found child neighbor from member %s",
|
wxLogTrace( "CONN", "Checking child neighbors for %s",
|
||||||
member->Name() );
|
member->Name() );
|
||||||
|
|
||||||
if( type == CONNECTION_BUS_GROUP )
|
if( type == CONNECTION_BUS_GROUP )
|
||||||
|
@ -1466,7 +1459,8 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
|
|
||||||
for( auto neighbor : kv.second )
|
for( auto neighbor : kv.second )
|
||||||
{
|
{
|
||||||
wxLogTrace( "CONN", "Propagating to neighbor driven by %s",
|
wxLogTrace( "CONN", "Propagating to child neighbor %lu (%s)",
|
||||||
|
neighbor->m_code,
|
||||||
neighbor->m_driver->GetSelectMenuText( MILLIMETRES ) );
|
neighbor->m_driver->GetSelectMenuText( MILLIMETRES ) );
|
||||||
|
|
||||||
bool neighbor_has_sheet_pins = false;
|
bool neighbor_has_sheet_pins = false;
|
||||||
|
@ -1485,8 +1479,8 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
|
|
||||||
if( neighbor_has_sheet_pins )
|
if( neighbor_has_sheet_pins )
|
||||||
{
|
{
|
||||||
wxLogTrace( "CONN", "Neighbor driven by %s has subsheet pins",
|
wxLogTrace( "CONN", "Neighbor %lu has subsheet pins",
|
||||||
neighbor->m_driver->GetSelectMenuText( MILLIMETRES ) );
|
neighbor->m_code );
|
||||||
child_subgraphs.push_back( neighbor );
|
child_subgraphs.push_back( neighbor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1496,7 +1490,8 @@ void CONNECTION_GRAPH::buildConnectionGraph()
|
||||||
// sheet pin members. If so, add to the queue.
|
// sheet pin members. If so, add to the queue.
|
||||||
if( candidate_has_sheet_pins)
|
if( candidate_has_sheet_pins)
|
||||||
{
|
{
|
||||||
wxLogTrace( "CONN", "Candidate %s has subsheet pins",
|
wxLogTrace( "CONN", "Candidate %lu (%s) has subsheet pins",
|
||||||
|
candidate->m_code,
|
||||||
candidate->m_driver->GetSelectMenuText( MILLIMETRES ) );
|
candidate->m_driver->GetSelectMenuText( MILLIMETRES ) );
|
||||||
child_subgraphs.push_back( candidate );
|
child_subgraphs.push_back( candidate );
|
||||||
}
|
}
|
||||||
|
@ -1981,8 +1976,6 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( CONNECTION_SUBGRAPH* aSubgraph,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(JE): Should it be an error to have a NC item but no pin?
|
|
||||||
// (JEY) Yes, I think it should
|
|
||||||
if( pin && has_invalid_items )
|
if( pin && has_invalid_items )
|
||||||
{
|
{
|
||||||
wxPoint pos = pin->GetTransformedPosition();
|
wxPoint pos = pin->GetTransformedPosition();
|
||||||
|
|
Loading…
Reference in New Issue