Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
5b79699
Introduce base integration schemes + acceleration based and velocity …
bakpaul Apr 29, 2026
f39b8a8
Remove ODESolvers
bakpaul Apr 29, 2026
9969aed
Fix last remnence of ODE + add BDF that doesn't work
bakpaul Apr 29, 2026
7c1e992
Fix EulerImplicit + partially fix BDF, at least it matches Alex implem
bakpaul May 7, 2026
eb626c5
Update BDFIntegrationScheme.cpp
bakpaul May 7, 2026
7f5a505
Added one more level of inheritance whith implicit/explicit integrati…
bakpaul May 12, 2026
37af3d3
Add Static solver
bakpaul May 12, 2026
4498130
Add linear ùmultistep methods
bakpaul May 13, 2026
14ce84d
Bring back forward solvers
bakpaul May 13, 2026
d3e4b30
Add explicit solvers
bakpaul May 19, 2026
91686df
Rename implicit solvers using IntegrationScheme
bakpaul May 20, 2026
8824483
Fix part of instability in freemotion + remove unnecessary clear
bakpaul May 22, 2026
eb607a0
Better usage of vop and mop
bakpaul May 26, 2026
fd175f0
Clean and add comments
bakpaul May 26, 2026
411f3ba
Fix instability by computing RHS before LHS
bakpaul May 27, 2026
ba601bd
Add first order capability to velocity-based IS
bakpaul May 27, 2026
894324b
changed iteration parameter into a bool instead of a number
bakpaul May 27, 2026
15a8bfa
Fix condition for rayleigh damping in the RHS
bakpaul May 27, 2026
0158e37
Implement the trapezoid scheme
bakpaul May 27, 2026
b0ef805
Refactor IS order getter to explicit the time characteristic
bakpaul May 27, 2026
71fca82
Use right mop and vop in static solver
bakpaul May 27, 2026
cc85d26
Rename residue estimation method
bakpaul May 28, 2026
ae374bd
Fix compilation
bakpaul Jun 10, 2026
fe570ab
Add Newton solver to StaticEquilibriumIS
bakpaul Jun 10, 2026
86bfe67
fix typo in comment
bakpaul Jun 10, 2026
ee9f6b0
Fix scenes
bakpaul Jun 10, 2026
de2b26a
Apply changes from #6087
bakpaul Jun 10, 2026
13ab889
Fix compilation
bakpaul Jun 10, 2026
652d9ff
fix more scenes
bakpaul Jun 11, 2026
d1172df
Fix compilation
bakpaul Jun 11, 2026
cf5d915
Fix requiredPlugins
bakpaul Jun 11, 2026
22d5b91
Change base class name according to review
bakpaul Jun 16, 2026
d2aa57c
Add compat layer for both C++ and CMake
bakpaul Jun 17, 2026
9b23485
<Remove s from IntegrationSchemeS
bakpaul Jun 17, 2026
df2aabc
Sort compat file more properly
bakpaul Jun 17, 2026
a3d7005
Add new feature to alway move forward in newton + fir one unit test
bakpaul Jun 18, 2026
5eee9c9
Fix module name when loading plugin
bakpaul Jun 22, 2026
c0cff33
Fix CG crash
bakpaul Jul 2, 2026
a6b7d92
Explicit are not linearSolver accessor by default because one is not …
bakpaul Jul 17, 2026
607eb5d
Remove explicit solvers under implicit ones because they are prune an…
bakpaul Jul 17, 2026
3195b85
Fix some scenes
bakpaul Jul 17, 2026
2da5bc7
Fix another scene
bakpaul Jul 17, 2026
002a85e
Fix a bunch on scenes
bakpaul Jul 20, 2026
20ea39b
Fix some regression tests
bakpaul Jul 21, 2026
ec1e782
Fix condition in VelBAsed
bakpaul Jul 21, 2026
221303a
Fix conditions
bakpaul Jul 22, 2026
5a31dba
REVERT previous commit on some unwanted changes
bakpaul Jul 22, 2026
e144d87
Fix some regression tests
bakpaul Jul 22, 2026
fb17851
Fix some unit tests
bakpaul Jul 22, 2026
6149ce9
Fix LHS for first order + fix diffusion test
bakpaul Jul 23, 2026
3f3d940
Fix strange behavior with interaciton springs
bakpaul Jul 27, 2026
64256dc
Add data in velocityBasedIS to compute acceleration at the end of tim…
bakpaul Jul 27, 2026
3232f9b
Stop propagating old states
bakpaul Jul 27, 2026
d1a4f1e
Take @alxbilger comments into account
bakpaul Jul 28, 2026
88046e2
Take @alxbilger comments into account
bakpaul Jul 28, 2026
50d0e71
Refactor all comment/indications of API methods and base classes
bakpaul Jul 29, 2026
f02b6a9
Mdify componant change messahe for NewtonRaphsonSolver
bakpaul Jul 29, 2026
df57b24
Update unit test values for LCPForceFeedback
bakpaul Jul 30, 2026
115cb8a
Try to fix Windows compilation
bakpaul Jul 30, 2026
b2705a8
Add deterministic doc link, working once teh documentation has been u…
bakpaul Jul 31, 2026
7038e4a
Fix newly introduced scene
bakpaul Jul 31, 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
2 changes: 1 addition & 1 deletion Sofa/Component/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ set(SOFACOMPONENT_SOURCE_DIR "src/sofa/component")

