[petsc-users] Re-ordering in DMPlexCreateFromCellListParallelPetsc

Matthew Knepley knepley at gmail.com
Sun Mar 21 15:29:31 CDT 2021


On Sat, Mar 20, 2021 at 10:07 AM Nicolas Barral <
nicolas.barral at math.u-bordeaux.fr> wrote:

> Hi all,
>
> I'm building a plex from elements arrays using
> DMPlexCreateFromCellListParallelPetsc. Once the plex is built, I need to
> set up boundary labels. I have an array of faces containing a series of
> 3 vertex local indices. To rebuild boundary labels, I need to loop over
> the array and get the join of 3 consecutive points to find the
> corresponding face point in the DAG.
>

This is very common. We should have a built-in thing that does this.


> Problem, vertices get reordered by DMPlexCreateFromCellListParallelPetsc
> so that locally owned vertices are before remote ones, so local indices
> are changed and the indices in the face array are not good anymore.
>

This is not exactly what happens. I will talk through the algorithm so that
maybe we can find a good
interface. I can probably write the code quickly:

1) We take in cells[numCells, numCorners], which is a list of all the
vertices in each cell

     The vertex numbers do not have to be a contiguous set. You can have
any integers you want.

2) We create a sorted list of the unique vertex numbers on each process.
The new local vertex numbers
     are the locations in this list.

Here is my proposed interface. We preserve this list of unique vertices,
just as we preserve the vertexSF.
Then after DMPlexCreateFromCellListParallelPetsc(), can
DMPlexInterpolate(), you could call

  DMPlexBuildFaceLabelsFromCellList(dm, numFaces, faces, labelName,
labelValues)

Would that work for you? I think I could do that in a couple of hours.

  Thanks,

     Matt


> Is there a way to track this renumbering ? For owned vertices, I can
> find the local index from the global one (so do old local index ->
> global index -> new local index). For the remote ones, I'm not sure. I
> can hash global indices, but is there a more idiomatic way ?
>
> Thanks,
>
> --
> Nicolas
>
>

-- 
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

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210321/441c051d/attachment.html>


More information about the petsc-users mailing list