How do I get the coordinates for the dofs in JuAFEM?

I have been trying to get a hang on the JuAFEM package and running the Heat Equation example from the documentation I have noticed that the ordering of the resulting vector appears to not correspond to the ordering of nodes I find in the mesh.

This makes sense to me, as it seems to be fairly standard to reorder the nodes using a reverse cuthill-mckee. However, I would like to be able to

  1. Get the dof node coordinates. For 1st order elements these correspond to the mesh node coordinates, but for higher order elements they won’t.

  2. For the case of 1st order elements I would like the permutation mapping the elements in the solution vector u to the node ordering in the mesh.

Okay, after much troublesome digging through the source code I have found a way to get the permutation. I have included it as a function below, should anyone else need something like this.

function getdofperm(dh::DofHandler)
    p = fill(0, getnnodes(dh.grid))
    for cell in CellIterator(dh)
        _celldofs = celldofs(cell)
        for (i,node) in enumerate(getnodes(cell))
            p[node] = _celldofs[i]
    return p