@@ -593,6 +593,26 @@ def face_boundary_indices(self):
593593 indzu = self .gridFz [:, 2 ] == max (self .gridFz [:, 2 ])
594594 return indxd , indxu , indyd , indyu , indzd , indzu
595595
596+ @property
597+ def cell_bounds (self ):
598+ """The bounds of each cell.
599+
600+ Return a 2D array with the coordinates that define the bounds of each
601+ cell in the mesh. Each row of the array contains the bounds for
602+ a particular cell in the following order: ``x1``, ``x2``, ``y1``,
603+ ``y2``, ``z1``, ``z2``, where ``x1 < x2``, ``y1 < y2`` and ``z1 < z2``.
604+ """
605+ nodes = self .nodes .reshape ((* self .shape_nodes , - 1 ), order = "F" )
606+
607+ min_nodes = nodes [(slice (- 1 ),) * self .dim ]
608+ min_nodes = min_nodes .reshape ((self .n_cells , - 1 ), order = "F" )
609+ max_nodes = nodes [(slice (1 , None ),) * self .dim ]
610+ max_nodes = max_nodes .reshape ((self .n_cells , - 1 ), order = "F" )
611+
612+ cell_bounds = np .stack ((min_nodes , max_nodes ), axis = - 1 )
613+ cell_bounds = cell_bounds .reshape ((self .n_cells , - 1 ))
614+ return cell_bounds
615+
596616 @property
597617 def cell_nodes (self ):
598618 """The index of all nodes for each cell.
0 commit comments