On Sun, Mar 9, 2025 at 8:04 PM Onur via petsc-users <petsc-users@mcs.anl.gov> wrote:
> Hi, > > I am building a solver and for mesh handling, I use DMPlex. 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 call DMCreateColoring, 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 using DMPlex? > > You can see at the bottom of this page ( https://urldefense.us/v3/__https://petsc.org/main/manualpages/DM/DMCreateColoring/__;!!G_uCfscf7eWS!Ye71m4cv18ArH6KNma4l3K6Dap0gpNdURt6Rr0xaC8a8xT0ZlCHGYf_082sga_F8wArt0_KklHPfxzx6WRgM$ ) that there are no Plex-specific implementations of DMCreateColorjng. This is because I do not know of any algorithms for unstructured meshes that work better than coloring the nonzero structure. Thus I have always used the greedy coloring on the matrix. Could you use that? Thanks, Matt > Thank you! > > Onur > > > -- 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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!Ye71m4cv18ArH6KNma4l3K6Dap0gpNdURt6Rr0xaC8a8xT0ZlCHGYf_082sga_F8wArt0_KklHPfx5tzftPQ$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!Ye71m4cv18ArH6KNma4l3K6Dap0gpNdURt6Rr0xaC8a8xT0ZlCHGYf_082sga_F8wArt0_KklHPfx9a2g7sv$ >