On Feb 16, 2023, at 10:54 AM, Lawrence Mitchell <[email protected]> wrote:

Hi Blaise,

On Thu, 16 Feb 2023 at 15:17, Blaise Bourdin <[email protected]> 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.


Excellent. That is what I was hoping.

Regards,
Blaise



Thanks,

Lawrence

— 
Canada Research Chair in Mathematical and Computational Aspects of Solid Mechanics (Tier 1)
Professor, Department of Mathematics & Statistics
Hamilton Hall room 409A, McMaster University
1280 Main Street West, Hamilton, Ontario L8S 4K1, Canada 
https://www.math.mcmaster.ca/bourdin | +1 (905) 525 9140 ext. 27243

Reply via email to