It gives me these errors :
*** Error: Unable to tabulate dof to vertex map.
*** Reason: Can only tabulate dofs on vertices.
*** Where: This error was encountered inside DofMap.cpp.
*** Process: 0 ***
*** DOLFIN version: 2019.1.0
*** Git changeset: unknown
The problem is likely that deg is greater than 1. In that case, there exist DoFs that are not located on mesh vertices, so it is not possible to map all DoFs to corresponding vertices. See the following example:
from dolfin import *
mesh = UnitIntervalMesh(10)
for deg in [1,2]:
print("------- "+str(deg)+" -------")
print(" Number of vertices = "+str(mesh.num_vertices()))
Vp = FunctionSpace(mesh, "Lagrange", deg)
print(" Number of dofs = "+str(Vp.dim()))
try:
vtd_p = dof_to_vertex_map(Vp)
except:
print(" Failed.")
exit()
print(" Worked.")