MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / BoundingBoxTree

Class BoundingBoxTree

python/dolfinx/geometry.py:69–114  ·  view source on GitHub ↗

Bounding box trees used in collision detection.

Source from the content-addressed store, hash-verified

67
68
69class BoundingBoxTree(typing.Generic[Real]):
70 """Bounding box trees used in collision detection."""
71
72 _cpp_object: _cpp.geometry.BoundingBoxTree_float32 | _cpp.geometry.BoundingBoxTree_float64
73
74 def __init__(self, tree):
75 """Wrap a C++ BoundingBoxTree.
76
77 Note:
78 This initializer should not be used in user code. Use
79 ``bb_tree``.
80
81 """
82 self._cpp_object = tree
83
84 @property
85 def num_bboxes(self) -> int:
86 """Number of bounding boxes."""
87 return self._cpp_object.num_bboxes
88
89 @property
90 def bbox_coordinates(self) -> npt.NDArray[Real]:
91 """Coordinates of lower and upper corners of bounding boxes.
92
93 Note:
94 Rows `2*ibbox` and `2*ibbox+1` correspond to the lower
95 and upper corners of bounding box `ibbox`, respectively.
96 """
97 return self._cpp_object.bbox_coordinates
98
99 def get_bbox(self, i) -> npt.NDArray[Real]:
100 """Get lower and upper corners of the ith bounding box.
101
102 Args:
103 i: Index of the box.
104
105 Returns:
106 The 'lower' and 'upper' points of the bounding box.
107 Shape is ``(2, 3)``,
108
109 """
110 return self._cpp_object.get_bbox(i)
111
112 def create_global_tree(self, comm) -> BoundingBoxTree[Real]:
113 """Create a global bounding box tree."""
114 return BoundingBoxTree(self._cpp_object.create_global_tree(comm))
115
116
117def bb_tree(

Callers 3

create_global_treeMethod · 0.70
bb_treeFunction · 0.70
create_midpoint_treeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected