Jed Brown jed at
Wed Jan 14 12:52:15 CST 2009

On Wed, Jan 14, 2009 at 09:03, Matthew Knepley <knepley at> wrote:
> <tim.kroeger at> wrote:
>> When I create a vector using VecCreateGhost(), and later on I want to
>> access the value of one of the ghost cells, and all I know is the *global*
>> index of that value, what is the correct thing to do?  I understand that the
>> ghost values are stored at the end of the vector and that this is done in
>> the order that I used when creating the vector, but do I have to remember
>> that order myself, or is there some method to query the local index
>> corresponding to a global index?
> Unfortunately, we never create the inverse mapping.

To elaborate on this, the natural thing in your application is that
user code (yours or the Libmesh DoF map) never sees the global
numbering except through the LocalToGlobalMapping.  It uses the local
numbering with the local forms (VecGhostGetLocalForm) and
VecSetValuesLocal, MatSetValuesLocal, etc.  I don't know how this
interacts with the parallel adaptive refinement model, but after
refinement you'll be creating new vectors anyway.


More information about the petsc-users mailing list