diff --git a/meshmode/mesh/processing.py b/meshmode/mesh/processing.py index 170b0a006fb8ea8ac612a7759f9e2fb0abe195f5..7d8d1b7898996aaa1edc7a34085e142aed6d6e08 100644 --- a/meshmode/mesh/processing.py +++ b/meshmode/mesh/processing.py @@ -30,9 +30,12 @@ import modepy as mp __doc__ = """ .. autofunction:: find_volume_mesh_element_orientations .. autofunction:: perform_flips +.. autofunction:: find_bounding_box """ +# {{{ orientations + def find_volume_mesh_element_group_orientation(mesh, grp): """Return a positive floating point number for each positively oriented element, and a negative floating point number for @@ -117,6 +120,8 @@ def test_volume_mesh_element_orientations(mesh): return (area_elements[valid] > 0).all() +# }}} + # {{{ flips @@ -192,4 +197,19 @@ def perform_flips(mesh, flip_flags, skip_tests=False): # }}} +# {{{ bounding box + +def find_bounding_box(mesh): + """ + :return: a tuple *(min, max)*, each consisting of a :class:`numpy.ndarray` + indicating the minimal and maximal extent of the geometry along each axis. + """ + + return ( + np.min(mesh.vertices, axis=-1), + np.max(mesh.vertices, axis=-1), + ) + +# }}} + # vim: foldmethod=marker