Lock or unlock a vector for exclusive read/write access
PetscErrorCode VecLockWriteSet_Private(Vec x,PetscBool flg)
Logically Collective on Vec
The function is usefull in split-phase computations, which usually have a begin phase and an end phase.
One can call VecLockWriteSet_Private(x,PETSC_TRUE) in the begin phase to lock a vector for exclusive
access, and call VecLockWriteSet_Private(x,PETSC_FALSE) in the end phase to unlock the vector from exclusive
access. In this way, one is ensured no other operations can access the vector in between. The code may like
VecGetArray(x,&xdata); // begin phase
Other operations, which can not acceess x anymore (they can access xdata, of course)
VecRestoreArray(x,&vdata); // end phase
The call can not be nested on the same vector, in other words, one can not call VecLockWriteSet_Private(x,PETSC_TRUE)
again before calling VecLockWriteSet_Private(v,PETSC_FALSE).
VecRestoreArray(), VecGetArrayRead(), VecLockReadPush(), VecLockReadPop(), VecLockGet()
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages