I want to iterate the values of MeshFunction and find interesting entities. Specific questions are in the comments of the code.
import meshio from mshr import * from fenics import * mesh = UnitCubeMesh(2,2,2) boundary = MeshFunction('size_t' ,mesh , 2) class BoundaryDown(SubDomain): def inside(self,x,on_boundary): return on_boundary and near(x, 0) down = BoundaryDown() down.mark(boundary, 1) n = 0 # I can iterate the values of MeshFunction. boundary.array()[n] # If I am interested in the value, I will get the entity. MeshEntity(mesh, 2, n) # Also, I can get the midpoint of this entity. MeshEntity(mesh, 2, n).midpoint() # But I can not find a function which return the vertices of the entity.