After manually generating the mesh, name the corresponding mesh label

Hello, after I manually generated a 2D mesh according to the code in section 4.3 of the i-tutorials, I want to set different names for different indexes through mesh.ngmesh.SetBCName(). However, when I check the boundary name through boundaries = mesh.GetBoundaries(), always shows default instead of the boundary name I gave. Why is that?

Thanks in advance for your reply.

set the boundary names and then recreate the ngsolve wrapper



Thank you for your reply, I tried to do this but the code will report an error at mesh=Mesh(mesh.ngmesh).

mesh = ngsolve.Mesh(ngmesh)
mesh.ngmesh.SetBCName(1, “left”)
mesh.ngmesh.SetBCName(2, “right”)
mesh.ngmesh.SetBCName(3, “bottom”)
mesh.ngmesh.SetBCName(4, “top”)

mesh = Mesh(mesh.ngmesh)

boundaries = mesh.GetBoundaries()
print(“Boundaries:”, boundaries)