sofa-framework / sofa

Real-time multi-physics simulation with an emphasis on medical simulation.
https://www.sofa-framework.org
GNU Lesser General Public License v2.1
883 stars 300 forks source link

[tests] Adapt code to any Eigen version #4724

Closed alxbilger closed 1 month ago

alxbilger commented 1 month ago

Fixes https://github.com/sofa-framework/sofa/discussions/4701


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

hugtalbot commented 1 month ago

Tried it with my eigen 3.3.7-2 and it still does not compile. Should we just close this PR and explicit the need of a recent version of eigen?

alxbilger commented 1 month ago

@hugtalbot the error was no template named 'Vector' in namespace 'Eigen' const Eigen::Vector<Real, 3>& eigenvalues = eigensolver.eigenvalues();. I no longer use the type Vector. Therefore, I expect the error message (if any) to be different. Is it the same?

hugtalbot commented 1 month ago

damned I need to recompile it to get the full error message, sorry I will get back to you

hugtalbot commented 1 month ago

Here is my error :

/data/Softwares/sofa/src/master/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/Material_test.cpp
/data/Softwares/sofa/src/master/Sofa/Component/SolidMechanics/FEM/HyperElastic/tests/Material_test.cpp:56:18: error: too few template arguments for class template 'Matrix'
    const Eigen::Matrix<Real, 3>& eigenvalues = eigensolver.eigenvalues();
                 ^
/usr/include/eigen3/Eigen/src/Core/Matrix.h:178:7: note: template is declared here
class Matrix
hugtalbot commented 1 month ago

I think the templated version of Vector or Matrix were just not present @alxbilger

alxbilger commented 1 month ago

const Eigen::Matrix<Real, 3>& eigenvalues = eigensolver.eigenvalues();

But the code has an extra parameter... Weird. You don't have local changes?