dragonfly_sim.utils.petsc_utils =============================== .. py:module:: dragonfly_sim.utils.petsc_utils Functions --------- .. autoapisummary:: dragonfly_sim.utils.petsc_utils.set_petsc_vec_array Module Contents --------------- .. py:function:: 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_array`` must have exactly as many elements as the local ownership range of ``petsc_vec`` on this rank, and values are placed at the correct *global* indices — not always starting at 0. :Parameters: **petsc_vec** : PETSc.Vec Target Vec. May be sequential or MPI-distributed. **np_array** : np.ndarray, 1-D Values to write. Length must equal the local ownership size. .. !! processed by numpydoc !!