Change interface of fem.petsc.create_vector
to allow for general list of function spaces
#3694
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The creation of PETSc vectors relies internally on a list of tuples
(IndexMap, bs)
. Given a list of such and a vector kind we can create the corresponding coefficient vector(s). Previously this functionality was not exposed to the user directly and only supported indirectly by passing aForm
from which the spaces would then be extracted.This introduces/changes
la.petsc.create_vector()
which now takes a list of(IndexMap, bs)
tuples and returns aPETSc.Vec
object. The interface offem.petsc.create_vector()
is extended to allow for function spaces as input as well. Vectors can therefore now be create by a list of function spaces:b = dolfinx.fem.create_vector([V, W])
and no longer require a form to be present for such construction.Additionally, the dispatching internally has been reworked, it no longer relies on
try-except
blocks.