<div dir="ltr"><div dir="ltr">On Tue, Jan 27, 2026 at 3:34 PM neil liu <<a href="mailto:liufield@gmail.com">liufield@gmail.com</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 dir="ltr"><div>Dear Petsc users and developers,<br></div><div><br></div><div>I am exploring the mapping between local, partition and global dofs.<br></div><div>The following is my pseudo code, dof2Partitionmapping denotes the mapping between the local dof (20 local dofs each tetrahedra) and partition dof.<br></div></div></blockquote><div><br></div><div>We usually say cell, local, and global dofs.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>Is this mapping determined by Petsc itself under the hood (PetscSectionGetOffset)?</div></div></blockquote><div><br></div><div>Plex just iterates over the points in the canonical numbering (cells, vertices, faces, edges). You can change the iteration order using</div><div><br></div><div> <a href="https://urldefense.us/v3/__https://petsc.org/main/manualpages/PetscSection/PetscSectionSetPermutation/__;!!G_uCfscf7eWS!d7O-UstRpLu6SVXJg9iUKL61tBvbPTcV2U07ko4ptaMdZ71evm1SJ5h_BdOA30VCeeLZU1IXr3PKorHeZBEJ$">https://petsc.org/main/manualpages/PetscSection/PetscSectionSetPermutation/</a></div><div><br></div><div>You can use that, for example, to place all ghost dofs at the end.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>For now, I am coding this mapping (local to partition) myself just based on the edge and face number in the partition. It seems the results are reasonable. But with this kind of self-defined mapping, the owned dofs and ghost dofs are interleaved. Will this bring bad results for the communication of MatStash? <br></div><div><br></div><div>Thanks,<br></div><div>Xiaodong<br></div><div><br></div><div><b>1. set 2 dofs for each edge and 2 dofs for each edge face respectively</b></div><div>PetscSectionSetChart(s, faceStart, edgeEnd);</div><div>PetscSectionSetDof(s, faceIndex, 2); </div><div>PetscSectionSetFieldDof(s, faceIndex, 0, 1);<br></div><div>PetscSectionSetDof(s, edgeIndex, 2); </div><div>PetscSectionSetFieldDof(s, edgeIndex, 0, 1);<br></div><div>PetscSectionsetup(s)</div><div><br></div><div><b>2. Create matrix based on DMPlex</b><br></div><div> DMSetMatType(dm, MATAIJ); </div><div> DMCreateMatrix(dm, &A);<br></div><div><br></div><div><b>3. loop over elements to set local values for Matrix</b><br></div><div>MatSetValuesLocal(A, dof2Partitionmapping.size(), dof2Partitionmapping.data(), dof2Partitionmapping.size(), dof2Partitionmapping.data(), Matrix_Local.data(), ADD_VALUES);</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!d7O-UstRpLu6SVXJg9iUKL61tBvbPTcV2U07ko4ptaMdZ71evm1SJ5h_BdOA30VCeeLZU1IXr3PKoiFbdkzM$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>