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() )
|
||||
{
|
||||
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() )
|
||||
{
|
||||
CN_VISITOR visitor( item, &cnListLock );
|
||||
|
@ -370,44 +374,25 @@ void CN_CONNECTIVITY_ALGO::searchConnections( bool aIncludeZones )
|
|||
}
|
||||
|
||||
#ifdef USE_OPENMP
|
||||
// launch at least two threads, one to compute, second to update UI
|
||||
#pragma omp parallel num_threads( std::max( omp_get_num_procs(), 2 ) )
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
#endif
|
||||
for(int i = 0; i < m_zoneList.Size(); i++ )
|
||||
{
|
||||
#ifdef USE_OPENMP
|
||||
#pragma omp master
|
||||
if (m_progressReporter)
|
||||
{
|
||||
m_progressReporter->KeepRefreshing( true );
|
||||
}
|
||||
#endif
|
||||
auto item = m_zoneList[i];
|
||||
auto zoneItem = static_cast<CN_ZONE *> (item);
|
||||
|
||||
#ifdef USE_OPENMP
|
||||
#pragma omp for schedule(dynamic)
|
||||
#endif
|
||||
for(int i = 0; i < m_zoneList.Size(); i++ )
|
||||
if( zoneItem->Dirty() )
|
||||
{
|
||||
auto item = m_zoneList[i];
|
||||
auto zoneItem = static_cast<CN_ZONE *> (item);
|
||||
|
||||
if( zoneItem->Dirty() )
|
||||
{
|
||||
CN_VISITOR visitor( item, &cnListLock );
|
||||
m_itemList.FindNearby( item, visitor );
|
||||
m_zoneList.FindNearby( item, visitor );
|
||||
}
|
||||
|
||||
if (m_progressReporter)
|
||||
{
|
||||
m_progressReporter->AdvanceProgress();
|
||||
}
|
||||
CN_VISITOR visitor( item, &cnListLock );
|
||||
m_itemList.FindNearby( item, visitor );
|
||||
m_zoneList.FindNearby( item, visitor );
|
||||
}
|
||||
}
|
||||
|
||||
m_zoneList.ClearDirtyFlags();
|
||||
m_itemList.ClearDirtyFlags();
|
||||
}
|
||||
|
||||
m_itemList.ClearDirtyFlags();
|
||||
|
||||
#ifdef CONNECTIVITY_DEBUG
|
||||
printf("Search end\n");
|
||||
|
|
Loading…
Reference in New Issue