Re: [petsc-users] ghost values

2015-04-14 Thread Barry Smith
> On Apr 14, 2015, at 7:43 PM, Gideon Simpson wrote: > > So in your example of the form function, is something happening where, when I > leave the scope of FormFunction, the invocation of DMGetLocalVector on the DM > keeps a note that it had been called previously and has that memory already

Re: [petsc-users] ghost values

2015-04-14 Thread Gideon Simpson
So in your example of the form function, is something happening where, when I leave the scope of FormFunction, the invocation of DMGetLocalVector on the DM keeps a note that it had been called previously and has that memory already allocated? Does the design distinguish between different calls

Re: [petsc-users] ghost values

2015-04-14 Thread Barry Smith
> On Apr 14, 2015, at 6:25 PM, Gideon Simpson wrote: > > So other than the minor point of it zeroing out the data, is there any > conceivable reason to use Create/Destroy over Get/Restore? The design intends that Create/Destroy are for long lived objects. For example in main you might call

Re: [petsc-users] ghost values

2015-04-14 Thread Matthew Knepley
On Tue, Apr 14, 2015 at 6:25 PM, Gideon Simpson wrote: > So other than the minor point of it zeroing out the data, is there any > conceivable reason to use Create/Destroy over Get/Restore? > Nope, and calling VecSet(v, 0.0) is really cheap. Matt > -gideon > > On Apr 14, 2015, at 7:16 PM, Ma

Re: [petsc-users] ghost values

2015-04-14 Thread Gideon Simpson
So other than the minor point of it zeroing out the data, is there any conceivable reason to use Create/Destroy over Get/Restore? -gideon > On Apr 14, 2015, at 7:16 PM, Matthew Knepley wrote: > > On Tue, Apr 14, 2015 at 6:15 PM, Gideon Simpson > wrote: > Other

Re: [petsc-users] ghost values

2015-04-14 Thread Matthew Knepley
On Tue, Apr 14, 2015 at 6:15 PM, Gideon Simpson wrote: > Other than zeroing things out, is there any substantive difference between > DMCreateLocalVector and DMGetLocalVector? > The Get version caches vectors, so you are not continually creating/destroying Matt > -gideon > > > On Apr 14, 2

Re: [petsc-users] ghost values

2015-04-14 Thread Gideon Simpson
Other than zeroing things out, is there any substantive difference between DMCreateLocalVector and DMGetLocalVector? -gideon > On Apr 14, 2015, at 7:02 PM, Barry Smith wrote: > > > When PETSc vectors are created initially they always have 0 everywhere. So > if you use DMCreateLocalVector()

Re: [petsc-users] ghost values

2015-04-14 Thread Barry Smith
When PETSc vectors are created initially they always have 0 everywhere. So if you use DMCreateLocalVector() it will have zero in all those ghost places (as well as everywhere else). But if you use DMGetLocalVector() it returns vectors that maybe dirty so you need to fill in any locations

[petsc-users] ghost values

2015-04-14 Thread Gideon Simpson
If i use the DM_BOUNDARY_GHOSTED flag in the creation of a DMDA array, are the ghosted values automatically set to zero, or should they be manually set to zero if that’s the desired ghost value? -gideon