<div dir="ltr">Thanks Matt and Jed,<div><br></div><div>I think I'm straight on usage/philosophy here.</div><div><br></div><div>A<br><br><div class="gmail_quote">On Fri, Aug 27, 2010 at 2:42 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Simply, in PETSc, getFoo() and restoreFoo() operate an object pool.<div><br></div><div>   Matt<div><div></div><div class="h5">
<br><br><div class="gmail_quote">On Fri, Aug 27, 2010 at 11:23 AM, Jed Brown <span dir="ltr"><<a href="mailto:jed@59a2.org" target="_blank">jed@59a2.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Fri, 27 Aug 2010 14:13:01 +0300, Aron Ahmadia <<a href="mailto:aron.ahmadia@kaust.edu.sa" target="_blank">aron.ahmadia@kaust.edu.sa</a>> wrote:<br>


> What exactly is the purpose of these routines then?  Is there a global<br>
> Vector associated with a DA?  If so, why are the values uninitialized?<br>
<br>
</div>It's common to need work vectors in places like residual evaluation and<br>
Jacobian assembly.  There is a little bit of setup cost to allocate a<br>
new vector each time, so usually we'd prefer that they be persistent and<br>
just reuse them.  One option would be to make the user manage this<br>
themselves, but that's error prone because it's easy to accidentally<br>
alias the work vectors, so instead the DA keeps a cache of vectors.  It<br>
starts out empty, and each time you call DAGetGlobalVector(), the cache<br>
is searched for an available vector.  If none are found, a new one is<br>
allocated and the cache grows by one.  DARestoreGlobalVector() checks a<br>
vector back in so it may be used elsewhere.  These vectors are destroyed<br>
in DADestroy().<br>
<font color="#888888"><br>
Jed<br>
</font></blockquote></div><br><br clear="all"><br></div></div>-- <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>

</div>
</blockquote></div><br></div></div>