[petsc-users] Using PETSc solvers and preconditioners with mfem

Jed Brown jed at jedbrown.org
Tue Oct 25 13:43:08 CDT 2016


Stefano Zampini <stefano.zampini at gmail.com> writes:
> MATHYPRE could be a shell wrapping Hypre calls for the moment.
> However, HypreParCSR and MATAIJ are mostly equivalent formats. As far as I know, the main (only?) difference resides in the fact that the diagonal term of the diagonal part is ordered first in the CSR.
> For this reason, I think it should inherit from AIJ.

This is more delicate.  Derived classes need to *exactly* retain the AIJ
structure because all unimplemented methods use the parent
implementations.  If the rows are not sorted, MatSetValues, MatGetRow,
and the like cease to work.  You can still make MatHypreParCSR respond
to MatMPIAIJSetPreallocation, but I don't think it can be derived from
AIJ unless you audit *all* reachable AIJ code to remove the assumption
of sorted rows *and* document the API change for all users that could
observe the lack of sorting.  (I don't think that's worthwhile.)

Note that the existing AIJ derived implementations merely augment the
AIJ structure rather than modifying it.

> As soon  as I have time, I can start a new matrix class, but I don’t have much time to implement at the SetValues level yet.

That's not urgent, but if you write it as a Mat implementation instead
of some utility functions, it would be easy to add later and would not
disrupt existing users.  There is no requirement that all Mat
implementations include all the methods that "make sense"; it can be
fleshed out later according to demand.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20161025/e42bcd1d/attachment.pgp>


More information about the petsc-users mailing list