Basis function ordering using T_apply

Instead of calling closure dofs, I would call entity_dofs(2,0), then (2,1), then (2,2) to get which dof is associated with the 1st,2nd and 3rd vertex (as you avoid assumptions on the order in entity closure dofs).

With respect to the order, if the above returns (0),(1),(2) then the vertices of the reference element aligns with the tabulated basis functions.

If cell dofs(i) align as this, then you have that the first vertex of cell i has number 0 (global number, local to process), the second has 3, etc.

Note that if you are trying to align this with the geometrical nodes of the mesh, you should use entities_to_geometry to map each vertex to the node in the geometry. See: Locate_entities returning incorrect points with MPI - #4 by dokken
for an example.