From ccad128ba217ce8f81ba1863153768db62a0a65a Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Tue, 26 Aug 2025 16:05:57 +0200 Subject: [PATCH] Apply changes from SOFA PR 5666 regarding GenericConstraintSolver --- examples/bouncingBall/softSphereFalling.py | 2 +- examples/bouncingBall/softSphereFalling_reduced.py | 2 +- examples/others/SphereOnAPlane/softSphereFalling.pyscn | 8 ++++---- examples/others/caduceus/caduceusNG.pyscn | 2 +- examples/others/caduceus/reduced/reduced_caduceusNG.py | 2 +- examples/others/hexaBeam/hexaBeam.pyscn | 2 +- examples/softRobots/diamond/diamondRobot.py | 2 +- examples/softRobots/diamond/diamondRobotHyperElastic.py | 2 +- examples/softRobots/finger/finger.pyscn | 2 +- examples/softRobots/multiGait/multiGait.py | 2 +- .../softRobots/multiGait/reducedMultiGait-softRobot.pyscn | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/bouncingBall/softSphereFalling.py b/examples/bouncingBall/softSphereFalling.py index 8b34cb85..58c84ef8 100644 --- a/examples/bouncingBall/softSphereFalling.py +++ b/examples/bouncingBall/softSphereFalling.py @@ -34,7 +34,7 @@ def createScene(rootNode): rootNode.gravity=[0,-9810, 0] rootNode.dt = 0.0001 rootNode.addObject('FreeMotionAnimationLoop') - rootNode.addObject('GenericConstraintSolver', name='GSSolver', maxIterations='10000', tolerance='1e-15') + rootNode.addObject('ProjectedGaussSeidelConstraintSolver', name='GSSolver', maxIterations='10000', tolerance='1e-15') rootNode.addObject('CollisionPipeline', verbose='0') rootNode.addObject('BruteForceBroadPhase', name='N2') rootNode.addObject('BVHNarrowPhase') diff --git a/examples/bouncingBall/softSphereFalling_reduced.py b/examples/bouncingBall/softSphereFalling_reduced.py index 8fd932e1..27aa98e1 100644 --- a/examples/bouncingBall/softSphereFalling_reduced.py +++ b/examples/bouncingBall/softSphereFalling_reduced.py @@ -38,7 +38,7 @@ def createScene(rootNode): rootNode.gravity=[0,-9810, 0] rootNode.dt = 0.0001 rootNode.addObject('FreeMotionAnimationLoop') - rootNode.addObject('GenericConstraintSolver', name='GSSolver', maxIterations='10000', tolerance='1e-15') + rootNode.addObject('ProjectedGaussSeidelConstraintSolver', name='GSSolver', maxIterations='10000', tolerance='1e-15') rootNode.addObject('CollisionPipeline', verbose="0") rootNode.addObject('BruteForceBroadPhase', name="N2") rootNode.addObject('BVHNarrowPhase') diff --git a/examples/others/SphereOnAPlane/softSphereFalling.pyscn b/examples/others/SphereOnAPlane/softSphereFalling.pyscn index 0ae734fd..255d9517 100644 --- a/examples/others/SphereOnAPlane/softSphereFalling.pyscn +++ b/examples/others/SphereOnAPlane/softSphereFalling.pyscn @@ -32,12 +32,12 @@ def createScene(rootNode): lambdaCoeffs = "lambdaCoeffsSphereFine6.txt" rootNode.addObject('FreeMotionAnimationLoop') - #rootNode.addObject('GenericConstraintSolver', printLog=True, tolerance="1e-6", maxIterations="500", storeLambdas=True) + #rootNode.addObject('ProjectedGaussSeidelConstraintSolver', printLog=True, tolerance="1e-6", maxIterations="500", storeLambdas=True) if reductionOn: - rootNode.addObject('GenericConstraintSolver', name='GSSolver', maxIterations='10000', tolerance='1e-15') + rootNode.addObject('ProjectedGaussSeidelConstraintSolver', name='GSSolver', maxIterations='10000', tolerance='1e-15') else: - #rootNode.addObject('GenericConstraintSolver', name='GSSolver', maxIterations='10000', tolerance='1e-15',storeLambdas=True, lambdaPath="lambdaStored.txt",computeConstraintForces=True) - rootNode.addObject('GenericConstraintSolver', name='GSSolver', maxIterations='10000', tolerance='1e-15',computeConstraintForces=True) + #rootNode.addObject('ProjectedGaussSeidelConstraintSolver', name='GSSolver', maxIterations='10000', tolerance='1e-15',storeLambdas=True, lambdaPath="lambdaStored.txt",computeConstraintForces=True) + rootNode.addObject('ProjectedGaussSeidelConstraintSolver', name='GSSolver', maxIterations='10000', tolerance='1e-15',computeConstraintForces=True) rootNode.addObject('PythonScriptController', filename="lambdaDumper.py", classname="storeLambda", variables="Zetest.txt") diff --git a/examples/others/caduceus/caduceusNG.pyscn b/examples/others/caduceus/caduceusNG.pyscn index 0d49f7f3..3f396923 100644 --- a/examples/others/caduceus/caduceusNG.pyscn +++ b/examples/others/caduceus/caduceusNG.pyscn @@ -34,7 +34,7 @@ def createScene(rootNode): rootNode.addObject('FreeMotionAnimationLoop') - rootNode.addObject('GenericConstraintSolver', printLog='0', tolerance="1e-6", maxIterations="500") + rootNode.addObject('ProjectedGaussSeidelConstraintSolver', printLog='0', tolerance="1e-6", maxIterations="500") rootNode.addObject('CollisionPipeline', verbose="0") rootNode.addObject('BruteForceBroadPhase', name="N2") rootNode.addObject('BVHNarrowPhase') diff --git a/examples/others/caduceus/reduced/reduced_caduceusNG.py b/examples/others/caduceus/reduced/reduced_caduceusNG.py index 3d4be060..41405e4b 100644 --- a/examples/others/caduceus/reduced/reduced_caduceusNG.py +++ b/examples/others/caduceus/reduced/reduced_caduceusNG.py @@ -150,7 +150,7 @@ def createScene(rootNode): rootNode.VisualStyle.displayFlags="showForceFields" rootNode.addObject('FreeMotionAnimationLoop') - rootNode.addObject('GenericConstraintSolver', printLog='0', tolerance="1e-6", maxIterations="500") + rootNode.addObject('ProjectedGaussSeidelConstraintSolver', printLog='0', tolerance="1e-6", maxIterations="500") rootNode.addObject('CollisionPipeline', verbose="0") rootNode.addObject('BruteForceBroadPhase', name="N2") rootNode.addObject('BVHNarrowPhase') diff --git a/examples/others/hexaBeam/hexaBeam.pyscn b/examples/others/hexaBeam/hexaBeam.pyscn index e4d89cb2..c2570331 100644 --- a/examples/others/hexaBeam/hexaBeam.pyscn +++ b/examples/others/hexaBeam/hexaBeam.pyscn @@ -25,7 +25,7 @@ def createScene(rootNode): rootNode.addObject('RequiredPlugin', name='Sofa.Component.Visual') # Needed to use components [VisualStyle] rootNode.addObject('FreeMotionAnimationLoop') - rootNode.addObject('GenericConstraintSolver', tolerance="1e-12", maxIterations="10000") + rootNode.addObject('ProjectedGaussSeidelConstraintSolver', tolerance="1e-12", maxIterations="10000") M1 = rootNode.addChild("M1") diff --git a/examples/softRobots/diamond/diamondRobot.py b/examples/softRobots/diamond/diamondRobot.py index 659cd1f7..66897e56 100644 --- a/examples/softRobots/diamond/diamondRobot.py +++ b/examples/softRobots/diamond/diamondRobot.py @@ -55,7 +55,7 @@ def createScene(rootNode): rootNode.addObject('RequiredPlugin', pluginName=plugins, printLog=False) rootNode.addObject('FreeMotionAnimationLoop') - rootNode.addObject('GenericConstraintSolver', tolerance="1e-6", maxIterations="1000") + rootNode.addObject('ProjectedGaussSeidelConstraintSolver', tolerance="1e-6", maxIterations="1000") rootNode.addObject('OglSceneFrame', style="Arrows", alignment="TopRight") rootNode.addObject('VisualStyle', displayFlags='showVisualModels showForceFields') diff --git a/examples/softRobots/diamond/diamondRobotHyperElastic.py b/examples/softRobots/diamond/diamondRobotHyperElastic.py index 76fbcccf..178e230d 100644 --- a/examples/softRobots/diamond/diamondRobotHyperElastic.py +++ b/examples/softRobots/diamond/diamondRobotHyperElastic.py @@ -64,7 +64,7 @@ def createScene(rootNode): rootNode.addObject('OglSceneFrame', style="Arrows", alignment="TopRight") rootNode.addObject('FreeMotionAnimationLoop') - rootNode.addObject('GenericConstraintSolver', tolerance="1e-6", maxIterations="1000") + rootNode.addObject('ProjectedGaussSeidelConstraintSolver', tolerance="1e-6", maxIterations="1000") modelNode = rootNode.addChild('modelNode') modelNode.addObject('EulerImplicitSolver', rayleighStiffness='0.1', rayleighMass='0.1') diff --git a/examples/softRobots/finger/finger.pyscn b/examples/softRobots/finger/finger.pyscn index e3ffe3a4..2486624e 100644 --- a/examples/softRobots/finger/finger.pyscn +++ b/examples/softRobots/finger/finger.pyscn @@ -35,7 +35,7 @@ def createScene(rootNode): scene.VisualStyle.displayFlags='showBehavior' rootNode.addObject("FreeMotionAnimationLoop") - rootNode.addObject("GenericConstraintSolver", maxIterations=1000, tolerance=0.001) + rootNode.addObject("ProjectedGaussSeidelConstraintSolver", maxIterations=1000, tolerance=0.001) #finger = ElasticMaterialObject(name="finger", #volumeMeshFileName="mesh/finger.vtk", diff --git a/examples/softRobots/multiGait/multiGait.py b/examples/softRobots/multiGait/multiGait.py index 334385bf..4697e04f 100644 --- a/examples/softRobots/multiGait/multiGait.py +++ b/examples/softRobots/multiGait/multiGait.py @@ -41,7 +41,7 @@ def createScene(rootNode): rootNode.addObject('FreeMotionAnimationLoop') rootNode.addObject('EulerImplicitSolver', name='odesolver', firstOrder="false", rayleighStiffness='0.1', rayleighMass='0.1') - rootNode.addObject('GenericConstraintSolver', printLog='0', tolerance="1e-15", maxIterations="5000") + rootNode.addObject('ProjectedGaussSeidelConstraintSolver', printLog='0', tolerance="1e-15", maxIterations="5000") rootNode.addObject('CollisionPipeline', verbose="0") rootNode.addObject('BruteForceBroadPhase', name="N2") rootNode.addObject('BVHNarrowPhase') diff --git a/examples/softRobots/multiGait/reducedMultiGait-softRobot.pyscn b/examples/softRobots/multiGait/reducedMultiGait-softRobot.pyscn index 991cf3a7..ff822af7 100644 --- a/examples/softRobots/multiGait/reducedMultiGait-softRobot.pyscn +++ b/examples/softRobots/multiGait/reducedMultiGait-softRobot.pyscn @@ -219,7 +219,7 @@ def createScene(rootNode): rootNode.addObject('VisualStyle', displayFlags='showVisualModels hideBehaviorModels hideCollisionModels hideBoundingCollisionModels showForceFields showInteractionForceFields hideWireframe') rootNode.addObject('FreeMotionAnimationLoop') - rootNode.addObject('GenericConstraintSolver', printLog=False, tolerance="1e-4", maxIterations="1000") + rootNode.addObject('ProjectedGaussSeidelConstraintSolver', printLog=False, tolerance="1e-4", maxIterations="1000") rootNode.addObject('CollisionPipeline') rootNode.addObject('BruteForceBroadPhase', name="N2") rootNode.addObject('BVHNarrowPhase')