114 Commits

Author SHA1 Message Date
Jeff Young
dc3cd81a2a Don't run connectivity on non-existant layers.
Fixes KICAD-X8V.
Fixes KICAD-VH3.
2025-08-02 22:04:53 +01:00
Jeff Young
3774d77cc7 Propagate from zone to free-via.
This must be open-coded as the CSM_PROPAGATION
algo ignores zones.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21251
2025-07-21 11:46:31 +01:00
Jeff Young
8235843d01 Don't pass large structures by value. 2025-06-09 20:09:24 +01:00
Jeff Young
9750f7690c Performance optimizations. 2025-06-05 18:01:44 +01:00
Seth Hillbrand
9d1142839a After removing items from the conn list, check valid
When cancelling, we mark elements invalid if they are removed from the
connectivity list.  Be cause when iterating through the list again.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20566
2025-04-21 11:44:30 -07:00
Jeff Young
2ca09457b0 Formatting. 2025-03-26 14:50:34 +00:00
Jon Evans
1c83f0a70b Implement jumpers for footprints
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2558
2025-03-24 22:17:46 -04:00
Jon Evans
51f56ab31c Fix inadvertent logic bug in SearchClusters
The safety changes in 3d526edc introduced a subtle
bug where aExcludeZones was not actually excluding
zones anymore because its behavior depended on the
item visited flag being set to true by a previous
call to the function.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20090
2025-03-01 10:39:35 -05:00
Jeff Young
20f40c1030 Replace GetConnectedItems() type list with an EXCLUDE_ZONES flag.
The type list kept atrophying when various new
items were added (arcs, shapes).

And god knows what the purpose of putting PCB_FOOTPRINT_T
in some of them was.  As far as I can tell a CN_ITEMs
parent can never be a footprint.

(Also moves IGNORE_NETS to a flag so that we don't
end up with two booleans and the potential to have
them out-of-order.)
2025-02-26 11:02:10 +00:00
JamesJCode
d1ba3c6402 Fix compiler warning 2025-02-09 17:27:36 +00:00
Jon Evans
3d526edc8a More thread safety for TRACKS_CLEANER
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19884
2025-02-09 09:18:18 -05:00
Jon Evans
f047b66cb8 Guard against multi-threaded access to connectivity rebuild
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19884
2025-02-08 20:27:49 -05:00
Seth Hillbrand
452e69de85 Move thread pool into true singleton
Thread pool needs to be stored in a single location for all of KiCad
otherwise each kiface will spin up its own pool of persistent threads
2025-01-09 09:03:08 -08:00
Seth Hillbrand
074e6df3bc Revert "Move thread pool to singleton class"
This reverts commit 361f61a02380881efb59b1cebfdc3e73322b3d3c.
2025-01-03 21:22:44 -08:00
Seth Hillbrand
361f61a023 Move thread pool to singleton class
Having thread pool as its own singleton in the library meant that each
kiface had its own threadpool, leading to many multiples of the threads
being started.  Placing a singleton class in PGM_BASE ensures that all
kifaces use the same thread pool.

The singleton class can be extended to provide single instance
guarantee for any element across kifaces
2025-01-03 13:51:11 -08:00
Seth Hillbrand
0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00
Seth Hillbrand
5e0abadb23 Reorganize layer numbering
F_Cu = 0
B_Cu = 2
Remaining internal copper layers are even and incrementing

Non-copper layers are odd and incrementing.

This means that we can no longer do things like:
for( PCB_LAYER_ID layer = F_Cu; layer <= B_Cu; ++layer)
Instead, we have the class LAYER_RANGE:
for( PCB_LAYER_ID layer : LAYER_RANGE( F_Cu, B_Cu) )

Similarly, gt/lt tests should not refer to the integer value of the
layer.  We have functions such as IsCopperLayer to test whether a layer
is copper or not.

When using the connectivity RTree, the third dimension is layer, so we
provide B_Cu with the special INT_MAX value, ensuring that elements
between F_Cu and B_Cu will be identified.  There is a new, special
function GetBoardLayer() for interfacing with CN_ITEMS

Similarly, PNS layers remain unchanged and sequential.  A set of
interface functions is provided to map PNS layers to Board layers and
back.  This allows the PNS_LAYER_RANGE to function as expected
2024-09-06 23:07:58 +00:00
Jeff Young
c549a214c9 Performance: don't alloc std::vector in critical areas.
For some history, see also aa2ad3b44c3e533cf00a5077db17fb0ee7e302eb
2024-06-21 19:07:46 +01:00
Jeff Young
694a7db457 Performance improvements.
Don't construct a wxString or a LSEQ when you don't
have to.  They're both more expensive than you might
think.
2024-06-12 11:06:10 +01:00
Seth Hillbrand
6e591f5f91 Don't count removed zone layers
This does 3 things:
1) Removes unused zone layers on load
2) Does not save unused zone layers
3) Removes unused zone layers from connectivity calculation

(1) Prevents existing boards from using unused zone layers for any
connectivity or rendering.  (2) Updates the contents of boards with
removed zone layers to prevent them from propagating.  (3) updates the
connectivity while running pcbnew and removing a zone layer

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17288
2024-03-11 23:38:10 +00:00
Jeff Young
fb59f83683 Clean up references in RN_NETs when garbage collecting CN_ITEMs. 2023-11-01 13:53:30 +00:00
Jeff Young
d93bb464bf When garbage collecting locally we also need to clear global references. 2023-11-01 12:47:54 +00:00
Marek Roszko
7505fd0f37 Profile can live in core 2023-09-07 07:47:01 -04:00
Marek Roszko
4d77fd48ef Shove thread_pool to core 2023-09-06 17:50:12 -04:00
Jon Evans
a77e630901 ADDED: Connectivity for graphic shapes on copper layers
Graphic shapes (excluding text) can now have nets when on
copper layers. Shapes behave like tracks in that they will
pick up nets from connected pads, and follow track opacity
settings.
2023-08-10 21:47:43 -04:00
Jeff Young
493828cc6b Eradicate a bunch of calls to dyn_cast.
Also deletes PAD::GetParent() which fails to look for parent footprint
through groups.
2023-06-25 11:10:07 +01:00
Jeff Young
7e51077992 STL is your friend... until it's not.
Operator[] was creating an empty entry in the connectivity map,
fooling us into thinking the item had already been added.

Worryingly, this bug has been in there since 2017; a recent
change in teardrops just happened to expose it.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14781
2023-05-21 17:56:43 +01:00
Jeff Young
bbd6c80507 Collapse FP_* down into their PCB_* equivalents. 2023-03-31 22:57:46 +01:00
Jeff Young
d6dd58fff9 Keep track of single-pad-islands so we can discount spokes to them. 2023-03-25 10:44:46 +00:00
Jeff Young
f2f54fe926 Improve zone-layer-connections terminology and comments.
This makes it clearer that the overrides are not inverses of each
other -- one overrides the flashing state and the other overrides
the connection state (to other zones, not to everything).

Also fixes a bug where we were failing to check the force-no-connect
for pads.
2023-02-05 17:39:42 +00:00
Jeff Young
509b39e9e4 Propagate nets within non-conflicting clusters immediately.
Fixes https://gitlab.com/kicad/code/kicad/issues/13601
2023-01-23 16:25:29 +00:00
Jeff Young
c430c88f9d Immediate update of no-net objects when they're connected to something else.
Fixes https://gitlab.com/kicad/code/kicad/issues/13601
2023-01-23 16:25:29 +00:00
Jeff Young
3cc960a872 Push nets to free pads when they're used.
Fixes https://gitlab.com/kicad/code/kicad/issues/13516

Fixes https://gitlab.com/kicad/code/kicad/issues/13517
2023-01-17 23:29:47 +00:00
Jeff Young
b42d5da07d Check keepTopBottom when determining whether or not to flash a pad/via.
Fixes https://gitlab.com/kicad/code/kicad/issues/12961
2022-11-22 18:18:43 +00:00
Jeff Young
3451506d25 Slight performance improvement. 2022-10-20 18:37:48 +01:00
Seth Hillbrand
c9f11827a7 Don't connect disparate nets
Only some elements get their nets assigned based on connectivity.  Other
elements should be keps in different clusters for connection

Fixes https://gitlab.com/kicad/code/kicad/issues/12622
2022-10-11 15:03:51 -07:00
Alex
dc07ab9df1 Replace PROF_COUNTER with PROF_TIMER in some conditional places. 2022-09-27 14:07:47 +00:00
Seth Hillbrand
26a1114e3c Avoid Yields when the results are ready
We always need to check for calculation results before yielding the
system otherwise we will delay outcomes

Fixes https://gitlab.com/kicad/code/kicad/issues/12228
2022-09-14 13:30:04 -07:00
Jeff Young
aa2ad3b44c Move KICAD_T[] to std::initializer_list<KICAD_T>. 2022-08-20 10:28:11 +01:00
Jeff Young
96f01d33c8 Performance improvements.
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
2022-08-03 11:59:42 +01:00
Seth Hillbrand
03c279ffd4 ADDED: Threadpool
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
2022-06-24 22:59:24 +00:00
Jeff Young
82ebc247b8 More performance enhancements for DRC. 2022-06-18 19:47:11 +01:00
Seth Hillbrand
442aae19d9 Separate flashing check for connectivity
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
2022-03-16 17:30:01 -07:00
Seth Hillbrand
b5c2f0d39a Remove the open array in favor of std containers
The containers allow iteration, size knowledge and lower bug surface
2022-03-03 16:03:26 -08:00
Jeff Young
ca095896cb Performance: multi-thread CN_ZONE_LAYER RTree generation. 2022-02-16 14:11:09 +00:00
Jeff Young
3b292a4941 Cleanup and code clarity. 2022-02-16 12:00:18 +00:00
Jeff Young
72a389e612 Performance: check line ends first before doing collision. 2022-02-15 19:19:03 +00:00
Jeff Young
2172810600 Performance: better sharing of zone fills. 2022-02-15 19:19:03 +00:00
Jeff Young
d8c4f2cb09 Performance improvements for zone filler. 2022-02-15 19:19:02 +00:00
Jeff Young
5c9e718407 Performance enhancements for connectivity.
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.
2022-02-15 12:20:34 +00:00