Refactor LA into native and PETSc part and add assigners - #3659
Conversation
Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com>
Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com>
Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com>
Co-authored-by: Jørgen Schartum Dokken <dokken92@gmail.com>
A Collection has no ordering - Sequence is correct. Use np.inexact instead of np.floating
|
Couldn’t we place all PETSC related structures in |
Well, yes, possibly, but not in this PR. But it's a huge API change. Let's discuss it on Slack. |
michalhabera
left a comment
There was a problem hiding this comment.
The separation into fem.petsc and la.petsc reads very nice! And also follows the C++ structure.
Why are all these helpers (la.petsc.create_vector_wrap, la.petsc.create_vector, la.petsc.assign, fem.petsc.assign, ...) written in Python only? Is the argument that C++ users would not need/want such helpers?
I discussed this with @garth-wells - providing similar functionality for C++ users would be beneficial as interfacing SNES in particular is apparently "very hard". However, it's not clear we would want to write helpers in C++ using PETSc and then expose to Python, or just provide two good designs that suits C++ and Python via PETSc C and petsc4py, respectively. |
Co-authored-by: Michal Habera <michal.habera@gmail.com>
There is a helper at dolfinx/cpp/dolfinx/la/petsc.h Line 107 in 43dafba More C++ 'helpers' could be helpful, but we should do it with a purpose, e.g. when adding SNES helpers, to get it right rather than adding it for hypothetical reasons. |
Supersedes #3652 which made it apparent that
dolfinx.lashould have a dedicateddolfinx.la.petscmodule.This PR introduces API changes:
dolfinx.la.create_petsc_vector->dolfinx.la.petsc.create_vectordolfinx.la.create_petsc_vector_wrap->dolfinx.la.petsc.create_vector_wrapNote that
dolfinx.fem.create_vectoris now a very light wrapper overdolfinx.la.create_vector, perhaps bringing into question the need for the former.