getting vector values using local block indices
Jed Brown
jed at 59A2.org
Fri Dec 4 11:17:28 CST 2009
On Fri, 4 Dec 2009 10:52:50 -0500, Craig Tanis <craig-tanis at utc.edu> wrote:
> Hi, I have a vector that I've manipulated using local indexing configured with VecSetLocalToGlobalMappingBlock,
> now I've done a linear solve using this vector as the RHS, and I need
> to extract values from the solution..
The most common thing is to have a local vector and a VecScatter from
the global vector to the local vector. Then you just get the array for
the local vector, work with it, and scatter to the global vector when
you're done. This is usually a nicer API than setting values using
VecSetValues, which is most useful as a quick way to set a small number
of remote values without bothering to figure out who owns them.
> There appears to be no VecGetValuesBlockedLocal function.. What's the
> best way to pull these out?
It would be easy to write a VecGetValuesBlockedLocal that could retrieve
owned values (just LocalToGlobalMappingApply and then fetch them by
global index). I think that making it work with remote values
(VecGetValues currently only gets owned values) is really not worthwhile
because creating the VecScatter is less work and offers a better API.
Jed
More information about the petsc-users
mailing list