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

Move DefaultIndexableGetter to Experimental:: and provide CTAD for Indexables #1181

Merged
merged 3 commits into from
Nov 10, 2024

Conversation

aprokop
Copy link
Contributor

@aprokop aprokop commented Oct 12, 2024

  • Move DefaultIndexableGetter from Details:: to Experimental::
  • Provide CTAD for Indexables

@aprokop aprokop added the refactoring Code reorganization label Oct 12, 2024
@aprokop
Copy link
Contributor Author

aprokop commented Oct 18, 2024

@dalg24 Thoughts on this PR?

Copy link
Contributor

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

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

Please elaborate on the rational/motivation
As I recall it, in Boost that function object was about being able to extract the geometry from things like pair or tuples but here it looks like a lateral move and it is unclear to me what this improves over the status quo as currently proposed

@aprokop
Copy link
Contributor Author

aprokop commented Nov 7, 2024

Please elaborate on the rational/motivation

Move to Experimental::

This is straightforward. We can't keep it in Details when it is part of the official interface and is a default argument to the constructor.

Calling it Indexable

Better alignment with Boost.Geometry. Not a strong point, but there's little drawback for more compatibility.

Templating it on value type

This strong types it, so that the indexable getter will be guaranteed to work with only the provided value type.
I'm less confident about that, and deferred expertise to Boost.

@dalg24
Copy link
Contributor

dalg24 commented Nov 7, 2024

We can't keep it in Details when it is part of the official interface and is a default argument to the constructor.

Why not. We can say there is a default and define clearly what it does without making it something public. Users can deduce the type if they really want to spell it out.

@aprokop
Copy link
Contributor Author

aprokop commented Nov 7, 2024

Why not. We can say there is a default and define clearly what it does without making it something public. Users can deduce the type if they really want to spell it out.

If a user wants to specify a custom bounding volume type for the hierarchy, they would have to write

   BVH<MemorySpace, Values, ArborX::Details::DefaultIndexableGetter, BoundingVolume> bvh(blah...);

thus putting Details:: namespace inside the user code.

@dalg24
Copy link
Contributor

dalg24 commented Nov 7, 2024

What benefit do we get from making it a template? Were you planing on supporting pair<Geometry, ...> or whatnot?

@aprokop
Copy link
Contributor Author

aprokop commented Nov 7, 2024

What benefit do we get from making it a template?

That is a good question. I don't have a good answer other than Boost does it. And I trust them to make good interfaces more than myself. Can you think of anything?

Were you planing on supporting pair<Geometry, ...> or whatnot?

We already support PairValueIndex. In the previous version, it was one of the member functions, while in the new one it's partial specialization.

@aprokop
Copy link
Contributor Author

aprokop commented Nov 8, 2024

I updated the PR. It no longer renames DefaultIndexableGetter and does not template it on the Value. Instead, it simply provides CTAD for Indexables and moves DefaultIndexableGetter from Details to Experimental.

@aprokop aprokop changed the title Make default indexable getter follow Boost Move DefaultIndexableGetter to Experimental:: and provide CTAD for Indexables Nov 8, 2024
@aprokop aprokop requested a review from dalg24 November 9, 2024 10:51
Copy link
Contributor

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

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

Looks good, just wanting to confirm that the Indexables deduction guide is needed

#else
KOKKOS_FUNCTION
#endif
Indexables(Values, IndexableGetter) -> Indexables<Values, IndexableGetter>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remind me why we need to provide a user-defined deduction guide and it does not work out of the box.

Copy link
Contributor Author

@aprokop aprokop Nov 9, 2024

Choose a reason for hiding this comment

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

Implicitly-generated deduction guide for aggregates is C++20. See Notes section here.

Copy link
Contributor

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

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

I would guard the deduction guides with #ifndef KOKKOS_ENABLE_CXX17 but leaving it up to you

@aprokop aprokop merged commit bede66d into arborx:master Nov 10, 2024
1 of 2 checks passed
@aprokop aprokop deleted the indexable branch November 10, 2024 17:55
@aprokop aprokop mentioned this pull request Nov 11, 2024
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