int local_size; Scalar *vec_values;then this vector can be made acceptable to the preconditioner by the following call:
Vec b; /* the resulting parallel vector in Petsc format */
MPI_Comm comm; /* the MPI context */
ierr = VecCreateMPIWithArray
(comm,local_size,vec_values,&b);
The user needs to specify the local local_size.
Since this operation is essentially a pointer redirection, its cost is negligible.
The vector structure needs to be de-allocated by
VecDestroy(b);
This does not de-allocate the array of values.