Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
d9e3cbe
Introduce base integration schemes + acceleration based and velocity …
bakpaul Apr 29, 2026
d99e167
Remove ODESolvers
bakpaul Apr 29, 2026
03ce2ee
Fix last remnence of ODE + add BDF that doesn't work
bakpaul Apr 29, 2026
25ea0a7
Fix EulerImplicit + partially fix BDF, at least it matches Alex implem
bakpaul May 7, 2026
95c0f95
Update BDFIntegrationScheme.cpp
bakpaul May 7, 2026
05974d3
Added one more level of inheritance whith implicit/explicit integrati…
bakpaul May 12, 2026
a6336b1
Add Static solver
bakpaul May 12, 2026
39c4740
Add linear ùmultistep methods
bakpaul May 13, 2026
52a4fc2
Bring back forward solvers
bakpaul May 13, 2026
1661f3b
Add explicit solvers
bakpaul May 19, 2026
d09a53e
Rename implicit solvers using IntegrationScheme
bakpaul May 20, 2026
b3a214a
Fix part of instability in freemotion + remove unnecessary clear
bakpaul May 22, 2026
1b5d276
Better usage of vop and mop
bakpaul May 26, 2026
4f38bf9
Clean and add comments
bakpaul May 26, 2026
03745b6
Fix instability by computing RHS before LHS
bakpaul May 27, 2026
2ef4b34
Add first order capability to velocity-based IS
bakpaul May 27, 2026
62b94ba
changed iteration parameter into a bool instead of a number
bakpaul May 27, 2026
8d2381d
Fix condition for rayleigh damping in the RHS
bakpaul May 27, 2026
3b8f6ff
Implement the trapezoid scheme
bakpaul May 27, 2026
e9b67c3
Refactor IS order getter to explicit the time characteristic
bakpaul May 27, 2026
7402333
Use right mop and vop in static solver
bakpaul May 27, 2026
b976fb5
Rename residue estimation method
bakpaul May 28, 2026
5b20745
Fix compilation
bakpaul Jun 10, 2026
764317c
Add Newton solver to StaticEquilibriumIS
bakpaul Jun 10, 2026
1dbf9cd
fix typo in comment
bakpaul Jun 10, 2026
962bcea
Fix scenes
bakpaul Jun 10, 2026
bf75461
Apply changes from #6087
bakpaul Jun 10, 2026
3208398
Fix compilation
bakpaul Jun 10, 2026
945d468
fix more scenes
bakpaul Jun 11, 2026
4b10ac0
Fix compilation
bakpaul Jun 11, 2026
efcf365
Fix requiredPlugins
bakpaul Jun 11, 2026
f14fe2b
Change base class name according to review
bakpaul Jun 16, 2026
116fc7f
Add compat layer for both C++ and CMake
bakpaul Jun 17, 2026
c8412eb
<Remove s from IntegrationSchemeS
bakpaul Jun 17, 2026
4517f33
Sort compat file more properly
bakpaul Jun 17, 2026
991de11
Add new feature to alway move forward in newton + fir one unit test
bakpaul Jun 18, 2026
8feefd2
Fix module name when loading plugin
bakpaul Jun 22, 2026
ce4657d
Fix CG crash
bakpaul Jul 2, 2026
620832b
Explicit are not linearSolver accessor by default because one is not …
bakpaul Jul 17, 2026
915c98c
Remove explicit solvers under implicit ones because they are prune an…
bakpaul Jul 17, 2026
ded1163
Fix some scenes
bakpaul Jul 17, 2026
d48a9f0
Fix another scene
bakpaul Jul 17, 2026
f494749
Fix a bunch on scenes
bakpaul Jul 20, 2026
27df90c
Fix some regression tests
bakpaul Jul 21, 2026
0410b12
Fix condition in VelBAsed
bakpaul Jul 21, 2026
65bbe06
Fix conditions
bakpaul Jul 22, 2026
a95b8d6
REVERT previous commit on some unwanted changes
bakpaul Jul 22, 2026
4fee97e
Fix some regression tests
bakpaul Jul 22, 2026
cbb3927
Fix some unit tests
bakpaul Jul 22, 2026
6ad3541
Fix LHS for first order + fix diffusion test
bakpaul Jul 23, 2026
406673f
Fix strange behavior with interaciton springs
bakpaul Jul 27, 2026
a2fae00
Add data in velocityBasedIS to compute acceleration at the end of tim…
bakpaul Jul 27, 2026
138c071
Stop propagating old states
bakpaul Jul 27, 2026
9796593
Take @alxbilger comments into account
bakpaul Jul 28, 2026
097232d
Take @alxbilger comments into account
bakpaul Jul 28, 2026
e02ba1c
Refactor all comment/indications of API methods and base classes
bakpaul Jul 29, 2026
2e65334
Mdify componant change messahe for NewtonRaphsonSolver
bakpaul Jul 29, 2026
bd3703e
Update unit test values for LCPForceFeedback
bakpaul Jul 30, 2026
72b8f17
Try to fix Windows compilation
bakpaul Jul 30, 2026
35c6d0d
Add deterministic doc link, working once teh documentation has been u…
bakpaul Jul 31, 2026
9e3323e
Fix newly introduced scene
bakpaul Jul 31, 2026
6ecaee3
Initialize properly attribute
bakpaul Aug 24, 2026
cbc5cc4
Fix link name in EulerExplicit to ensure backward compat
bakpaul Aug 24, 2026
7d8e35c
Avoid overflow
bakpaul Aug 24, 2026
2010472
Add early return for order overflow
bakpaul Aug 24, 2026
e1ef9ed
fix uncompiled code
bakpaul Aug 24, 2026
92e88e3
Various small fixes
bakpaul Aug 24, 2026
ccb465e
Now lambda are real forces and not impulsion anymore
bakpaul Aug 24, 2026
19e7fb8
Add propagation of states after updating them to ensure mapped FF wil…
bakpaul Aug 24, 2026
10bb2c6
Fix armijo condition as it was mixing energy-based cost funcction def…
bakpaul Aug 24, 2026
56c0427
Replace the test on time with a state test to enable reloading of scenes
bakpaul Aug 26, 2026
d0942af
Fix novmultiop compilaiton
bakpaul Aug 26, 2026
6226bb1
FIX Typos
bakpaul Aug 26, 2026
f98a7a0
Refactorize the compatibility layer to still offer the libs Sofa.Comp…
bakpaul Aug 26, 2026
17e888d
Add warning concerning the force now being real forces in LCPForceFee…
bakpaul Aug 26, 2026
1034149
Change logic to avoid unnecessary computation at first timestep + com…
bakpaul Aug 26, 2026
312f8e2
WIP try to understand why damping is not right
bakpaul Aug 27, 2026
801d837
Fix unit tests
bakpaul Aug 28, 2026
8b8cd38
Fix incoherencies in Uncouples constraint corrections
bakpaul Aug 31, 2026
4cd35af
Add warning to tell user to update their compliance value
bakpaul Aug 31, 2026
f0e051c
Fix some factors in explicit schemes
bakpaul Aug 28, 2026
d5f0b1e
Fix lambda being impulsion in precomputed
bakpaul Aug 28, 2026
63791df
Rollback the propagation of states in the I as animation loops are al…
bakpaul Sep 1, 2026
0f4fa8d
Uncoupled now throws info not warning
bakpaul Sep 1, 2026
4692959
Fix last regression on SofaScene
bakpaul Sep 1, 2026
e9c3974
Fix first order in term of solving a first order ODE instead of remov…
bakpaul Sep 9, 2026
8199aa4
Merge branch 'master' into 26_05_introduce_integration_schemes
bakpaul Sep 16, 2026
0b85117
Apply batched suggestions from code review
bakpaul Sep 16, 2026
1bba7d9
Merge branch 'master' into 26_05_introduce_integration_schemes
fredroy Sep 17, 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 @@ -23,7 +23,8 @@
#include <sofa/component/constraint/lagrangian/correction/config.h>

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

Expand Down Expand Up @@ -69,7 +70,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 +198,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