Change interface of fem.petsc.create_vector to allow for general list of function spaces - #3694
Conversation
9591f98 to
7e9c3e2
Compare
la.petsc.create_vector to allow for general list of function spacesfem.petsc.create_vector to allow for general list of function spaces
|
Shouldn't then this also be done for matrices to stay consistent, i.e. have an |
Sounds good - lets do that in another PR. |
|
|
Is that possible? We inspect type of integrals present in the form to prepare the sparsity pattern of the matrix, see |
|
True matrix is integral, and thus form, dependant. If one was to switch basing the construction of a matrix on spaces, creation and sparsity pattern setting would need to be separated. That could be desirable for customisable sparsity patterns, ref #3779 (comment). |
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. Previously this functionality was not exposed to the user directly and only supported indirectly by passing aFormfrom which the spaces would then be extracted.la.petsc.create_vectorwhich now takes a list of(IndexMap, bs)tuples and returns aPETSc.Vecobject. The interface offem.petsc.create_vectoris 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. And alternatively from a general sequence of index maps and blocks sizes, without the presence of any function spaces withla.petsc.create_vector._assign_block_datawhich factors out the attachment of block information to PETSc vectors.create_vectoron a form. Enforces explicitness, that the space is the critical argument, not the form.