-
-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.la
should have a dedicateddolfinx.la.petsc
module.This PR introduces API changes:
dolfinx.la.create_petsc_vector
->dolfinx.la.petsc.create_vector
dolfinx.la.create_petsc_vector_wrap
->dolfinx.la.petsc.create_vector_wrap
Note that
dolfinx.fem.create_vector
is now a very light wrapper overdolfinx.la.create_vector
, perhaps bringing into question the need for the former.