For 2:
A ugly bug/feature:
the mesh expects x,y,z values as input.
If no z is given z = 0, if no y -> y =0
it allows x,y,z to be array like to evalute many points more efficiently.
vert.points is array like, so it assumes this is an array for x values and you get 2 results namely gfu evaluated at (x, 0), (y,0) thats not what you want
Code:
for vert in mesh.vertices:
print(gfu(mesh(*vert.point)))
works.
For 3 there are 2 options.
You can either evalutate the function anywhere on the boundary:
Code:
for x in numpy.linspace(0,1,100):
print(gfu(mesh(x, 0)))
[code]
or more efficient
[code]
print(gfu(numpy.linspace(0,1,100), 0))
or if you need it at the vertices collect the boundary vertices firts:
Code:
bnd_verts = set()
for el in mesh.Elements(BND):
if el.mat == "top":
for vert in el.vertices:
bnd_verts.add(mesh[vert])
print("bnd verts = ", bnd_verts)
for vert in bnd_verts:
print(gfu(mesh(*vert.point)))
Note that el.vertices just gives a NodeId which is basically the node type (vertex) plus node number. You have to put that into the mesh again to create a node with all information (like point,...)
Best
Christopher