dragonfly_sim.utils.petsc_utils
Functions
|
Set the locally-owned entries of a PETSc Vec from a numpy array. |
Module Contents
- dragonfly_sim.utils.petsc_utils.set_petsc_vec_array(petsc_vec, np_array)
Set the locally-owned entries of a PETSc Vec from a numpy array.
Works for both sequential and distributed (MPI) Vecs. For a distributed Vec,
np_arraymust have exactly as many elements as the local ownership range ofpetsc_vecon this rank, and values are placed at the correct global indices — not always starting at 0.- Parameters:
- petsc_vecPETSc.Vec
Target Vec. May be sequential or MPI-distributed.
- np_arraynp.ndarray, 1-D
Values to write. Length must equal the local ownership size.