Skip to content
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

Refactor space filling curves surrounding code #1180

Merged
merged 3 commits into from
Jan 27, 2025

Conversation

aprokop
Copy link
Contributor

@aprokop aprokop commented Oct 11, 2024

  • Fix getGeometry for prvalues
    If a passed function argument is a prvalue, it will be destroyed once we return, as returning a reference to its member does not extend its lifetime.
  • Move projectOntoSpaceFillingCurve from ArborX_TreeConstruction.hpp to ArborX_SpaceFillingCurve.hpp
    It will also be used by the tree traversal now
  • Add computeSpaceFillingCurvePermutation that combines projectOntoSpaceFillingCurve with sorting to further reduce the amount of code
  • Added PredicateIndexables to easily iterate over predicate geometries

@aprokop aprokop added the refactoring Code reorganization label Oct 11, 2024
dalg24
dalg24 previously requested changes Oct 11, 2024
src/spatial/detail/ArborX_SpaceFillingCurves.hpp Outdated Show resolved Hide resolved
src/spatial/detail/ArborX_SpaceFillingCurves.hpp Outdated Show resolved Hide resolved
Comment on lines 96 to 104
template <typename ExecutionSpace, typename Values, typename SpaceFillingCurve,
typename Box>
inline auto computeSpaceFillingCurvePermutation(ExecutionSpace const &space,
Values const &values,
SpaceFillingCurve const &curve,
Box const &scene_bounding_box)
{
auto linear_ordering_indices =
projectOntoSpaceFillingCurve(space, values, curve, scene_bounding_box);
return sortObjects(space, linear_ordering_indices);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saves little code to bundle two distinct operations.
I am not convinced it is a good idea to introduce it.

Copy link
Contributor Author

@aprokop aprokop Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does a bit more than that in that it also reduces the amount of used memory as linear_ordering_indices are deallocated automatically once this function returns. This behavior is similar to the original sortPredicatesAlongSpaceFillingCurve.

If a passed function argument is a prvalue, it will be destroyed once we
return, as returning a reference to its member does not extend its
lifetime.
@aprokop aprokop force-pushed the remove_batched_queries branch from aaff2d0 to 6160156 Compare January 6, 2025 16:16
@aprokop aprokop force-pushed the remove_batched_queries branch from 6160156 to 8a7d92b Compare January 17, 2025 16:22
@aprokop aprokop requested a review from dalg24 January 17, 2025 16:23
@aprokop aprokop merged commit b007f37 into arborx:master Jan 27, 2025
1 of 2 checks passed
@aprokop aprokop deleted the remove_batched_queries branch January 27, 2025 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Code reorganization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants