the ith
row of V.tabulate_dof_coordinates()
relates to the i
th entry of u.vector().get_local()
.
You can for instance use
from dolfin import *
import numpy as np
mesh = UnitSquareMesh(4, 4)
V = FunctionSpace(mesh, 'CG', 1)
u = Function(V)
u.interpolate(Expression('x[0]+ 2*x[1]', degree=1))
vertex_function = MeshFunction("size_t", mesh, 0)
class BoundaryMarker(SubDomain):
def inside(self, x, on_boundary):
return on_boundary
BoundaryMarker().mark(vertex_function, 1)
boundary_vertices = np.asarray(vertex_function.where_equal(1))
v_to_d = vertex_to_dof_map(V)
dofs = v_to_d[boundary_vertices]
x = V.tabulate_dof_coordinates()
for dof in dofs:
print(x[dof], u.vector()[dof])