solidcore

Units / topology

topology.brep_p2 green

Layer
47
Upstream lines
2,578
Functions
24
Rust module
topology::brep::p2

Status history

Oct 12Nov 25
  1. todo 2,443 lines
  2. partial 2,443 lines
  3. green 2,443 lines

Source: crates/solidcore/src/topology/brep/p2.rs

Upstream: source/SMLib/src/SmBrep.cpp

Port-plan notes

These notes preserve historical port measurements and limitations, not current CI results.

2026-10-28 (PR #1380, SwapUV notifications for the env-less callers): SmBrep::SwapUV / sm_SwapFaceUV take a NotifyEnv and swap each face with SmFace::SwapUV's face and surface SM_NO_PRE_EDIT / SM_NO_POST_EDIT through it; the Swap op runs under a topology change tracker on both sides (harness/cpp/shim/sc_tracked.h, topology_brep_p3::run_tracked) and compares its lists and events as tracker: GREEN topology.brep_p2 cases=1720 passed=1720 failed=0 deferred=0; disabling the surface notification fails exactly the 38 Swap cases that swap a face (16 swap_* fixtures, 22 generated). 2026-10-30 (RayFire: the B-rep cache is built over the build's own geometry owners, this runner's key_of identities, instead of crate::util::own_arena_geometry, which gave every edge curve and face surface an arena owner from its holder, unowned ones included): the RayFire cases' previous counts rested on those forced owners; to be re-measured. Rust B-rep: shim-built sources by own_builder, .smb files by the Rust reader (own_reader::brep_in_order, renumbered into the shim walk order); no C++ export or Extras on the Rust side; the shim no longer replaces analytic face surfaces and edge curves by plain B-spline copies (that existed only so the Rust import was exact). 2026-10-25 (with main merged after #866): PASS topology.brep_p2 cases=1709 passed=1709 failed=0 deferred=0, promoted to green. 2026-10-25 (MateLaminaEdgeToSurface's LiftCurve on the face's replaced surface reaches its face's cache): PARTIAL topology.brep_p2 cases=1709 passed=1708 failed=0 deferred=1 blocked_by=topology.brep_p2(1) (was 1707 / 2 with topology.face_p2(1)). UPDATE (MergeCurvesOnSurface over the B-rep itself, 2026-10-25): merge_curves_on_surface takes one adapter holding the B-rep mutably (MergeCurvesObjects: brep() + MergeIntervalBrep), classifies through a shared view and merges through MergeIntervals' mutable path; the concrete world is topology::brep::p10's MergeCurvesWorld. difftest 1709 cases, 1708 pass, 0 failed, 1 deferred (topology.face_p2); merge_plane10_line now passes. PR #637 (2026-10-23): face ChangeGeometry notification wired. difftest 1709 cases, 1673 pass, 0 failed, 36 deferred (topology.face_p2 35, topology.brep_p2 1); of the 18 former topology.face_p3 deferrals 17 pass, 1 defers on at topology.face_p2. PARTIAL (PR #149, builds on #145): difftest 1629 cases (1229 fixture: SetTolerance as smTopoTest.cpp:337/696 and smMergeTest.cpp:1728, IsManifoldSolid as smTopoTest.cpp:449, MergeCurvesOnSurface as smTopoTest.cpp:1664, the my_test_topology wire network makers, LocalCurveSector (face/edge/vertex classes plus the default SM_ERR arm for classes 100/101/105/110, unknown orientation, extrapolated intervals), Notify, MateLaminaEdgeToSurface, ReplaceSurface, RayFire, SwapUV, DeleteStaleCaches with seeded SM_OC_TRIMSRF caches and modified-face masks, and the queries on 15 upstream .smb B-reps, a wire edge and a 10x10 plane face; 400 generated, tiny/huge scales; 0 both-errored), 1290 pass, 0 fail, 339 deferred (topology.face_p3 114, query.brep 93, intersect.surface_drop_lib_p3 74: SmSurface::DropCurve behind topology.edgeuse_p3's CreateUVTrimCurve/EvaluateBinormal, topology.face_p4 38: SmFace::GetBrep behind #145's now-wired SwapUV, topology.face_p2 19, intersect.curve_class_p4 1), max_rel_err 0, --perturb SENSITIVE 1290/1290, difftest --fuzz 2000 FUZZ-PASS (rejected 462, malformed 768, ran 770, differs/crashes/panics/timeouts 0), with_values 1290 no_values 0. After merging #145 5b1b28ae (main through e1ae2640: #117 topology.edgeuse_p3, #154 topology.shell, #169, #186): the 8 own UNPORTED(topology.shell) sites (region shell-list PostInsert / Remove, IsVertexShell, the vertex shell's vertex use, the vertex / wire shell type and list head, TransferChildrenTo) and the 3 UNPORTED(topology.edgeuse_p3) sites (MateLaminaEdgeToSurface's GetOrCreateUVTrimCurve copy and trim, NormalizedEvaluate) are wired with upstream's calls; MakeEdgeTopology takes the kernel (TransferChildrenTo's mark lock), LocalCurveSector / RayFire take the B-rep mutably (#117's radial sectoring may make UV trim curves) and RayFire builds its BrepObjects from the caller's cache parts. Flips against 73113465: 228 EvaluateBinormal -> pass (Sector: status and region; of the 52 orientation-0 (SM_OT_UNKNOWN) fixtures 46 now pass, 19 before and 27 of the 32 flagged EvaluateBinormal deferrals, which reach the one site where UNKNOWN acts as SAME; the other 6 defer on DropCurve 4 / GetTolerance 2), 66 GetShells -> pass (IsSheet / IsOrientedSheet), 76 shell-list / IsVertexShell -> pass (Make*Topology; the shim and runner now output the topology read back after the op, 17-86 values per case, instead of a status alone), 74 -> intersect.surface_drop_lib_p3, 38 SwapUV -> topology.face_p4, 7 -> topology.face_p2; 0 new fails or hangs. Back-edges into this unit after the merge: topology.brep_p6's TestClosureSplitRegion Notify wired with a NotifyEnv threaded through the split API (its 6 deferrals relabel to query.brep), topology.shell's ShellRayWorld::shell_ray_sector default retagged UNPORTED(query.brep) (overseer rulings; plan/findings.md). Coverage: 262 of the 1290 passes carry no numeric content beyond a compared status code or constant output, which still counts as a value, so no_values is 0 (Notify 162: the shim output is the constant 0 until query.brep lands; MateLaminaEdgeToSurface 91: early SM_ERR, editing off or not lamina; MergeCurvesOnSurface 3: status only, generated curves take the too-short skip; SwapUV 2 on faceless B-reps; RebuildUVTrimCurves 4 on B-reps without UV curves); the queries, SetTolerance, GetMinEdgeBBoxSize, LocalCurveSector and DeleteStaleCaches compare real values. Analytic geometry other than planes/lines is normalised to B-splines by the shim; RayFire and ReplaceSurface compare no values yet (see plan/findings.md). FFI guards: MateLaminaEdgeToSurface rejects a negative extension factor (HANG-18 in plan/upstream-issues.md, the C++ never returns) and an extension distance dMaxDist*factor that is not finite (HANG-9's halving loop with an infinite distance: a mating surface whose squared distance to the edge overflows, from 1.35e154; a MateProbe shim op replays Mate's early returns (editing, lamina edge, face, lamina/seam neighbours, surface copy) and then computes upstream's dMaxDist, so a Mate that returns early is still compared, e.g. the 3 noedit fixtures with the mating plane at 1e300/-1e300/1e160; found by --fuzz 2000); a B-spline face of degree >= 2 with init_gaps set is refused when a corner control point coordinate exceeds 1e154 (HANG-28: the shared fixture's SmVertexuse::GetVertexFaceGap slows down from 1e155 and stops returning around 1e156 on v-degree-1 faces, measured with timeouts on x, y and z; found by --fuzz 2000; the first bound 2e156 was inside the slow band (review of d12f88e9); planes, degree-1 and interior control points stay compared up to 1e300, v-degree-2 and single/two-span patches are over-refused; a rational corner is bounded at 1e151 on its stored (homogeneous) and its Cartesian coordinate, measured with weights 1e-3 to 1e3 (review of f3fe6094: a stored 1e154 with weight 1e-3, a vertex at 1e157, did not return)); LocalCurveSector requires t0 != t1 (an inverted pair is swapped by SmExtent1d(t0, t1) on both sides; follow-up to bherbruck's review of 87c57c02), an integer class 100..=110 with the object kind matching only for 102/103/104, and an orientation code 0..=2 that the runner decodes exactly (0 SM_OT_UNKNOWN, 1 SAME, 2 OPPOSITE; any other code is a harness error). Back-edges wired: SetTolerance (heal.heal_data_p2 and through it heal.heal_data_p1 / heal.heal_data_p3, topology.trimming_tools; heal.heal_data_p1's SmApiHealBrep box cases now defer to primitive.api_primitives since its runner cannot build the box), IsManifoldSolid (mass.integrator, query.api_queries), SmBrep::Notify in topology::edge (topology.edge deferrals on brep_p2 5 -> 0); also wired: query::edge EvaluateBinormalStepOff -> topology::edgeuse::p2::evaluate_binormal_step_off_into (was a stale UNPORTED(topology.edgeuse_p2) stub; query.edge 178 deferrals now name topology.edgeuse_p3), and SmCurveClassification::AreCoincidentMaybe (intersect.curve_class_p7, PR #65) in MergeCurvesOnSurface. After merging topology.face_p1 (PR #148): ReplaceSurface's SmFace::SetSurface (default bDeleteCurrFace FALSE) and RemoveUVTrimCurves wired to topology::face::p1::set_surface / remove_uv_trim_curves (counts unchanged: every ReplaceSurface case defers first at SmFace::Notify, topology.face_p3); the 38 topology.face_p1 SwapUV deferrals went through sm_SwapFaceUV's SmFace::SwapUV stub in #145's topology/brep/p1.rs; #145 wired it, and they now defer on SmFace::GetBrep (topology.face_p4) inside face_p1's swap_uv. Not wired: the UNPORTED(topology.face_p2) SmFace::GetTolerance stubs in intersect/point_class.rs (generic ClassGeometry code without B-rep access; 19 deferrals here). Also wired: ProtoTopologyManager::new's tolerance fallback (SmProtoTopology.cpp:3548-3556, the UNPORTED(topology.brep_p2) SmBrep::GetMinEdgeBBoxSize stub #145 labelled in topology/proto_topology/p1/proto.rs): new() now takes each B-rep as (handle, &Brep) and a kernel, and ports GetTolerance x2, GetMinEdgeBBoxSize x2 and min(1.25*tol, 0.5*edge); the proto_topology_p1 and query.face_p2 runners pass two empty Breps like their shims, and 5 new proto_topology_p1 cases (approx_tol 0, -1e-3, -1, 1e-13, and SM_EFF_ZERO itself) compare the fallback. Only its tolerance half is compared against C++: on the two empty B-reps 1.25*(2*ZONE_TOL_3D) is always below 0.5*0.001, so the edge-size half (0.5*min edge size winning) is covered only by the unit test manager_tolerance_falls_back_to_the_breps. sm_GetPointFromSol and sm_CheckAndFixUVTrimCurves (file statics) are covered by Rust unit tests. 23 fns; largest: SmBrep::MateLaminaEdgeToSurface, SmBrep::MergeCurvesOnSurface, SmBrep::Notify, SmBrep::LocalCurveSector; cycle back-edges (call into later units; stub or co-port): query.brep(2), query.edge(2), query.face_p1(2), query.face_p2(1); unit-SCC #22 (220 units); 317 upstream test entry points reach this unit Follow-up to bherbruck's review of 87c57c02: the runner's Notify env keys every entity type in its own range (faces keep 1 + index) and holds a record for the B-rep, so all 17 SmNotifyOperations run with the B-rep as a data object (68 new fixtures); the Sector guard refuses only t0 == t1 and the runner builds the interval with Extent1d::from_min_max as the shim's swapping SmExtent1d(t0, t1) (12 inverted-interval fixtures, each with its original's outcome); ReplaceSurface's pTopFace deviation is documented. difftest 1709 cases, 1367 pass, 0 fail, 342 deferred (intersect.surface_drop_lib_p3 77), --perturb SENSITIVE 1367/1367, --fuzz 2000 FUZZ-PASS (rejected 442, malformed 767, ran 791, 0 differs/crashes/panics/timeouts); the 1629 earlier cases are unchanged. Follow-up back-edges: topology.brep_p7's 4 (Notify, SetTolerance, sm_CheckAndFixUVTrimCurves, RebuildUVTrimCurves), heal.stitch_p1's Notify, topology.brep_p10's IsManifoldSolid, sm_GetPointFromSol, GetShellVertices and MergeCurvesOnSurface are wired (MergeCurvesOnSurface through an uninhabited cache world whose constructor is UNPORTED(query.brep), the real blocker); the own UNPORTED(intersect.curve_class_p2) ConnectIntervals site calls #85's port (SER, as SmBrep.cpp:22072). No UNPORTED(topology.brep_p2) remains in the crate; brep_p2's report is unchanged (1709/1367/0/342). Re-run in PR #149 (review 5578349117 round, merged with main through fb58ea76; topology.brep_p2's UNPORTED stubs wired): difftest 1709 cases, 1437 pass, 0 fail, 272 deferred (query.brep 93, intersect.surface_drop_lib_p3 85, topology.face_p4 38, surface.surface_cache_p1 20: SmPlane::CreateIsoParametricCurve inside MateLaminaEdgeToSurface, topology.face_p2 19, topology.face_p3 16: SmFace::SetSurface's SmFace::Notify in face_p1 for every ReplaceSurface, intersect.curve_class_p2 1), max_rel_err 0. Own stubs wired into units main made partial: topology.face_p3 SetTolerance / Notify / CreateUVTrimCurves (SetTolerance 58 and Mate 12 deferrals now pass) and intersect.curve_class_p4's constructor in MergeCurvesOnSurface (now at ReSet, intersect.curve_class_p2); uv_trim_curve_copy accepts an SmLine UV curve (an SmBSplineCurve upstream). All 33 UNPORTED(topology.brep_p2) sites main had (topology.brep_p5 x11, topology.brep_p9 x6, topology.brep_p6 x2, topology.edge, topology.face_p1, topology.shell LocalCurveSector, topology.trimming_tools, topology.proto_topology_p1, heal.heal_data_p2/p3, heal.stitch_p1, query.api_queries, mass.integrator, offset.offset_geometry_creation x2, blend.hcr, blend.fillet_geom_p1) are wired, each with upstream's status handling; none remains. Re-run in PR #149 (merge with main through 39ceb995, #283): 1709 cases, 1437 pass, 0 fail, 272 deferred (unchanged); the UNPORTED(topology.brep_p2) sites #283 brought are wired (boolean.merge_p4 IsSheet / IsOrientedSheet / DeleteStaleCaches, boolean.merge_p3's component-copy Notify through ArenaNotifyState, the merge_p3 and api_brep runners), merge_p4's ArenaPair implements brep_arena and BrepGlue, and this unit's face_box calls query.face_p1 (#238); none remains in any crate. Pre-review follow-ups: RegionNotifyState keys regions by notify_ref (the heal tracker's decoder; unit test region_only_keys_decode_as_the_tracker_reads_them); --fuzz 2000 FUZZ-PASS with differs=2 (fuzz00488 / fuzz00815, the plane's global_point_solve at an origin of +/-9.2e18, plan/findings.md). With intersect.curve_class_p4's constructor wired to ReSet (wire/curve-class-p4) the MergeCurvesOnSurface fixture merge_plane10_line reaches CurveOnClassify on the face; the runner's MergeObjects resolves only the case curves (merge_curves_on_surface takes the B-rep as &mut, so no ClassGeometry adapter can lend it to topology_entity), so the case defers as topology.brep_p2 instead of the intersect.curve_class_p2 ReSet deferral (counts unchanged). Owner zone-tol cache (surface/owner-zone-tol): 1709 cases, 1494 pass, 0 fail, 215 deferred. Wired SmAdvSurfaceIntersector::FindInteriorCurves' ComputePointValues and TraceCurve (base bodies; ComputeSingularityPoint dispatches via the advanced flag): 1709 cases, 1565 pass, 144 deferred -> 1709 cases, 1567 pass, 0 failed, 142 deferred (intersect.surface_drop_lib_p3 85, topology.face_p2 34, topology.face_p3 18, geom.tol 4, topology.brep_p2 1). 2026-10-26 (PR #1159): MergeSsi op (MergeCurvesOnSurface with UV curves and pOptIntersectionSurface, curves/edges/vertices read back) and fixtures/topology.brep_p2/refine_cci.json (11 cases reaching sm_RefineCCIToSurfaces large-gap part): PASS topology.brep_p2 cases=1720 passed=1720 deferred=0.

Goldens

This is committed inventory, not a runtime result or a correctness proof. A golden records what solidcore produced when blessed. Current results require the canonical CI gate, not these counts.

Golden records
1,720
Stored error outcomes
0
Stored deferrals
0
Stored harness rejections
0
Known-failure entries
0

Metadata counts describe fields in the stored records; they are not passes or live failures.

Source at f9704ee3b: golden JSONL · known-failure list.

Dependencies

Depends on: curve.curve_p2 green geom.a_object green geom.context green geom.extent1d green geom.extent2d green geom.extent3d green geom.object green geom.solution_array green geom.tol green geom.vector3d green intersect.curve_class_p1 green intersect.point_class green nurbs.b_spline_curve_p1 green surface.offset_surface green surface.surface_p2 partial topology.brep_cache green topology.brep_p1 green topology.edge green topology.edgeuse_p1 green topology.face_p2 partial topology.face_p3 green topology.proto_topology_p1 green topology.shell green topology.topology green topology.vertex green topology.vertexuse green

Soft dependencies: curve.curve_p6 green curve.curve_p8 green geom.tree green geom.vector2d green intersect.curve_class_p2 green intersect.curve_class_p4 green intersect.curve_class_p5 green intersect.curve_class_p7 green intersect.topology_solver_p2 green nurbs.b_spline_curve_n_lib green nurbs.b_spline_curve_p2 green surface.plane_p1 partial surface.surface_p1 green surface.surface_p11 green surface.surface_p4 green topology.edgeuse_p2 green topology.edgeuse_p3 green topology.face_p1 green topology.face_p4 green

Dependents: blend.fillet_geom_p1 green blend.fillet_removal green boolean.merge_p2 green boolean.merge_p4 green mass.integrator partial offset.offset_executive_p2 partial query.brep green topology.brep_local_operation partial topology.brep_mirror green topology.brep_p3 partial

Soft dependents: blend.fillet_executive_p1 green blend.fillet_executive_p2 green blend.fillet_executive_p3 partial blend.hcr green boolean.api_brep partial boolean.merge_p3 green heal.heal_data_p2 green heal.stitch_p1 green heal.stitch_p2 green offset.offset_executive_p1 partial offset.offset_geometry_creation partial primitive.api_trim_ops partial primitive.primitive_creation_p2 green query.api_queries green sweep.topology_sweep green

Upstream functions

Upstream functionDefined atLinesRust (from the file header)
sm_CheckAndFixUVTrimCurvesSmBrep.cpp:20626[check_and_fix_uv_trim_curves]
SmBrep::RebuildUVTrimCurvesSmBrep.cpp:904033[rebuild_uv_trim_curves]
SmBrep::IsManifoldSolidSmBrep.cpp:1126824[is_manifold_solid]
SmBrep::IsSheetSmBrep.cpp:1131033[is_sheet]
SmBrep::IsOrientedSheetSmBrep.cpp:1136155[is_oriented_sheet]
SmBrep::LocalCurveSectorSmBrep.cpp:11736200[local_curve_sector]
sm_IsFirstNonseparatingSeamSmBrep.cpp:12321135
SmBrep::MakeEdgeTopologySmBrep.cpp:13914143[make_edge_topology]
SmBrep::MakeEdgeVertexTopologySmBrep.cpp:14072105[make_edge_vertex_topology]
SmBrep::MakeShellVertexTopologySmBrep.cpp:1898757[make_shell_vertex_topology]
SmBrep::MergeCurvesOnSurfaceSmBrep.cpp:22152260[merge_curves_on_surface], [MergeCurvesObjects], [MergeCurvesOptions], [MergedCurves]
SmBrep::MateLaminaEdgeToSurfaceSmBrep.cpp:22425542[mate_lamina_edge_to_surface]
sm_AddToSpatialTreeSmBrep.cpp:23903110add_to_spatial_tree (private)
sm_RmFromSpatialTreeSmBrep.cpp:24020115rm_from_spatial_tree (private)
SmBrep::NotifySmBrep.cpp:24147202[notify], [NotifyArg], [brep_ref]
SmBrep::SwapUVSmBrep.cpp:2435626[swap_uv]
sm_GetPointFromSolSmBrep.cpp:2520159[point_from_solution]
SmBrep::RayFireSmBrep.cpp:25585144[ray_fire], [RayFireResult]
SmBrep::ReplaceSurfaceSmBrep.cpp:2657398[replace_surface], [OldSurface]
SmBrep::SetToleranceSmBrep.cpp:2671395[set_tolerance]
SmBrep::DeleteStaleCachesSmBrep.cpp:3793039[delete_stale_caches]
SmBrep::GetMinEdgeBBoxSizeSmBrep.cpp:3829735[min_edge_bbox_size]
SmBrep::GetEdgeusesSmBrep.cpp:3836721[edgeuses]
SmBrep::GetShellVerticesSmBrep.cpp:3854121[shell_vertices]
Module file-header table (27 rows)
RustUpstream
[edgeuses]SmBrep::GetEdgeuses
[shell_vertices]SmBrep::GetShellVertices
[is_manifold_solid]SmBrep::IsManifoldSolid
[is_sheet]SmBrep::IsSheet
[is_oriented_sheet]SmBrep::IsOrientedSheet
[min_edge_bbox_size]SmBrep::GetMinEdgeBBoxSize
[set_tolerance]SmBrep::SetTolerance (SM_USE_OLDTOL)
[rebuild_uv_trim_curves]SmBrep::RebuildUVTrimCurves
[create_missing_uv_trim_curves](not upstream) the kernel's own UV trim curve for every edge use on a face that holds none
[check_and_fix_uv_trim_curves]sm_CheckAndFixUVTrimCurves (file static)
[swap_uv]SmBrep::SwapUV
[notify], [NotifyArg], [brep_ref]SmBrep::Notify
[RegionNotifyState], [region_only_key](port helper) the notify state of a caller without attribute state
[ArenaNotifyState](port helper) the notify state of an arena-only caller (every object's record)
add_to_spatial_tree (private)sm_AddToSpatialTree
rm_from_spatial_tree (private)sm_RmFromSpatialTree
[delete_stale_caches]SmBrep::DeleteStaleCaches
[point_from_solution]sm_GetPointFromSol (file static)
[local_curve_sector]SmBrep::LocalCurveSector
[ray_fire], [RayFireResult]SmBrep::RayFire
[replace_surface], [OldSurface]SmBrep::ReplaceSurface
[replace_curve]SmBrep::ReplaceCurve
[make_shell_vertex_topology]SmBrep::MakeShellVertexTopology
[make_edge_vertex_topology]SmBrep::MakeEdgeVertexTopology
[make_edge_topology]SmBrep::MakeEdgeTopology
[merge_curves_on_surface], [MergeCurvesObjects], [MergeCurvesOptions], [MergedCurves]SmBrep::MergeCurvesOnSurface
[mate_lamina_edge_to_surface]SmBrep::MateLaminaEdgeToSurface

Upstream tests reaching this unit

prog_test:my_test_surface_closest_point, prog_test:my_test_drop_point, prog_test:my_test_matrix, prog_test:my_test_reversed_line_join, SM_API_test:TestSmCreateRectangle, SM_API_test:TestSmCreateRegularPolygon