Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
88df164
Introduce base integration schemes + acceleration based and velocity …
bakpaul Apr 29, 2026
4009edb
Remove ODESolvers
bakpaul Apr 29, 2026
93acafe
Fix last remnence of ODE + add BDF that doesn't work
bakpaul Apr 29, 2026
74e2f63
Fix EulerImplicit + partially fix BDF, at least it matches Alex implem
bakpaul May 7, 2026
141ed46
Update BDFIntegrationScheme.cpp
bakpaul May 7, 2026
278b051
Added one more level of inheritance whith implicit/explicit integrati…
bakpaul May 12, 2026
8c51b67
Add Static solver
bakpaul May 12, 2026
45fe6ac
Add linear ùmultistep methods
bakpaul May 13, 2026
ee82a15
Bring back forward solvers
bakpaul May 13, 2026
9da1a65
Add explicit solvers
bakpaul May 19, 2026
c715b1f
Rename implicit solvers using IntegrationScheme
bakpaul May 20, 2026
8eb11ed
Fix part of instability in freemotion + remove unnecessary clear
bakpaul May 22, 2026
058dfc2
Better usage of vop and mop
bakpaul May 26, 2026
826010d
Clean and add comments
bakpaul May 26, 2026
7983758
Fix instability by computing RHS before LHS
bakpaul May 27, 2026
6641858
Add first order capability to velocity-based IS
bakpaul May 27, 2026
43b6a0b
changed iteration parameter into a bool instead of a number
bakpaul May 27, 2026
c7e213d
Fix condition for rayleigh damping in the RHS
bakpaul May 27, 2026
3807a7e
Implement the trapezoid scheme
bakpaul May 27, 2026
1528ebf
Refactor IS order getter to explicit the time characteristic
bakpaul May 27, 2026
5e99b23
Use right mop and vop in static solver
bakpaul May 27, 2026
dbc0b51
Rename residue estimation method
bakpaul May 28, 2026
0de0186
Fix compilation
bakpaul Jun 10, 2026
56ffcea
Add Newton solver to StaticEquilibriumIS
bakpaul Jun 10, 2026
6bbda49
fix typo in comment
bakpaul Jun 10, 2026
40a2b44
Fix scenes
bakpaul Jun 10, 2026
39bd940
Apply changes from #6087
bakpaul Jun 10, 2026
1b3323a
Fix compilation
bakpaul Jun 10, 2026
ba786b0
fix more scenes
bakpaul Jun 11, 2026
4c58c59
Fix compilation
bakpaul Jun 11, 2026
9192802
Fix requiredPlugins
bakpaul Jun 11, 2026
e1fe9dc
Change base class name according to review
bakpaul Jun 16, 2026
3e18339
Add compat layer for both C++ and CMake
bakpaul Jun 17, 2026
d6cc7f9
<Remove s from IntegrationSchemeS
bakpaul Jun 17, 2026
401126f
Sort compat file more properly
bakpaul Jun 17, 2026
c6c0385
Add new feature to alway move forward in newton + fir one unit test
bakpaul Jun 18, 2026
25e7c5d
Fix module name when loading plugin
bakpaul Jun 22, 2026
811c5f4
Fix CG crash
bakpaul Jul 2, 2026
0c567b9
Explicit are not linearSolver accessor by default because one is not …
bakpaul Jul 17, 2026
b7a61db
Remove explicit solvers under implicit ones because they are prune an…
bakpaul Jul 17, 2026
b29a60a
Fix some scenes
bakpaul Jul 17, 2026
66d14a8
Fix another scene
bakpaul Jul 17, 2026
12aa9c0
Fix a bunch on scenes
bakpaul Jul 20, 2026
c3cacfc
Fix some regression tests
bakpaul Jul 21, 2026
80ec988
Fix condition in VelBAsed
bakpaul Jul 21, 2026
c878322
Fix conditions
bakpaul Jul 22, 2026
cc3ab34
REVERT previous commit on some unwanted changes
bakpaul Jul 22, 2026
e58801e
Fix some regression tests
bakpaul Jul 22, 2026
41445eb
Fix some unit tests
bakpaul Jul 22, 2026
39996f8
Fix LHS for first order + fix diffusion test
bakpaul Jul 23, 2026
be85fc5
Fix strange behavior with interaciton springs
bakpaul Jul 27, 2026
fd30330
Add data in velocityBasedIS to compute acceleration at the end of tim…
bakpaul Jul 27, 2026
2ce2b95
Stop propagating old states
bakpaul Jul 27, 2026
bbfdf9b
Take @alxbilger comments into account
bakpaul Jul 28, 2026
768b525
Take @alxbilger comments into account
bakpaul Jul 28, 2026
c81ece3
Refactor all comment/indications of API methods and base classes
bakpaul Jul 29, 2026
38910dd
Mdify componant change messahe for NewtonRaphsonSolver
bakpaul Jul 29, 2026
3f7af3b
Update unit test values for LCPForceFeedback
bakpaul Jul 30, 2026
b826e81
Try to fix Windows compilation
bakpaul Jul 30, 2026
43a54f7
Add deterministic doc link, working once teh documentation has been u…
bakpaul Jul 31, 2026
7295d55
Fix newly introduced scene
bakpaul Jul 31, 2026
19a8c68
Initialize properly attribute
bakpaul Aug 24, 2026
5943400
Fix link name in EulerExplicit to ensure backward compat
bakpaul Aug 24, 2026
c8e4ee7
Avoid overflow
bakpaul Aug 24, 2026
7af9e6c
Add early return for order overflow
bakpaul Aug 24, 2026
ce948aa
fix uncompiled code
bakpaul Aug 24, 2026
3fb9218
Various small fixes
bakpaul Aug 24, 2026
2006425
Now lambda are real forces and not impulsion anymore
bakpaul Aug 24, 2026
118355f
Add propagation of states after updating them to ensure mapped FF wil…
bakpaul Aug 24, 2026
9e3389c
Fix armijo condition as it was mixing energy-based cost funcction def…
bakpaul Aug 24, 2026
f20b552
Replace the test on time with a state test to enable reloading of scenes
bakpaul Aug 26, 2026
c0f5ab6
Fix novmultiop compilaiton
bakpaul Aug 26, 2026
84c2cf1
FIX Typos
bakpaul Aug 26, 2026
3e39e75
Refactorize the compatibility layer to still offer the libs Sofa.Comp…
bakpaul Aug 26, 2026
4361099
Add warning concerning the force now being real forces in LCPForceFee…
bakpaul Aug 26, 2026
dbf82cf
Change logic to avoid unnecessary computation at first timestep + com…
bakpaul Aug 26, 2026
8be0c88
WIP try to understand why damping is not right
bakpaul Aug 27, 2026
4286780
Fix unit tests
bakpaul Aug 28, 2026
88cac6c
Fix incoherencies in Uncouples constraint corrections
bakpaul Aug 31, 2026
552cee5
Add warning to tell user to update their compliance value
bakpaul Aug 31, 2026
dd3e467
Fix some factors in explicit schemes
bakpaul Aug 28, 2026
17d3171
Fix lambda being impulsion in precomputed
bakpaul Aug 28, 2026
f4d9331
Rollback the propagation of states in the I as animation loops are al…
bakpaul Sep 1, 2026
162cb5c
Uncoupled now throws info not warning
bakpaul Sep 1, 2026
4ba33a1
Fix last regression on SofaScene
bakpaul Sep 1, 2026
96ebd4e
Fix first order in term of solving a first order ODE instead of remov…
bakpaul Sep 9, 2026
3a8fa53
Apply batched suggestions from code review
bakpaul Sep 16, 2026
9558a65
Apply @alxbilger suggestion
bakpaul Sep 21, 2026
773ad56
Add option to go back to impulse-based computation
bakpaul Sep 21, 2026
648c55d
Merge branch 'master' into 26_05_introduce_integration_schemes
hugtalbot Sep 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SOFA_HEADER_DEPRECATED_NOT_REPLACED("v26.06", "v26.12")
#include <sofa/core/MultiVecId.h>
#include <sofa/core/VecId.h>
#include <sofa/core/behavior/BaseConstraintCorrection.h>
#include <sofa/core/behavior/OdeSolver.h>
#include <sofa/core/behavior/BaseIntegrationScheme.h>
#include <sofa/core/ConstraintParams.h>
#include <sofa/core/fwd.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,6 @@ void FreeMotionAnimationLoop::step(const sofa::core::ExecParams* params, SReal d

