Feature eigen
Context
This MR generalizes the use of Eigen in waves.
Tasks
Following MR !50 (merged), here is the updated to-do list:
replacegmm::matrix<double>
byEigen::Matrix<double>
replacestd::vector<double>
byEigen::(Row)Vector<double>
refactor elementary matrices computationchange method return type, ievoid build(Matrix const &A, Matrix &K)
should becomeMatrix K build(Matrix const &A)
replacetbox::Pt
byEigen::VectorXd
investigate Pardiso interfaceinvestigate Eigen multithreading feature- clean the thermo-mechanical matrices
Notes
- I added a general interface
tbox::LinearSolver
from which derivetbox::Mumps
,tbox::Pardiso
,tbox::Gmres
andtbox::SparseLu
. The first class is a direct interface to the MUMPS solver, while the other three merely call Eigen interface or implementation of these solvers. The linear solvers are interfaced in python and the nonlinear solvers must now be initialized with a problem and a linear solver. - I did not clean the thermo-mechanical matrices computation in
tbox::Tetra4
andtbox::Hex8
. This could be further addressed in the branch clean_mirrors, which brings LFS support for large geometry files and improved tests. - Regarding the multi-threading in Eigen, it does not make sense to use it if the top level functions in waves are multi-threaded, which should be the case. However, multi-threading can be used for linear solvers. For now, only Pardiso can use multi-threading (GMRES and SparseLU are not multi-threaded and I did not look into MUMPS).
Additional changes
- I replaced the
std::vector
holding the shape functions byEigen::Matrices
, and consequently updated the Cache, ShapeFunction and Gauss classes. Additionally, the members of Cache and Gauss are now private and can only be accessed by getters (which I inlined). - I replaced the
std::vector
bystd::deque
to hold the list ofEigen::Triplet
for the global matrices assembly, as it proved to be faster. - I changed the assembly procedure of periodic BCs (
tbox::MshDeform
) and Kutta condition (flow::Newton
andflow::Picard
) so that the contributions are directly assembled on the right rows, thus avoiding the costly manipulation of the rows after the matrix has been built.
Tests
Passed on ubuntu18.04 (python 2.7.15), debian4.9 (python 2.7.13), msys2 (python 3.8.1).
Edited by Adrien Crovato