dolfinx.la.petsc
Functions for working with PETSc linear algebra objects.
Note
Due to subtle issues in the interaction between petsc4py memory
management and the Python garbage collector, it is recommended that
the PETSc method destroy()
is called on returned PETSc objects
once the object is no longer required. Note that destroy()
is
collective over the object’s MPI communicator.
Functions
|
Assign |
|
Create a distributed PETSc vector. |
Wrap a distributed DOLFINx vector as a PETSc vector. |
- dolfinx.la.petsc.assign(x0: ndarray[Any, dtype[inexact]] | list[ndarray[Any, dtype[inexact]]], x1: Vec)[source]
- dolfinx.la.petsc.assign(x0: Vec, x1: ndarray[Any, dtype[inexact]] | list[ndarray[Any, dtype[inexact]]])
Assign
x0
values to a PETSc vectorx1
.Values in
x0
, which is possibly a stacked collection of arrays, are assignedx1
. Whenx0
holds a sequence ofn`
arrays andx1
has typeNEST
, the assignment is:[x0[0]] x1 = [x0[1]] [.....] [x0[n-1]]
When
x0
holds a sequence ofn
arrays andx1
does not have typeNEST
, the assignment is:[x0_owned[0]] x1 = [.....] [x0_owned[n-1]] [x0_ghost[0]] [.....] [x0_ghost[n-1]]
- Parameters:
x0 – An array or list of arrays that will be assigned to
x1
.x1 – Vector to assign values to.