[petsc-users] Usage of VecCreateMPIWithArray in fortran

Matthew Knepley knepley at gmail.com
Thu Feb 2 06:16:05 CST 2017


On Wed, Feb 1, 2017 at 11:46 PM, Praveen C <cpraveen at gmail.com> wrote:

> Dear all
> I am creating a vector in fortran like this
>
> PetscReal,allocatable :: res(:,:)
>
> Vec :: v_res
>
> allocate( res(nvar,nvl_nvg) )
>
> call VecCreateMPIWithArray(PETSC_COMM_WORLD, nvar, nvar*nvl, &
>
>                            PETSC_DECIDE, res(1,1), v_res, &
>
>                            ierr); CHKERRQ(ierr)
>
>
> Note that my array "res" is larger than needed by the vector v_res.
>
> Is this ok to do this ?
>

Yes

  Matt


> I use the extra "res" array for dummy ghost values, but I dont need v_res
> to be ghosted.
>
> Thanks
> praveen
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170202/8e6d9dc4/attachment.html>


More information about the petsc-users mailing list