Skip to content
Snippets Groups Projects

Refactor access traits

Merged Arndt, Daniel requested to merge github/fork/dalg24/refactor_access_traits into master
1 file
+ 21
2
Compare changes
  • Side-by-side
  • Inline
@@ -213,6 +213,25 @@ inline void TreeConstruction<DeviceType>::calculateBoundingBoxOfTheScene(
Kokkos::fence();
}
template <typename Primitives>
struct GeometryTagHelper
{
private:
using accessor_return_type = std::decay_t<decltype(
Traits::Access<Primitives, Traits::PrimitivesTag>::get(
std::declval<Primitives const &>(), std::declval<int>()))>;
static_assert(std::is_same<accessor_return_type, Point>::value ||
std::is_same<accessor_return_type, Box>::value,
"Invalid return type of "
"Traits::Access<Primitives,Traits::PrimitivesTag>::get()");
public:
using tag =
std::conditional_t<std::is_same<accessor_return_type, Point>::value,
PointTag, BoxTag>;
};
template <typename Primitives, typename MortonCodes>
inline void assignMortonCodesDispatch(BoxTag, Primitives const &primitives,
MortonCodes morton_codes,
@@ -262,7 +281,7 @@ inline void TreeConstruction<DeviceType>::assignMortonCodes(
auto const n = Access::size(primitives);
ARBORX_ASSERT(morton_codes.extent(0) == n);
using Tag = typename Access::Tag;
using Tag = typename GeometryTagHelper<Primitives>::tag;
assignMortonCodesDispatch(Tag{}, primitives, morton_codes,
scene_bounding_box);
}
@@ -322,7 +341,7 @@ inline void TreeConstruction<DeviceType>::initializeLeafNodes(
"Encoding leaf index in pointer to child is not safe if the "
"index and pointer types do not have the same size");
using Tag = typename Access::Tag;
using Tag = typename GeometryTagHelper<Primitives>::tag;
initializeLeafNodesDispatch(Tag{}, primitives, permutation_indices,
leaf_nodes);
}
Loading