[SofaDeformable] Make SpringForceField a ForceField (not an InteractionForceField)
Contains https://github.com/sofa-framework/sofa/pull/2557
This PR is the first step toward the conversion of the interaction force fields into simple force fields. This PR concerns the class SpringForceField and all its derived classes, including StiffSpringForceField which is used extensively to create springs.
The changes maintain the backward compatibility with current scenes. However, the signature of some functions changed. That's why it's breaking. It is now impossible to construct a StiffSpringForceField between 2 objects in C++. Instead a utility function is provided.
To maintain the backward compatibility and to facilitate the design of a simulation scene, StiffSpringForceField continues to accept two Data attributes ('object1' and 'object2') corresponding to two different objects. However, they don't correspond to any Data or Link in the component. Actually, during its creation, the component will instantiate other components in order to link both objects into one. In the end, the component is able to work on a single mechanical state while keeping the same physical behavior.
The component now instantiates:
- A new Node
- A new mechanical state which will be the fusion of the provided objects,
- A
SubsetMultiMappingthat will make the link between the two provided objects and the new mechanical state - The spring force field
Since SubsetMultiMapping was initially in SofaMiscMapping, it has been moved into SofaBaseMechanics. A compatibility layer is available.
Other components using StiffSpringForceField had to be adapted to create also the extra components. An example is AttachBodyPerformer which creates the spring between an object and the mouse (shift + clic).
WARNING:
Since StiffSpringForceField is now necessarily located in a mapped node, its stiffness matrix is not mapped in case of a built linear system. The forces are then computed explicitly only. This issue will be addressed in the new design of the matrix assembly.
TODO:
- [x] A description for this PR
- [ ] Handle topological changes in
SpringForceField-> see https://github.com/sofa-framework/sofa/pull/2653 and https://github.com/sofa-framework/sofa/pull/2729 - [x] Deal with
BoxStiffSpringForceField-> see https://github.com/sofa-framework/sofa/pull/2621 - [x] Compilation and tests issues on CI (CUDA)
- [x] In
AttachBodyPerformer, a Node remains in the scene whenAttachBodyPerformeris destroyed
[ci-depends-on https://github.com/sofa-framework/SofaPython3/pull/224]
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).
[ci-build][with-all-tests]
[ci-build][with-all-tests]
[ci-build][with-all-tests]
[ci-build][force-full-build][with-all-tests]
[ci-build][force-full-build][with-all-tests]
[ci-build][force-full-build][with-all-tests]
[ci-depends-on] detected during build #16.
To unlock the merge button, you must
- Merge or close https://github.com/sofa-framework/SofaPython3/pull/224 For this build, SofaPython3/ExternalProjectConfig.cmake.in will be edited by builders with GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 GIT_TAG c502a62a0410e1f15487c195b186d46ddad8d3cd
[ci-depends-on] detected during build #17.
To unlock the merge button, you must
- Merge or close https://github.com/sofa-framework/SofaPython3/pull/224 For this build, SofaPython3/ExternalProjectConfig.cmake.in will be edited by builders with GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 GIT_TAG c502a62a0410e1f15487c195b186d46ddad8d3cd
[ci-depends-on] detected during build #18.
To unlock the merge button, you must
- Merge or close https://github.com/sofa-framework/SofaPython3/pull/224 For this build, SofaPython3/ExternalProjectConfig.cmake.in will be edited by builders with GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 GIT_TAG c502a62a0410e1f15487c195b186d46ddad8d3cd
[ci-depends-on] detected during build #19.
To unlock the merge button, you must
- Merge or close https://github.com/sofa-framework/SofaPython3/pull/224 For this build, SofaPython3/ExternalProjectConfig.cmake.in will be edited by builders with GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 GIT_TAG c502a62a0410e1f15487c195b186d46ddad8d3cd
[ci-depends-on] detected during build #20.
To unlock the merge button, you must
- Merge or close https://github.com/sofa-framework/SofaPython3/pull/224 For this build, SofaPython3/ExternalProjectConfig.cmake.in will be edited by builders with GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 GIT_TAG c502a62a0410e1f15487c195b186d46ddad8d3cd
[ci-depends-on] detected during build #21.
To unlock the merge button, you must
- Merge or close https://github.com/sofa-framework/SofaPython3/pull/224 For this build, SofaPython3/ExternalProjectConfig.cmake.in will be edited by builders with GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 GIT_TAG c502a62a0410e1f15487c195b186d46ddad8d3cd
[ci-depends-on] detected during build #22.
To unlock the merge button, you must
- Merge or close https://github.com/sofa-framework/SofaPython3/pull/224 For this build, SofaPython3/ExternalProjectConfig.cmake.in will be edited by builders with GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 GIT_TAG c502a62a0410e1f15487c195b186d46ddad8d3cd
[ci-depends-on] detected during build #23.
To unlock the merge button, you must
- Merge or close https://github.com/sofa-framework/SofaPython3/pull/224 For this build, SofaPython3/ExternalProjectConfig.cmake.in will be edited by builders with GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 GIT_TAG c502a62a0410e1f15487c195b186d46ddad8d3cd
[ci-build][with-all-tests]
[ci-depends-on] detected during build #24.
To unlock the merge button, you must
- Merge or close https://github.com/sofa-framework/SofaPython3/pull/224 For this build, SofaPython3/ExternalProjectConfig.cmake.in will be edited by builders with GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 GIT_TAG c502a62a0410e1f15487c195b186d46ddad8d3cd
[ci-build][with-all-tests]
[ci-depends-on] detected during build #25.
To unlock the merge button, you must
- Merge or close https://github.com/sofa-framework/SofaPython3/pull/224 For this build, SofaPython3/ExternalProjectConfig.cmake.in will be edited by builders with GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 GIT_TAG 29589bf9d20cdc777a472a1135e11f9fd6ddac9a
[ci-depends-on] detected during build #26.
To unlock the merge button, you must
- Merge or close https://github.com/sofa-framework/SofaPython3/pull/224 For this build, SofaPython3/ExternalProjectConfig.cmake.in will be edited by builders with GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 GIT_TAG 5d2f4215bc14d591748bfe4c13b6e0649faaf945
Just a note for the reviewers: SubsetMultiMapping was moved to SofaBaseMechanics for dependency reasons (but the problem will be solved in the new sofang architecture a priori)
[ci-depends-on] detected during build #27.
To unlock the merge button, you must
- Merge or close https://github.com/sofa-framework/SofaPython3/pull/224 For this build, SofaPython3/ExternalProjectConfig.cmake.in will be edited by builders with GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 GIT_TAG 5d2f4215bc14d591748bfe4c13b6e0649faaf945
[ci-depends-on] detected during build #28.
To unlock the merge button, you must
- Merge or close https://github.com/sofa-framework/SofaPython3/pull/224 For this build, SofaPython3/ExternalProjectConfig.cmake.in will be edited by builders with GIT_REPOSITORY https://github.com/sofa-framework/SofaPython3 GIT_TAG 4d73445ecbd73b9afa06312d96ac72056ef2dc66