Commit Graph

236 Commits

Author SHA1 Message Date
Jeff Young 7f8e397dfb Behave (or assert) when source or target are null or dirty. 2023-11-01 17:11:42 +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
Jeff Young 62d959ed0e Don't assume an error location for PAD::GetEffectivePolygon().
While ERROR_INSIDE was good for plotting, 3D generation, etc., it's
not good for generating router hulls.

Also reverts part of the change to always use polygons for PNS::SOLIDs.  A single shape in a SHAPE_COMPOUND will be faster (and
more accurate).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14898
2023-10-13 13:59:26 +01: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
Mike Williams 9079df85fd PCB: check ratsnest for nullptr (segfaults) 2023-08-24 10:51:34 -04:00
Jeff Young 55a7b9e6bf More consistent naming.
(Also better differentiates the PCBEXPR_ classes from PCB_
objects.)
2023-08-21 15:26:33 +01: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 fb40c202a1 Refine track dangling test.
Turns out Clean Up Tracks and Vias wants a different answer from DRC.
2023-06-17 22:56:57 +01:00
Jeff Young 4e3730f653 Track not dangling if entirely covered by pad.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14211
2023-06-17 21:13:30 +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 8b1fd62d35 Make pad & via teardrops 1st-class citizens (props of the pad/via)
Change teardrop generation to rely more heavily on BOARD_CONNECTIVITY
for improved performance.

Add updating of teardrops on BOARD_COMMIT::Push().

Also converts m_CopperItemRTreeCache to std::shared_ptr.
We don't copy it around anyway, and having to create a new set
of std::unique_ptr's for each operation is likely to be more
expensive than std::shared_ptr's overhead.
2023-05-19 18:02:03 +01:00
Marek Roszko 3bf2fb2c0e Fix more C5266 warnings 2023-05-18 22:08:50 -04:00
Jeff Young 0eac5c6748 Tighten lifecycle management of CN_ANCHOR/CN_ITEM.
In particular, when a CN_ITEM is freed set all its anchor's
item pointers to NULL.  (The anchors have a separate
lifecycle due to being std::shared_ptrs.)

Hopefully fixes Sentry KICAD-KV.
2023-05-03 10:50:31 +01:00
Seth Hillbrand 990641d2eb Cleanup printf bits 2023-04-20 15:19:04 -07:00
Jeff Young b76ef8c7e2 Multi-threading safety.
(Possible fix for KICAD-74.)
2023-04-16 15:36:21 +01:00
Ian McInerney 311d5d5e26 Remove unused container header 2023-04-06 15:01:18 +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
Nimish Telang 8ea357f04d Fix Doxygen directives in numerous headers 2023-03-24 13:02:13 +00:00
Seth Hillbrand 283770fc45 Check for dirtied items in the cluster
When drawing the ratsnest, we need to be careful to avoid accessing
CONN_ITEMs that have been changed by the underlying model.  Checking for
dirty items instead of valid items will prevent us looking at data that
are out of date

Fixes https://gitlab.com/kicad/code/kicad/issues/14265
2023-03-13 16:10:39 -07:00
Jeff Young b7a3b0967b Commenting. No functional changes. 2023-03-13 18:29:55 +00:00
Seth Hillbrand 6fb9d190ac Use the common subset of nets for local update
When adding new data, we may have differing sizes of the dynamic
ratsnest and our local copy, so ensure that we are only referencing
elements that exist in both
2023-02-10 12:50:29 -08: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
Seth Hillbrand dde336ee40 Split connectivity mutex locking
Internal routines have no need for locking the mutex they already own.
While external routines that want to recalculate the Ratsnest do need an
exclusive lock before being allowed access

Fixes https://gitlab.com/kicad/code/kicad/issues/13011
2023-02-03 15:26:19 +01:00
Seth Hillbrand a0236113da Attempt fix to RATSNEST crash
We call 'RecalculateRatsnest' in multiple locations, this will
invalidate various pointers needed by VIEW::Redraw().  When this is
called through the normal connectivity routines, we have the mutex
locked to prevent conflict but we've added more locations that update
just the Ratsnest.  The std::adopt_lock should take over the existing
lock when needed

Fixes https://gitlab.com/kicad/code/kicad/issues/13011
2023-01-26 17:32:38 -08:00
Seth Hillbrand e713a3eac2 Handle cleanup safely
Make sure that the connectivity has successfully completed before
attempting to merge segments.  Also avoids reaching into the shared_ptr
if we don't need to

Fixes https://gitlab.com/kicad/code/kicad/issues/13639
2023-01-23 15:56:46 -08: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 e916b715d5 Special case for very-short tracks was killing both-ends-in-a-zone.
(And doing so randomly as if the closer endpoint to the zone center
was the one without a pad then it would get marked as good, while if
it was the other way around we'd notch 2 connections for the pad end
and none for the other end.)

Fixes https://gitlab.com/kicad/code/kicad/issues/13420
2023-01-09 13:35:54 +00:00
Seth Hillbrand 66e9d5c61c Return reference rather than copy
No need to return a const copy by default in GetItems().  The const
reference will be faster.  Thanks to @GyrosGeier for the suggestion
2022-12-16 10:52:57 -08:00
Seth Hillbrand f9a36b9c91 Update thread_pool to 3.3
Fixes an issue with `wait_for_tasks()` and adds a lower-overhead
`push_loop` helper.  We replace our usage of `parallelize_loop` with
`push_loop` as we didn't use the multi-future vector return and don't
need the extra overhead.
2022-12-02 12:01:34 -08:00
Jeff Young 19eab62516 More safety around ratsnest state.
Fixes https://gitlab.com/kicad/code/kicad/issues/13011
2022-11-30 13:00:21 +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 50089ce558 Fix errors in handling of std::shared_ptrs.
We can't reset to a pointer owned by another std::shared_ptr.
2022-11-22 13:14:00 +00:00
Jeff Young 226529235c Mostly const safety, but also performance opt. by avoiding shared_ptr overhead. 2022-11-22 12:21:30 +00:00
Jeff Young 11130bfd88 Backing out earlier fix in favour of fixing std::shared_ptr usage.
Assigning to a reference to a std::shared_ptr does not update the
reference to a different std::shared_ptr; it changes what the
std::shared_ptr points to.

Fixes https://gitlab.com/kicad/code/kicad/issues/12968
2022-11-21 21:56:17 +00:00
Jeff Young 106508f266 Split ratsnest optimization into separate parallel threads.
Fixes https://gitlab.com/kicad/code/kicad/issues/12968
2022-11-21 18:50:44 +00:00
Jeff Young 3451506d25 Slight performance improvement. 2022-10-20 18:37:48 +01:00
Jeff Young 437d2c4589 Overhaul of remove-unconnected's zone filling and drawing strategies.
1) The highest priority zone that a via/pad collides with "owns" its
connectivity state.  Once set, lower priority zones cannot change it --
and in fact, if they would have connected to it are forced not to.

2) The connectivity state goes with the zone fill state, and therefore
must be saved in the file.

3) Display of remove-unconnected's pads is no longer done in GetViewLOD()
(which isn't called for selected items), and is instead done in PCB_PAINTER.
This allows us to draw the full pad in outline mode when a via/pad is
selected which would otherwise only show the hole.

4) Note that in some cases this will still generate DRC errors -- in
particular when a via nearly collides with a higher priority zone it
won't get "owned" by that zone and may therefore have insufficient
clearance if said zone concludes it's unconnected and a subsequent
(lower priority) zone connects to it (causing it to now become flashed).

Fixes https://gitlab.com/kicad/code/kicad/issues/11299
2022-10-18 13:05:42 +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
Seth Hillbrand 87171f53c7 Speedup dynamic ratsnest
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
2022-10-04 17:06:45 -07:00
Seth Hillbrand 15d52c91e4 Clear ratsnest when removing nets
While we can keep the vector for nets, we need to ensure that the data
are cleared to prevent stale pointer access

Fixes https://gitlab.com/kicad/code/kicad/issues/12564
2022-10-03 09:33:31 -07:00
Seth Hillbrand 6d298b661a Minor speedup for some dynamic ratsnest cases 2022-10-01 13:43:57 -07:00
Jeff Young f095453d3e Optimize ratsnest line endings for zones. 2022-09-30 19:04:54 +00:00
Jeff Young d67437a2aa Move ratsnest exclusion processing to a post-pass.
Also fixes a few cases where we were unnecessarily rebuilding
connectivity more than once for an operation.
2022-09-29 17:08:49 +01:00
Alex dc07ab9df1 Replace PROF_COUNTER with PROF_TIMER in some conditional places. 2022-09-27 14:07:47 +00:00