On Mon, Nov 22, 2010 at 10:09 PM, Dmitry Karpeev <span dir="ltr"><<a href="mailto:karpeev@mcs.anl.gov">karpeev@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
This sounds good to me. While at it, why not make<br>
VecGet/RestoreArrayRead take a const PetscScalar ** second argument?<br>
Somewhat unrelated: should VecGet/RestoreArray(Read) be renamed<br>
VecGet/RestoreLocalArray(Read)?<br>
This would conform to the IS usage. I guess that last change would<br>
have a significant impact on the user code, though.<br>
<font color="#888888"></font></blockquote><div><br></div><div>I am against this for the same reasons Barry laid out before. "Local" would imply</div><div>ghost values which are not there.</div><div><br></div><div>
Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><font color="#888888">Dmitry.<br>
</font><div><div></div><div class="h5"><br>
On Mon, Nov 22, 2010 at 9:57 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
><br>
> Hg pull; hg update before reading this.<br>
><br>
> VecGet/RestoreArrayRead() is suppose to be read only. VecGet/RestoreArray() is read/write and increases the state of the vector. These are the standard public methods.<br>
><br>
><br>
> VecGetArrayPrivate() is read/write but DOES NOT increase the state of the vector directly, this is used by Vector operations that manage the change in state themselves. For example VecGetArrayPrivate() is used in, for example VecScale_Seq() because the VecScale() outer method manages increasing the state and preserving the norm value if it was set. If we used VecGetArrayRead() in that location (and did not have VecGetArrayPrivate() it would be very confusing since in VecScale_Seq() it does change the values so read is not appropriate but VecGetArray() would result in a double increase in the state and hence lose the VecNorm cached.<br>
><br>
> In looking at the code now I make the following observation. The state increase operation being given inside the outer method (for example VecScale) comes from the days when the individual implementations (like VecScale_Seq) did not call VecGetArray....() but just accessed the array inside the structure directly. We then went to the model where NO method (like VecScale_Seq) was ever suppose to directly access the array and always when through a VecGetArray....(), I had to introduce the VecGetArrayPrivate() to avoid double increasing the state of the vector (and thus losing some cached VecNorms). I think if we removed ALL the increase state from the outer methods (like VecScale) we could remove the VecGetArrayPrivate() and always use VecGetArray() or write ones and VecGetArrayRead() for read ones inside the private methods. This has to be done with care, if all agree I'll do it.<br>
><br>
><br>
> Barry<br>
><br>
><br>
> On Nov 22, 2010, at 8:54 PM, Matthew Knepley wrote:<br>
><br>
>> Why would you use Private, since Read jsut seems to call it?<br>
>><br>
>> Thanks,<br>
>><br>
>> Matt<br>
>><br>
>> --<br>
>> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
>> -- Norbert Wiener<br>
><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>