[petsc-users] Re-ordering in DMPlexCreateFromCellListParallelPetsc
Nicolas Barral
nicolas.barral at math.u-bordeaux.fr
Mon Mar 22 05:22:55 CDT 2021
On 21/03/2021 21:29, Matthew Knepley wrote:
> On Sat, Mar 20, 2021 at 10:07 AM Nicolas Barral
> <nicolas.barral at math.u-bordeaux.fr
> <mailto: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.
>
Ordering apart, it's not very complicated once you figure out "join" is
the right operation to use. We need more doc on graph layout and
operations in DMPlex, I think I'm going to make pictures when I'm done
with that code because I waste too much time every time. Is there a
starting point you like ?
> 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.
>
Ok It took me re-writing this email a couple times but I think I
understand. I was too focused on local/global indices. But if I get this
right, you still make an assumption: that the numVertices*dim
coordinates passed in vertexCoords are the coordinates of the
numvertices first vertices in the sorted list. Is that true ?
> 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.
>
So that function would be very helpful. But is it as simple as you're
thinking ? The sorted list gives local index -> unique identifier, but
what we need is the other way round, isn't it ?
Once I understand better, I can have a first draft in my plexadapt code
and we pull it out later.
Thanks
--
Nicolas
> 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/>
More information about the petsc-users
mailing list