setting values in parallel vectors

Khan, Irfan irfan.khan at
Thu Apr 2 14:22:59 CDT 2009

Excellent! Thank you

----- Original Message -----
From: "Jed Brown" <jed at>
To: petsc-users at
Sent: Thursday, April 2, 2009 3:18:06 PM GMT -05:00 US/Canada Eastern
Subject: Re: setting values in parallel vectors

On Thu 2009-04-02 15:09, Khan, Irfan wrote:
> Thank you, that was very helpful. Please do let me know if I understood this right. Generally VecSetValues()+VecGhostUpdateBegin/End() is faster than VecGetArray()+assign_array()+VecRestoreArray()+VecGhostUpdateBegin/End(). Also both these operation would be equivalent.

These operations would be equivalent.  The second option would be
faster, but only because it doesn't do a function call and
range-checking in an inner loop.  It would be nearly impossible to tell
the difference in a real code so don't worry about it, just use
whichever is more natural.


More information about the petsc-users mailing list