<div class="gmail_quote">On Mon, Oct 31, 2011 at 15:53, Dominik Szczerba <span dir="ltr">&lt;<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":fc">Seems I was not clear enough. I have my pointer to the local vector<br>
values obtained witth VecGetArray. This function is called only once<br>
at the beginning of the program and VecRestoreArray is called at the<br>
end. The pointer is only used to read the values. I am doing an<br>
iterative scheme whereby I change the vector values (VecSetValues,<br>
i.e., cross-process) and subsequent VecAssemblyBegin/End. All I want<br>
to know is if I need to VecRestoreArray and VecGetArray again, of if<br>
it remains valid throughout the scheme.</div></blockquote></div><br><div>Yes, call VecRestoreArray() when you are done looking at values and call VecGetArray() the next time you want to look at values.</div><div><br></div>
<div><br></div><div>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&#39;s okay to replaced structured control flow with a linked list of function addresses stored as char* that you &quot;call&quot; using longjmp(). Yes, it&#39;s possible and will usually work, but please don&#39;t.</div>