dmsg_info() << "beginVisitor performed - SolveVisitor for freeMotion is called" ;

// Mapping geometric stiffness coming from previous lambda.
{
SCOPED_TIMER("lambdaMultInvDt");
MechanicalVOpVisitor lambdaMultInvDt(params, cparams.lambda(), sofa::core::ConstMultiVecId::null(), cparams.lambda(), 1.0 / dt);
lambdaMultInvDt.setMapped(true);
node->executeVisitor(&lambdaMultInvDt);
}

{
SCOPED_TIMER("MechanicalComputeGeometricStiffness");
MechanicalComputeGeometricStiffness geometricStiffnessVisitor(&mop.mparams, cparams.lambda());
Expand Down
3 changes: 2 additions & 1 deletion Sofa/Component/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ set(SOFACOMPONENT_SOURCE_DIR "src/sofa/component")

sofa_add_subdirectory_modules(SOFACOMPONENT_TARGETS
DIRECTORIES
ODESolver
IO
Playback
SceneUtility
Topology
Visual
LinearSystem
IntegrationScheme
LinearSolver
Mass
ODESolver
Diffusion
Mapping
StateContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ set(SOURCE_FILES
sofa_find_package(Sofa.Simulation.Core REQUIRED)
sofa_find_package(Sofa.Component.Mass REQUIRED) # UncoupledCC needs UniformMass
sofa_find_package(Sofa.Component.LinearSolver.Iterative REQUIRED) # PrecomputedCC needs CGLinearSolver
sofa_find_package(Sofa.Component.ODESolver.Backward REQUIRED) # PrecomputedCC needs EulerSolver
sofa_find_package(Sofa.Component.IntegrationScheme.Backward REQUIRED) # PrecomputedCC needs EulerSolver

add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Simulation.Core)
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Component.Mass)
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Component.LinearSolver.Iterative)
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Component.ODESolver.Backward)
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Component.IntegrationScheme.Backward)

