ddemidov/amgcl

Matrix Assembly

karabelaselias opened this issue · 1 comments

I'm recently saw this amazing lib for AMG. Tried the examples and they perform very well so I wanted to use the lib for my own FE implementation as solver backend, however up til now I was using Petsc for matrix assembly, and I was wondering if there is a possibility to assemble a distributed matrix also with this code, as all the examples used to read in a MatrixMarket format?

To formulate it more precise: Is there an equivalent to https://petsc.org/release/docs/manualpages/Mat/MatSetValues/ from Petsc?

Matrix assembly is outside of the library scope, the library expect the user to provide assembled matrices in CSR format. The MM reader is only provided to facilitate examples and experimenting. Here is an example of direct assembly:

https://github.com/ddemidov/amgcl/blob/master/examples/mpi/mpi_solver.cpp#L47

There is also trilinos.epetra adapter that allows using matrices in epetra format as input:

https://github.com/ddemidov/amgcl/blob/master/amgcl/adapter/epetra.hpp

There are other adapters (e.g. eigen adapter) that allow to use assembled matrices in third-party formats.

If PETSc provides direct access to the underlying CSR format, it should be possible to use a similar approach for PETSc matrices.