[petsc-users] vertices on the boundary of a DMPLEX mesh

Jed Brown jed at jedbrown.org
Sat Mar 21 07:34:13 CDT 2020


Swarnava Ghosh <swarnava89 at gmail.com> writes:

> Dear PETSc team,
>
> I had the following question related to DMPLEX.
> I have a dmplex mesh created through DMPlexCreateFromCellList. I want to
> find out all the vertices that are on the mesh boundary. What is the best
> way to do this?

DMLabelCreate(PETSC_COMM_SELF, "boundary", &label);
DMPlexMarkBoundaryFaces(dm, 1, label);
DMPlexLabelComplete(dm, label);
DMPlexGetDepthStratum(dm, 0, &vstart, &vend);
for (p=vstart; p<vend; p++) {
  DMLabelGetValue(label,p,&val);
  if (val != 1) continue;
  // ... with boundary vertex p
}


More information about the petsc-users mailing list