[petsc-users] dmplex overlap questions

Lawrence Mitchell wence at gmx.li
Thu Feb 16 09:54:10 CST 2023


Hi Blaise,

On Thu, 16 Feb 2023 at 15:17, Blaise Bourdin <bourdin at mcmaster.ca> wrote:
>
> Hi,
>
> I am trying to implement a non-local finite elements reconstruction operator in parallel.
>
> Given a dmplex distributed with an overlap, is there a way to figure out which cells are in the overlap and which are not?

Yes. Get the pointSF of the DM, and the cell chart

DMPlexGetPointSF(dm, &sf);
DMPlexGetHeightStratum(dm, 0, &cstart, &cend);

Now get the graph (specifically ilocal of the sf):

PetscSFGetGraph(sf, NULL, &nleaves, &ilocal,  NULL);

Now any value of ilocal that lies in [cstart, cend) is a cell which is
not owned by this process (i.e. in the overlap). Note that ilocal can
be NULL which just means it is the identity map [0, ..., nleaves), so
you just intersect [cstart, cend) with [0, nleaves) in that case to
find the overlap cells.

But that is very unlikely to be true, so:

for (PetscInt i = 0; i < nleaves; i++) {
    if (cstart <= ilocal[i] && ilocal[i] < cend) {
       // i is an overlap cell
    }
}
> Alternatively, suppose that I distribute the same DM with and without an overlap. Is there any warranty that the distributions are compatible (i.e. coincide when the overlap is ignored)? If this is the case, can I assume that the non-overlap cells are numbered first in the overlapped dm?

If you do:

DMPlexDistribute(dm, 0, &migrationSF, &paralleldm);
DMPlexDistributeOverlap(paralleldm, 1, &migrationSF2, &overlapdm);

Then paralleldm and overlapdm will be compatible, and I think it is
still the case that the overlap cells are numbered last (and
contiguously).

If you just do DMPlexDistribute(dm, 1, &migrationSF, &overlapdm) then
you obviously don't have the non-overlapped one to compare, but it is
in this case still true that the overlap cells are numbered last.

Thanks,

Lawrence


More information about the petsc-users mailing list