[petsc-users] Face coloring in DMPlex

Onur onur71 at protonmail.ch
Sun Mar 9 18:49:52 CDT 2025


Hi,

I am building a solver and for mesh handling, I useDMPlex. In my 3D mesh, I need to color faces. The adjacency information appears correct based on my checks(But I tried setting adjacency and creating new sections too):

for (PetscInt f = fStart; f < fEnd; ++f) {
PetscInt adjSize = PETSC_DETERMINE;
PetscInt *adj = NULL;
PetscCallVoid(DMPlexGetAdjacency(dm_, f, &adjSize, &adj));
PetscCallVoid(PetscPrintf(PETSC_COMM_WORLD, "[%4d]", f));
PetscInt count = 0;
for (int i = 0; i < adjSize; ++i) {
if (adj[i] >= fStart && adj[i] < fEnd) {
count++;
PetscCallVoid(PetscPrintf(PETSC_COMM_WORLD, " %4d", adj[i]));
}
}
PetscCallVoid(PetscPrintf(PETSC_COMM_WORLD, " | %d\n", count));
PetscCallVoid(PetscFree(adj));}

I am testing this on a mesh consisting of quadrilateral elements. This code correctly outputs 7 adjacent faces for interior faces and 4 for boundary faces (including the face itself).

However, when I callDMCreateColoring, I get the following error:

[0]PETSC ERROR: No support for this operation for this object type
[0]PETSC ERROR: No method getcoloring for DM of type plex

What is the way to perform face coloring usingDMPlex?

Thank you!

Onur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20250309/973b45ab/attachment.html>


More information about the petsc-users mailing list