[Core] Explicit all input vectors in addDForce - #6281
Open
alxbilger wants to merge 13 commits into
Open
Conversation
alxbilger
force-pushed
the
explicitdxadddforce
branch
from
August 31, 2026 12:47
e1098d9 to
b3fa52e
Compare
alxbilger
force-pushed
the
explicitdxadddforce
branch
from
September 2, 2026 08:10
1203b12 to
f7a9998
Compare
Contributor
Author
|
[ci-build][with-all-tests] |
This was referenced Sep 2, 2026
th-skam
approved these changes
Sep 7, 2026
Contributor
Author
|
to do: add |
alxbilger
force-pushed
the
explicitdxadddforce
branch
from
September 8, 2026 08:02
7f1671f to
b1f6915
Compare
addDForceaddDForce
alxbilger
force-pushed
the
explicitdxadddforce
branch
from
September 11, 2026 13:30
fc035b3 to
021f91c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
addDForcecomputes the termHowever, the vectors$dx$ , $x$ and $v$ couldn't be defined as a parameter of
addDForce.vec_id::read_access::dxthrough the call ofreadDx. Now, the vectordxcan be defined to something different fromvec_id::read_access::dx. For example, look at the trick used here to applyaddDForcetov:sofa/Sofa/framework/Simulation/Core/src/sofa/simulation/MechanicalOperations.cpp
Lines 275 to 288 in 52b9786
It's breaking for classes derived from
BaseForceField, if this class overridesaddDForce. This should not be a significant impact because in general, force fields overrides theaddDForceof an intermediate class, such asForceFieldorPairInteractionForceField. It's not breaking for the users ofBaseForceField, because thedx,xandvparameters can be omitted. Without them, it routes to the previous behavior. However, this legacy method is deprecated.This PR is an example to be generalised wherever an implicit vector is used.
Note: usually
addForcepre-computes derivatives that can be used inaddDForce. AddingxandvinaddDForcewill allow to check that thexandvused inaddDForcedoes correspond to thexandvused inaddForce.[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