On Mon, Oct 31, 2011 at 15:53, Dominik Szczerba <dominik at itis.ethz.ch>wrote:
> Seems I was not clear enough. I have my pointer to the local vector > values obtained witth VecGetArray. This function is called only once > at the beginning of the program and VecRestoreArray is called at the > end. The pointer is only used to read the values. I am doing an > iterative scheme whereby I change the vector values (VecSetValues, > i.e., cross-process) and subsequent VecAssemblyBegin/End. All I want > to know is if I need to VecRestoreArray and VecGetArray again, of if > it remains valid throughout the scheme. > Yes, call VecRestoreArray() when you are done looking at values and call VecGetArray() the next time you want to look at values. With PETSc native Vec, both will work, at least under typical use conditions. But why misuse an API in a fragile way just to create more implicit, non-referenced counted, confusing sharing? Your question sounds to me like asking whether it's okay to replaced structured control flow with a linked list of function addresses stored as char* that you "call" using longjmp(). Yes, it's possible and will usually work, but please don't. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111031/5cdc7824/attachment.htm>
