-
Notifications
You must be signed in to change notification settings - Fork 39
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
Finalize BasicBoundingVolumeHierarchy #915
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,8 +153,12 @@ void check_valid_access_traits(PredicatesTag, Predicates const &) | |
"Invalid tag for the predicates"); | ||
} | ||
|
||
template <typename Primitives> | ||
void check_valid_access_traits(PrimitivesTag, Primitives const &) | ||
struct DoNotCheckGetReturnType : std::false_type | ||
{}; | ||
|
||
template <typename Primitives, typename CheckGetReturnType = std::true_type> | ||
void check_valid_access_traits(PrimitivesTag, Primitives const &, | ||
CheckGetReturnType = {}) | ||
{ | ||
using Access = AccessTraits<Primitives, PrimitivesTag>; | ||
static_assert( | ||
|
@@ -187,11 +191,32 @@ void check_valid_access_traits(PrimitivesTag, Primitives const &) | |
"member function"); | ||
using T = std::decay_t<Kokkos::detected_t<AccessTraitsGetArchetypeExpression, | ||
Access, Primitives>>; | ||
static_assert(GeometryTraits::is_point<T>{} || GeometryTraits::is_box<T>{}, | ||
"AccessTraits<Primitives,PrimitivesTag>::get() return type " | ||
"must decay to a point or a box type"); | ||
if constexpr (CheckGetReturnType()) | ||
{ | ||
static_assert(GeometryTraits::is_point<T>{} || GeometryTraits::is_box<T>{}, | ||
"AccessTraits<Primitives,PrimitivesTag>::get() return type " | ||
"must decay to a point or a box type"); | ||
} | ||
} | ||
|
||
template <typename Values> | ||
class AccessValues | ||
Comment on lines
+202
to
+203
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about the name but I suppose we can change at will later. It reminds me of #729 but I suppose it is better to wait for the refactor to be done before we proceed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I plan to do some version of #729 after this one to cut down on the number of |
||
{ | ||
private: | ||
using Access = AccessTraits<Values, PrimitivesTag>; | ||
|
||
public: | ||
Values _values; | ||
|
||
using memory_space = typename Access::memory_space; | ||
|
||
KOKKOS_FUNCTION | ||
decltype(auto) operator()(int i) const { return Access::get(_values, i); } | ||
|
||
KOKKOS_FUNCTION | ||
auto size() const { return Access::size(_values); } | ||
}; | ||
|
||
} // namespace Details | ||
|
||
namespace Traits | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ class LegacyValues | |
{} | ||
|
||
KOKKOS_FUNCTION | ||
decltype(auto) operator()(size_type i) const | ||
auto operator()(size_type i) const | ||
{ | ||
if constexpr (std::is_same_v<BoundingVolume, | ||
typename AccessTraitsHelper<Access>::type>) | ||
|
@@ -70,4 +70,25 @@ struct LegacyCallbackWrapper | |
|
||
} // namespace ArborX::Details | ||
|
||
template <typename Primitives, typename BoundingVolume> | ||
struct ArborX::AccessTraits< | ||
ArborX::Details::LegacyValues<Primitives, BoundingVolume>, | ||
ArborX::PrimitivesTag> | ||
{ | ||
using Values = ArborX::Details::LegacyValues<Primitives, BoundingVolume>; | ||
|
||
using memory_space = typename Values::memory_space; | ||
using size_type = typename Values::size_type; | ||
using value_type = typename Values::value_type; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is that used? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now now |
||
|
||
KOKKOS_FUNCTION static size_type size(Values const &values) | ||
{ | ||
return values.size(); | ||
} | ||
KOKKOS_FUNCTION static decltype(auto) get(Values const &values, size_type i) | ||
{ | ||
return values(i); | ||
} | ||
}; | ||
|
||
#endif |
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.
Any particular reason for defining this guy instead of using
AccessValues
?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.
AccessValues
Old/new interface: creates an illusion of an array of values through calling based on
Values
through callingAccessTraits
(RangeTraits
in the future)Indexables
New interface: creates an illusion of an array of indexables based on
Values
through calling an indexable getterPrimitivesIndexables
Old interface: creates an illusion of an array of indexables based on
Primitives
through callingAccessTraits