Expose _bbox_coordinates of BoundingBoxTree to users - #3600
Merged
Conversation
bbox_coordinates of BoundingBoxTree to users_bbox_coordinates of BoundingBoxTree to users
- Avoiding copying of bounding boxes - Early break in point_in_bbox
Contributor
Author
|
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 |
Member
|
Could you split these changes into two PRs? The algorithmic changes need a different type of review. |
garth-wells
reviewed
Feb 13, 2025
| 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) |
Contributor
Author
|
I'll make the changes as soon as I have time, apologies for the delay. |
garth-wells
approved these changes
Mar 2, 2025
garth-wells
approved these changes
Mar 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addressing #3599. Expose
_bbox_coordinatesofBoundingBoxTreethe same way_xofGeometryis exposed. I added a test with point-tree collisions before and after a translational motion.