https://github.com/alxbilger/eigenlinearsolvers
SOFA plugin wrapping the Eigen linear solvers into SOFA components
https://github.com/alxbilger/eigenlinearsolvers
eigen sofa-framework
Last synced: 7 days ago
JSON representation
SOFA plugin wrapping the Eigen linear solvers into SOFA components
- Host: GitHub
- URL: https://github.com/alxbilger/eigenlinearsolvers
- Owner: alxbilger
- License: mit
- Created: 2022-03-22T12:54:12.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-14T09:15:45.000Z (almost 4 years ago)
- Last Synced: 2025-02-08T00:11:06.371Z (11 months ago)
- Topics: eigen, sofa-framework
- Language: C++
- Homepage:
- Size: 55.7 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EigenLinearSolvers
SOFA plugin wrapping the Eigen linear solvers into SOFA components
- SOFA: [https://www.sofa-framework.org/](https://www.sofa-framework.org/)
- Eigen: [https://eigen.tuxfamily.org/](https://eigen.tuxfamily.org/)
## Components
### EigenConjugateGradient
This linear solver component is based on `Eigen::ConjugateGradient` (https://eigen.tuxfamily.org/dox/classEigen_1_1ConjugateGradient.html).
Its equivalent in SOFA is `CGLinearSolver` (without preconditioner), or `ShewchukPCGLinearSolver` (with preconditioner).
The available templates are:
- EigenSparseMatrixd
- CompressedRowSparseMatrixMat3x3d
- CompressedRowSparseMatrixd
In XML, the declaration of this component looks like:
```xml
```
A [scene example](https://github.com/alxbilger/EigenLinearSolvers/blob/master/scenes/FEMBAR_EigenConjugateGradient.scn) is available.
### EigenSimplicialLDLT
This linear solver component is based on `Eigen::SimplicialLDLT` (https://eigen.tuxfamily.org/dox/classEigen_1_1SimplicialLDLT.html).
Its equivalent in SOFA is `SparseLDLSolver`.
The available templates are:
- EigenSparseMatrixd
- CompressedRowSparseMatrixMat3x3d
- CompressedRowSparseMatrixd
In XML, the declaration of this component looks like:
```xml
```
Scene examples are available:
- [FEMBAR_EigenSimplicialLDLT.scn](https://github.com/alxbilger/EigenLinearSolvers/blob/master/scenes/FEMBAR_EigenSimplicialLDLT.scn)
- [Cylinder_EigenSimplicialLDLT.scn](https://github.com/alxbilger/EigenLinearSolvers/blob/master/scenes/Cylinder_EigenSimplicialLDLT.scn)
## Choice of the template
EigenConjugateGradient and EigenSimplicialLDLT can have the choice of a template based on an Eigen sparse matrix, or a SOFA type CompressedRowSparseMatrix.
Both templates have different approaches and can have an impact on the performances.
If possible, the use of `CompressedRowSparseMatrixMat3x3d` is preferable as it brings significant speed up of the matrix assembly.
## Performances
The following measures are given on a indicative basis.
### FEMBAR_EigenSimplicialLDLT.scn
Both solvers have been templated with `CompressedRowSparseMatrixMat3x3d`.
The measurements were made without GUI, running 1000 time steps.
| Measure | SparseLDLSolver | EigenSimplicialLDLT |
|-----------------------|-----------------|---------------------|
| total (s) | 3.79887 | 2.45837 |
| total (FPS) | 263.236 | 406.774 |
| MBKBuild (average ms) | 0.53 | 0.52 |
| MBKSolve (average ms) | 3.07 | 1.74 |
The scene is available in [FEMBAR_EigenSimplicialLDLT.scn](https://github.com/alxbilger/EigenLinearSolvers/blob/master/scenes/FEMBAR_EigenSimplicialLDLT.scn).
### Cylinder_EigenSimplicialLDLT.scn
Both solvers have been templated with `CompressedRowSparseMatrixMat3x3d`.
The measurements were made without GUI, running 1000 time steps.
| Measure | SparseLDLSolver | EigenSimplicialLDLT |
|-----------------------|-----------------|---------------------|
| total (s) | 13.3605 | 10.5815 |
| total (FPS) | 74.8476 | 94.5048 |
| MBKBuild (average ms) | 5.79 | 5.84 |
| MBKSolve (average ms) | 7.02 | 4.16 |
The scene is available in [Cylinder_EigenSimplicialLDLT.scn](https://github.com/alxbilger/EigenLinearSolvers/blob/master/scenes/Cylinder_EigenSimplicialLDLT.scn)
### DiamondRobot.py3scn
Both solvers have been templated with `CompressedRowSparseMatrixMat3x3d`.
The measurements were made without GUI, running 200 time steps.
| Measure | SparseLDLSolver | EigenSimplicialLDLT |
|-----------------------|-----------------|---------------------|
| total (s) | 3.9661 | 3.30239 |
| total (FPS) | 50.4274 | 60.5622 |
| MBKBuild (average ms) | 9.57 | 9.07 |
| MBKSolve (average ms) | 7.75 | 4.96 |
The scene is available in [DiamondRobot.py3scn.scn](https://github.com/SofaDefrost/SoftRobots/blob/master/docs/sofapython3/tutorials/DiamondRobot/DiamondRobot.py3scn)
## Build Instructions
As any SOFA plugin, follow the build procedure on [sofa-framework.org/community/doc/plugins/build-a-plugin-from-sources/](https://www.sofa-framework.org/community/doc/plugins/build-a-plugin-from-sources/)