[petsc-users] dmplex overlap questions
Matthew Knepley
knepley at gmail.com
Thu Feb 16 10:43:16 CST 2023
On Thu, Feb 16, 2023 at 10:54 AM Lawrence Mitchell <wence at gmx.li> wrote:
> 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:
>
Note that you can use
PetscFindInt(nleaves, ilocal, cell, &loc);
as well. I do this a lot in the library.
Thanks,
Matt
> 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, ¶lleldm);
> 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
>
--
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/20230216/a755245c/attachment.html>
More information about the petsc-users
mailing list