Hi Konrad,
I'm sorry for taking some time to reply. To be honest, the inner
working of the FE classes is not something that I've ever had the
time or opportunity to dig into, so I'm really not well positioned
to answer many of your questions. I'm glad that you've submitted a
PR for the work that you've done thus far, and I hope that you can
be guided by someone who has more familiarity with this part of the
library.
What I can say, though, is that the various FE classes have been
implemented by numerous people over time, and the logic that
dictates the way that the DoFs are assigned varies between each FE.
We have always considered this to be perfectly fine -- this is, to
the average person, an implementational detail, and the interface
that we have to interrogate DoFs (e.g. which vector component
they're associated with, whether or not they have support points,
etc...) seems to be sufficiently rich to most users. So, as the end
user, you shouldn't be writing code that would care that the FE_Q
element orders DoFs like this: [N_{0,x} N_{0,y} N_{0,z} N_{1,x} ...]
; while IIRC the FE_DGQ element orders DoFs like this: [N_{0,x}
N_{1,x} N_{2,x} ... N_{0,y} N_{1,y} ...] .
So, returning to your original set of questions: In general, I don't
believe that it can be assumed that all cell vertex DoFs are
enumerated before line/edges DoFs, before face DoFs, before cell
interior DoFs. Through the FiniteElementData class, the
FiniteElement base class seems to have a set of
n_dofs_per_[vertex,line,face,cell]_dofs()
and
get_first_[line/quad/hex]_index()
functions, which does suggest that I'm wrong about this, so I'd be
happy to be corrected on this point. (Question: What does a
vertex/edge/face DoF even mean for a DG element?) Maybe these are
the exact functions that you were looking for (and maybe with this ,
if the [vertex,edge,face,cell] groupings do apply, you can map from
the cell DoF->associated geometric entity using these functions).
But I don't that they would help understanding the ordering (e.g.
lexiographic or something else; element base index fast or spacedim
fast, etc.) within each grouping -- again, that's probably a
decision that was left to the designer of each FE class, and I don't
think that there's been a need for any consistency between the
classes. But again, I'm just putting my thoughts out there and
anticipate being corrected on these points.
I get the feeling that there is no overlap in assignment of DoFs
between geometric entities. Consider each of these entities not to
have closure: so you're actually referring to DoFs associated with
the cell interior (excl. faces, edges and vertices), face interior
(excl edges and vertices) and edge interiors (excl. vertices). To
me, that the only sensible interpretation of this.
Thanks for giving this so much thought, and for the interesting
questions. I've certainly got a lot to learn from the responses that
may come from the other developers.
Best,
Jean-Paul