solidcore

Units / surface

surface.srf_in_volume green

Layer
30
Upstream lines
779
Functions
31
Rust module
surface::srf_in_volume

Status history

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

Source: crates/solidcore/src/surface/srf_in_volume.rs

Upstream: source/SMLib/inc/SmSrfInVolume.h, source/SMLib/src/SmSrfInVolume.cpp

Port-plan notes

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

GREEN (PR #1354, 2026-10-27 virtual Copy domain): the existing virtual Copy guard now admits a plain SmVolume head exactly when the effective result does not own it (flags0/1); flags2/3 and constructor copy flags2/3 remain rejected before the shim. All six new named cases failed at the old FFI guard before the fix; afterward each compares76-95 copied-state values plus status at zero relative error, including raw knots and a non-identity next map. Full native unit:2155 cases,2080 value passes,0 failures/deferred,max_rel_err0,75 unchanged libc++ ReadDb platform skips. Focused FFI safety matrix passes and perturbation detects6/6. Existing generated inputs retain their established copyable-head sampling domain; no kernel, native shim, protocol, tolerance or skip changes. GREEN (2026-10-27, wave 5 Clone gate): the copy constructor SmSrfInVolume(const SmSrfInVolume&) is now an explicit native comparison. New CopyCtor object op (20; ops 0-19 and 40/41 untouched) invokes the native copy constructor directly and reports the copied state plus the original-versus-copy operator==; Rust uses Surface::clone of the object moved into a Surface, not SrfInVolume::copy. Before the fix the original 15 fixtures gave 7 passes and 8 failures (owner flags 0 and 2): the native copy shares an unowned base surface and keeps the raw knot 0.5, while the derived clone fixed it up to 0.49999999399 (out[62] raw U, out[118] raw V). Replacing the derived clone with an ownership-aware Clone for SrfInVolume fixed them: an owned base surface uses the ordinary copy constructor, a borrowed one clone_exact_bounded (so the shared surface's exact basis data survives), the volume is always copied (also for owner flag 1, whose result does not own it) and the owner flag is recomputed 3/1/2/0. All 17 fixtures now pass (raw U and V with 1e-10 and 3e-9 gaps, owners 0-3, ordinary-knot controls, transform and twist chains, safe plain-volume owner 0/1 controls), all compared rather than skipped, and --perturb detected 17/17. Full unit: 2149 cases, 2074 with values, 0 failed, 0 deferred, max_rel_err 0, 75 platform skips - the runner's existing ReadDb skips (libc++ istream extraction differs from libstdc++, issue #450), none added by this work; ARM mac host numbers, canonical x86-64 CI authoritative. SrfInVolume::copy is unchanged. FFI guard: CopyCtor rejects a plain SmVolume head only when the copy constructor's result owns the volume (effective owner flag owner|copy 2 or 3; the base SmVolume::Copy returns SM_ERR without setting the output pointer, so an owner-0/1 result safely shares it); the existing Copy guard, the constructor copy-flag 2/3 rejection and the owner 0-3 input validation are unchanged. No generator, protocol, tolerance or other kernel change, and no new public API.GREEN (PR #1305, 2026-10-27): bend/unbend/twist MakeExactBSpline1stOutSurface ported (the three dispatch-gap stubs removed); Exact runs on every map kind and on a cylinder base, its result is evaluated (domain, 3 x 3 points and normals), and 412 exact_volume cases align planes and cylinders with C++-built bend/unbend/twist frames: 2536 cases, 2536 pass, 0 deferred. Previously GREEN (PR #595, 2026-10-23): canonical Linux CI run 39936301165 at dd40f3e05 (main 38b0745b3 merged) compared all 2112 cases: 2112 passed, 0 failed, 0 deferred, max_rel_err 0, with_values 2112, no_values/vacuous 0. Exact now uses the existing kernel-aware implementation and compares returned-surface presence, concrete type and full NURB data. All 2096 original input constructions retained; gen0450/gen0602/gen0608/gen1982 now compare observed results. Added 16 fixtures: 8 returned-geometry cases with rational control nets, non-unit knot domains, noncommuting transform chains and real derived planes; 8 successful-null controls. Both native regressions passed; full 260-unit differential sweep had 0 failures. That head's only CI failure was indexing in the new test helper, corrected with checked accessors in the follow-up; final-head CI remains the PR gate. No numerical port, guard, tolerance or generator changes; bend/unbend/twist exact conversion remains outside the existing transform-only FFI coverage. Historical: Shim batch 2: CO-PORTED SmVolume::Mirror / SmVolume::MirrorSimple / SmTransform::MirrorSimple / SmBSplineVolume::MirrorSimple (in no unit in units.json) -> surface::volume::p1::Volume::{mirror, mirror_simple}, geom::transform::Transform::mirror_simple, surface::b_spline_volume::BSplineVolume::mirror_simple; CreateMirrorSurface now compares the mirrored surface's state (shim + runner) and 60 fixed-seed mirror cases were added: 2096 cases, 2092 pass, 4 deferred (MakeExactBSplineOutSurfaceFrom*Space, dispatch gap), --perturb SENSITIVE 2092/2092. PARTIAL: difftest 2036 cases (2000 generated + 36 inline; B-spline and plane base surfaces; transform, plain, default and component-constructed twist, unbend and bend volume chains; every owned op), 1968 pass bit-identical, 68 deferred (surface.surface_p4 59: the base surface's STEPInversion reaches SmSurface::GlobalPointSolve once the volume inversion succeeded; surface.srf_in_volume 9: Mirror, MakeExactBSplineOutSurfaceFrom*Space), --perturb 1968/1968, 20000-seed run 19382 pass / 654 deferred / 0 failed; SmSurface::operator== wired (surface.surface_p1). B-spline volumes are not built: they evaluate to SM_ERR on both sides (no USE_VOLUMES in the reference build). Evaluate(uv, 0, 0, bOnlyUpperHalf=FALSE) succeeds as upstream (the out-of-range Duv write is skipped; the shim allocates 32 entries). STEPInversion runs SmVolume::InvEvaluatePoint/InvMapPoint (surface.volume_p2; SM_ERR when the inverse fails or has no point, upstream UB-103) through any map kind; ReadFromDB runs SmVolume::ReadFromDB on the text upstream WriteToDB writes for generated objects (about 4% of cases). Added SurfaceKind::SrfInVolume (boxed) and its arms in surface::surface::p2/p7, surface_cache p1/p2/p3, curve crv_on_surf/iso_curve, intersect::surface_tracer. Plane NURB is made on demand upstream also by const methods: the difftest dump makes it on both sides. SmVolume::Mirror and MakeExactBSplineOutSurfaceFrom{Param,In}Space are in no unit in units.json: dispatch gaps tagged surface.srf_in_volume. Wired UNPORTED(surface.srf_in_volume) SmSrfInVolume::ReadFromDB in surface::surface::p2. 31 fns; largest: SmSrfInVolume::Evaluate, SmSrfInVolume::SmSrfInVolume, SmSrfInVolume::ReadFromDB, SmSrfInVolume::STEPInversion; unit-SCC #22 (220 units); 319 upstream test entry points reach this unit Re-run with surface.surface_point_solve_p3 (PR #106): cases=2036 passed=2025 failed=0 deferred=11 max_rel_err=0.0 blocked_by=surface.srf_in_volume(9),surface.surface_p8(2). Re-run after merging PR #106 (surface.surface_point_solve_p3 wired, 2026-10-15): 2036 cases, 2025 pass, 11 deferred (surface.srf_in_volume 9, surface.surface_p8 2), 0 failed, max_rel_err 0. fix/geom-stale-stubs: SmVolume::MakeExactBSplineOutSurfaceFrom{Param,In}Space and the SmVolume/SmBSplineVolume/SmTransform MakeExactBSpline1stOutSurface ported as SrfInVolume::make_exact_b_spline_if_possible_with(k); bend/unbend/twist 1st-out-surface overrides still Unported. The runner (crates/difftest/src/units/surface_srf_in_volume.rs, OpIn::Exact) must call make_exact_b_spline_if_possible_with(&k) for the 4 deferred cases to compare. Platform note (2026-10-24, issue #450, PR #749): the read_db cases are libstdc++-dependent (upstream's ASCII reader UB-5/UB-6 + the SmBendVolume separator defect are benign only under GCC); on a non-libstdc++ C++ build (e.g. macOS libc++) they report skipped(platform) instead of running; canonical status stays green (Linux/libstdc++).

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
4,567
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: geom.object green geom.vector3d green surface.surface_p1 green surface.surface_p2 partial surface.volume_p1 green surface.volume_p2 green topology.database_io green

Soft dependencies: geom.axis2_placement green geom.extent2d green geom.vector2d green

Dependents: audit.recursion green

Soft dependents: none

Upstream functions

Upstream functionDefined atLinesRust (from the file header)
SmSrfInVolume::SmSrfInVolumeSmSrfInVolume.h:661[SrfInVolume]
SmSrfInVolume::GetNaturalUVDomainSmSrfInVolume.h:1001[SrfInVolume::natural_uv_domain], [SrfInVolume::step_uv_domain], [SrfInVolume::max_analytic_domain]
SmSrfInVolume::GetSTEPUVDomainSmSrfInVolume.h:1011[SrfInVolume::natural_uv_domain], [SrfInVolume::step_uv_domain], [SrfInVolume::max_analytic_domain]
SmSrfInVolume::GetMaxAnalyticDomainSmSrfInVolume.h:1021[SrfInVolume::natural_uv_domain], [SrfInVolume::step_uv_domain], [SrfInVolume::max_analytic_domain]
SmSrfInVolume::GetDegreeSmSrfInVolume.h:1031[SrfInVolume::degree]
SmSrfInVolume::ConvertUVFromSTEPToNURBSSmSrfInVolume.h:1142[SrfInVolume::convert_uv_from_step_to_nurbs], [SrfInVolume::convert_uv_from_nurbs_to_step]
SmSrfInVolume::ConvertUVFromNURBSToSTEPSmSrfInVolume.h:1172[SrfInVolume::convert_uv_from_step_to_nurbs], [SrfInVolume::convert_uv_from_nurbs_to_step]
SmSrfInVolume::SetContextSmSrfInVolume.h:1453
SmSrfInVolume::OwnsSurfaceSmSrfInVolume.h:1491[SrfInVolume::owns_surface], [SrfInVolume::owns_volume]
SmSrfInVolume::OwnsVolumeSmSrfInVolume.h:1501[SrfInVolume::owns_surface], [SrfInVolume::owns_volume]
SmSrfInVolume::GetClassStringSmSrfInVolume.h:3011[SrfInVolume::TYPE], [SrfInVolume::type_code], [SrfInVolume::type_string], [SrfInVolume::class_string]
SmSrfInVolume::GetTypeSmSrfInVolume.h:3011[SrfInVolume::TYPE], [SrfInVolume::type_code], [SrfInVolume::type_string], [SrfInVolume::class_string]
SmSrfInVolume::GetTypeStringSmSrfInVolume.h:3011[SrfInVolume::TYPE], [SrfInVolume::type_code], [SrfInVolume::type_string], [SrfInVolume::class_string]
SmSrfInVolume::SmSrfInVolumeSmSrfInVolume.cpp:5069[SrfInVolume]
SmSrfInVolume::SmSrfInVolumeSmSrfInVolume.cpp:12851[SrfInVolume]
SmSrfInVolume::CopySmSrfInVolume.cpp:18510[SrfInVolume::copy], Clone
SmSrfInVolume::~SmSrfInVolumeSmSrfInVolume.cpp:20211Drop (implicit)
SmSrfInVolume::operator==SmSrfInVolume.cpp:22031[SrfInVolume::approx_eq]
SmSrfInVolume::GetKnotsSmSrfInVolume.cpp:32012[SrfInVolume::knots]
SmSrfInVolume::EvaluatePointSmSrfInVolume.cpp:4959[SrfInVolume::evaluate_point]
SmSrfInVolume::EvaluateNormalSmSrfInVolume.cpp:51024[SrfInVolume::evaluate_normal]
SmSrfInVolume::EvaluateSmSrfInVolume.cpp:540305[SrfInVolume::evaluate]
SmSrfInVolume::EvaluateSimpleSmSrfInVolume.cpp:85230[SrfInVolume::evaluate_simple]
SmSrfInVolume::STEPInversionSmSrfInVolume.cpp:88849[SrfInVolume::step_inversion]
SmSrfInVolume::ReverseSmSrfInVolume.cpp:94315[SrfInVolume::reverse], [SrfInVolume::swap_uv], [SrfInVolume::trim_with_domain], [SrfInVolume::transform]
SmSrfInVolume::SplitAtSmSrfInVolume.cpp:96428[SrfInVolume::split_at]
SmSrfInVolume::SwapUVSmSrfInVolume.cpp:99817[SrfInVolume::reverse], [SrfInVolume::swap_uv], [SrfInVolume::trim_with_domain], [SrfInVolume::transform]
SmSrfInVolume::TransformSmSrfInVolume.cpp:102826[SrfInVolume::reverse], [SrfInVolume::swap_uv], [SrfInVolume::trim_with_domain], [SrfInVolume::transform]
SmSrfInVolume::TrimWithDomainSmSrfInVolume.cpp:106718[SrfInVolume::reverse], [SrfInVolume::swap_uv], [SrfInVolume::trim_with_domain], [SrfInVolume::transform]
SmSrfInVolume::ReadFromDBSmSrfInVolume.cpp:153353[SrfInVolume::read_from_db]
SmSrfInVolume::IsKindOfSmSrfInVolume.cpp:15914[SrfInVolume::is_kind_of]
Module file-header table (29 rows)
RustUpstream
[SrfInVolume]SmSrfInVolume
[SrfInVolume::new]SmSrfInVolume(SmSurface&, SmBoolean, SmVolume&, ULONG, ULONG, const SmContext*)
[SrfInVolume::copy], Clonecopy constructor, Copy
Drop (implicit)~SmSrfInVolume
[SrfInVolume::approx_eq]operator==
[SrfInVolume::TYPE], [SrfInVolume::type_code], [SrfInVolume::type_string], [SrfInVolume::class_string]GetType, GetTypeString, GetClassString (SM_COMMON)
[SrfInVolume::is_kind_of]IsKindOf
[SrfInVolume::surface], [SrfInVolume::volume], [SrfInVolume::in_param_space]GetSurface, GetVolume, GetInParamSpace
[SrfInVolume::natural_uv_domain], [SrfInVolume::step_uv_domain], [SrfInVolume::max_analytic_domain]GetNaturalUVDomain, GetSTEPUVDomain, GetMaxAnalyticDomain
[SrfInVolume::degree]GetDegree
[SrfInVolume::convert_uv_from_step_to_nurbs], [SrfInVolume::convert_uv_from_nurbs_to_step]ConvertUVFromSTEPToNURBS, ConvertUVFromNURBSToSTEP
[SrfInVolume::owns_surface], [SrfInVolume::owns_volume]OwnsSurface, OwnsVolume
[SrfInVolume::set_owner_flag], [SrfInVolume::make_owner]SetOwnerFlag, MakeOwner
[SrfInVolume::set_base_surface], [SrfInVolume::set_volume]SetBaseSurface, SetVolume
[SrfInVolume::knots]GetKnots
[SrfInVolume::evaluate]Evaluate
[SrfInVolume::evaluate_simple]EvaluateSimple
[SrfInVolume::evaluate_point]EvaluatePoint
[SrfInVolume::evaluate_normal]EvaluateNormal
[SrfInVolume::step_inversion]STEPInversion
[SrfInVolume::reverse], [SrfInVolume::swap_uv], [SrfInVolume::trim_with_domain], [SrfInVolume::transform]Reverse, SwapUV, TrimWithDomain, Transform
[SrfInVolume::split_at]SplitAt
[SrfInVolume::create_mirror_surface]CreateMirrorSurface
[SrfInVolume::make_exact_b_spline_if_possible_with]MakeExactBSplineIfPossible
make_exact_b_spline_out_surface_from_{in,param}_space (private)SmVolume::MakeExactBSplineOutSurfaceFrom{In,Param}Space
make_exact_b_spline_1st_out_surface (private)SmVolume/SmBSplineVolume/SmTransform::MakeExactBSpline1stOutSurface
transform_axis2_placement (private)SmTransform::LoadAxis2Placement, IsUnitOrthonormal
[SrfInVolume::read_from_db]ReadFromDB
[SrfInVolume::write_to_db]WriteToDB

Upstream tests reaching this unit

prog_test:my_test_extent3d, prog_test:my_test_vector2d, 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