sofa_create_package_with_targets(
PACKAGE_NAME ${PROJECT_NAME}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ find_package(Sofa.Config QUIET REQUIRED)
sofa_find_package(Sofa.Simulation.Core QUIET REQUIRED)
sofa_find_package(Sofa.Component.Mass QUIET REQUIRED)
sofa_find_package(Sofa.Component.LinearSolver.Iterative QUIET REQUIRED)
sofa_find_package(Sofa.Component.ODESolver.Backward QUIET REQUIRED)
sofa_find_package(Sofa.Component.IntegrationScheme.Backward QUIET REQUIRED)

if(NOT TARGET @PROJECT_NAME@)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <sofa/component/constraint/lagrangian/correction/GenericConstraintCorrection.h>
#include <sofa/simulation/mechanicalvisitor/MechanicalIntegrateConstraintVisitor.h>
#include <sofa/core/behavior/OdeSolver.h>
#include <sofa/core/behavior/BaseIntegrationScheme.h>
#include <sofa/core/ObjectFactory.h>
#include <sofa/core/behavior/ConstraintSolver.h>
#include <sofa/core/behavior/LinearSolver.h>
Expand Down Expand Up @@ -94,10 +94,10 @@ void GenericConstraintCorrection::init()
{
msg_info() << "Link \"ODESolver\" to the desired ODE solver should be set to ensure right behavior." << msgendl
<< "First ODESolver found in current context will be used.";
l_ODESolver.set( context->get<sofa::core::behavior::OdeSolver>(BaseContext::Local) );
l_ODESolver.set( context->get< sofa::core::behavior::BaseIntegrationScheme>(BaseContext::Local) );
if (l_ODESolver.get() == nullptr)
{
l_ODESolver.set( context->get<sofa::core::behavior::OdeSolver>(BaseContext::SearchRoot) );
l_ODESolver.set( context->get< sofa::core::behavior::BaseIntegrationScheme>(BaseContext::SearchRoot) );
}
}

Expand Down Expand Up @@ -138,7 +138,7 @@ void GenericConstraintCorrection::addComplianceInConstraintSpace(const Constrain
if (!l_ODESolver.get()) return;
const SReal complianceFactor = d_complianceFactor.getValue();

// use the OdeSolver to get the integration factor
// use the IntegrationScheme to get the integration factor
SReal factor = BaseConstraintCorrection::correctionFactor(l_ODESolver.get(), cparams->constOrder());
factor *= complianceFactor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_CORRECTION_API GenericConstraintCorre
void resetContactForce() override;

SingleLink<GenericConstraintCorrection, sofa::core::behavior::LinearSolver, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_linearSolver; ///< Link towards the linear solver used to compute the compliance matrix, requiring the inverse of the linear system matrix
SingleLink<GenericConstraintCorrection, sofa::core::behavior::OdeSolver, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_ODESolver; ///< Link towards the ODE solver used to recover the integration factors
SingleLink<GenericConstraintCorrection, sofa::core::behavior::BaseIntegrationScheme, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_ODESolver; ///< Link towards the ODE solver used to recover the integration factors
Data< SReal > d_complianceFactor; ///< Factor applied to the position factor and velocity factor used to calculate compliance matrix
Data< SReal > d_regularizationTerm; ///< add regularizationTerm*Id to W when solving for constraints

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <sofa/core/behavior/ConstraintCorrection.h>

#include <sofa/core/behavior/OdeSolver.h>
#include <sofa/core/behavior/BaseIntegrationScheme.h>
#include <sofa/core/behavior/LinearSolver.h>

#include <sofa/type/Mat.h>
Expand Down Expand Up @@ -95,7 +95,7 @@ class LinearSolverConstraintCorrection : public sofa::core::behavior::Constraint
Data< bool > wire_optimization; ///< constraints are reordered along a wire-like topology (from tip to base)
Data< SReal > d_regularizationTerm; ///< add regularization*Id to W when solving for constraints
SingleLink<LinearSolverConstraintCorrection, sofa::core::behavior::LinearSolver, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_linearSolver; ///< Link towards the linear solver used to compute the compliance matrix, requiring the inverse of the linear system matrix
SingleLink<LinearSolverConstraintCorrection, sofa::core::behavior::OdeSolver, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_ODESolver; ///< Link towards the ODE solver used to recover the integration factors
SingleLink<LinearSolverConstraintCorrection, sofa::core::behavior::BaseIntegrationScheme, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_ODESolver; ///< Link towards the ODE solver used to recover the integration factors

void verify_constraints();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ void LinearSolverConstraintCorrection<DataTypes>::init()
{
msg_info() << "Link \"ODESolver\" to the desired ODE solver should be set to ensure right behavior." << msgendl
<< "First ODESolver found in current context will be used.";
l_ODESolver.set( context->get<sofa::core::behavior::OdeSolver>(sofa::core::objectmodel::BaseContext::Local) );
l_ODESolver.set( context->get< sofa::core::behavior::BaseIntegrationScheme>(sofa::core::objectmodel::BaseContext::Local) );
if (l_ODESolver.get() == nullptr)
{
l_ODESolver.set( context->get<sofa::core::behavior::OdeSolver>(sofa::core::objectmodel::BaseContext::SearchRoot) );
l_ODESolver.set( context->get< sofa::core::behavior::BaseIntegrationScheme>(sofa::core::objectmodel::BaseContext::SearchRoot) );
}
}

Expand Down Expand Up @@ -192,7 +192,7 @@ void LinearSolverConstraintCorrection<DataTypes>::addComplianceInConstraintSpace
if(d_componentState.getValue() != ComponentState::Valid)
return ;

// use the OdeSolver to get the position integration factor
// use the IntegrationScheme to get the position integration factor
const SReal factor = core::behavior::BaseConstraintCorrection::correctionFactor(l_ODESolver.get(), cparams->constOrder());

// J is read from the mechanical state and converted to m_constraintJacobian
Expand Down Expand Up @@ -373,10 +373,10 @@ void LinearSolverConstraintCorrection<DataTypes>::applyContactForce(const linear

//TODO: tell the solver not to recompute the matrix

// use the OdeSolver to get the position integration factor
// use the IntegrationScheme to get the position integration factor
const SReal positionFactor = l_ODESolver.get()->getPositionIntegrationFactor();

// use the OdeSolver to get the position integration factor
// use the IntegrationScheme to get the position integration factor
const SReal velocityFactor = l_ODESolver.get()->getVelocityIntegrationFactor();

Data<VecCoord>& xData = *mstate->write(core::vec_id::write_access::position);
Expand Down Expand Up @@ -689,7 +689,7 @@ void LinearSolverConstraintCorrection<DataTypes>::getBlockDiagonalCompliance(lin
if(d_componentState.getValue() != ComponentState::Valid)
return ;

// use the OdeSolver to get the position integration factor
// use the IntegrationScheme to get the position integration factor
const SReal factor = l_ODESolver.get()->getPositionIntegrationFactor(); //*m_ODESolver->getPositionIntegrationFactor(); // dt*dt

const unsigned int numDOFs = mstate->getSize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@
******************************************************************************/
#pragma once
#include <sofa/component/constraint/lagrangian/correction/config.h>

#include <sofa/core/behavior/BaseIntegrationScheme.h>
#include <sofa/core/behavior/ConstraintCorrection.h>
#include <sofa/component/odesolver/backward/EulerImplicitSolver.h>
#include <sofa/core/behavior/LinearSolver.h>
#include <sofa/core/objectmodel/DataFileName.h>

#include <sofa/linearalgebra/FullMatrix.h>

#include <sofa/type/Mat.h>
#include <sofa/type/Vec.h>
#include <sofa/component/integrationscheme/backward/EulerImplicitIntegrationScheme.h>

namespace sofa::component::constraint::lagrangian::correction
{
Expand Down Expand Up @@ -69,7 +67,7 @@ class PrecomputedConstraintCorrection : public sofa::core::behavior::ConstraintC
sofa::core::objectmodel::DataFileName d_fileCompliance; ///< Precomputed compliance matrix data file
Data<std::string> d_fileDir; ///< If not empty, the compliance will be saved in this repertory

SingleLink<PrecomputedConstraintCorrection, sofa::component::odesolver::backward::EulerImplicitSolver, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_odeSolver; ///< Link towards the EulerImplicit solver used during the compliance precomputation. If unset, the first OdeSolver found in the current context is used.
SingleLink<PrecomputedConstraintCorrection, sofa::component::integrationscheme::backward::EulerImplicitIntegrationScheme, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_odeSolver; ///< Link towards the EulerImplicit solver used during the compliance precomputation. If unset, the first OdeSolver found in the current context is used.
SingleLink<PrecomputedConstraintCorrection, sofa::core::behavior::LinearSolver, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_linearSolver; ///< Link towards the linear solver used during the compliance precomputation. If unset, the first LinearSolver found in the current context is used.

protected:
Expand Down Expand Up @@ -197,6 +195,15 @@ class PrecomputedConstraintCorrection : public sofa::core::behavior::ConstraintC
void computeDx(Data<VecDeriv>& dx, const Data< VecDeriv > &f, const std::list< int > &activeDofs);

std::list< int > m_activeDofs;

/// Integration scheme found in the context, used to scale the compliance and the corrections
sofa::core::behavior::BaseIntegrationScheme* m_pIntegrationScheme { nullptr };

/// Position integration factor of the integration scheme (falls back to the implicit Euler factor if no scheme was found)
SReal getPositionIntegrationFactor() const;

/// Velocity integration factor of the integration scheme (falls back to the implicit Euler factor if no scheme was found)
SReal getVelocityIntegrationFactor() const;
};


Expand Down
Loading
Loading