porepy.geometry.bounding_box module

Compute bounding boxes of geometric objects.

class DomainSides(all_bf, east, west, north, south, top, bottom)[source]

Bases: NamedTuple

Type for domain sides.

Parameters:
  • all_bf (npt.NDArray[np.int_])

  • east (npt.NDArray[np.bool_])

  • west (npt.NDArray[np.bool_])

  • north (npt.NDArray[np.bool_])

  • south (npt.NDArray[np.bool_])

  • top (npt.NDArray[np.bool_])

  • bottom (npt.NDArray[np.bool_])

all_bf: ndarray[Any, dtype[int64]]

All boundary faces.

bottom: ndarray[Any, dtype[bool]]

Bottom boundary faces.

east: ndarray[Any, dtype[bool]]

East boundary faces.

north: ndarray[Any, dtype[bool]]

North boundary faces.

south: ndarray[Any, dtype[bool]]

South boundary faces.

top: ndarray[Any, dtype[bool]]

Top boundary faces.

west: ndarray[Any, dtype[bool]]

West boundary faces.

from_grid(g)[source]

Return the bounding box of the grid.

Parameters:

g (Grid) – The grid for which the bounding box is to be computed.

Returns:

A 2-tuple containing

ndrarray: shape=(3,)

Minimum node coordinates in each direction.

ndrarray: shape=(3,)

Maximum node coordinates in each direction.

Return type:

tuple[ndarray, ndarray]

from_md_grid(mdg, as_dict=False)[source]

Return the bounding box of a mixed-dimensional grid.

Parameters:
  • mdg (MixedDimensionalGrid) – Mixed-dimensional grid for which the bounding box is to be computed.

  • as_dict (bool) –

    default=False

    If True, the bounding box is returned as a dictionary, if False, it is represented by arrays with max and min values.

Returns:

If as_dict is True, the bounding box is represented as a dictionary with keys xmin, xmax, ymin, ymax, zmin, and zmax.

Else, two ndarrays are returned, containing the min and max values of the coordinates, respectively.

Return type:

dict[str, float] | tuple[ndarray, ndarray]

from_points(pts, overlap=0)[source]

Obtain a bounding box for a point cloud.

Parameters:
  • pts (ndarray) –

    shape=(nd, np)

    Point cloud. nd should be 2 or 3.

  • overlap (float) –

    default=0

    Extension of the bounding box outside the point cloud. Scaled with extent of the point cloud in the respective dimension.

Returns:

The domain represented as a dictionary with keywords xmin, xmax, ymin, ymax, and (if nd == 3) zmin and zmax.

Return type:

dict[str, float]

make_bounding_planes_from_box(box)[source]

Translate the bounding box into fractures. Tag them as boundaries.

For now the domain specification is limited to a box consisting of six planes.

Parameters:

box (dict[str, float]) – Dictionary containing max and min coordinates in three dimensions. The dictionary should contain the keys xmin, xmax, ymin, ymax, zmin, and zmax.

Returns:

List of the six bounding planes defined by 3 x 4 coordinate values.

Return type:

list[ndarray]