Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/brute_force/example_brute_force.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ struct ArborX::AccessTraits<Dummy>
}
};

template <typename View,
typename Enable = std::enable_if_t<Kokkos::is_view_v<View>>>
template <typename View>
requires(Kokkos::is_view_v<View>)
std::ostream &operator<<(std::ostream &os, View const &view)
{
auto view_host =
Expand Down
4 changes: 2 additions & 2 deletions src/cluster/detail/ArborX_CartesianGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ struct CartesianGrid
buildGrid();
}

template <typename Point, typename Enable = std::enable_if_t<
GeometryTraits::is_point_v<Point>>>
template <typename Point>
requires(GeometryTraits::is_point_v<Point>)
KOKKOS_FUNCTION size_t cellIndex(Point const &point) const
{
static_assert(GeometryTraits::dimension_v<Point> == DIM);
Expand Down
28 changes: 14 additions & 14 deletions src/distributed/detail/ArborX_DistributedTreeImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ struct DistributedTreeImpl
// spatial queries
template <typename DistributedTree, typename ExecutionSpace,
typename Predicates, typename Values, typename Offset>
static std::enable_if_t<Kokkos::is_view_v<Values> &&
Kokkos::is_view_v<Offset>>
queryDispatch(SpatialPredicateTag, DistributedTree const &tree,
ExecutionSpace const &space, Predicates const &queries,
Values &values, Offset &offset);
requires(Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>)
static void queryDispatch(SpatialPredicateTag, DistributedTree const &tree,
ExecutionSpace const &space,
Predicates const &queries, Values &values,
Offset &offset);

template <typename DistributedTree, typename ExecutionSpace,
typename Predicates, typename OutputView, typename OffsetView,
typename Callback>
static std::enable_if_t<Kokkos::is_view_v<OutputView> &&
Kokkos::is_view_v<OffsetView>>
queryDispatch(SpatialPredicateTag, DistributedTree const &tree,
ExecutionSpace const &space, Predicates const &queries,
Callback const &callback, OutputView &out, OffsetView &offset);
requires(Kokkos::is_view_v<OutputView> && Kokkos::is_view_v<OffsetView>)
static void queryDispatch(SpatialPredicateTag, DistributedTree const &tree,
ExecutionSpace const &space,
Predicates const &queries, Callback const &callback,
OutputView &out, OffsetView &offset);

template <typename DistributedTree, typename ExecutionSpace,
typename Predicates, typename Callback>
Expand All @@ -59,16 +59,16 @@ struct DistributedTreeImpl

template <typename DistributedTree, typename ExecutionSpace,
typename Predicates, typename Values, typename Offset>
static std::enable_if_t<Kokkos::is_view_v<Values> &&
Kokkos::is_view_v<Offset>>
requires(Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>)
static void
queryDispatch(NearestPredicateTag tag, DistributedTree const &tree,
ExecutionSpace const &space, Predicates const &queries,
Values &values, Offset &offset);

template <typename Tree, typename ExecutionSpace, typename Predicates,
typename Callback, typename Values, typename Offset>
static std::enable_if_t<Kokkos::is_view_v<Values> &&
Kokkos::is_view_v<Offset>>
requires(Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>)
static void
queryDispatch(NearestPredicateTag, Tree const &tree,
ExecutionSpace const &space, Predicates const &predicates,
Callback const &callback, Values &values, Offset &offset);
Expand Down
23 changes: 12 additions & 11 deletions src/distributed/detail/ArborX_DistributedTreeNearest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,24 +217,25 @@ void DistributedTreeImpl::queryDispatch2RoundImpl(

template <typename Tree, typename ExecutionSpace, typename Predicates,
typename Values, typename Offset>
std::enable_if_t<Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>>
DistributedTreeImpl::queryDispatch(NearestPredicateTag tag, Tree const &tree,
ExecutionSpace const &space,
Predicates const &predicates, Values &values,
Offset &offset)
requires(Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>)
void DistributedTreeImpl::queryDispatch(NearestPredicateTag tag,
Tree const &tree,
ExecutionSpace const &space,
Predicates const &predicates,
Values &values, Offset &offset)
{
queryDispatch2RoundImpl(tag, tree, space, predicates, DefaultCallback{},
values, offset);
}

template <typename Tree, typename ExecutionSpace, typename Predicates,
typename Callback, typename Values, typename Offset>
std::enable_if_t<Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>>
DistributedTreeImpl::queryDispatch(NearestPredicateTag, Tree const &tree,
ExecutionSpace const &space,
Predicates const &predicates,
Callback const &callback, Values &values,
Offset &offset)
requires(Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>)
void DistributedTreeImpl::queryDispatch(NearestPredicateTag, Tree const &tree,
ExecutionSpace const &space,
Predicates const &predicates,
Callback const &callback,
Values &values, Offset &offset)
{
if (tree.empty())
{
Expand Down
22 changes: 11 additions & 11 deletions src/distributed/detail/ArborX_DistributedTreeSpatial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ namespace ArborX::Details

template <typename Tree, typename ExecutionSpace, typename Predicates,
typename Values, typename Offset, typename Callback>
std::enable_if_t<Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>>
DistributedTreeImpl::queryDispatch(SpatialPredicateTag, Tree const &tree,
ExecutionSpace const &space,
Predicates const &predicates,
Callback const &callback, Values &values,
Offset &offset)
requires(Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>)
void DistributedTreeImpl::queryDispatch(SpatialPredicateTag, Tree const &tree,
ExecutionSpace const &space,
Predicates const &predicates,
Callback const &callback,
Values &values, Offset &offset)
{
Kokkos::Profiling::ScopedRegion guard(
"ArborX::DistributedTree::query::spatial");
Expand Down Expand Up @@ -96,11 +96,11 @@ void DistributedTreeImpl::queryDispatch(SpatialPredicateTag, Tree const &tree,

template <typename Tree, typename ExecutionSpace, typename Predicates,
typename Values, typename Offset>
std::enable_if_t<Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>>
DistributedTreeImpl::queryDispatch(SpatialPredicateTag, Tree const &tree,
ExecutionSpace const &space,
Predicates const &predicates, Values &values,
Offset &offset)
requires(Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>)
void DistributedTreeImpl::queryDispatch(SpatialPredicateTag, Tree const &tree,
ExecutionSpace const &space,
Predicates const &predicates,
Values &values, Offset &offset)
{
queryDispatch(SpatialPredicateTag{}, tree, space, predicates,
DefaultCallback{}, values, offset);
Expand Down
5 changes: 2 additions & 3 deletions src/geometry/algorithms/ArborX_TranslateAndScale.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ namespace ArborX::Details
{
// transformation that maps the unit cube into a new axis-aligned box
// NOTE safe to perform in-place
template <typename Point, typename Box,
std::enable_if_t<GeometryTraits::is_point_v<Point> &&
GeometryTraits::is_box_v<Box>> * = nullptr>
template <typename Point, typename Box>
requires(GeometryTraits::is_point_v<Point> && GeometryTraits::is_box_v<Box>)
KOKKOS_FUNCTION void translateAndScale(Point const &in, Point &out,
Box const &ref)
{
Expand Down
7 changes: 4 additions & 3 deletions src/spatial/ArborX_BruteForce.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ class BruteForce

template <typename ExecutionSpace, typename UserPredicates,
typename CallbackOrView, typename View, typename... Args>
std::enable_if_t<Kokkos::is_view_v<std::decay_t<View>>>
query(ExecutionSpace const &space, UserPredicates const &user_predicates,
CallbackOrView &&callback_or_view, View &&view, Args &&...args) const
requires(Kokkos::is_view_v<std::decay_t<View>>)
void query(ExecutionSpace const &space, UserPredicates const &user_predicates,
CallbackOrView &&callback_or_view, View &&view,
Args &&...args) const
{
Kokkos::Profiling::ScopedRegion guard("ArborX::BruteForce::query_crs");

Expand Down
7 changes: 4 additions & 3 deletions src/spatial/ArborX_LinearBVH.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ class BoundingVolumeHierarchy

template <typename ExecutionSpace, typename UserPredicates,
typename CallbackOrView, typename View, typename... Args>
std::enable_if_t<Kokkos::is_view_v<std::decay_t<View>>>
query(ExecutionSpace const &space, UserPredicates const &user_predicates,
CallbackOrView &&callback_or_view, View &&view, Args &&...args) const
requires(Kokkos::is_view_v<std::decay_t<View>>)
void query(ExecutionSpace const &space, UserPredicates const &user_predicates,
CallbackOrView &&callback_or_view, View &&view,
Args &&...args) const
{
Kokkos::Profiling::ScopedRegion guard("ArborX::BVH::query_crs");

Expand Down
8 changes: 4 additions & 4 deletions src/spatial/detail/ArborX_AccessTraits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ using AccessTraitsNotSpecializedArchetypeAlias =
typename Traits::not_specialized;

template <typename View>
struct AccessTraits<
View, std::enable_if_t<Kokkos::is_view<View>{} && View::rank() == 1>>
requires(Kokkos::is_view_v<View> && View::rank() == 1)
struct AccessTraits<View>
{
// Returns a const reference
KOKKOS_FUNCTION static typename View::const_value_type &get(View const &v,
Expand All @@ -49,8 +49,8 @@ struct AccessTraits<
};

template <typename View>
struct AccessTraits<
View, std::enable_if_t<Kokkos::is_view<View>{} && View::rank() == 2>>
requires(Kokkos::is_view_v<View> && View::rank() == 2)
struct AccessTraits<View>
{
template <std::size_t... Is>
KOKKOS_FUNCTION static auto getPoint(std::index_sequence<Is...>,
Expand Down
83 changes: 44 additions & 39 deletions src/spatial/detail/ArborX_CrsGraphWrapperImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,13 @@ struct Iota

template <typename Tag, typename ExecutionSpace, typename Predicates,
typename OffsetView, typename OutView>
std::enable_if_t<std::is_same_v<Tag, SpatialPredicateTag> ||
std::is_same_v<Tag, OrderedSpatialPredicateTag>>
allocateAndInitializeStorage(Tag, ExecutionSpace const &space,
Predicates const &predicates, OffsetView &offset,
OutView &out, int buffer_size)
requires(std::is_same_v<Tag, SpatialPredicateTag> ||
std::is_same_v<Tag, OrderedSpatialPredicateTag>)
void allocateAndInitializeStorage(Tag, ExecutionSpace const &space,
Predicates const &predicates,
OffsetView &offset, OutView &out,
int buffer_size)

{
auto const n_queries = predicates.size();
KokkosExt::reallocWithoutInitializing(space, offset, n_queries + 1);
Expand All @@ -353,10 +355,11 @@ allocateAndInitializeStorage(Tag, ExecutionSpace const &space,

template <typename Tag, typename ExecutionSpace, typename Predicates,
typename OffsetView, typename OutView>
std::enable_if_t<std::is_same_v<Tag, NearestPredicateTag>>
allocateAndInitializeStorage(Tag, ExecutionSpace const &space,
Predicates const &predicates, OffsetView &offset,
OutView &out, int /*buffer_size*/)
requires(std::is_same_v<Tag, NearestPredicateTag>)
void allocateAndInitializeStorage(Tag, ExecutionSpace const &space,
Predicates const &predicates,
OffsetView &offset, OutView &out,
int /*buffer_size*/)
{
auto const n_queries = predicates.size();
KokkosExt::reallocWithoutInitializing(space, offset, n_queries + 1);
Expand All @@ -377,13 +380,13 @@ allocateAndInitializeStorage(Tag, ExecutionSpace const &space,
template <typename Tag, typename Tree, typename ExecutionSpace,
typename Predicates, typename OutputView, typename OffsetView,
typename Callback>
std::enable_if_t<!is_tagged_post_callback<Callback>::value &&
Kokkos::is_view_v<OutputView> && Kokkos::is_view_v<OffsetView>>
queryDispatch(Tag, Tree const &tree, ExecutionSpace const &space,
Predicates const &predicates, Callback const &callback,
OutputView &out, OffsetView &offset,
Experimental::TraversalPolicy const &policy =
Experimental::TraversalPolicy())
requires(!is_tagged_post_callback<Callback>::value &&
Kokkos::is_view_v<OutputView> && Kokkos::is_view_v<OffsetView>)
void queryDispatch(Tag, Tree const &tree, ExecutionSpace const &space,
Predicates const &predicates, Callback const &callback,
OutputView &out, OffsetView &offset,
Experimental::TraversalPolicy const &policy =
Experimental::TraversalPolicy())
{
check_valid_callback<typename Tree::value_type>(callback, predicates, out);

Expand Down Expand Up @@ -447,11 +450,12 @@ queryDispatch(Tag, Tree const &tree, ExecutionSpace const &space,

template <typename Tag, typename Tree, typename ExecutionSpace,
typename Predicates, typename Indices, typename Offset>
inline std::enable_if_t<Kokkos::is_view_v<Indices> && Kokkos::is_view_v<Offset>>
queryDispatch(Tag, Tree const &tree, ExecutionSpace const &space,
Predicates const &predicates, Indices &indices, Offset &offset,
Experimental::TraversalPolicy const &policy =
Experimental::TraversalPolicy())
requires(Kokkos::is_view_v<Indices> && Kokkos::is_view_v<Offset>)
inline void queryDispatch(Tag, Tree const &tree, ExecutionSpace const &space,
Predicates const &predicates, Indices &indices,
Offset &offset,
Experimental::TraversalPolicy const &policy =
Experimental::TraversalPolicy())
{
queryDispatch(Tag{}, tree, space, predicates, DefaultCallback{}, indices,
offset, policy);
Expand All @@ -460,12 +464,13 @@ queryDispatch(Tag, Tree const &tree, ExecutionSpace const &space,
template <typename Tag, typename Tree, typename ExecutionSpace,
typename Predicates, typename OutputView, typename OffsetView,
typename Callback>
inline std::enable_if_t<is_tagged_post_callback<Callback>::value>
queryDispatch(Tag, Tree const &tree, ExecutionSpace const &space,
Predicates const &predicates, Callback const &callback,
OutputView &out, OffsetView &offset,
Experimental::TraversalPolicy const &policy =
Experimental::TraversalPolicy())
requires(is_tagged_post_callback<Callback>::value)
inline void queryDispatch(Tag, Tree const &tree, ExecutionSpace const &space,
Predicates const &predicates,
Callback const &callback, OutputView &out,
OffsetView &offset,
Experimental::TraversalPolicy const &policy =
Experimental::TraversalPolicy())
{
using MemorySpace = typename Tree::memory_space;

Expand All @@ -478,9 +483,9 @@ queryDispatch(Tag, Tree const &tree, ExecutionSpace const &space,

template <typename Value, typename Callback, typename Predicates,
typename OutputView>
std::enable_if_t<!Kokkos::is_view_v<Callback> &&
!is_tagged_post_callback<Callback>::value>
check_valid_callback_if_first_argument_is_not_a_view(
requires(!Kokkos::is_view_v<Callback> &&
!is_tagged_post_callback<Callback>::value)
void check_valid_callback_if_first_argument_is_not_a_view(
Callback const &callback, Predicates const &predicates,
OutputView const &out)
{
Expand All @@ -489,21 +494,21 @@ check_valid_callback_if_first_argument_is_not_a_view(

template <typename Value, typename Callback, typename Predicates,
typename OutputView>
std::enable_if_t<!Kokkos::is_view_v<Callback> &&
is_tagged_post_callback<Callback>::value>
check_valid_callback_if_first_argument_is_not_a_view(Callback const &,
Predicates const &,
OutputView const &)
requires(!Kokkos::is_view_v<Callback> &&
is_tagged_post_callback<Callback>::value)
void check_valid_callback_if_first_argument_is_not_a_view(Callback const &,
Predicates const &,
OutputView const &)
{
// TODO
}

template <typename Value, typename View, typename Predicates,
typename OutputView>
std::enable_if_t<Kokkos::is_view_v<View>>
check_valid_callback_if_first_argument_is_not_a_view(View const &,
Predicates const &,
OutputView const &)
requires(Kokkos::is_view_v<View>)
void check_valid_callback_if_first_argument_is_not_a_view(View const &,
Predicates const &,
OutputView const &)
{
// do nothing
}
Expand Down
5 changes: 2 additions & 3 deletions src/spatial/detail/ArborX_IndexableGetter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ struct DefaultIndexableGetter
return geometry;
}

template <typename Geometry,
typename Enable = std::enable_if_t<
!Details::is_pair_value_index_v<std::decay_t<Geometry>>>>
template <typename Geometry>
requires(!Details::is_pair_value_index_v<std::decay_t<Geometry>>)
KOKKOS_FUNCTION auto operator()(Geometry &&geometry) const
{
return geometry;
Expand Down
16 changes: 8 additions & 8 deletions src/spatial/detail/ArborX_MortonCode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ KOKKOS_INLINE_FUNCTION unsigned long long expandBitsBy<9>(unsigned long long x)
return x;
}

template <typename Point,
typename Enable = std::enable_if_t<GeometryTraits::is_point_v<Point>>>
template <typename Point>
requires(GeometryTraits::is_point_v<Point>)
KOKKOS_INLINE_FUNCTION unsigned int morton32(Point const &p)
{
constexpr int DIM = GeometryTraits::dimension_v<Point>;
Expand All @@ -303,9 +303,9 @@ KOKKOS_INLINE_FUNCTION unsigned int morton32(Point const &p)
return r;
}

template <typename Point,
std::enable_if_t<GeometryTraits::is_point_v<Point> &&
GeometryTraits::dimension_v<Point> != 2> * = nullptr>
template <typename Point>
requires(GeometryTraits::is_point_v<Point> &&
GeometryTraits::dimension_v<Point> != 2)
KOKKOS_INLINE_FUNCTION unsigned long long morton64(Point const &p)
{
constexpr int DIM = GeometryTraits::dimension_v<Point>;
Expand All @@ -326,9 +326,9 @@ KOKKOS_INLINE_FUNCTION unsigned long long morton64(Point const &p)

// Calculate a 62-bit Morton code for a 2D point located within [0, 1]^2.
// Special case because it needs double.
template <typename Point,
std::enable_if_t<GeometryTraits::is_point_v<Point> &&
GeometryTraits::dimension_v<Point> == 2> * = nullptr>
template <typename Point>
requires(GeometryTraits::is_point_v<Point> &&
GeometryTraits::dimension_v<Point> == 2)
KOKKOS_INLINE_FUNCTION unsigned long long morton64(Point const &p)
{
// The interval [0,1] is subdivided into 2,147,483,648 bins (in each
Expand Down
Loading