feat(analysis): structural analyzer with DOF counting and sparsity checks #25
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
Implement
structural_analyzer.py— pre-solve structural diagnostics that detect overconstrained, underconstrained, and redundant constraints using purely graph-based analysis, before any numerical solving occurs.Context
This is the single biggest improvement over both OndselSolver and FreeCAD's PlaneGCS: per-constraint attribution of structural problems before N-R ever runs. Users currently get cryptic "solve failed" messages with no indication of which constraint is problematic. The structural analyzer provides actionable diagnostics mapped directly to
ConstraintDiagnosticfrom the KCSolve API.The analyzer uses sparsity counting on the body-bar-hinge constraint graph. For the (6,6)-sparsity condition (Tay's theorem), a subgraph with V vertices and E weighted edges is:
Depends on: #24 (constraint graph builder)
Design
Analysis pipeline
ConstraintGraph.dof_balance(). If negative → overconstrained. If positive → underconstrained. If zero → potentially well-constrained.structural_rank()on the constraint Jacobian pattern matrix as a fast proxyConstraintDiagnostic:Kind.Conflictingon the excess constraintsKind.RedundantKind.MalformedAPI
Pebble game implementation
The (6,6)-pebble game for body-bar-hinge rigidity:
dof_removedpebbles from the two endpoint nodesConsider using TRAMbio's (k,l)-pebble game as a reference implementation, or implement a focused version for (6,6)-sparsity.
Tasks
StructuralAnalyzerclassConstraintDiagnosticinstancestests/decomposition/test_analyzer.py:Acceptance criteria
diagnose()returns correctConstraintDiagnosticlist for all test fixtures