<div dir="ltr"><div dir="ltr">On Sun, Mar 9, 2025 at 8:04 PM Onur via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:</div><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-family:Arial,sans-serif;font-size:14px"></div><p style="text-decoration:none">Hi,</p><p style="text-decoration:none">I am building a solver and for mesh handling, I use<span> </span><span>DMPlex</span>. 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):</p><div style="text-decoration:none;margin-top:14px;margin-bottom:14px"><span style="font-family:Menlo,Consolas,"Courier New",monospace">for (PetscInt f = fStart; f < fEnd; ++f) {</span><div><span style="font-family:Menlo,Consolas,"Courier New",monospace">    PetscInt adjSize = PETSC_DETERMINE;</span></div><div><span style="font-family:Menlo,Consolas,"Courier New",monospace">    PetscInt *adj = NULL;</span></div><div><span style="font-family:Menlo,Consolas,"Courier New",monospace">    PetscCallVoid(DMPlexGetAdjacency(dm_, f, &adjSize, &adj));</span></div><div><span style="font-family:Menlo,Consolas,"Courier New",monospace">    PetscCallVoid(PetscPrintf(PETSC_COMM_WORLD, "[%4d]", f));</span></div><div><span style="font-family:Menlo,Consolas,"Courier New",monospace">    PetscInt count = 0;</span></div><div><span style="font-family:Menlo,Consolas,"Courier New",monospace">    for (int i = 0; i < adjSize; ++i) {</span></div><div><span style="font-family:Menlo,Consolas,"Courier New",monospace">        if (adj[i] >= fStart && adj[i] < fEnd) {</span></div><div><span style="font-family:Menlo,Consolas,"Courier New",monospace">            count++;</span></div><div><span style="font-family:Menlo,Consolas,"Courier New",monospace">            PetscCallVoid(PetscPrintf(PETSC_COMM_WORLD, " %4d", adj[i]));</span></div><div><span style="font-family:Menlo,Consolas,"Courier New",monospace">        }</span></div><div><span style="font-family:Menlo,Consolas,"Courier New",monospace">    }</span></div><div><span style="font-family:Menlo,Consolas,"Courier New",monospace">    PetscCallVoid(PetscPrintf(PETSC_COMM_WORLD, " | %d\n", count));</span></div><div><span style="font-family:Menlo,Consolas,"Courier New",monospace">    PetscCallVoid(PetscFree(adj));</span></div><span style="font-family:Menlo,Consolas,"Courier New",monospace">}</span></div><div style="text-decoration:none;margin-top:14px;margin-bottom:14px"><span style="font-family:Menlo,Consolas,"Courier New",monospace"><p style="text-decoration:none"><span style="font-family:Arial,sans-serif">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).</span></p><p style="text-decoration:none"><span style="font-family:Arial,sans-serif">However, when I call</span><span style="font-family:Arial,sans-serif"> </span><span style="font-family:Menlo,Consolas,"Courier New",monospace">DMCreateColoring</span><span style="font-family:Arial,sans-serif">, I get the following error:</span></p><p style="text-decoration:none"><span style="font-family:Arial,sans-serif"><span style="font-family:Menlo,Consolas,"Courier New",monospace">[0]PETSC ERROR: No support for this operation for this object type  </span><br><span style="font-family:Menlo,Consolas,"Courier New",monospace">[0]PETSC ERROR: No method getcoloring for DM of type plex  </span></span></p><p style="text-decoration:none"><span style="font-family:Arial,sans-serif"><span style="font-family:Menlo,Consolas,"Courier New",monospace"></span></span></p><p style="text-decoration:none"><span style="font-family:Arial,sans-serif">What is the way to perform face coloring using</span><span style="font-family:Arial,sans-serif"> </span><span style="font-family:Arial,sans-serif">DMPlex</span><span style="font-family:Arial,sans-serif">?</span></p><p style="text-decoration:none"><span style="font-family:Arial,sans-serif"></span></p></span></div></blockquote><div>You can see at the bottom of this page (<a href="https://urldefense.us/v3/__https://petsc.org/main/manualpages/DM/DMCreateColoring/__;!!G_uCfscf7eWS!Ye71m4cv18ArH6KNma4l3K6Dap0gpNdURt6Rr0xaC8a8xT0ZlCHGYf_082sga_F8wArt0_KklHPfxzx6WRgM$">https://petsc.org/main/manualpages/DM/DMCreateColoring/</a>) 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?</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="text-decoration:none;margin-top:14px;margin-bottom:14px"><span style="font-family:Menlo,Consolas,"Courier New",monospace"><p style="text-decoration:none"><span style="font-family:Arial,sans-serif">Thank you!</span></p><p style="text-decoration:none"><span style="font-family:Arial,sans-serif">Onur</span></p></span><p></p><br></div><div style="font-family:Arial,sans-serif;font-size:14px"><div>
    </div>
</div>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!Ye71m4cv18ArH6KNma4l3K6Dap0gpNdURt6Rr0xaC8a8xT0ZlCHGYf_082sga_F8wArt0_KklHPfx9a2g7sv$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>