Skip to content

[Simulation.Core] Differential operations - #6300

Open
alxbilger wants to merge 5 commits into
sofa-framework:masterfrom
alxbilger:differentialoperations
Open

[Simulation.Core] Differential operations#6300
alxbilger wants to merge 5 commits into
sofa-framework:masterfrom
alxbilger:differentialoperations

Conversation

@alxbilger

@alxbilger alxbilger commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

This PR introduces fundamental operations in SOFA, formalized to be physics-independent. The vocabulary no longer uses mechanics terms. The terms are more generic. It is also closer to autodiff frameworks.

The functions are based on the mapping graph. As a consequence, they can be used only in codes where the mapping graph is available. As an example, I use them in MappingGraphMechanicalOperations. But they should replace all the propagate* methods in MechanicalOperations. Since those methods are called mainly in integration scheme, I did not want to create conflicts with #6117.

To do in a next PR:

  • Deprecate all the propagate* methods in MechanicalOperations.
  • Use the methods from DifferentialOperations wherever MechanicalOperations::propagate* is used.

[with-all-tests]


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@alxbilger alxbilger added pr: status to review To notify reviewers to review this pull-request pr: clean Cleaning the code labels Sep 9, 2026
{
mappingGraph.algorithms.traverseBottomUp_([&](core::BaseMapping& mapping)
{
if (mapping.areForcesMapped() || ignoreMappingFlag)

@damienmarchal damienmarchal Sep 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the areForcesMapped() methode renamed it seems a rather mechanical term.

I would also invert the ignoreMappingFlag and mapping.areForcesMapped() because the cost for quering mapping.areForceMapped() is much more costly as it is virtual function, that is accessing a Data, so calling a bunch of other virtual function trigger and update the DDG).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes of course

@alxbilger

Copy link
Copy Markdown
Contributor Author

[ci-build][with-all-tests]

@fredroy fredroy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess adding unit tests would be tedious ? 👀

@alxbilger
alxbilger force-pushed the differentialoperations branch from 3b5e201 to e2b2f4f Compare September 10, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: clean Cleaning the code pr: status to review To notify reviewers to review this pull-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants