Removes some unneeded calculations and threads the remaining.
Threading was previously removed to avoid overhead issues with small
boards. This is no longer needed with the thread pool implementation
Fixes https://gitlab.com/kicad/code/kicad/issues/12131
1) Move a bunch of std::map's to std::unordered_map to get constant-time
look-ups
2) Lengthen progress-reporting intervals to spend more time doing work
and less time talking about it
3) Reverse order of SHAPE_LINE_CHAINs in thermal intersection checks to
make (much) better use of bbox caches
4) Don't re-generate bboxes we already have
5) Fix some autos that weren't by reference (and were therefore copying
large datasets)
6) Rename delta progressDelta so it's easier to search for in future
7) Get rid of a few more autos (because I don't like them)
8) Pass large items to lambdas by reference
Fixes https://gitlab.com/kicad/code/kicad/issues/12130
Thread pools are long-lasting executors that have close to zero overhead
when launching new jobs. This is advantageous over creating new threads
as we can use this for threading smalling jobs and smaller quanta. It
also avoids the heuristics needed to determine the optimal number of
threads to spawn
When building the connectivity database, we should not be using the
connectivity to check for shapes.
To make this deterministic, we introduce two flags (ALWAYS_FLASH and
NEVER_FLASH) that are used with connectivity building to determine
whether a pad is flashed for connectivity or not. ZONE <-> PAD/VIA
connectivity will be checked with ALWAYS_FLASHED and all other
connectivity will be checked with NEVER_FLASHED if they are marked for
potential annular ring removal. If they are not marked for removal,
they will be checked ALWAYS_FLASHED.
Fixes https://gitlab.com/kicad/code/kicad/issues/11114
1) Drop tiny islands which might cause connection problems.
2) Cleanup some dead code in filler
3) Don't estabilish a connection to an island that is fully covered
by whatever its connecting to.
Fixes https://gitlab.com/kicad/code/kicad/issues/11036
1) Generate SHAPE_POLY_SET triangulation by outline so they can be
shared between connectivity system and other clients.
2) Don't add items to connectivity when reading board; we're going
to do a total rebuild anyway.
3) Use multithreading when caching triangulation.
When we reset m_connAlgo, we need to lock the data mutex otherwise,
yields to the system may sometimes issue calls back to invalid data
until m_connAlgo has finished rebuilding
Fixes https://gitlab.com/kicad/code/kicad/issues/9922
Some tools move only preview items while keeping the real items
hidden. Those tools must use this new offset parameter.
Other tools move the real items. Those tools can ignore this
parameter (which will default to {0,0}).
Fixes https://gitlab.com/kicad/code/kicad/issues/9391
1) Implement more robust connection checking so we don't decide very
short segments with both endpoints within a single track are connected
at both ends.
2) Make use of the IS_DELETED flag to perform iteration during dryRun
so that all deletions to be made are flagged.
Fixes https://gitlab.com/kicad/code/kicad/issues/8883
They don't define a KiCad string class, so the header file name was
somewhat misleading. But the fact that they didn't match definitely
made coding more difficult.
This was leaking windows headers and partial wx headers to 1084 compilation units......
This also means math/util.h is leaking to 1084 compilation units which seems a bit high too.
Use the connecting straight tracks even if not exactly parallel - allow
an error margin configurable in ADVANCED_CFG (default 1 degree). Also
be less strict about end point matching and use the width of the track
as the criteria to determine suitability.
Finally, delete any short lengths of track at the end of the operation
and amend the arc end points to keep connectivity.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7967
CHANGED: when pad net assignments are changed in a conflicting way (i.e.,
tracks exist that short out more than one net after the change,
track nets will be updated to the net with the most pads).
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7929
Two issues found with the locking system used to prevent access to
stale connectivity data during the zone fill process:
1) a std::mutex has undefined behavior if you try to use it to guard
against access from the same thread. Because of the use of wx event
loops (and coroutines) it is entirely possible, and in some situations
inevitable, that the same thread will try to redraw the ratsnest in the
middle of zone refilling.
2) The mutex was only guarding the ZONE_FILLER::Fill method, but the callers
of that method also do connectivity updates as part of the COMMIT::Push.
Redrawing the ratsnest after the Fill but before the Push will result in
stale connectivity pointers to zone filled areas.
Fixed (1) by switching to a trivial spinlock implementation. Spinlocks would
generally not be desirable if the contention for the connectivity data crossed
thread boundaries, but at the moment I believe it's guaranteed that the reads
and writes to connectivity that are guarded by this lock happen from the main
UI thread. The writes are also quite rare compared to reads, and reads are
generally fast, so I'm not really worried about the UI thread spinning for any
real amount of time.
Fixed (2) by moving the locking location up to the call sites of
ZONE_FILLER::Fill.
This issue was quite difficult to reproduce, but I found a fairly reliable way:
It only happens (for me) on Windows, MSYS2 build, with wxWidgets 3.0
It also only happens if I restrict PcbNew to use 2 CPU cores.
With those conditions, I can reproduce the issue described in #6471 by
repeatedly editing a zone properties and changing its net. The crash is
especially easy to trigger if you press some keys (such as 'e' for edit)
while the progress dialog is displayed. It's easiest to do this in a debug
build as the slower KiCad is running, the bigger the window is to trigger this
bug.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6471
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7048
Commit 6ffb721 detects vias connected on only one layer.
But the DRC diag (marker position and error message) were not correctly initialized
for this new test.
CHANGED: manually-placed (stitching) vias won't have their nets automatically updated
(unless the via is placed directly on a track segment)
CHANGED: stitching vias can be placed on footprint pads and pick up their nets
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5484
- Fix the function so it actually returns the connected items (previously it was returning aItem every time)
- Make the function const
- Rename the function so that it is not confused with the other function of the same name
- Add doxygen comments for the function