mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-06 20:02:16 +00:00
e81a201ff8
* geom/hlr: per-curve work on worker threads, shared work limits Silhouette tracing, screen sampling, shadow cuts, classification, coverage and the crossing search (by grid rows) with crossing refinement run on worker threads through one ordered map: results go back in item order, so drawings are the same bit for bit on any number of threads. Options::threads picks the workers (0 = one per core, small views stay on the calling thread); the browser build stays serial. Placements sharing a body and a turn share one silhouette tracing. Cancellation is polled before every item and inside long ones from every worker; the first error stops the others; a panicking worker becomes HlrError::Internal instead of escaping. Ray, curve, crossing, shadow and coverage budgets are totals over all threads (shared counters; crossing pairs are counted before the search). Limits: placements and the default max_tracks are hlr::MAX_ITEMS, which is section::MAX_ITEMS (also the brep record limit); trim_samples must be 1..=4096. * docs/drawing-hlr: link the parallel-work PR * geom/hlr: clearer limits and parallel-work docs, faster thread tests docs/drawing-hlr.md now separates input limits (with the error each returns: body records fail with Invalid, not Budget) from the work budgets, names every budget's error, and states how errors and panics behave on worker threads. Code comments say the same in plainer terms. The budget and cancellation tests drop the oblique torus, and the freeform pass of the identity test compares one parallel run, which keeps the HLR suite under 4 s. * geom/hlr: poll cancellation inside long items, find spline spans by bisection Review found two items a worker could run for seconds without seeing a cancellation: tracing a body with many curved surfaces, and sampling one long spline (up to 4096 control points). Silhouette tracing now asks before each surface, screen sampling at every refinement pass, the cuts at left-out faces every 4096 chords and coverage every 65536 checks. The long spline was slow because every point and every part hull scanned all of its knot spans. de Boor evaluation now finds its span by bisection over the ordered knots, and a part's hull starts at its first piece and stops after its last: the same spans, so the same bits (checked on the fixture scenes), and a 4096-point spline edge prepares in 0.9 s instead of 2.2 s and samples in 0.23 s instead of 1.47 s. * geom/hlr: poll cancellation while forming and trimming silhouette sets Review found that forming a body's silhouette sets scanned each face's whole surface group before the first poll, quadratic in the faces on one surface (about 4e8 steps for 20 000 faces). The group scan now stops at its first supported face (groups list faces in order, so that is the same face), the loop polls every 256 faces, and trimming a traced curve asks before each face. A cancellation seen while trimming drops the partial curves, even if the callback answers false later. Output unchanged on the fixture scenes. * geom/hlr: poll cancellation per boxes met when cutting at left-out faces Review found that one chord crossing the screen boxes of very many left-out faces bisects every side without a poll (polls came only every 4096 chords). It now also polls every 1024 boxes met. The docs state the cancellation contract precisely: polls are where listed, and the work between two polls is bounded by the input limits rather than by a time. * docs/drawing-hlr: say where coverage polls cancellation * geom/hlr: body records have brep's own, larger limit now Main raised brep::MAX_ITEMS to 1 000 000 (#3093, which stores whole evaluated models), so it no longer equals section::MAX_ITEMS. hlr::MAX_ITEMS stays section's 100 000 for placements and the default curve budget; the docs and the limits test now say that a body's records are bounded separately, by brep's limit. * geom/hlr: a panicking worker stops the others; the ray budget is HLR's own A worker that panics now sets the shared stop flag while it unwinds, so the other workers end the phase early instead of finishing work the call throws away. The docs no longer compare the ray budget with the occlusion work budget of file.export_view_dxf: the two count different work. * geom/hlr: an ignored timing test, prepare and drawing timed apart hlr_timing prepares four bodies, then draws 100 differently turned placements on one thread, two workers and one worker per core, printing the total, the phase timings and the ray count. SOLIDCRAFT_BENCH_HLR sets the placement count. * geom/hlr: timing scenes for sharing and crossings; placements keep their lines when permuted hlr_timing now starts its prepare clock after the fixtures are built, adds the same grid at one turn (shared definitions against one per placement) and sixteen thin bars crossing 8x8 from above, rotates the thread order over three rounds and checks the drawings match across thread counts outside the timed part. A new test permutes three placements of one prepared box and removes one: each line keeps its own placement index, and the boxes' lines stay exact. * docs/drawing-hlr: the review's limits and fixtures in the parallel tables * geom/hlr: follow the B-rep record into solidcore-record The record, its version and its item limit now come from solidcore-record (#11496): the new tests build their bodies at `solidcore_record::brep::VERSION` and make a spline's curve with `C3::bounded`, as the other fixtures do, and the limits table gives the record's own limit, 4 000 000 items, checked by `brep::check::validate`. --------- Co-authored-by: MateuszSychXpl <151755914+MateuszSychXpl@users.noreply.github.com>