[petsc-users] Accessing Vector's ghost values

Jed Brown jedbrown at mcs.anl.gov
Fri Feb 24 07:20:35 CST 2012


On Fri, Feb 24, 2012 at 03:42, Mohammad Mirzadeh <mirzadeh at gmail.com> wrote:

> Actually now that we are at it, what would you guys recommend as the best
> way to find local indecies from global ones when accessing the _ghost_
> values in the local form? This becomes even more complicated when your
> global petsc ordering is different from global application ordering.
>
> Its quite easy to access the local indecies for the local nodes -- you use
> ao to convert application global to petsc global and from petsc global, it
> is easy to get petsc local. However, when you have ghost nodes, there is no
> such simple relationship between petsc global and the _ghosted_ petsc local
> (Even though there is a simple one from petsc local to petsc global). The
> best thing I have came up with so far is to use a sequential second ao to
> map local indecies of ghost points to petsc global indecies. Is there a
> better way of doing this?
>

Do the conversion the other way. If your nodes are labeled with global
indices, do a traversal (in some ordering, probably owned then ghosted)
assigning local indices.

As you point out, it is not efficient to convert global indices for ghost
points into local indices, so you should build the data structure in terms
of local indices and just keep a local-to-global mapping to glue the
subdomains together.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120224/43391b41/attachment.htm>


More information about the petsc-users mailing list