I will try now to answer my question. As FunctionSpace.h documentation says, the only possibility is to extract somehow this piece of information from dofmap()
. For example, you can do:
from dolfin import *
mesh = UnitSquareMesh(10,10)
V = FunctionSpace(mesh, "CG", 3)
maxCellDim = V.dofmap().max_cell_dimension()
print "maximum cell dimension = ", maxCellDim
And from maxCellDim
you can obtain the degree using e.g. the fact that $\sum_{k=1}^n k = \frac{n(n+1)}{2}$. In my opinion, the reason you are not able to just write something like V.degree()
is that FEniCS can use different spaces for different cells in a mesh... Or is there any different solution?