[petsc-users] VecGetValues not working.

Kaushik Kulkarni kaushikggg at gmail.com
Sun Feb 7 05:29:01 CST 2016


Hello,
I am a beginner at PETSc, so please excuse for such a trivial doubt. I am
writing a program to learn about PETSc vectors. So in the process I thought
to write a small program to learn about initializing and accessing vectors,
which creates vectors with size `rank+1' where rank is initialized using
`MPI_Comm_rank (PETSC_COMM_WORLD, &rank);`. And, then simply I looped
thorugh all the elements to get the sum. But as can seen in the
output(attached), it is returning "junk" values.

Source Code:- http://pastebin.com/Swku7A3X
Output:- http://pastebin.com/paSWnFwz


Thanks,

*Kaushik*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160207/2f3eadaf/attachment.html>


More information about the petsc-users mailing list