Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""Permute the global/universal DoF numbering according to a
depth-first traversal of the Plex graph."""
dim = plex.getDimension()
glbl = plex.getDefaultSection()
univ = plex.getDefaultGlobalSection()
pStart, pEnd = glbl.getChart()
entity_classes = [0, 0, 0, 0]
permutation = -1 * np.ones(pEnd-pStart, dtype=np.int)
glbl_num = 0
# Create new numbering sections
glbl_new = PETSc.Section().create()
glbl_new.setChart(pStart, pEnd)
glbl_new.setUp()
univ_new = PETSc.Section().create()
univ_new.setChart(pStart, pEnd)
univ_new.setUp()
# Get a list of current universal DoFs
universal_dofs = []
for p in range(pStart, pEnd):
for c in range(univ.getDof(p)):
universal_dofs.append(univ.getOffset(p)+c)
# Renumber core DoFs
seen = set()
if plex.getStratumSize("op2_core", dim) > 0:
for cell in plex.getStratumIS("op2_core", dim).getIndices():
for p in plex.getTransitiveClosure(cell)[0]:
if p in seen:
continue