<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><br class=""><br class=""><blockquote type="cite" class="">On 19 Mar 2021, at 14:21, Jed Brown <<a href="mailto:jed@jedbrown.org" class="">jed@jedbrown.org</a>> wrote:<br class=""><br class="">Notice how the permutations are contained within the vertices {0, ..., 8}, edges {9, ..., 24}, and cells {25, ..., 32}. I would like to get rid of that restriction, but you've said it would have significant non-local consequences so I haven't tried.<br class=""></blockquote><br class=""><div class="">What we do, and I'm not sure if this is exactly what you want, is the following.</div><div class=""><br class=""></div><div class="">Use DMPlexGetOrdering to compute permutatations of points with RCM. As you say, this is stratified.</div><div class=""><br class=""></div><div class="">Then, we traverse cells in this RCM ordering and compute a permutation of the full plex chart greedily.</div><div class=""><br class=""></div><div class="">Pseudo-code:</div><div class=""><br class=""></div><div class="">permutation = empty(pstart - pend)</div><div class="">i = 0</div><div class="">for cell in reordered_cells:</div><div class="">   points = plex.getclosure(cell)</div><div class="">   for point in points:</div><div class="">       if not seen(point):</div><div class="">           permutation[i] = point</div><div class="">           i += 1</div><div class=""><br class=""></div><div class="">Now when we create a section, we say</div><div class=""><br class=""></div><div class="">PetscSectionSetPermutation(sec, permutation)</div><div class=""><br class=""></div><div class="">And then when the section offsets are calculated, the points are visited and numbered in the order provided by the permutation.</div><div class=""><br class=""></div><div class="">This seems to work, here are the sparsity patterns for a Q3 mass matrix on an unstructured quad mesh (from gmsh). One with RCM ordering applied, the other without).</div><div class=""><br class=""></div><div class="">I guess the only issue is now one needs to always remember to traverse cells in the reordered_cells order (although if you call DMPlexPermute that is automatic?).</div><div class=""><br class=""></div><div class="">Cheers,</div><div class=""><br class=""></div><div class="">Lawrence</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><img apple-inline="yes" id="433EABF3-F22C-425A-870A-999CC5BEA6D5" width="264" height="263" src="cid:703BA83B-896A-4511-A10F-1285BA9777F4@lan" class=""><img apple-inline="yes" id="10A3F342-8351-4B3A-BD06-5B71C9710F3F" width="268" height="266" src="cid:476160DB-026A-4B5B-8B22-86E5A21B3159@lan" class=""></div></body></html>