Add len() support to Meshes
Description
Sometimes it is helpful to know how many elements are in a Mesh. Right now there is no easy way to do this.
I proposed implementing __len__ for all Mesh classes (e.g., SphericalMesh). This is the function called by len().
Alternatives
The current workaround that I have seen is:
mesh = openmc.SphericalMesh(...)
mesh_size = len(list(mesh.indices))
Compatibility
This would not change any existing behavior. There is the question of if this should return the number of elements, or the number of "edges".
UnstructuredMesh has an n_elements property and the StructuredMesh class has num_mesh_cells, which is kind of silly. I think it would be good to provide this via an attribute of the same name for consistency.
I'll advise against an implementation of len for these objects as they aren't really containers (not able to be indexed or iterated).
Thanks for bringing this up!