Skip to content

Commit d7a697d

Browse files
bakpaulth-skamhugtalbotfredroyalxbilger
authored
[Constraints] Rename PGS into BlockGaussSeidel (#5804)
* Rename C++ symbols * Report change in C++ files * Apply changes to scenes * Apply suggestions from code review Co-authored-by: Themis Skamagkis <[email protected]> --------- Co-authored-by: Themis Skamagkis <[email protected]> Co-authored-by: Hugo <[email protected]> Co-authored-by: Frederick Roy <[email protected]> Co-authored-by: Alex Bilger <[email protected]>
1 parent f6576d8 commit d7a697d

File tree

45 files changed

+61
-61
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+61
-61
lines changed

Sofa/Component/AnimationLoop/src/sofa/component/animationloop/FreeMotionAnimationLoop.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@
4444
#include <sofa/simulation/CollisionVisitor.h>
4545
#include <sofa/simulation/SolveVisitor.h>
4646
#include <sofa/simulation/task/MainTaskSchedulerFactory.h>
47-
#include <sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.h>
47+
#include <sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.h>
4848

4949
#include <sofa/simulation/mechanicalvisitor/MechanicalVInitVisitor.h>
5050

51-
#include <sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.h>
51+
#include <sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.h>
5252
using sofa::simulation::mechanicalvisitor::MechanicalVInitVisitor;
5353

5454

@@ -71,7 +71,7 @@ using namespace core::behavior;
7171
using namespace sofa::simulation;
7272
using sofa::helper::ScopedAdvancedTimer;
7373

74-
using DefaultConstraintSolver = sofa::component::constraint::lagrangian::solver::ProjectedGaussSeidelConstraintSolver;
74+
using DefaultConstraintSolver = sofa::component::constraint::lagrangian::solver::BlockGaussSeidelConstraintSolver;
7575

7676
FreeMotionAnimationLoop::FreeMotionAnimationLoop() :
7777
d_solveVelocityConstraintFirst(initData(&d_solveVelocityConstraintFirst , false, "solveVelocityConstraintFirst", "solve separately velocity constraint violations before position constraint violations"))
@@ -104,7 +104,7 @@ void FreeMotionAnimationLoop::init()
104104
l_constraintSolver.set(this->getContext()->get<sofa::core::behavior::ConstraintSolver>(core::objectmodel::BaseContext::SearchDown));
105105
if (!l_constraintSolver)
106106
{
107-
if (const auto constraintSolver = sofa::core::objectmodel::New<constraint::lagrangian::solver::ProjectedGaussSeidelConstraintSolver>())
107+
if (const auto constraintSolver = sofa::core::objectmodel::New<constraint::lagrangian::solver::BlockGaussSeidelConstraintSolver>())
108108
{
109109
getContext()->addObject(constraintSolver);
110110
constraintSolver->setName( this->getContext()->getNameHelper().resolveName(constraintSolver->getClassName(), {}));

Sofa/Component/Constraint/Lagrangian/Model/tests/scenes_test/BilateralInteractionConstraint.scn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Node name="root" dt="0.001" gravity="0 -981 0">
33
<VisualStyle displayFlags="showForceFields" />
44
<FreeMotionAnimationLoop />
5-
<ProjectedGaussSeidelConstraintSolver maxIterations="100" tolerance="1e-3" />
5+
<BlockGaussSeidelConstraintSolver maxIterations="100" tolerance="1e-3" />
66
<CollisionPipeline depth="6" verbose="0" draw="0" />
77
<BruteForceBroadPhase/>
88
<BVHNarrowPhase/>

Sofa/Component/Constraint/Lagrangian/Solver/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ set(HEADER_FILES
1313
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/BuiltConstraintSolver.h
1414
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/ImprovedJacobiConstraintSolver.h
1515
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/NNCGConstraintSolver.h
16-
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/ProjectedGaussSeidelConstraintSolver.h
16+
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/BlockGaussSeidelConstraintSolver.h
1717
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/UnbuiltConstraintSolver.h
1818
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/UnbuiltGaussSeidelConstraintSolver.h
1919
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/LCPConstraintSolver.h
@@ -32,7 +32,7 @@ set(SOURCE_FILES
3232
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/BuiltConstraintSolver.cpp
3333
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/ImprovedJacobiConstraintSolver.cpp
3434
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/NNCGConstraintSolver.cpp
35-
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/ProjectedGaussSeidelConstraintSolver.cpp
35+
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/BlockGaussSeidelConstraintSolver.cpp
3636
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/UnbuiltConstraintSolver.cpp
3737
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/UnbuiltGaussSeidelConstraintSolver.cpp
3838
${SOFACOMPONENTCONSTRAINTLAGRANGIANSOLVER_SOURCE_DIR}/LCPConstraintSolver.cpp

Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.cpp renamed to Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Contact information: [email protected] *
2121
******************************************************************************/
2222

23-
#include <sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.h>
23+
#include <sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.h>
2424
#include <sofa/component/constraint/lagrangian/solver/GenericConstraintSolver.h>
2525
#include <sofa/helper/AdvancedTimer.h>
2626
#include <sofa/helper/ScopedAdvancedTimer.h>
@@ -30,7 +30,7 @@ namespace sofa::component::constraint::lagrangian::solver
3030
{
3131

3232

33-
void ProjectedGaussSeidelConstraintSolver::doSolve( GenericConstraintProblem * problem ,SReal timeout)
33+
void BlockGaussSeidelConstraintSolver::doSolve( GenericConstraintProblem * problem ,SReal timeout)
3434
{
3535
SCOPED_TIMER_VARNAME(gaussSeidelTimer, "ConstraintsGaussSeidel");
3636

@@ -200,7 +200,7 @@ void ProjectedGaussSeidelConstraintSolver::doSolve( GenericConstraintProblem * p
200200
}
201201
}
202202

203-
void ProjectedGaussSeidelConstraintSolver::gaussSeidel_increment(bool measureError, SReal *dfree, SReal *force, SReal **w, SReal tol, SReal *d, int dim, bool& constraintsAreVerified, SReal& error, std::vector<core::behavior::ConstraintResolution*>& constraintCorrections, sofa::type::vector<SReal>& tabErrors) const
203+
void BlockGaussSeidelConstraintSolver::gaussSeidel_increment(bool measureError, SReal *dfree, SReal *force, SReal **w, SReal tol, SReal *d, int dim, bool& constraintsAreVerified, SReal& error, std::vector<core::behavior::ConstraintResolution*>& constraintCorrections, sofa::type::vector<SReal>& tabErrors) const
204204
{
205205
for(int j=0; j<dim; ) // increment of j realized at the end of the loop
206206
{
@@ -284,10 +284,10 @@ void ProjectedGaussSeidelConstraintSolver::gaussSeidel_increment(bool measureErr
284284
}
285285

286286

287-
void registerProjectedGaussSeidelConstraintSolver(sofa::core::ObjectFactory* factory)
287+
void registerBlockGaussSeidelConstraintSolver(sofa::core::ObjectFactory* factory)
288288
{
289-
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")
290-
.add< ProjectedGaussSeidelConstraintSolver >());
289+
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")
290+
.add< BlockGaussSeidelConstraintSolver >());
291291
}
292292

293293

Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.h renamed to Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626

2727
namespace sofa::component::constraint::lagrangian::solver
2828
{
29-
class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER_API ProjectedGaussSeidelConstraintSolver : public BuiltConstraintSolver
29+
class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER_API BlockGaussSeidelConstraintSolver : public BuiltConstraintSolver
3030
{
3131
public:
32-
SOFA_CLASS(ProjectedGaussSeidelConstraintSolver, BuiltConstraintSolver);
32+
SOFA_CLASS(BlockGaussSeidelConstraintSolver, BuiltConstraintSolver);
3333

3434
protected:
3535
virtual void doSolve(GenericConstraintProblem * problem , SReal timeout = 0.0) override;

Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/NNCGConstraintSolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void NNCGConstraintSolver::doSolve(GenericConstraintProblem * problem , SReal ti
9191
sofa::type::vector<SReal> tabErrors(dimension);
9292

9393
{
94-
// perform one iteration of ProjectedGaussSeidel
94+
// perform one iteration of BlockGaussSeidel
9595
bool constraintsAreVerified = true;
9696

9797
std::copy_n(force, dimension, std::begin(problem->m_lam));

Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/NNCGConstraintSolver.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
******************************************************************************/
2222
#pragma once
2323

24-
#include <sofa/component/constraint/lagrangian/solver/ProjectedGaussSeidelConstraintSolver.h>
24+
#include <sofa/component/constraint/lagrangian/solver/BlockGaussSeidelConstraintSolver.h>
2525
#include <sofa/core/behavior/ConstraintResolution.h>
2626

2727
namespace sofa::component::constraint::lagrangian::solver
2828
{
29-
class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER_API NNCGConstraintSolver : public ProjectedGaussSeidelConstraintSolver
29+
class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER_API NNCGConstraintSolver : public BlockGaussSeidelConstraintSolver
3030
{
3131
public:
32-
SOFA_CLASS(NNCGConstraintSolver, ProjectedGaussSeidelConstraintSolver);
32+
SOFA_CLASS(NNCGConstraintSolver, BlockGaussSeidelConstraintSolver);
3333

3434
virtual void doSolve(GenericConstraintProblem * problem , SReal timeout = 0.0) override;
3535
};

Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace sofa::component::constraint::lagrangian::solver
2727
{
2828

2929
extern void registerNNCGConstraintSolver(sofa::core::ObjectFactory* factory);
30-
extern void registerProjectedGaussSeidelConstraintSolver(sofa::core::ObjectFactory* factory);
30+
extern void registerBlockGaussSeidelConstraintSolver(sofa::core::ObjectFactory* factory);
3131
extern void registerUnbuiltGaussSeidelConstraintSolver(sofa::core::ObjectFactory* factory);
3232
extern void registerLCPConstraintSolver(sofa::core::ObjectFactory* factory);
3333
extern void registerImprovedJacobiConstraintSolver(sofa::core::ObjectFactory* factory);
@@ -57,7 +57,7 @@ const char* getModuleVersion()
5757
void registerObjects(sofa::core::ObjectFactory* factory)
5858
{
5959
registerNNCGConstraintSolver(factory);
60-
registerProjectedGaussSeidelConstraintSolver(factory);
60+
registerBlockGaussSeidelConstraintSolver(factory);
6161
registerUnbuiltGaussSeidelConstraintSolver(factory);
6262
registerLCPConstraintSolver(factory);
6363
registerImprovedJacobiConstraintSolver(factory);

Sofa/Component/SolidMechanics/FEM/Elastic/tests/BaseTetrahedronFEMForceField_test.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class BaseTetrahedronFEMForceField_test : public sofa::testing::BaseTest
137137
Sofa.Component.Constraint.Projective
138138
});
139139

140-
simpleapi::createObject(m_root, "ProjectedGaussSeidelConstraintSolver", { {"tolerance", "1e-3"}, {"maxIt", "1000"} });
140+
simpleapi::createObject(m_root, "BlockGaussSeidelConstraintSolver", { {"tolerance", "1e-3"}, {"maxIt", "1000"} });
141141

142142
simpleapi::createObject(m_root, "RegularGridTopology", { {"name", "grid"},
143143
{"n", sofa::simpleapi::str(nbrGrid)}, {"min", "0 0 20"}, {"max", "10 40 30"} });

Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ std::map<std::string, ComponentChange, std::less<> > uncreatableComponents = {
626626

627627
{ "GenericConstraintSolver",
628628
ComponentChange().withCustomMessage("GenericConstraintSolver has been replaced since v25.12 by a set of new components, whose names relate to the method used:\n"
629-
" - ProjectedGaussSeidelConstraintSolver (if you were using this component without setting 'resolutionMethod' or by setting it to 'ProjectedGaussSeidel')\n"
629+
" - BlockGaussSeidelConstraintSolver (if you were using this component without setting 'resolutionMethod' or by setting it to 'BlockGaussSeidel')\n"
630630
" - UnbuiltGaussSeidelConstraintSolver (if you were using this component while setting 'resolutionMethod=\"UnbuiltGaussSeidel\"')\n"
631631
" - NNCGConstraintSolver (if you were using this component while setting 'resolutionMethod=\"NonsmoothNonlinearConjugateGradient\"')\n"
632632
" --> For NNCGConstraintSolver, data 'newtonIterations' has been replaced by 'maxIterations'"

0 commit comments

Comments
 (0)