sofa_add_subdirectory_modules(SOFACOMPONENT_TARGETS
DIRECTORIES
ODESolver
IO
Playback
SceneUtility
Topology
Visual
LinearSystem
IntegrationScheme
LinearSolver
Mass
Diffusion
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 @@ -27,7 +27,7 @@
#include <sofa/simulation/Node.h>
#include <sofa/simulation/MechanicalVisitor.h>

#include <sofa/component/odesolver/backward/EulerImplicitSolver.h>
#include <sofa/component/integrationscheme/backward/EulerImplicitIntegrationScheme.h>

#include <sofa/linearalgebra/SparseMatrix.h>
#include <sofa/component/linearsolver/iterative/CGLinearSolver.h>
Expand Down Expand Up @@ -287,7 +287,7 @@ void PrecomputedConstraintCorrection<DataTypes>::bwdInit()
static constexpr sofa::type::Vec3 gravity_zero(0_sreal, 0_sreal, 0_sreal);
this->getContext()->setGravity(gravity_zero);

sofa::component::odesolver::backward::EulerImplicitSolver* eulerSolver;
sofa::component::integrationscheme::backward::EulerImplicitIntegrationScheme* eulerSolver;
sofa::component::linearsolver::iterative::CGLinearSolver< sofa::component::linearsolver::GraphScatteredMatrix, sofa::component::linearsolver::GraphScatteredVector >* cgLinearSolver;
core::behavior::LinearSolver* linearSolver;

Expand All @@ -297,19 +297,19 @@ void PrecomputedConstraintCorrection<DataTypes>::bwdInit()

if (eulerSolver && cgLinearSolver)
{
msg_info() << "use EulerImplicitSolver & CGLinearSolver" ;
msg_info() << "use EulerImplicitIntegrationScheme & CGLinearSolver" ;
}
else if (eulerSolver && linearSolver)
{
msg_info() << "use EulerImplicitSolver & LinearSolver";
msg_info() << "use EulerImplicitIntegrationScheme & LinearSolver";
}
else if(eulerSolver)
{
msg_info() << "use EulerImplicitSolver";
msg_info() << "use EulerImplicitIntegrationScheme";
}
else
{
msg_error() << "PrecomputedContactCorrection must be associated with EulerImplicitSolver+LinearSolver for the precomputation\nNo Precomputation" ;
msg_error() << "PrecomputedContactCorrection must be associated with EulerImplicitIntegrationScheme+LinearSolver for the precomputation\nNo Precomputation" ;
return;
}

Expand Down Expand Up @@ -345,7 +345,7 @@ void PrecomputedConstraintCorrection<DataTypes>::bwdInit()
/// (avoid to have a line of 0 at the top of the matrix)
if (eulerSolver)
{
eulerSolver->solve(core::execparams::defaultInstance(), dt, core::vec_id::write_access::position, core::vec_id::write_access::velocity);
eulerSolver->integrate(core::execparams::defaultInstance(), dt, core::vec_id::write_access::position, core::vec_id::write_access::velocity);
}

Deriv unitary_force;
Expand Down Expand Up @@ -380,7 +380,7 @@ void PrecomputedConstraintCorrection<DataTypes>::bwdInit()
{
fact *= eulerSolver->getPositionIntegrationFactor(); // here, we compute a compliance

eulerSolver->solve(core::execparams::defaultInstance(), dt, core::vec_id::write_access::position, core::vec_id::write_access::velocity);
eulerSolver->integrate(core::execparams::defaultInstance(), dt, core::vec_id::write_access::position, core::vec_id::write_access::velocity);
}

for (unsigned int v = 0; v < nbNodes; v++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_CORRECTION_API void UncoupledConstraintCorr

double odeFactor = 1.0;

this->getContext()->get(m_pOdeSolver);
if (!m_pOdeSolver)
this->getContext()->get(m_pIntegrationScheme);
if (!m_pIntegrationScheme)
{
if (d_useOdeSolverIntegrationFactors.getValue() == true)
if (d_useIntegrationSchemeIntegrationFactors.getValue() == true)
{
msg_error() << "Can't find any odeSolver";
d_useOdeSolverIntegrationFactors.setValue(false);
d_useIntegrationSchemeIntegrationFactors.setValue(false);
}
d_useOdeSolverIntegrationFactors.setReadOnly(true);
d_useIntegrationSchemeIntegrationFactors.setReadOnly(true);
}
else
{
if( !d_useOdeSolverIntegrationFactors.getValue() )
if( !d_useIntegrationSchemeIntegrationFactors.getValue() )
{
const double dt = this->getContext()->getDt();
odeFactor = dt*dt; // W = h^2 * JMinvJt : only correct when solving in constraint equation in position. Must be deprecated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
#include <sofa/component/constraint/lagrangian/correction/config.h>

#include <sofa/core/behavior/ConstraintCorrection.h>
#include <sofa/core/behavior/OdeSolver.h>
#include <sofa/core/behavior/BaseIntegrationScheme.h>
#include <sofa/core/topology/TopologyData.h>
#include <sofa/core/objectmodel/lifecycle/RenamedData.h>

namespace sofa::component::constraint::lagrangian::correction
{
Expand Down Expand Up @@ -116,7 +117,8 @@ class UncoupledConstraintCorrection : public sofa::core::behavior::ConstraintCor
Data<bool> d_verbose; ///< Dump the constraint matrix at each iteration
Data< Real > d_correctionVelocityFactor; ///< Factor applied to the constraint forces when correcting the velocities
Data< Real > d_correctionPositionFactor; ///< Factor applied to the constraint forces when correcting the positions
Data < bool > d_useOdeSolverIntegrationFactors; ///< Use odeSolver integration factors instead of correctionVelocityFactor and correctionPositionFactor
Data < bool > d_useIntegrationSchemeIntegrationFactors; ///< Use odeSolver integration factors instead of correctionVelocityFactor and correctionPositionFactor
sofa::core::objectmodel::lifecycle::RenamedData<bool> d_useOdeSolverIntegrationFactors;

/// Link to be set to the topology container in the component graph.
SingleLink<UncoupledConstraintCorrection<DataTypes>, sofa::core::topology::BaseMeshTopology, BaseLink::FLAG_STOREPATH | BaseLink::FLAG_STRONGLINK> l_topology;
Expand All @@ -128,7 +130,7 @@ class UncoupledConstraintCorrection : public sofa::core::behavior::ConstraintCor

protected:

sofa::core::behavior::OdeSolver* m_pOdeSolver;
sofa::core::behavior::BaseIntegrationScheme* m_pIntegrationScheme;

/**
* @brief Compute dx correction from motion space force vector.
Expand Down
Loading
Loading