From ce644b8305310f2f22ca46bf768ac96822a77dd2 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 1 Dec 2025 11:36:47 +0100 Subject: [PATCH 1/4] Rename C++ symbols --- .../BlockGaussSeidelConstraintSolver.cpp | 294 ++++++++++++++++++ .../solver/BlockGaussSeidelConstraintSolver.h | 40 +++ 2 files changed, 334 insertions(+) create mode 100644 Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.cpp create mode 100644 Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.h diff --git a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.cpp b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.cpp new file mode 100644 index 00000000000..590998bd3ea --- /dev/null +++ b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.cpp @@ -0,0 +1,294 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ + +#include +#include +#include +#include +#include + +namespace sofa::component::constraint::lagrangian::solver +{ + + +void BlockGaussSeidelConstraintSolver::doSolve( GenericConstraintProblem * problem ,SReal timeout) +{ + SCOPED_TIMER_VARNAME(gaussSeidelTimer, "ConstraintsGaussSeidel"); + + + + const int dimension = problem->getDimension(); + + if(!dimension) + { + problem->currentError = 0.0; + problem->currentIterations = 0; + return; + } + + const SReal t0 = (SReal)sofa::helper::system::thread::CTime::getTime() ; + const SReal timeScale = 1.0 / (SReal)sofa::helper::system::thread::CTime::getTicksPerSec(); + + + SReal *dfree = problem->getDfree(); + SReal *force = problem->getF(); + SReal **w = problem->getW(); + SReal tol = problem->tolerance; + SReal *d = problem->_d.ptr(); + + SReal error=0.0; + bool convergence = false; + sofa::type::vector tempForces; + + if(problem->sor != 1.0) + { + tempForces.resize(dimension); + } + + if(problem->scaleTolerance && !problem->allVerified) + { + tol *= dimension; + } + + for(int i=0; iconstraintsResolutions[i]) + { + msg_error()<< "Bad size of constraintsResolutions in GenericConstraintSolver" ; + break; + } + problem->constraintsResolutions[i]->init(i, w, force); + i += problem->constraintsResolutions[i]->getNbLines(); + } + + bool showGraphs = false; + sofa::type::vector* graph_residuals = nullptr; + std::map < std::string, sofa::type::vector > *graph_forces = nullptr, *graph_violations = nullptr; + + showGraphs = d_computeGraphs.getValue(); + + if(showGraphs) + { + graph_forces = d_graphForces.beginEdit(); + graph_forces->clear(); + + graph_violations = d_graphViolations.beginEdit(); + graph_violations->clear(); + + graph_residuals = &(*d_graphErrors.beginEdit())["Error"]; + graph_residuals->clear(); + } + + sofa::type::vector tabErrors(dimension); + + int iterCount = 0; + + + for(int i=0; imaxIterations; i++) + { + iterCount ++; + bool constraintsAreVerified = true; + + + if(problem->sor != 1.0) + { + std::copy_n(force, dimension, tempForces.begin()); + } + + error=0.0; + + gaussSeidel_increment(true, dfree, force, w, tol, d, dimension, constraintsAreVerified, error, problem->constraintsResolutions, tabErrors); + + if(showGraphs) + { + for(int j=0; j& graph_force = (*graph_forces)[oss.str()]; + graph_force.push_back(force[j]); + + sofa::type::vector& graph_violation = (*graph_violations)[oss.str()]; + graph_violation.push_back(d[j]); + } + + graph_residuals->push_back(error); + } + + if(problem->sor != 1.0) + { + for(int j=0; jsor * force[j] + (1-problem->sor) * tempForces[j]; + } + } + + const SReal t1 = (SReal)sofa::helper::system::thread::CTime::getTime(); + const SReal dt = (t1 - t0)*timeScale; + + if(timeout && dt > timeout) + { + + msg_info() << "TimeOut" ; + + problem->currentError = error; + problem->currentIterations = i+1; + return; + } + else if(problem->allVerified) + { + if(constraintsAreVerified) + { + convergence = true; + break; + } + } + else if(error < tol) // do not stop at the first iteration (that is used for initial guess computation) + { + convergence = true; + break; + } + } + + sofa::helper::AdvancedTimer::valSet("GS iterations", problem->currentIterations); + + problem->result_output(this, force, error, iterCount, convergence); + + if(showGraphs) + { + d_graphErrors.endEdit(); + + sofa::type::vector& graph_constraints = (*d_graphConstraints.beginEdit())["Constraints"]; + graph_constraints.clear(); + + for(int j=0; jconstraintsResolutions[j]->getNbLines(); + + if(tabErrors[j]) + graph_constraints.push_back(tabErrors[j]); + else if(problem->constraintsResolutions[j]->getTolerance()) + graph_constraints.push_back(problem->constraintsResolutions[j]->getTolerance()); + else + graph_constraints.push_back(tol); + + j += nbDofs; + } + d_graphConstraints.endEdit(); + + d_graphForces.endEdit(); + } +} + +void BlockGaussSeidelConstraintSolver::gaussSeidel_increment(bool measureError, SReal *dfree, SReal *force, SReal **w, SReal tol, SReal *d, int dim, bool& constraintsAreVerified, SReal& error, std::vector& constraintCorrections, sofa::type::vector& tabErrors) const +{ + for(int j=0; jgetNbLines(); + + //2. for each line we compute the actual value of d + // (a)d is set to dfree + + std::vector errF(&force[j], &force[j+nb]); + std::copy_n(&dfree[j], nb, &d[j]); + + // (b) contribution of forces are added to d => TODO => optimization (no computation when force= 0 !!) + for(int k=0; kresolution(j, w, d, force, dfree); + + //4. the error is measured (displacement due to the new resolution (i.e. due to the new force)) + if(measureError) + { + SReal contraintError = 0.0; + if(nb > 1) + { + for(unsigned int l=0; l tol) + { + constraintsAreVerified = false; + } + + contraintError += lineError; + } + } + else + { + contraintError = fabs(w[j][j] * (force[j] - errF[0])); + if(contraintError > tol) + { + constraintsAreVerified = false; + } + } + + const bool givenTolerance = (bool)constraintCorrections[j]->getTolerance(); + + if(givenTolerance) + { + if(contraintError > constraintCorrections[j]->getTolerance()) + { + constraintsAreVerified = false; + } + contraintError *= tol / constraintCorrections[j]->getTolerance(); + } + + error += contraintError; + tabErrors[j] = contraintError; + } + else + { + constraintsAreVerified = true; + } + + j += nb; + } +} + + +void registerBlockGaussSeidelConstraintSolver(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("A Constraint Solver using the Linear Complementarity Problem formulation to solve Constraint based components using a Block Gauss-Seidel iterative method") + .add< BlockGaussSeidelConstraintSolver >()); +} + + +} diff --git a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.h b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.h new file mode 100644 index 00000000000..91ca8a6be5d --- /dev/null +++ b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.h @@ -0,0 +1,40 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#pragma once + +#include +#include + +namespace sofa::component::constraint::lagrangian::solver +{ +class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER_API BlockGaussSeidelConstraintSolver : public BuiltConstraintSolver +{ +public: + SOFA_CLASS(BlockGaussSeidelConstraintSolver, BuiltConstraintSolver); + +protected: + virtual void doSolve(GenericConstraintProblem * problem , SReal timeout = 0.0) override; + + void gaussSeidel_increment(bool measureError, SReal *dfree, SReal *force, SReal **w, SReal tol, SReal *d, int dim, bool& constraintsAreVerified, SReal& error, std::vector& constraintCorrections, sofa::type::vector& tabErrors) const; + +}; +} \ No newline at end of file From d67e64cd456267c67ee852f72b0bd47952501824 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 1 Dec 2025 11:37:51 +0100 Subject: [PATCH 2/4] Report change in C++ files --- .../animationloop/FreeMotionAnimationLoop.cpp | 8 +- .../BilateralInteractionConstraint.scn | 2 +- .../Lagrangian/Solver/CMakeLists.txt | 4 +- .../solver/NNCGConstraintSolver.cpp | 2 +- .../lagrangian/solver/NNCGConstraintSolver.h | 6 +- .../ProjectedGaussSeidelConstraintSolver.cpp | 294 ------------------ .../ProjectedGaussSeidelConstraintSolver.h | 40 --- .../constraint/lagrangian/solver/init.cpp | 4 +- .../tests/BaseTetrahedronFEMForceField_test.h | 2 +- .../src/sofa/helper/ComponentChange.cpp | 2 +- .../Helper/src/sofa/helper/SelectableItem.h | 2 +- ...jectedGaussSeidelConstraintSolver_test.cpp | 6 +- examples/SimpleAPI/fallingSOFA.cpp | 2 +- 13 files changed, 20 insertions(+), 354 deletions(-) delete mode 100644 Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.cpp delete mode 100644 Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.h diff --git a/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/FreeMotionAnimationLoop.cpp b/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/FreeMotionAnimationLoop.cpp index 8dc8ddc9536..ec7e3668a17 100644 --- a/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/FreeMotionAnimationLoop.cpp +++ b/Sofa/Component/AnimationLoop/src/sofa/component/animationloop/FreeMotionAnimationLoop.cpp @@ -44,11 +44,11 @@ #include #include #include -#include +#include #include -#include +#include using sofa::simulation::mechanicalvisitor::MechanicalVInitVisitor; @@ -71,7 +71,7 @@ using namespace core::behavior; using namespace sofa::simulation; using sofa::helper::ScopedAdvancedTimer; -using DefaultConstraintSolver = sofa::component::constraint::lagrangian::solver::ProjectedGaussSeidelConstraintSolver; +using DefaultConstraintSolver = sofa::component::constraint::lagrangian::solver::BlockGaussSeidelConstraintSolver; FreeMotionAnimationLoop::FreeMotionAnimationLoop() : d_solveVelocityConstraintFirst(initData(&d_solveVelocityConstraintFirst , false, "solveVelocityConstraintFirst", "solve separately velocity constraint violations before position constraint violations")) @@ -104,7 +104,7 @@ void FreeMotionAnimationLoop::init() l_constraintSolver.set(this->getContext()->get(core::objectmodel::BaseContext::SearchDown)); if (!l_constraintSolver) { - if (const auto constraintSolver = sofa::core::objectmodel::New()) + if (const auto constraintSolver = sofa::core::objectmodel::New()) { getContext()->addObject(constraintSolver); constraintSolver->setName( this->getContext()->getNameHelper().resolveName(constraintSolver->getClassName(), {})); diff --git a/Sofa/Component/Constraint/Lagrangian/Model/tests/scenes_test/BilateralInteractionConstraint.scn b/Sofa/Component/Constraint/Lagrangian/Model/tests/scenes_test/BilateralInteractionConstraint.scn index 21bd26bf1af..dada2fe376d 100644 --- a/Sofa/Component/Constraint/Lagrangian/Model/tests/scenes_test/BilateralInteractionConstraint.scn +++ b/Sofa/Component/Constraint/Lagrangian/Model/tests/scenes_test/BilateralInteractionConstraint.scn @@ -2,7 +2,7 @@ - + diff --git a/Sofa/Component/Constraint/Lagrangian/Solver/CMakeLists.txt b/Sofa/Component/Constraint/Lagrangian/Solver/CMakeLists.txt index e9395e32b19..c96adb5c931 100644 --- a/Sofa/Component/Constraint/Lagrangian/Solver/CMakeLists.txt +++ b/Sofa/Component/Constraint/Lagrangian/Solver/CMakeLists.txt @@ -13,7 +13,7 @@ set(HEADER_FILES ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/BuiltConstraintSolver.h ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/ImprovedJacobiConstraintSolver.h ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/NNCGConstraintSolver.h - ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/ProjectedGaussSeidelConstraintSolver.h + ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/BlockGaussSeidelConstraintSolver.h ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/UnbuiltConstraintSolver.h ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/UnbuiltGaussSeidelConstraintSolver.h ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/LCPConstraintSolver.h @@ -32,7 +32,7 @@ set(SOURCE_FILES ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/BuiltConstraintSolver.cpp ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/ImprovedJacobiConstraintSolver.cpp ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/NNCGConstraintSolver.cpp - ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/ProjectedGaussSeidelConstraintSolver.cpp + ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/BlockGaussSeidelConstraintSolver.cpp ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/UnbuiltConstraintSolver.cpp ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/UnbuiltGaussSeidelConstraintSolver.cpp ${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/LCPConstraintSolver.cpp diff --git a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/NNCGConstraintSolver.cpp b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/NNCGConstraintSolver.cpp index bbcb2b6f17d..393e86140f7 100644 --- a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/NNCGConstraintSolver.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/NNCGConstraintSolver.cpp @@ -91,7 +91,7 @@ void NNCGConstraintSolver::doSolve(GenericConstraintProblem * problem , SReal ti sofa::type::vector tabErrors(dimension); { - // perform one iteration of ProjectedGaussSeidel + // perform one iteration of BlockGaussSeidel bool constraintsAreVerified = true; std::copy_n(force, dimension, std::begin(problem->m_lam)); diff --git a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/NNCGConstraintSolver.h b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/NNCGConstraintSolver.h index 26bd9e95eed..fbf1ae53ebb 100644 --- a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/NNCGConstraintSolver.h +++ b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/NNCGConstraintSolver.h @@ -21,15 +21,15 @@ ******************************************************************************/ #pragma once -#include +#include #include namespace sofa::component::constraint::lagrangian::solver { -class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER_API NNCGConstraintSolver : public ProjectedGaussSeidelConstraintSolver +class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER_API NNCGConstraintSolver : public BlockGaussSeidelConstraintSolver { public: - SOFA_CLASS(NNCGConstraintSolver, ProjectedGaussSeidelConstraintSolver); + SOFA_CLASS(NNCGConstraintSolver, BlockGaussSeidelConstraintSolver); virtual void doSolve(GenericConstraintProblem * problem , SReal timeout = 0.0) override; }; diff --git a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.cpp b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.cpp deleted file mode 100644 index eebc1b03764..00000000000 --- a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/****************************************************************************** -* SOFA, Simulation Open-Framework Architecture * -* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU Lesser General Public License as published by * -* the Free Software Foundation; either version 2.1 of the License, or (at * -* your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but WITHOUT * -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * -* for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this program. If not, see . * -******************************************************************************* -* Authors: The SOFA Team and external contributors (see Authors.txt) * -* * -* Contact information: contact@sofa-framework.org * -******************************************************************************/ - -#include -#include -#include -#include -#include - -namespace sofa::component::constraint::lagrangian::solver -{ - - -void ProjectedGaussSeidelConstraintSolver::doSolve( GenericConstraintProblem * problem ,SReal timeout) -{ - SCOPED_TIMER_VARNAME(gaussSeidelTimer, "ConstraintsGaussSeidel"); - - - - const int dimension = problem->getDimension(); - - if(!dimension) - { - problem->currentError = 0.0; - problem->currentIterations = 0; - return; - } - - const SReal t0 = (SReal)sofa::helper::system::thread::CTime::getTime() ; - const SReal timeScale = 1.0 / (SReal)sofa::helper::system::thread::CTime::getTicksPerSec(); - - - SReal *dfree = problem->getDfree(); - SReal *force = problem->getF(); - SReal **w = problem->getW(); - SReal tol = problem->tolerance; - SReal *d = problem->_d.ptr(); - - SReal error=0.0; - bool convergence = false; - sofa::type::vector tempForces; - - if(problem->sor != 1.0) - { - tempForces.resize(dimension); - } - - if(problem->scaleTolerance && !problem->allVerified) - { - tol *= dimension; - } - - for(int i=0; iconstraintsResolutions[i]) - { - msg_error()<< "Bad size of constraintsResolutions in GenericConstraintSolver" ; - break; - } - problem->constraintsResolutions[i]->init(i, w, force); - i += problem->constraintsResolutions[i]->getNbLines(); - } - - bool showGraphs = false; - sofa::type::vector* graph_residuals = nullptr; - std::map < std::string, sofa::type::vector > *graph_forces = nullptr, *graph_violations = nullptr; - - showGraphs = d_computeGraphs.getValue(); - - if(showGraphs) - { - graph_forces = d_graphForces.beginEdit(); - graph_forces->clear(); - - graph_violations = d_graphViolations.beginEdit(); - graph_violations->clear(); - - graph_residuals = &(*d_graphErrors.beginEdit())["Error"]; - graph_residuals->clear(); - } - - sofa::type::vector tabErrors(dimension); - - int iterCount = 0; - - - for(int i=0; imaxIterations; i++) - { - iterCount ++; - bool constraintsAreVerified = true; - - - if(problem->sor != 1.0) - { - std::copy_n(force, dimension, tempForces.begin()); - } - - error=0.0; - - gaussSeidel_increment(true, dfree, force, w, tol, d, dimension, constraintsAreVerified, error, problem->constraintsResolutions, tabErrors); - - if(showGraphs) - { - for(int j=0; j& graph_force = (*graph_forces)[oss.str()]; - graph_force.push_back(force[j]); - - sofa::type::vector& graph_violation = (*graph_violations)[oss.str()]; - graph_violation.push_back(d[j]); - } - - graph_residuals->push_back(error); - } - - if(problem->sor != 1.0) - { - for(int j=0; jsor * force[j] + (1-problem->sor) * tempForces[j]; - } - } - - const SReal t1 = (SReal)sofa::helper::system::thread::CTime::getTime(); - const SReal dt = (t1 - t0)*timeScale; - - if(timeout && dt > timeout) - { - - msg_info() << "TimeOut" ; - - problem->currentError = error; - problem->currentIterations = i+1; - return; - } - else if(problem->allVerified) - { - if(constraintsAreVerified) - { - convergence = true; - break; - } - } - else if(error < tol) // do not stop at the first iteration (that is used for initial guess computation) - { - convergence = true; - break; - } - } - - sofa::helper::AdvancedTimer::valSet("GS iterations", problem->currentIterations); - - problem->result_output(this, force, error, iterCount, convergence); - - if(showGraphs) - { - d_graphErrors.endEdit(); - - sofa::type::vector& graph_constraints = (*d_graphConstraints.beginEdit())["Constraints"]; - graph_constraints.clear(); - - for(int j=0; jconstraintsResolutions[j]->getNbLines(); - - if(tabErrors[j]) - graph_constraints.push_back(tabErrors[j]); - else if(problem->constraintsResolutions[j]->getTolerance()) - graph_constraints.push_back(problem->constraintsResolutions[j]->getTolerance()); - else - graph_constraints.push_back(tol); - - j += nbDofs; - } - d_graphConstraints.endEdit(); - - d_graphForces.endEdit(); - } -} - -void ProjectedGaussSeidelConstraintSolver::gaussSeidel_increment(bool measureError, SReal *dfree, SReal *force, SReal **w, SReal tol, SReal *d, int dim, bool& constraintsAreVerified, SReal& error, std::vector& constraintCorrections, sofa::type::vector& tabErrors) const -{ - for(int j=0; jgetNbLines(); - - //2. for each line we compute the actual value of d - // (a)d is set to dfree - - std::vector errF(&force[j], &force[j+nb]); - std::copy_n(&dfree[j], nb, &d[j]); - - // (b) contribution of forces are added to d => TODO => optimization (no computation when force= 0 !!) - for(int k=0; kresolution(j, w, d, force, dfree); - - //4. the error is measured (displacement due to the new resolution (i.e. due to the new force)) - if(measureError) - { - SReal contraintError = 0.0; - if(nb > 1) - { - for(unsigned int l=0; l tol) - { - constraintsAreVerified = false; - } - - contraintError += lineError; - } - } - else - { - contraintError = fabs(w[j][j] * (force[j] - errF[0])); - if(contraintError > tol) - { - constraintsAreVerified = false; - } - } - - const bool givenTolerance = (bool)constraintCorrections[j]->getTolerance(); - - if(givenTolerance) - { - if(contraintError > constraintCorrections[j]->getTolerance()) - { - constraintsAreVerified = false; - } - contraintError *= tol / constraintCorrections[j]->getTolerance(); - } - - error += contraintError; - tabErrors[j] = contraintError; - } - else - { - constraintsAreVerified = true; - } - - j += nb; - } -} - - -void registerProjectedGaussSeidelConstraintSolver(sofa::core::ObjectFactory* factory) -{ - factory->registerObjects(core::ObjectRegistrationData("A Constraint Solver using the Linear Complementarity Problem formulation to solve Constraint based components using a Projected Gauss-Seidel iterative method") - .add< ProjectedGaussSeidelConstraintSolver >()); -} - - -} diff --git a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.h b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.h deleted file mode 100644 index aabf2c6ef7b..00000000000 --- a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.h +++ /dev/null @@ -1,40 +0,0 @@ -/****************************************************************************** -* SOFA, Simulation Open-Framework Architecture * -* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU Lesser General Public License as published by * -* the Free Software Foundation; either version 2.1 of the License, or (at * -* your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but WITHOUT * -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * -* for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this program. If not, see . * -******************************************************************************* -* Authors: The SOFA Team and external contributors (see Authors.txt) * -* * -* Contact information: contact@sofa-framework.org * -******************************************************************************/ -#pragma once - -#include -#include - -namespace sofa::component::constraint::lagrangian::solver -{ -class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER_API ProjectedGaussSeidelConstraintSolver : public BuiltConstraintSolver -{ -public: - SOFA_CLASS(ProjectedGaussSeidelConstraintSolver, BuiltConstraintSolver); - -protected: - virtual void doSolve(GenericConstraintProblem * problem , SReal timeout = 0.0) override; - - void gaussSeidel_increment(bool measureError, SReal *dfree, SReal *force, SReal **w, SReal tol, SReal *d, int dim, bool& constraintsAreVerified, SReal& error, std::vector& constraintCorrections, sofa::type::vector& tabErrors) const; - -}; -} \ No newline at end of file diff --git a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/init.cpp b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/init.cpp index c3cbd2d6ab0..2e4426b180f 100644 --- a/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/init.cpp +++ b/Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/init.cpp @@ -27,7 +27,7 @@ namespace sofa::component::constraint::lagrangian::solver { extern void registerNNCGConstraintSolver(sofa::core::ObjectFactory* factory); -extern void registerProjectedGaussSeidelConstraintSolver(sofa::core::ObjectFactory* factory); +extern void registerBlockGaussSeidelConstraintSolver(sofa::core::ObjectFactory* factory); extern void registerUnbuiltGaussSeidelConstraintSolver(sofa::core::ObjectFactory* factory); extern void registerLCPConstraintSolver(sofa::core::ObjectFactory* factory); extern void registerImprovedJacobiConstraintSolver(sofa::core::ObjectFactory* factory); @@ -57,7 +57,7 @@ const char* getModuleVersion() void registerObjects(sofa::core::ObjectFactory* factory) { registerNNCGConstraintSolver(factory); - registerProjectedGaussSeidelConstraintSolver(factory); + registerBlockGaussSeidelConstraintSolver(factory); registerUnbuiltGaussSeidelConstraintSolver(factory); registerLCPConstraintSolver(factory); registerImprovedJacobiConstraintSolver(factory); diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BaseTetrahedronFEMForceField_test.h b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BaseTetrahedronFEMForceField_test.h index 5d1b92953b6..f19c9d27127 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BaseTetrahedronFEMForceField_test.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/tests/BaseTetrahedronFEMForceField_test.h @@ -137,7 +137,7 @@ class BaseTetrahedronFEMForceField_test : public sofa::testing::BaseTest Sofa.Component.Constraint.Projective }); - simpleapi::createObject(m_root, "ProjectedGaussSeidelConstraintSolver", { {"tolerance", "1e-3"}, {"maxIt", "1000"} }); + simpleapi::createObject(m_root, "BlockGaussSeidelConstraintSolver", { {"tolerance", "1e-3"}, {"maxIt", "1000"} }); simpleapi::createObject(m_root, "RegularGridTopology", { {"name", "grid"}, {"n", sofa::simpleapi::str(nbrGrid)}, {"min", "0 0 20"}, {"max", "10 40 30"} }); diff --git a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp index 91dd6a0ef14..9dfb443e592 100644 --- a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp @@ -626,7 +626,7 @@ std::map > uncreatableComponents = { { "GenericConstraintSolver", ComponentChange().withCustomMessage("GenericConstraintSolver has been replaced since v25.12 by a set of new components, whose names relate to the method used:\n" - " - ProjectedGaussSeidelConstraintSolver (if you were using this component without setting 'resolutionMethod' or by setting it to 'ProjectedGaussSeidel')\n" + " - BlockGaussSeidelConstraintSolver (if you were using this component without setting 'resolutionMethod' or by setting it to 'ProjectedGaussSeidel')\n" " - UnbuiltGaussSeidelConstraintSolver (if you were using this component while setting 'resolutionMethod=\"UnbuiltGaussSeidel\"')\n" " - NNCGConstraintSolver (if you were using this component while setting 'resolutionMethod=\"NonsmoothNonlinearConjugateGradient\"')\n" " --> For NNCGConstraintSolver, data 'newtonIterations' has been replaced by 'maxIterations'" diff --git a/Sofa/framework/Helper/src/sofa/helper/SelectableItem.h b/Sofa/framework/Helper/src/sofa/helper/SelectableItem.h index 06a86c4cc9b..215031ccdf9 100644 --- a/Sofa/framework/Helper/src/sofa/helper/SelectableItem.h +++ b/Sofa/framework/Helper/src/sofa/helper/SelectableItem.h @@ -66,7 +66,7 @@ struct DeprecatedItem * * Example: * MAKE_SELECTABLE_ITEMS(ResolutionMethod, - * sofa::helper::Item{"ProjectedGaussSeidel", "Projected Gauss-Seidel"}, + * sofa::helper::Item{"BlockGaussSeidel", "Projected Gauss-Seidel"}, * sofa::helper::Item{"UnbuiltGaussSeidel", "Gauss-Seidel no matrix assembly"}, * sofa::helper::Item{"NonsmoothNonlinearConjugateGradient", "Non-smooth non-linear conjugate gradient"} * ); diff --git a/Sofa/framework/Simulation/Core/tests/ProjectedGaussSeidelConstraintSolver_test.cpp b/Sofa/framework/Simulation/Core/tests/ProjectedGaussSeidelConstraintSolver_test.cpp index 077892b374b..be26789e876 100644 --- a/Sofa/framework/Simulation/Core/tests/ProjectedGaussSeidelConstraintSolver_test.cpp +++ b/Sofa/framework/Simulation/Core/tests/ProjectedGaussSeidelConstraintSolver_test.cpp @@ -30,7 +30,7 @@ namespace /** Test the UncoupledConstraintCorrection class */ -struct ProjectedGaussSeidelConstraintSolver_test : BaseSimulationTest +struct BlockGaussSeidelConstraintSolver_test : BaseSimulationTest { void SetUp() override { @@ -49,7 +49,7 @@ struct ProjectedGaussSeidelConstraintSolver_test : BaseSimulationTest " " " " " \n" - " \n" + " \n" " \n" " \n" " \n" @@ -66,7 +66,7 @@ struct ProjectedGaussSeidelConstraintSolver_test : BaseSimulationTest }; /// run the tests -TEST_F(ProjectedGaussSeidelConstraintSolver_test, checkConstraintForce) +TEST_F(BlockGaussSeidelConstraintSolver_test, checkConstraintForce) { EXPECT_MSG_NOEMIT(Error); enableConstraintForce(); diff --git a/examples/SimpleAPI/fallingSOFA.cpp b/examples/SimpleAPI/fallingSOFA.cpp index 4425463eab6..24ed0ef3b42 100644 --- a/examples/SimpleAPI/fallingSOFA.cpp +++ b/examples/SimpleAPI/fallingSOFA.cpp @@ -49,7 +49,7 @@ sofa::simulation::Node::SPtr createScene(const sofa::simpleapi::Simulation::SPtr sofa::simpleapi::createObject(root, "VisualStyle", {{"displayFlags", "showVisual"}}); sofa::simpleapi::createObject(root, "ConstraintAttachButtonSetting"); sofa::simpleapi::createObject(root, "FreeMotionAnimationLoop"); - sofa::simpleapi::createObject(root, "ProjectedGaussSeidelConstraintSolver",{{"maxIterations","50"}, {"tolerance","1.0e-6"}}); + sofa::simpleapi::createObject(root, "BlockGaussSeidelConstraintSolver",{{"maxIterations","50"}, {"tolerance","1.0e-6"}}); sofa::simpleapi::createObject(root, "CollisionPipeline",{{"name","Pipeline"}}); sofa::simpleapi::createObject(root, "ParallelBruteForceBroadPhase",{{"name","BroadPhase"}}); From 4eebc44c71ae718137a20e881bccd8d2ddce143c Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Mon, 1 Dec 2025 11:38:10 +0100 Subject: [PATCH 3/4] Apply changes to scenes --- .../ArticulatedSystemPlugin/examples/ArticulatedArm/header.py | 2 +- applications/plugins/PersistentContact/examples/grasping.scn | 2 +- applications/plugins/Sensable/examples/SimpleBox-Method2.scn | 2 +- applications/plugins/SofaHAPI/examples/SofaHAPI1.scn | 2 +- .../plugins/SofaMatrix/examples/ComplianceMatrixExporter.scn | 2 +- .../plugins/SofaMatrix/examples/ComplianceMatrixImage.scn | 2 +- applications/plugins/Xitact/examples/xitactTest.scn | 2 +- .../src/SceneChecking/SceneCheckCollisionResponse.cpp | 4 ++-- examples/Benchmark/Performance/TorusFall.scn | 2 +- .../Component/Collision/Response/RuleBasedContactManager.scn | 2 +- .../Lagrangian/BilateralLagrangianConstraint_PGS.scn | 2 +- .../Lagrangian/BilateralLagrangianConstraint_Rigid.scn | 2 +- .../BilateralLagrangianConstraint_Soft_Rigid_Bodies.scn | 2 +- ...teralLagrangianConstraint_with_regularization_solvable.scn | 2 +- ...ralLagrangianConstraint_with_regularization_unsolvable.scn | 2 +- ...lLagrangianConstraint_with_svd_regularization_solvable.scn | 2 +- .../Constraint/Lagrangian/FixedLagrangianConstaint_Rigid3.scn | 2 +- .../Constraint/Lagrangian/FixedLagrangianConstaint_Vec3.scn | 2 +- .../Lagrangian/FrictionContact_VelocityConstraints.scn | 2 +- .../Component/Constraint/Lagrangian/InextensiblePendulum.scn | 2 +- .../Constraint/Lagrangian/SlidingLagrangianConstraint.scn | 2 +- .../Projective/LinearVelocityProjectiveConstraint.scn | 2 +- examples/Component/Mapping/Linear/DistanceToPlaneMapping.scn | 2 +- examples/Component/Mapping/NonLinear/AreaMapping.scn | 2 +- .../FEM/Heterogeneous-TetrahedronFEMForceField.scn | 2 +- .../SolidMechanics/Spring/RestShapeSpringsForceField2.scn | 2 +- examples/Demos/SofaScene.scn | 2 +- examples/Demos/SofaWasher.scn | 2 +- examples/Demos/fallingBeamAugmentedLagrangianCollision.scn | 2 +- examples/Demos/fallingBeamLagrangianCollision.scn | 2 +- examples/Demos/fallingSOFA.scn | 2 +- examples/Demos/sofa_1000PR.scn | 2 +- 32 files changed, 33 insertions(+), 33 deletions(-) diff --git a/applications/plugins/ArticulatedSystemPlugin/examples/ArticulatedArm/header.py b/applications/plugins/ArticulatedSystemPlugin/examples/ArticulatedArm/header.py index 2df9619b8a8..19614f0b782 100644 --- a/applications/plugins/ArticulatedSystemPlugin/examples/ArticulatedArm/header.py +++ b/applications/plugins/ArticulatedSystemPlugin/examples/ArticulatedArm/header.py @@ -6,7 +6,7 @@ def addHeader(rootNode): rootNode.addObject('DefaultVisualManagerLoop') rootNode.addObject('FreeMotionAnimationLoop') - rootNode.addObject('ProjectedGaussSeidelConstraintSolver', maxIterations=50, tolerance=1e-5, printLog=False) + rootNode.addObject('BlockGaussSeidelConstraintSolver', maxIterations=50, tolerance=1e-5, printLog=False) rootNode.addObject('BackgroundSetting', color=[1., 1., 1., 1.]) rootNode.findData('dt').value=0.01 rootNode.gravity = [0,-9810,0] diff --git a/applications/plugins/PersistentContact/examples/grasping.scn b/applications/plugins/PersistentContact/examples/grasping.scn index 2c221faff97..7d735b6f864 100644 --- a/applications/plugins/PersistentContact/examples/grasping.scn +++ b/applications/plugins/PersistentContact/examples/grasping.scn @@ -2,7 +2,7 @@ - + diff --git a/applications/plugins/Sensable/examples/SimpleBox-Method2.scn b/applications/plugins/Sensable/examples/SimpleBox-Method2.scn index 30fa16c5bf9..2f2e4c722b6 100644 --- a/applications/plugins/Sensable/examples/SimpleBox-Method2.scn +++ b/applications/plugins/Sensable/examples/SimpleBox-Method2.scn @@ -7,7 +7,7 @@ - + diff --git a/applications/plugins/SofaHAPI/examples/SofaHAPI1.scn b/applications/plugins/SofaHAPI/examples/SofaHAPI1.scn index 6d44a4ee7bf..095b4841d8a 100644 --- a/applications/plugins/SofaHAPI/examples/SofaHAPI1.scn +++ b/applications/plugins/SofaHAPI/examples/SofaHAPI1.scn @@ -7,7 +7,7 @@ - + diff --git a/applications/plugins/SofaMatrix/examples/ComplianceMatrixExporter.scn b/applications/plugins/SofaMatrix/examples/ComplianceMatrixExporter.scn index eeb60a8b0b0..fd5474a707b 100644 --- a/applications/plugins/SofaMatrix/examples/ComplianceMatrixExporter.scn +++ b/applications/plugins/SofaMatrix/examples/ComplianceMatrixExporter.scn @@ -17,7 +17,7 @@ - + diff --git a/applications/plugins/SofaMatrix/examples/ComplianceMatrixImage.scn b/applications/plugins/SofaMatrix/examples/ComplianceMatrixImage.scn index 660f53115ec..4fab1497825 100644 --- a/applications/plugins/SofaMatrix/examples/ComplianceMatrixImage.scn +++ b/applications/plugins/SofaMatrix/examples/ComplianceMatrixImage.scn @@ -17,7 +17,7 @@ - + diff --git a/applications/plugins/Xitact/examples/xitactTest.scn b/applications/plugins/Xitact/examples/xitactTest.scn index c2680fa0ee5..699c87ac41f 100644 --- a/applications/plugins/Xitact/examples/xitactTest.scn +++ b/applications/plugins/Xitact/examples/xitactTest.scn @@ -3,7 +3,7 @@ - + diff --git a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckCollisionResponse.cpp b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckCollisionResponse.cpp index 8c559aee30f..687eec987c3 100644 --- a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckCollisionResponse.cpp +++ b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckCollisionResponse.cpp @@ -82,9 +82,9 @@ void SceneCheckCollisionResponse::doCheckOn(Node* node) sofa::core::behavior::ConstraintSolver* constraintSolver; root->get(constraintSolver, sofa::core::objectmodel::BaseContext::SearchRoot); - if (!constraintSolver || ( constraintSolver && ( constraintSolver->getClassName() != "ProjectedGaussSeidelConstraintSolver" )) ) + if (!constraintSolver || ( constraintSolver && ( constraintSolver->getClassName() != "BlockGaussSeidelConstraintSolver" )) ) { - m_message <<"A ProjectedGaussSeidelConstraintSolver must be in the scene to solve StickContactConstraint" << msgendl; + m_message <<"A BlockGaussSeidelConstraintSolver must be in the scene to solve StickContactConstraint" << msgendl; } } /// If FrictionContactConstraint is chosen, make sure the scene includes a FreeMotionAnimationLoop diff --git a/examples/Benchmark/Performance/TorusFall.scn b/examples/Benchmark/Performance/TorusFall.scn index 1f24dba9312..14617707a33 100644 --- a/examples/Benchmark/Performance/TorusFall.scn +++ b/examples/Benchmark/Performance/TorusFall.scn @@ -30,7 +30,7 @@ - + diff --git a/examples/Component/Collision/Response/RuleBasedContactManager.scn b/examples/Component/Collision/Response/RuleBasedContactManager.scn index 24ba8ed5c7d..0c2cee4c509 100644 --- a/examples/Component/Collision/Response/RuleBasedContactManager.scn +++ b/examples/Component/Collision/Response/RuleBasedContactManager.scn @@ -20,7 +20,7 @@ - + diff --git a/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_PGS.scn b/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_PGS.scn index bfa2d71c677..510e0348a13 100644 --- a/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_PGS.scn +++ b/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_PGS.scn @@ -22,7 +22,7 @@ - + diff --git a/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_Rigid.scn b/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_Rigid.scn index 31f93a6c1e8..fdbce4926d5 100644 --- a/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_Rigid.scn +++ b/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_Rigid.scn @@ -18,7 +18,7 @@ - + diff --git a/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_Soft_Rigid_Bodies.scn b/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_Soft_Rigid_Bodies.scn index b8f8f81479b..2fb10cbdb0c 100644 --- a/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_Soft_Rigid_Bodies.scn +++ b/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_Soft_Rigid_Bodies.scn @@ -28,7 +28,7 @@ - + diff --git a/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_with_regularization_solvable.scn b/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_with_regularization_solvable.scn index 2e10347f367..28d0669d2da 100644 --- a/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_with_regularization_solvable.scn +++ b/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_with_regularization_solvable.scn @@ -17,7 +17,7 @@ - + diff --git a/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_with_regularization_unsolvable.scn b/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_with_regularization_unsolvable.scn index 038917c14ae..0ffbb256d61 100644 --- a/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_with_regularization_unsolvable.scn +++ b/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_with_regularization_unsolvable.scn @@ -17,7 +17,7 @@ - + diff --git a/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_with_svd_regularization_solvable.scn b/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_with_svd_regularization_solvable.scn index 059c065fca2..34359b48da2 100644 --- a/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_with_svd_regularization_solvable.scn +++ b/examples/Component/Constraint/Lagrangian/BilateralLagrangianConstraint_with_svd_regularization_solvable.scn @@ -17,7 +17,7 @@ - + diff --git a/examples/Component/Constraint/Lagrangian/FixedLagrangianConstaint_Rigid3.scn b/examples/Component/Constraint/Lagrangian/FixedLagrangianConstaint_Rigid3.scn index adef70eaade..8069d63be0f 100644 --- a/examples/Component/Constraint/Lagrangian/FixedLagrangianConstaint_Rigid3.scn +++ b/examples/Component/Constraint/Lagrangian/FixedLagrangianConstaint_Rigid3.scn @@ -21,7 +21,7 @@ - + diff --git a/examples/Component/Constraint/Lagrangian/FixedLagrangianConstaint_Vec3.scn b/examples/Component/Constraint/Lagrangian/FixedLagrangianConstaint_Vec3.scn index 2aaf4554dac..502187b38fd 100644 --- a/examples/Component/Constraint/Lagrangian/FixedLagrangianConstaint_Vec3.scn +++ b/examples/Component/Constraint/Lagrangian/FixedLagrangianConstaint_Vec3.scn @@ -24,7 +24,7 @@ - + diff --git a/examples/Component/Constraint/Lagrangian/FrictionContact_VelocityConstraints.scn b/examples/Component/Constraint/Lagrangian/FrictionContact_VelocityConstraints.scn index 2132cb08012..18f81be1611 100644 --- a/examples/Component/Constraint/Lagrangian/FrictionContact_VelocityConstraints.scn +++ b/examples/Component/Constraint/Lagrangian/FrictionContact_VelocityConstraints.scn @@ -16,7 +16,7 @@ - + diff --git a/examples/Component/Constraint/Lagrangian/InextensiblePendulum.scn b/examples/Component/Constraint/Lagrangian/InextensiblePendulum.scn index bba47020525..8a8583d8210 100644 --- a/examples/Component/Constraint/Lagrangian/InextensiblePendulum.scn +++ b/examples/Component/Constraint/Lagrangian/InextensiblePendulum.scn @@ -25,7 +25,7 @@ - + diff --git a/examples/Component/Constraint/Lagrangian/SlidingLagrangianConstraint.scn b/examples/Component/Constraint/Lagrangian/SlidingLagrangianConstraint.scn index c89c3cd609b..7cd56c235e7 100644 --- a/examples/Component/Constraint/Lagrangian/SlidingLagrangianConstraint.scn +++ b/examples/Component/Constraint/Lagrangian/SlidingLagrangianConstraint.scn @@ -20,7 +20,7 @@ - + diff --git a/examples/Component/Constraint/Projective/LinearVelocityProjectiveConstraint.scn b/examples/Component/Constraint/Projective/LinearVelocityProjectiveConstraint.scn index cdfef263603..5afbb7a9489 100644 --- a/examples/Component/Constraint/Projective/LinearVelocityProjectiveConstraint.scn +++ b/examples/Component/Constraint/Projective/LinearVelocityProjectiveConstraint.scn @@ -23,7 +23,7 @@ - + diff --git a/examples/Component/Mapping/Linear/DistanceToPlaneMapping.scn b/examples/Component/Mapping/Linear/DistanceToPlaneMapping.scn index dde370eb370..b3c3af06fa4 100644 --- a/examples/Component/Mapping/Linear/DistanceToPlaneMapping.scn +++ b/examples/Component/Mapping/Linear/DistanceToPlaneMapping.scn @@ -14,7 +14,7 @@ - + diff --git a/examples/Component/Mapping/NonLinear/AreaMapping.scn b/examples/Component/Mapping/NonLinear/AreaMapping.scn index 08353a4a408..a45c2651fe1 100644 --- a/examples/Component/Mapping/NonLinear/AreaMapping.scn +++ b/examples/Component/Mapping/NonLinear/AreaMapping.scn @@ -23,7 +23,7 @@ - + diff --git a/examples/Component/SolidMechanics/FEM/Heterogeneous-TetrahedronFEMForceField.scn b/examples/Component/SolidMechanics/FEM/Heterogeneous-TetrahedronFEMForceField.scn index 23cae4c230c..79655c48bb6 100644 --- a/examples/Component/SolidMechanics/FEM/Heterogeneous-TetrahedronFEMForceField.scn +++ b/examples/Component/SolidMechanics/FEM/Heterogeneous-TetrahedronFEMForceField.scn @@ -25,7 +25,7 @@ - + diff --git a/examples/Component/SolidMechanics/Spring/RestShapeSpringsForceField2.scn b/examples/Component/SolidMechanics/Spring/RestShapeSpringsForceField2.scn index 2af2de80456..5b9427ef279 100644 --- a/examples/Component/SolidMechanics/Spring/RestShapeSpringsForceField2.scn +++ b/examples/Component/SolidMechanics/Spring/RestShapeSpringsForceField2.scn @@ -14,7 +14,7 @@ - + diff --git a/examples/Demos/SofaScene.scn b/examples/Demos/SofaScene.scn index e65b4a1717c..82a12c947eb 100644 --- a/examples/Demos/SofaScene.scn +++ b/examples/Demos/SofaScene.scn @@ -42,7 +42,7 @@ - + diff --git a/examples/Demos/SofaWasher.scn b/examples/Demos/SofaWasher.scn index e7f01600304..0317462e7cc 100644 --- a/examples/Demos/SofaWasher.scn +++ b/examples/Demos/SofaWasher.scn @@ -32,7 +32,7 @@ - + diff --git a/examples/Demos/fallingBeamAugmentedLagrangianCollision.scn b/examples/Demos/fallingBeamAugmentedLagrangianCollision.scn index 324247538c5..2ec3c12b168 100644 --- a/examples/Demos/fallingBeamAugmentedLagrangianCollision.scn +++ b/examples/Demos/fallingBeamAugmentedLagrangianCollision.scn @@ -27,7 +27,7 @@ - + diff --git a/examples/Demos/fallingBeamLagrangianCollision.scn b/examples/Demos/fallingBeamLagrangianCollision.scn index 29e7059ba44..3cb00b82ac1 100644 --- a/examples/Demos/fallingBeamLagrangianCollision.scn +++ b/examples/Demos/fallingBeamLagrangianCollision.scn @@ -27,7 +27,7 @@ - + diff --git a/examples/Demos/fallingSOFA.scn b/examples/Demos/fallingSOFA.scn index 978637fd861..c39c440eafa 100644 --- a/examples/Demos/fallingSOFA.scn +++ b/examples/Demos/fallingSOFA.scn @@ -38,7 +38,7 @@ - + diff --git a/examples/Demos/sofa_1000PR.scn b/examples/Demos/sofa_1000PR.scn index 7c44da2aa24..006c0bf6c21 100644 --- a/examples/Demos/sofa_1000PR.scn +++ b/examples/Demos/sofa_1000PR.scn @@ -24,7 +24,7 @@ - + From 19399b85b00106daa1a68f337089223e7f22e874 Mon Sep 17 00:00:00 2001 From: Paul Baksic <30337881+bakpaul@users.noreply.github.com> Date: Wed, 10 Dec 2025 14:22:23 +0100 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Themis Skamagkis <70031729+th-skam@users.noreply.github.com> --- Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp | 2 +- Sofa/framework/Helper/src/sofa/helper/SelectableItem.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp index 9dfb443e592..306f26c000a 100644 --- a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp @@ -626,7 +626,7 @@ std::map > uncreatableComponents = { { "GenericConstraintSolver", ComponentChange().withCustomMessage("GenericConstraintSolver has been replaced since v25.12 by a set of new components, whose names relate to the method used:\n" - " - BlockGaussSeidelConstraintSolver (if you were using this component without setting 'resolutionMethod' or by setting it to 'ProjectedGaussSeidel')\n" + " - BlockGaussSeidelConstraintSolver (if you were using this component without setting 'resolutionMethod' or by setting it to 'BlockGaussSeidel')\n" " - UnbuiltGaussSeidelConstraintSolver (if you were using this component while setting 'resolutionMethod=\"UnbuiltGaussSeidel\"')\n" " - NNCGConstraintSolver (if you were using this component while setting 'resolutionMethod=\"NonsmoothNonlinearConjugateGradient\"')\n" " --> For NNCGConstraintSolver, data 'newtonIterations' has been replaced by 'maxIterations'" diff --git a/Sofa/framework/Helper/src/sofa/helper/SelectableItem.h b/Sofa/framework/Helper/src/sofa/helper/SelectableItem.h index 215031ccdf9..1250fda6ccd 100644 --- a/Sofa/framework/Helper/src/sofa/helper/SelectableItem.h +++ b/Sofa/framework/Helper/src/sofa/helper/SelectableItem.h @@ -66,7 +66,7 @@ struct DeprecatedItem * * Example: * MAKE_SELECTABLE_ITEMS(ResolutionMethod, - * sofa::helper::Item{"BlockGaussSeidel", "Projected Gauss-Seidel"}, + * sofa::helper::Item{"BlockGaussSeidel", "Block Gauss-Seidel"}, * sofa::helper::Item{"UnbuiltGaussSeidel", "Gauss-Seidel no matrix assembly"}, * sofa::helper::Item{"NonsmoothNonlinearConjugateGradient", "Non-smooth non-linear conjugate gradient"} * );