[petsc-users] Cell numbering in DMPlex

Matthew Knepley knepley at gmail.com
Tue Sep 29 12:56:14 CDT 2020


On Tue, Sep 29, 2020 at 11:34 AM Pierre Seize <Pierre.Seize at onera.fr> wrote:

> Hello!
>
> I have a parallel DMPlex, and I would like to loop on every "real" cell.
> It seems that the indexing is as such:
>
> [cStart (always 0 I think), XXX [ -> actual cell
>
> [XXX, cStartGhost [ -> parallel cells, as I have overlap = 1
>
> [cStartGhost, cEndGhost= cEnd[ -> my finite volume boundaries cells.
>
> I can get cStart and cEnd with DMPlexGetHeightStratum, and cStartGhost
> and cEndGhost with DMPlexGetGhostCellStratum.
>
> What I want is the bound XXX. Right now, I do loop from cStart to cEnd,
> and when I find a cell that gives me DMGetLabelValue(dm, "ghost", c,
> &value) with a positive value I break my loop and take the current cell
> number as the wanted bound. I am not unsatisfied with this but I wonder
> if there is a more straightforward way to get what I want.
>

The documentation needs to be improved I see. Okay, first

  [cStart, cEnd) is the range for all cells, meaning codimension 0 mesh
points

  [cStartGhost, cEndGhost) is the range for FV ghost cells. These are _not_
parallel ghosts. They are phantom cells
  outside boundary faces, used to enforce boundary conditions.

Thus,

  [cStart, cStartGhost) are the cells in the local Plex

However, if you have nonzero overlap, then cells can be shared. Cells that
are not owned by this process are listed
in the pointSF,

  DMGetPointSF(dm, &sf)

and you can check for them using

  PetscSFGetGraph(sf, &nroots, &nleaves, &leaves, &remoteLeaves);
  PetscFindInt(cell, nleaves, leaves, &idx);
  if (idx >= 0) {
    <cell is not owned>
  }

You could, of course, put the leaves in a DMLabel if you think it is easier
than the SF check.

   Thanks,

      Matt


> Thank you.
>
>
> Pierre
>
>

-- 
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/20200929/75697f48/attachment.html>


More information about the petsc-users mailing list