I’m trying to set up boundary conditions for a square mesh imported from gmesh, but I need to know the mesh’s height and width in order to define them. I don’t want to hardcode them for every mesh I use, so I’m trying to determine them through code. How can I find the maximum values for x[0] and x[1] across the entire mesh?
Thanks!
You didn’t say what version of dolfin you are using, but probably you can do:
xmin = mesh.coordinates()[:, 0].min()
and similar for max and for y.