feat(solver): Phase 1a — IKCSolver C++ API types and interface #292
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Define the pluggable solver C++ API as header files. No integration changes — this is the contract that everything else builds against.
Parent: #287 (Phase 1)
Blocks: #293 (1b), #294 (1c), #295 (1d)
Scope
Directory structure
Types.h — Core data types
BaseJointKind enum (22 decomposed types):
These are decomposed from FreeCAD's current 13
JointTypevalues. In particular, the currentDistancetype smart-dispatches to 35+ geometry subtypes — those map to the decomposed types above (Coincident, PointOnLine, PointInPlane, Planar, Concentric, etc.). Each solver sees the specific constraint type rather than being forced to implement geometry dispatch.Structs:
JointTypeId—{solver_id, joint_name}JointDef— solver-registered joint descriptor (base_kind, display_name, dof_removed, params, supports_limits, supports_friction)Constraint— instance with part refs, geometry refs, param values, suppressed flagSolveContext— full problem definition:bundle_fixedhint (default true — solver may override)SolveResult— output:SolveStatusenum — Converged, MaxIterationsReached, Overconstrained, Underconstrained, Redundant, FailedConstraintDiagnostic— per-constraint residual, satisfied flag, messageIKCSolver.h — Solver interface
Key design decisions:
run_kinematic()+num_frames()+update_for_frame()allow solvers to own the simulation lifecyclesupports_bundle_fixed()— solver declares whether it handles fixed-joint bundling internally. If false, AssemblyObject does the bundling before building SolveContext. If true, the solver receives unbundled parts and optimizes itselfsolve(), so a minimal solver only needs to implementsolve()+supported_joints()SolverRegistry.h — Plugin discovery and lookup
CMakeLists.txt
Header-only INTERFACE target so other modules can
target_link_libraries(Assembly KCSolve)to get the include paths. Actual implementation comes in 1b.Acceptance criteria
BaseJointKindcovers all 22 decomposed types from the spec + geometry analysisIKCSolverinterface has solve, drag, simulation, and diagnostic methodssolve()SolveContextincludesbundle_fixedhint for solver-controlled optimizationReferences
docs/INTER_SOLVER.md§4 (Layer 1: C++ Solver API)src/Mod/Assembly/App/AssemblyUtils.h— current 13 JointType + 35 DistanceTypesrc/Mod/Assembly/App/AssemblyObject.cpp— current 6 solver call patterns