-
Notifications
You must be signed in to change notification settings - Fork 342
[BuiltConstraintSolver] Add SVD based regularization strategy #5722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fredroy
merged 20 commits into
sofa-framework:master
from
bakpaul:25_09_add_svd_based_regularization_strategy
Nov 18, 2025
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ad0a832
First working version of exploded constraint problrms. Still lots of …
bakpaul ad5fe25
Changed all problems into solvers. It makes more sense to use an inhe…
bakpaul cbeadf6
Apply changes to scenes, tests and tutorials
bakpaul ac6be24
Apply review comments
bakpaul 956c777
change ownership of d_multithreading
bakpaul 9a823b2
Add comment on do methods and changed signature to add constraint pro…
bakpaul dd1c031
Add scene check to fix and display info if GenericConstraintSolver is…
bakpaul c2d565e
Merge branch 'master' into 25_08_modularize_solving_method_in_generic…
bakpaul 30f81e4
Add SVD based null space regularization
bakpaul 2c1ac45
Change null space criteria to have one homogenized for all vectors
bakpaul 70222b1
Merge branch 'master' into 25_09_add_svd_based_regularization_strategy
bakpaul 35a3159
Add check on dynamic cast
bakpaul 62a79b0
Merge branch 'master' into 25_09_add_svd_based_regularization_strategy
bakpaul cd30d34
Clean PR
bakpaul 17f5cbe
Add two nex parameters for SVD regularization
bakpaul ffa03b4
Merge branch 'master' into 25_09_add_svd_based_regularization_strategy
hugtalbot c685446
Merge branch 'master' into 25_09_add_svd_based_regularization_strategy
fredroy a335e05
Use introduced parameters
bakpaul 309be35
Merge branch 'master' into 25_09_add_svd_based_regularization_strategy
fredroy 4d794fd
Merge branch 'master' into 25_09_add_svd_based_regularization_strategy
fredroy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
.../Constraint/Lagrangian/BilateralLagrangianConstraint_with_svd_regularization_solvable.scn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| <?xml version="1.0"?> | ||
| <!-- BilateralLagrangianConstraint example --> | ||
| <Node name="root" dt="0.001" gravity="0 0 -9.81"> | ||
| <RequiredPlugin name="Sofa.Component.AnimationLoop"/> <!-- Needed to use components [FreeMotionAnimationLoop] --> | ||
| <RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Correction"/> <!-- Needed to use components [LinearSolverConstraintCorrection] --> | ||
| <RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Model"/> <!-- Needed to use components [BilateralLagrangianConstraint] --> | ||
| <RequiredPlugin name="Sofa.Component.Constraint.Lagrangian.Solver"/> <!-- Needed to use components [GenericConstraintSolver] --> | ||
| <RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] --> | ||
| <RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [SparseLDLSolver] --> | ||
| <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] --> | ||
| <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] --> | ||
| <RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [HexahedronFEMForceField] --> | ||
| <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] --> | ||
| <RequiredPlugin name="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] --> | ||
| <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] --> | ||
|
|
||
| <VisualStyle displayFlags="showForceFields showWireFrame showBehavior" /> | ||
| <DefaultVisualManagerLoop /> | ||
| <FreeMotionAnimationLoop /> | ||
| <ProjectedGaussSeidelConstraintSolver tolerance="0.0001" maxIterations="1000" regularizationTerm="1e-3" useSVDForRegularization="true"/> | ||
|
|
||
|
|
||
| <Node name="TargetCubeExtrimities"> | ||
| <RegularGridTopology name="grid" nx="7" ny="2" nz="2" xmin="-1" xmax="1" ymin="-0.16" ymax="0.16" zmin="-0.16" zmax="0.16" /> | ||
| <MechanicalObject name="mstate" template="Vec3"/> | ||
| <BoxROI name="bottom" box="-1.1 -1.1 -1.1 -0.9 1.1 1.1" /> | ||
| <BoxROI name="top" box="0.9 -1.1 -1.1 1.1 1.1 1.1" /> | ||
| </Node> | ||
| <Node name="TargetCubeMid"> | ||
| <RegularGridTopology name="grid" nx="7" ny="2" nz="2" xmin="-1" xmax="1" ymin="-0.16" ymax="0.16" zmin="-0.16" zmax="0.16" /> | ||
| <MechanicalObject name="mstate" template="Vec3"/> | ||
| <BoxROI name="center" box="-0.1 -1.1 -1.1 0.1 1.1 1.1" drawPoints="True" drawSize="0.01"/> | ||
| </Node> | ||
| <Node name="TargetCubeMidMove"> | ||
|
|
||
| <MechanicalObject name="mstate" template="Rigid3" position="0 0 0 0 0 0 1"/> | ||
| <LinearMovementProjectiveConstraint indices="0" keyTimes="0 1 3 5 7" movements="0 0 0 0 0 0 0 1.0 0 0 0 0 0 0 1.0 0 0 0 0 -1.0 0 0 0 0 0 0 -1.0 0 0 0" /> | ||
| <Node name="Attach"> | ||
| <MechanicalObject name="mstate" template="Vec3" position=" 0 -0.16 -0.16 0 0.16 -0.16 0 -0.16 0.16 0 0.16 0.16"/> | ||
| <RigidMapping/> | ||
| </Node> | ||
| </Node> | ||
| <Node name="DeformableCube0"> | ||
|
|
||
| <VisualStyle displayFlags="showForceFields" /> | ||
| <EulerImplicitSolver name="odesolver" printLog="false" /> | ||
| <SparseLDLSolver name="linearSolver" template="CompressedRowSparseMatrixMat3x3d" /> | ||
|
|
||
| <RegularGridTopology name="grid" nx="7" ny="2" nz="2" xmin="-1" xmax="1" ymin="-0.16" ymax="0.16" zmin="-0.16" zmax="0.16" /> | ||
| <MechanicalObject name="mstate" template="Vec3" /> | ||
| <HexahedronFEMForceField poissonRatio="0.49" youngModulus="1e7"/> | ||
| <UniformMass totalMass="10" /> | ||
| <BoxROI name="bottom" box="-1.1 -1.1 -1.1 -0.9 1.1 1.1" /> | ||
| <BoxROI name="top" box="0.9 -1.1 -1.1 1.1 1.1 1.1" /> | ||
| <BoxROI name="center" box="-0.1 -1.1 -1.1 0.1 1.1 1.1" /> | ||
|
|
||
| <LinearSolverConstraintCorrection linearSolver="@linearSolver"/> | ||
| </Node> | ||
|
|
||
|
|
||
| <BilateralLagrangianConstraint template="Vec3" | ||
| object1="@DeformableCube0/mstate" first_point="@DeformableCube0/top.indices" | ||
| object2="@TargetCubeExtrimities/mstate" second_point="@TargetCubeExtrimities/top.indices" /> | ||
|
|
||
| <BilateralLagrangianConstraint template="Vec3" | ||
| object1="@DeformableCube0/mstate" first_point="@DeformableCube0/center.indices" | ||
| object2="@TargetCubeMid/mstate" second_point="@TargetCubeMid/center.indices" /> | ||
|
|
||
| <BilateralLagrangianConstraint template="Vec3" | ||
| object1="@DeformableCube0/mstate" first_point="@DeformableCube0/center.indices" | ||
| object2="@TargetCubeMidMove/Attach/mstate" second_point="0 1 2 3" /> | ||
|
|
||
| <BilateralLagrangianConstraint template="Vec3" | ||
| object1="@DeformableCube0/mstate" first_point="@DeformableCube0/bottom.indices" | ||
| object2="@TargetCubeExtrimities/mstate" second_point="@TargetCubeExtrimities/bottom.indices" /> | ||
|
|
||
|
|
||
| </Node> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.