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

Unify old and new interfaces in a single class #970

Merged
merged 3 commits into from
Dec 20, 2023

Conversation

aprokop
Copy link
Contributor

@aprokop aprokop commented Nov 4, 2023

Just looking for feedback for this way of unification. Essentially, it introduced an (undocumented and unused) default value to the Value template argument, and then hacks the inherited legacy class based on that.

Copy link
Contributor Author

@aprokop aprokop left a comment

Choose a reason for hiding this comment

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

Still undecided what to do with ArborX::BVH alias. It could be extended to all template arguments, but that would require changing many things in testing (ArborXTest_TreeTypeTraits.hppp and such). Benchmarks and examples would be fine.

Updated the alias.

class BruteForce
: public BasicBruteForce<MemorySpace, Details::PairIndexVolume<Box>,
Details::DefaultIndexableGetter, BoundingVolume>
template <typename MemorySpace>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This changes the number of template arguments and actually breaks backwards compatibility if someone was using ArborX::BruteForce<MemorySpace, BoundingVolume>. But to my knowledge, no one had done it, as we have not documented it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that is fine.

Copy link
Collaborator

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

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

The approach here looks good enough to me.

@aprokop aprokop added the API User visible interface modifications label Dec 7, 2023
@aprokop aprokop marked this pull request as ready for review December 16, 2023 16:57
@aprokop aprokop requested a review from dalg24 December 17, 2023 05:51
src/ArborX_BruteForce.hpp Show resolved Hide resolved
class BruteForce
: public BasicBruteForce<MemorySpace, Details::PairIndexVolume<Box>,
Details::DefaultIndexableGetter, BoundingVolume>
template <typename MemorySpace>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that is fine.

: public BasicBruteForce<MemorySpace, Details::PairIndexVolume<Box>,
Details::DefaultIndexableGetter, BoundingVolume>
template <typename MemorySpace>
class BruteForce<MemorySpace, Details::LegacyDefaultTemplateValue,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you give a default template argument to Value in the primary template then?

Copy link
Contributor Author

@aprokop aprokop Dec 20, 2023

Choose a reason for hiding this comment

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

So that ArborX::BruteForce<MemorySpace> and ArborX::BoundingVolumeHierarchy<MemorySpace> still works. If you try to remove it, you get things like

test/tstQueryTreeCallbacks_BF.cpp:5:39: error:
too few template arguments for class template 'BruteForce'
using ArborX_BruteForce_Box = ArborX::BruteForce<MemorySpace>;

Copy link
Contributor

Choose a reason for hiding this comment

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

template <class MS>
using BF = ArborX::BruteForce<MemorySpace>;

template <class MemorySpace>
using ArborX_BruteForce_Box = BF<MemorySpace>;

Copy link
Contributor Author

@aprokop aprokop Dec 20, 2023

Choose a reason for hiding this comment

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

I don't understand it. If a user had a code like ArborX::BruteForce<MemorySpace> blah, your code does nothing to it. For example, examples/brute_force would simply break.

test/ArborXTest_TreeTypeTraits.hpp Outdated Show resolved Hide resolved
src/ArborX_LinearBVH.hpp Show resolved Hide resolved
src/ArborX_LinearBVH.hpp Show resolved Hide resolved
src/details/ArborX_DetailsLegacy.hpp Show resolved Hide resolved
@aprokop aprokop mentioned this pull request Dec 20, 2023
Copy link
Collaborator

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

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

Still looks good to me.

@aprokop aprokop merged commit 528631b into arborx:master Dec 20, 2023
1 of 2 checks passed
@aprokop aprokop deleted the the_great_unification branch December 20, 2023 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API User visible interface modifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants