Fix swarm-review findings: empty-layer crashes, teardrop fills, Jmag

- adaptive: skip layers with zero quadtree leaves in the connectivity
  restriction and mesh-boundary loops (IndexError on boards where a
  selected layer has no copper)
- board_io: accept ZT_TEARDROP zones as conducting copper (KiCad types
  teardrop fills ZT_TEARDROP, never ZT_COPPER, so they were dropped)
- geometry: copper_bbox uses the exact stroke bbox (centerline extrema
  + half width) instead of a 100 um chord tessellation that could
  undershoot arc/cap extrema past the raster guard margin
- solver/adaptive: reference |J| to the conduction-equivalent thickness
  sigma*rho in every branch (the uniform branch used geometric t, so AC
  plots changed scale ~rs_ratio depending on unrelated per-cell maps)
- solver/adaptive/raster: chain cells no longer show phantom sheet-face
  currents; store dl per chain link and overlay the true 1D density
  |dV|/(rho*dl) (exact at any frequency: AC scaling of link conductance
  and cross-section cancels)
- test_quadtree: compare edge lists pair-for-pair (the independent
  column sort destroyed endpoint association)
This commit is contained in:
2026-07-15 19:43:21 +07:00
parent 1c97090005
commit 0afb55216b
6 changed files with 73 additions and 27 deletions
+8 -3
View File
@@ -159,10 +159,15 @@ class Problem:
def copper_bbox(self) -> tuple[int, int, int, int]:
xs = [p.outline[:, 0] for l in self.layers for p in l.polygons]
ys = [p.outline[:, 1] for l in self.layers for p in l.polygons]
tol = 1_000.0
for seg in self.tracks:
ring = seg.outline(100_000.0) # coarse tol: bbox only
xs.append(ring[:, 0])
ys.append(ring[:, 1])
# exact stroke bbox: centerline extrema + half width (round
# caps); a chord-tessellated outline undershoots arc and cap
# extrema by up to its sagitta tolerance
pts = seg.centerline(tol)
r = seg.width_nm / 2.0 + tol
xs.append(np.array([pts[:, 0].min() - r, pts[:, 0].max() + r]))
ys.append(np.array([pts[:, 1].min() - r, pts[:, 1].max() + r]))
x = np.concatenate(xs)
y = np.concatenate(ys)
return int(x.min()), int(y.min()), int(x.max()), int(y.max())