Skip to content

Feature eigen

Adrien Crovato requested to merge feature_eigen into master

Context

This MR replaces gmm by Eigen.
Eigen is newer, easier to use, has a larger community and could possibly be faster than gmm. Furthermore, Eigen has an interface to the Intel's Pardiso solver, which might be more efficient than MUMPS.

Tasks

For now, the code has merely been translated, but not really refactored nor optimized.
To-do list:

  • replace gmm::matrix<double> by Eigen::Matrix<double>
  • replace std::vector<double> by Eigen::(Row)Vector<double>, where applicable and useful
  • refactor elementary matrices computation (mainly tbox::Element:build() methods), especially clean the thermo-mechanical matrices
  • change method return type, ie void build(Matrix const &A, Matrix &K) should become Matrix K build(Matrix const &A), where applicable (mainly tbox::Element)
  • replace tbox::Pt by Eigen::VectorXd
  • investigate Eigen multithreading feature
  • investigate Pardiso interface

The unchecked tasks will be dealt with in the next MR.

Issues

Eigen uses the method of co-factors to inverse a matrix, whose size is fixed and up to 4x4.For now, the matrices in Mem are dynamically sized, but there should be a way to force Eigen to use the method of co-factors for MemTri3, MemQuad4 and MemTetr4. This could partly address #27.

Notes

I replaced std::vector<double> by Eigen::VectorXd where those vectors were used for linear algebra. There are some exceptions, check the comments in my commits.
The main exception is that some vectors are public and hold variables and results. I decided to keep std::vector for such cases in order to have more flexibility when interfacing in python (SWIG already already fully interfaces std::vector). For linear algebra on the C++ side, these std::vector are mapped with Eigen::Map<Eigen::Vector>, which holds a reference to std::vector to keep it up to date, and can be manipulated as Eigen::Vector.

Additional changes

  • Git LFS support
  • Force to look for MKL before looking for other BLAS
  • Minor changes in flow solver

Tests

Passed on ubuntu18.04 (python 2.7.15), debian4.9 (python 2.7.13), msys2 (python 3.8.1).
@R.Boman and @Kim.Liegeois: Please double check that the solvers you implemented still give accurate results, particularly using multithreading. The battery is passing, but I did not run and check each test individually (only some of them)!

Edited by Adrien Crovato

Merge request reports