Not to mention the various Get routines that are actually used to create things, such as DAGetMatrix. Still, the idea of a pool of work vectors makes sense, I was just trying to wrap my head around the actual use for those routines.
A On Fri, Aug 27, 2010 at 4:06 PM, Dmitry Karpeev <karpeev at mcs.anl.gov> wrote: > Except VecGetArray, etc, which operate a "pool" of one object. > I think this may be the root cause of confusion. > > Dmitry. > > On Fri, Aug 27, 2010 at 6:42 AM, Matthew Knepley <knepley at gmail.com> > wrote: > > Simply, in PETSc, getFoo() and restoreFoo() operate an object pool. > > Matt > > > > On Fri, Aug 27, 2010 at 11:23 AM, Jed Brown <jed at 59a2.org> wrote: > >> > >> On Fri, 27 Aug 2010 14:13:01 +0300, Aron Ahmadia > >> <aron.ahmadia at kaust.edu.sa> wrote: > >> > What exactly is the purpose of these routines then? Is there a global > >> > Vector associated with a DA? If so, why are the values uninitialized? > >> > >> It's common to need work vectors in places like residual evaluation and > >> Jacobian assembly. There is a little bit of setup cost to allocate a > >> new vector each time, so usually we'd prefer that they be persistent and > >> just reuse them. One option would be to make the user manage this > >> themselves, but that's error prone because it's easy to accidentally > >> alias the work vectors, so instead the DA keeps a cache of vectors. It > >> starts out empty, and each time you call DAGetGlobalVector(), the cache > >> is searched for an available vector. If none are found, a new one is > >> allocated and the cache grows by one. DARestoreGlobalVector() checks a > >> vector back in so it may be used elsewhere. These vectors are destroyed > >> in DADestroy(). > >> > >> Jed > > > > > > > > -- > > What most experimenters take for granted before they begin their > experiments > > is infinitely more interesting than any results to which their > experiments > > lead. > > -- Norbert Wiener > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20100827/39eceb50/attachment.html>
