Make sure pair caches are layer-specific where they need to be.

This commit is contained in:
Jeff Young 2022-08-25 17:00:18 +01:00
parent 86944c4f9f
commit 909358e643
3 changed files with 15 additions and 9 deletions

View File

@ -426,7 +426,7 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances()
reportAux( wxT( "Testing %d tracks & vias..." ), m_board->Tracks().size() );
std::unordered_map<PTR_PTR_CACHE_KEY, int> checkedPairs;
std::unordered_map<PTR_PTR_CACHE_KEY, LSET> checkedPairs;
for( PCB_TRACK* track : m_board->Tracks() )
{
@ -454,13 +454,15 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances()
if( static_cast<void*>( a ) > static_cast<void*>( b ) )
std::swap( a, b );
if( checkedPairs.find( { a, b } ) != checkedPairs.end() )
auto it = checkedPairs.find( { a, b } );
if( it != checkedPairs.end() && it->second.test( layer ) )
{
return false;
}
else
{
checkedPairs[ { a, b } ] = 1;
checkedPairs[ { a, b } ].set( layer );
return true;
}
},

View File

@ -154,7 +154,7 @@ bool DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run()
return true;
} );
std::unordered_map<PTR_PTR_CACHE_KEY, int> checkedPairs;
std::unordered_map<PTR_PTR_CACHE_KEY, LSET> checkedPairs;
progressDelta = 100;
ii = 0;
@ -191,13 +191,15 @@ bool DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run()
if( static_cast<void*>( a ) > static_cast<void*>( b ) )
std::swap( a, b );
if( checkedPairs.find( { a, b } ) != checkedPairs.end() )
auto it = checkedPairs.find( { a, b } );
if( it != checkedPairs.end() && it->second.test( layer ) )
{
return false;
}
else
{
checkedPairs[ { a, b } ] = 1;
checkedPairs[ { a, b } ].set( layer );
return true;
}
},

View File

@ -100,7 +100,7 @@ private:
std::unique_ptr<DRC_RTREE> m_tesselatedTree;
std::unique_ptr<DRC_RTREE> m_itemTree;
std::unordered_map<PTR_PTR_LAYER_CACHE_KEY, int> m_checkedPairs;
std::unordered_map<PTR_PTR_CACHE_KEY, LSET> m_checkedPairs;
// Shapes used to define solder mask apertures don't have nets, so we assign them the
// first object+net that bridges their aperture (after which any other nets will generate
@ -455,13 +455,15 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems( BOARD_ITEM* aItem,
if( static_cast<void*>( a ) > static_cast<void*>( b ) )
std::swap( a, b );
if( m_checkedPairs.find( { a, b, aTargetLayer } ) != m_checkedPairs.end() )
auto it = m_checkedPairs.find( { a, b } );
if( it != m_checkedPairs.end() && it->second.test( aTargetLayer ) )
{
return false;
}
else
{
m_checkedPairs[ { a, b, aTargetLayer } ] = 1;
m_checkedPairs[ { a, b } ].set( aTargetLayer );
return true;
}
},