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 >
