-
-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose _bbox_coordinates
of BoundingBoxTree
to users
#3600
base: main
Are you sure you want to change the base?
Conversation
bbox_coordinates
of BoundingBoxTree to users_bbox_coordinates
of BoundingBoxTree
to users
- Avoiding copying of bounding boxes - Early break in point_in_bbox
I've been profiling
In this snippet of code from dolfinx import mesh, geometry
import numpy as np
from mpi4py import MPI
from line_profiler import LineProfiler
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
def main():
tdim = 3
num_elems_side = 20
domain = mesh.create_unit_cube(MPI.COMM_WORLD,
num_elems_side, num_elems_side, num_elems_side,
mesh.CellType.tetrahedron, dtype=np.float64)
bbtree = geometry.bb_tree(domain, tdim, padding=0.0)
rng = np.random.default_rng(0)
num_points = 200000
points = rng.random((num_points, 3))
collisions = geometry.compute_collisions_points(bbtree, points)
if __name__=="__main__":
lp = LineProfiler()
lp_wrapper = lp(main)
lp_wrapper()
with open(f"profiling_rank{rank}.txt", 'w') as pf:
lp.print_stats(stream=pf) the line |
Could you split these changes into two PRs? The algorithmic changes need a different type of review. |
@@ -310,10 +311,13 @@ void _compute_collisions_point(const geometry::BoundingBoxTree<T>& tree, | |||
{ | |||
std::deque<std::int32_t> stack; | |||
std::int32_t next = tree.num_bboxes() - 1; | |||
std::span<const T> bbox_coordinates = tree.bbox_coordinates(); | |||
auto view_bbox = [&bbox_coordinates](std::size_t node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed - use subspan.
Addressing #3599. Expose
_bbox_coordinates
ofBoundingBoxTree
the same way_x
ofGeometry
is exposed. I added a test with point-tree collisions before and after a translational motion.