pcbnew: standardize itemlist/zonelist connectivity
The itemlist and zonelist in connectivity can both contain many items, so both use the same OpenMP routine. However, we can only clear the dirty flag when we conduct a full search, including zones. Otherwise we missing connections to zones when propogating changed items that are then marked as not dirty. Fixes: lp:1777993 * https://bugs.launchpad.net/kicad/+bug/1777993
This commit is contained in:
parent
f634b75652
commit
cf04d341ec
|
@ -345,8 +345,12 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
|
||||||
|
|
||||||
if( m_itemList.IsDirty() )
|
if( m_itemList.IsDirty() )
|
||||||
{
|
{
|
||||||
for( auto item : m_itemList )
|
#ifdef USE_OPENMP
|
||||||
|
#pragma omp parallel for schedule(dynamic)
|
||||||
|
#endif
|
||||||
|
for( int i = 0; i < m_itemList.Size(); i++ )
|
||||||
{
|
{
|
||||||
|
auto item = m_itemList[i];
|
||||||
if( item->Dirty() )
|
if( item->Dirty() )
|
||||||
{
|
{
|
||||||
CN_VISITOR visitor( item, &cnListLock );
|
CN_VISITOR visitor( item, &cnListLock );
|
||||||
|
@ -370,44 +374,25 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_OPENMP
|
#ifdef USE_OPENMP
|
||||||
// launch at least two threads, one to compute, second to update UI
|
#pragma omp parallel for schedule(dynamic)
|
||||||
#pragma omp parallel num_threads( std::max( omp_get_num_procs(), 2 ) )
|
|
||||||
#endif
|
#endif
|
||||||
|
for(int i = 0; i < m_zoneList.Size(); i++ )
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENMP
|
auto item = m_zoneList[i];
|
||||||
#pragma omp master
|
auto zoneItem = static_cast<CN_ZONE *> (item);
|
||||||
if (m_progressReporter)
|
|
||||||
{
|
|
||||||
m_progressReporter->KeepRefreshing( true );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_OPENMP
|
if( zoneItem->Dirty() )
|
||||||
#pragma omp for schedule(dynamic)
|
|
||||||
#endif
|
|
||||||
for(int i = 0; i < m_zoneList.Size(); i++ )
|
|
||||||
{
|
{
|
||||||
auto item = m_zoneList[i];
|
CN_VISITOR visitor( item, &cnListLock );
|
||||||
auto zoneItem = static_cast<CN_ZONE *> (item);
|
m_itemList.FindNearby( item, visitor );
|
||||||
|
m_zoneList.FindNearby( item, visitor );
|
||||||
if( zoneItem->Dirty() )
|
|
||||||
{
|
|
||||||
CN_VISITOR visitor( item, &cnListLock );
|
|
||||||
m_itemList.FindNearby( item, visitor );
|
|
||||||
m_zoneList.FindNearby( item, visitor );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_progressReporter)
|
|
||||||
{
|
|
||||||
m_progressReporter->AdvanceProgress();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_zoneList.ClearDirtyFlags();
|
m_zoneList.ClearDirtyFlags();
|
||||||
|
m_itemList.ClearDirtyFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_itemList.ClearDirtyFlags();
|
|
||||||
|
|
||||||
#ifdef CONNECTIVITY_DEBUG
|
#ifdef CONNECTIVITY_DEBUG
|
||||||
printf("Search end\n");
|
printf("Search end\n");
|
||||||
|
|
Loading…
Reference in New Issue