On Mon, 31 Oct 2011, Dominik Szczerba wrote: > In the documentation of VecGetArray I read that it returns a pointer > to the local data array and does not use any copies. Does this mean, > that changing the values of the vector followed by > VecAssemblyBegin/End does NOT invalidate the pointer? In other words, > do I need to re-get the array when vec's values are changed?
For one - you don't need VecAssemblyBegin/End if you obtain the array with VecGetArray() - and change values there. Also - after you are done using the array - you should call VecRestoreArray(). And you should be changing the values only between these two calls. [i.e do not stash the pointer for later use - and keep changing values with this pointer - after the call to VecRestroeArray()]. If you need to change the vec again - call VecGetArray() again. Note: With VecGetArray() - you get access to local array - so can modify only local values. If you have to set values that might go to a different processor - then VecSetValues() - with VecAssemblyBegin/End() - is the correct thing to do. Satish
