sofa icon indicating copy to clipboard operation
sofa copied to clipboard

[SofaDeformable] Make SpringForceField a ForceField (not an InteractionForceField)

Open alxbilger opened this issue 4 years ago • 22 comments

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:

  1. A new Node
  2. A new mechanical state which will be the fusion of the provided objects,
  3. A SubsetMultiMapping that will make the link between the two provided objects and the new mechanical state
  4. 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 when AttachBodyPerformer is 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).

alxbilger avatar Dec 21 '21 15:12 alxbilger

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

alxbilger avatar Dec 21 '21 15:12 alxbilger

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

alxbilger avatar Jan 06 '22 09:01 alxbilger

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

alxbilger avatar Jan 06 '22 09:01 alxbilger

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

fredroy avatar Jan 06 '22 11:01 fredroy

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

alxbilger avatar Jan 10 '22 14:01 alxbilger

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

alxbilger avatar Jan 10 '22 14:01 alxbilger

[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

sofabot avatar Jan 10 '22 14:01 sofabot

[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

sofabot avatar Jan 10 '22 15:01 sofabot

[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

sofabot avatar Jan 10 '22 16:01 sofabot

[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

sofabot avatar Jan 10 '22 16:01 sofabot

[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

sofabot avatar Jan 11 '22 13:01 sofabot

[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

sofabot avatar Jan 11 '22 14:01 sofabot

[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

sofabot avatar Jan 21 '22 11:01 sofabot

[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

sofabot avatar Jan 25 '22 14:01 sofabot

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

alxbilger avatar Jan 25 '22 14:01 alxbilger

[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

sofabot avatar Jan 25 '22 14:01 sofabot

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

alxbilger avatar Jan 26 '22 08:01 alxbilger

[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

sofabot avatar Jan 26 '22 08:01 sofabot

[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

sofabot avatar Feb 02 '22 14:02 sofabot

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)

fredroy avatar Feb 10 '22 10:02 fredroy

[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

sofabot avatar Feb 21 '22 15:02 sofabot

[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

sofabot avatar Feb 28 '22 09:02 sofabot