sofa icon indicating copy to clipboard operation
sofa copied to clipboard

[Spring] RestSpringsForceField: Unify Vec/Rigid implementation

Open fredroy opened this issue 3 years ago • 2 comments

RestSpringsForceField has almost two versions: one for Vec (default implementation), the other for Rigid (specialization in cpp) Problems are:

  • ugly code duplication
  • not possible to instantiate from somewhere else for other kind of RigidTypes (i.e for float version or CudaRigid...)

so this PR unifies the code and does not rely on any specialization in the cpp.

The main difference is that the "Vector" version was testing if the stiffness was global or for each spring (more or less), with again an other ugly code duplication. I removed the particular case but it means there is a test of the size at each iteration (in addF(), addDF()) which I think is not very problematic but I did not do any bench to test that. 🙊 ~~I also test if the case is Rigid on the Name(), a bit ugly but does the trick for me....~~


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).

fredroy avatar Jul 27 '22 07:07 fredroy

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

fredroy avatar Jul 27 '22 09:07 fredroy

let's do the move into sofa::defaulttype will be done in another PR else :+1: and :heart: @fredroy

hugtalbot avatar Aug 17 '22 08:08 hugtalbot