Question about DAVecGetArray and DAVecRestoreArray

Milad Fatenejad icksa1 at gmail.com
Mon Jul 21 18:31:16 CDT 2008


Hello:
The documentation states that to access elements of a vector created
with a DA you should use the DAVecGetArray function and you should
return the pointer when you are finished with the DAVecRestoreArray
function.

For my code, I would really like to call DAVecGetArray as soon as the
vector is created, and call DAVecRestoreArray right before the vector
is destroyed. In other words, I would like to be able to access the
elements during the vector's entire life and not have to call these
two functions every time I need to access individual elements.

I would like to know if having access to the elements of the vector
prevents me from using it in some way? I am concerned that there might
be some operation that won't work while the array is being accessed,
i.e. that DAVecGetArray somehow locks the vector so some other
function cannot use it until DAVecRestoreArray is called. Is this the
case?

Thanks for your help.
Milad




More information about the petsc-users mailing list