Skip to content

Commit 31bcb16

Browse files
committed
Switch function signatures to use concepts
1 parent bd9c426 commit 31bcb16

19 files changed

+120
-105
lines changed

benchmarks/cluster/ArborX_DBSCANVerification.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ struct IndexLabelCallback
292292
}
293293
};
294294

295-
template <typename ExecutionSpace, typename Primitives, typename Labels,
296-
typename Coordinate>
295+
template <typename ExecutionSpace, Concepts::Primitives Primitives,
296+
typename Labels, typename Coordinate>
297297
bool verifyDBSCAN(ExecutionSpace exec_space, Primitives const &primitives,
298298
Coordinate eps, int core_min_size, Labels const &labels,
299299
bool verbose = false)
@@ -385,8 +385,8 @@ struct IndexRankLabelCoreCallback
385385
}
386386
};
387387

388-
template <typename ExecutionSpace, typename Primitives, typename Labels,
389-
typename Coordinate>
388+
template <typename ExecutionSpace, Concepts::Primitives Primitives,
389+
typename Labels, typename Coordinate>
390390
bool verifyDBSCAN(MPI_Comm comm, ExecutionSpace exec_space,
391391
Primitives const &primitives, Coordinate eps,
392392
int core_min_size, Labels const &labels, bool verbose = false)

src/cluster/ArborX_DBSCAN.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ struct MixedBoxPrimitives
9797

9898
} // namespace Details
9999

100-
template <typename Primitives, typename PermuteFilter>
100+
template <Concepts::Primitives Primitives, typename PermuteFilter>
101101
struct AccessTraits<
102102
Details::PointsWithRadiusReorderedAndFiltered<Primitives, PermuteFilter>>
103103
{
@@ -204,7 +204,8 @@ struct Parameters
204204
};
205205
} // namespace DBSCAN
206206

207-
template <typename ExecutionSpace, typename Primitives, typename Coordinate>
207+
template <typename ExecutionSpace, Concepts::Primitives Primitives,
208+
typename Coordinate>
208209
Kokkos::View<int *, typename AccessTraits<Primitives>::memory_space>
209210
dbscan(ExecutionSpace const &exec_space, Primitives const &primitives,
210211
Coordinate eps, int core_min_size,

src/cluster/ArborX_DistributedDBSCAN.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
namespace ArborX::Experimental
2525
{
2626

27-
template <typename ExecutionSpace, typename Primitives, typename Coordinate,
28-
typename Labels>
27+
template <typename ExecutionSpace, Concepts::Primitives Primitives,
28+
typename Coordinate, typename Labels>
2929
void dbscan(MPI_Comm comm, ExecutionSpace const &space,
3030
Primitives const &primitives, Coordinate eps, int core_min_size,
3131
Labels &labels,

src/cluster/ArborX_HDBSCAN.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
namespace ArborX::Experimental
2020
{
2121

22-
template <typename ExecutionSpace, typename Primitives>
22+
template <typename ExecutionSpace, Concepts::Primitives Primitives>
2323
auto hdbscan(ExecutionSpace const &exec_space, Primitives const &primitives,
2424
int core_min_size,
2525
DendrogramImplementation dendrogram_impl =

src/cluster/detail/ArborX_FDBSCANDenseBox.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ namespace ArborX
2626
namespace Details
2727
{
2828

29-
template <typename MemorySpace, typename Primitives, typename DenseCellOffsets,
30-
typename Permutation>
29+
template <typename MemorySpace, Concepts::Primitives Primitives,
30+
typename DenseCellOffsets, typename Permutation>
3131
struct CountUpToN_DenseBox
3232
{
3333
using Coordinate =
@@ -92,8 +92,9 @@ struct CountUpToN_DenseBox
9292
}
9393
};
9494

95-
template <typename UnionFind, typename CorePointsType, typename Primitives,
96-
typename DenseCellOffsets, typename Permutation>
95+
template <typename UnionFind, typename CorePointsType,
96+
Concepts::Primitives Primitives, typename DenseCellOffsets,
97+
typename Permutation>
9798
struct FDBSCANDenseBoxCallback
9899
{
99100
using Coordinate =
@@ -187,7 +188,7 @@ struct FDBSCANDenseBoxCallback
187188
}
188189
};
189190

190-
template <typename ExecutionSpace, typename Primitives>
191+
template <typename ExecutionSpace, Concepts::Primitives Primitives>
191192
Kokkos::View<size_t *, typename Primitives::memory_space> computeCellIndices(
192193
ExecutionSpace const &exec_space, Primitives const &primitives,
193194
CartesianGrid<GeometryTraits::dimension_v<typename Primitives::value_type>,

src/distributed/detail/ArborX_DistributedTreeImpl.hpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,64 +24,65 @@ struct DistributedTreeImpl
2424
{
2525
// spatial queries
2626
template <typename DistributedTree, typename ExecutionSpace,
27-
typename Predicates, typename Values, typename Offset>
27+
Concepts::Predicates Predicates, typename Values, typename Offset>
2828
static std::enable_if_t<Kokkos::is_view_v<Values> &&
2929
Kokkos::is_view_v<Offset>>
3030
queryDispatch(SpatialPredicateTag, DistributedTree const &tree,
3131
ExecutionSpace const &space, Predicates const &queries,
3232
Values &values, Offset &offset);
3333

3434
template <typename DistributedTree, typename ExecutionSpace,
35-
typename Predicates, typename OutputView, typename OffsetView,
36-
typename Callback>
35+
Concepts::Predicates Predicates, typename OutputView,
36+
typename OffsetView, typename Callback>
3737
static std::enable_if_t<Kokkos::is_view_v<OutputView> &&
3838
Kokkos::is_view_v<OffsetView>>
3939
queryDispatch(SpatialPredicateTag, DistributedTree const &tree,
4040
ExecutionSpace const &space, Predicates const &queries,
4141
Callback const &callback, OutputView &out, OffsetView &offset);
4242

4343
template <typename DistributedTree, typename ExecutionSpace,
44-
typename Predicates, typename Callback>
44+
Concepts::Predicates Predicates, typename Callback>
4545
static void queryDispatch(SpatialPredicateTag, DistributedTree const &tree,
4646
ExecutionSpace const &space,
4747
Predicates const &predicates,
4848
Callback const &callback);
4949

5050
// nearest neighbors queries
5151
template <typename DistributedTree, typename ExecutionSpace,
52-
typename Predicates, typename Callback, typename Indices,
53-
typename Offset>
52+
Concepts::Predicates Predicates, typename Callback,
53+
typename Indices, typename Offset>
5454
static void
5555
queryDispatch2RoundImpl(NearestPredicateTag, DistributedTree const &tree,
5656
ExecutionSpace const &space,
5757
Predicates const &queries, Callback const &callback,
5858
Indices &indices, Offset &offset);
5959

6060
template <typename DistributedTree, typename ExecutionSpace,
61-
typename Predicates, typename Values, typename Offset>
61+
Concepts::Predicates Predicates, typename Values, typename Offset>
6262
static std::enable_if_t<Kokkos::is_view_v<Values> &&
6363
Kokkos::is_view_v<Offset>>
6464
queryDispatch(NearestPredicateTag tag, DistributedTree const &tree,
6565
ExecutionSpace const &space, Predicates const &queries,
6666
Values &values, Offset &offset);
67-
template <typename Tree, typename ExecutionSpace, typename Predicates,
68-
typename Callback, typename Values, typename Offset>
67+
template <typename Tree, typename ExecutionSpace,
68+
Concepts::Predicates Predicates, typename Callback, typename Values,
69+
typename Offset>
6970
static std::enable_if_t<Kokkos::is_view_v<Values> &&
7071
Kokkos::is_view_v<Offset>>
7172
queryDispatch(NearestPredicateTag, Tree const &tree,
7273
ExecutionSpace const &space, Predicates const &predicates,
7374
Callback const &callback, Values &values, Offset &offset);
7475

7576
// nearest neighbors helpers
76-
template <typename ExecutionSpace, typename Tree, typename Predicates,
77-
typename Distances>
77+
template <typename ExecutionSpace, typename Tree,
78+
Concepts::Predicates Predicates, typename Distances>
7879
static void phaseI(ExecutionSpace const &space, Tree const &tree,
7980
Predicates const &predicates,
8081
Distances &farthest_distances);
8182

82-
template <typename ExecutionSpace, typename Tree, typename Predicates,
83-
typename Callback, typename Distances, typename Offset,
84-
typename Values>
83+
template <typename ExecutionSpace, typename Tree,
84+
Concepts::Predicates Predicates, typename Callback,
85+
typename Distances, typename Offset, typename Values>
8586
static void phaseII(ExecutionSpace const &space, Tree const &tree,
8687
Predicates const &predicates, Callback const &callback,
8788
Distances &distances, Offset &offset, Values &values);

src/distributed/detail/ArborX_DistributedTreeNearest.hpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ struct PairValueDistance
3636
Coordinate distance;
3737
};
3838

39-
template <typename ExecutionSpace, typename Tree, typename Predicates,
40-
typename Distances>
39+
template <typename ExecutionSpace, typename Tree,
40+
Concepts::Predicates Predicates, typename Distances>
4141
void DistributedTreeImpl::phaseI(ExecutionSpace const &space, Tree const &tree,
4242
Predicates const &predicates,
4343
Distances &farthest_distances)
@@ -124,9 +124,9 @@ void DistributedTreeImpl::phaseI(ExecutionSpace const &space, Tree const &tree,
124124
});
125125
}
126126

127-
template <typename ExecutionSpace, typename Tree, typename Predicates,
128-
typename Callback, typename Distances, typename Offset,
129-
typename Values>
127+
template <typename ExecutionSpace, typename Tree,
128+
Concepts::Predicates Predicates, typename Callback,
129+
typename Distances, typename Offset, typename Values>
130130
void DistributedTreeImpl::phaseII(ExecutionSpace const &space, Tree const &tree,
131131
Predicates const &predicates,
132132
Callback const &callback,
@@ -174,8 +174,9 @@ void DistributedTreeImpl::phaseII(ExecutionSpace const &space, Tree const &tree,
174174
DistributedTree::filterResults(space, predicates, distances, values, offset);
175175
}
176176

177-
template <typename Tree, typename ExecutionSpace, typename Predicates,
178-
typename Callback, typename Values, typename Offset>
177+
template <typename Tree, typename ExecutionSpace,
178+
Concepts::Predicates Predicates, typename Callback, typename Values,
179+
typename Offset>
179180
void DistributedTreeImpl::queryDispatch2RoundImpl(
180181
NearestPredicateTag, Tree const &tree, ExecutionSpace const &space,
181182
Predicates const &predicates, Callback const &callback, Values &values,
@@ -222,8 +223,8 @@ void DistributedTreeImpl::queryDispatch2RoundImpl(
222223
values);
223224
}
224225

225-
template <typename Tree, typename ExecutionSpace, typename Predicates,
226-
typename Values, typename Offset>
226+
template <typename Tree, typename ExecutionSpace,
227+
Concepts::Predicates Predicates, typename Values, typename Offset>
227228
std::enable_if_t<Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>>
228229
DistributedTreeImpl::queryDispatch(NearestPredicateTag tag, Tree const &tree,
229230
ExecutionSpace const &space,
@@ -234,8 +235,9 @@ DistributedTreeImpl::queryDispatch(NearestPredicateTag tag, Tree const &tree,
234235
values, offset);
235236
}
236237

237-
template <typename Tree, typename ExecutionSpace, typename Predicates,
238-
typename Callback, typename Values, typename Offset>
238+
template <typename Tree, typename ExecutionSpace,
239+
Concepts::Predicates Predicates, typename Callback, typename Values,
240+
typename Offset>
239241
std::enable_if_t<Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>>
240242
DistributedTreeImpl::queryDispatch(NearestPredicateTag, Tree const &tree,
241243
ExecutionSpace const &space,

src/distributed/detail/ArborX_DistributedTreeSpatial.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
namespace ArborX::Details
2525
{
2626

27-
template <typename Tree, typename ExecutionSpace, typename Predicates,
28-
typename Values, typename Offset, typename Callback>
27+
template <typename Tree, typename ExecutionSpace,
28+
Concepts::Predicates Predicates, typename Values, typename Offset,
29+
typename Callback>
2930
std::enable_if_t<Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>>
3031
DistributedTreeImpl::queryDispatch(SpatialPredicateTag, Tree const &tree,
3132
ExecutionSpace const &space,
@@ -58,8 +59,8 @@ DistributedTreeImpl::queryDispatch(SpatialPredicateTag, Tree const &tree,
5859
intersected_ranks, offset, values);
5960
}
6061

61-
template <typename Tree, typename ExecutionSpace, typename Predicates,
62-
typename Callback>
62+
template <typename Tree, typename ExecutionSpace,
63+
Concepts::Predicates Predicates, typename Callback>
6364
void DistributedTreeImpl::queryDispatch(SpatialPredicateTag, Tree const &tree,
6465
ExecutionSpace const &space,
6566
Predicates const &predicates,
@@ -94,8 +95,8 @@ void DistributedTreeImpl::queryDispatch(SpatialPredicateTag, Tree const &tree,
9495
bottom_tree.query(space, fwd_predicates, callback);
9596
}
9697

97-
template <typename Tree, typename ExecutionSpace, typename Predicates,
98-
typename Values, typename Offset>
98+
template <typename Tree, typename ExecutionSpace,
99+
Concepts::Predicates Predicates, typename Values, typename Offset>
99100
std::enable_if_t<Kokkos::is_view_v<Values> && Kokkos::is_view_v<Offset>>
100101
DistributedTreeImpl::queryDispatch(SpatialPredicateTag, Tree const &tree,
101102
ExecutionSpace const &space,

src/distributed/detail/ArborX_DistributedTreeUtils.hpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include <ArborX_Config.hpp>
1515

16+
#include <detail/ArborX_AccessTraits.hpp>
1617
#include <detail/ArborX_Distributor.hpp>
1718
#include <detail/ArborX_PairValueIndex.hpp>
1819
#include <kokkos_ext/ArborX_KokkosExtSort.hpp>
@@ -45,8 +46,9 @@ void countResults(ExecutionSpace const &space, int n_queries,
4546
KokkosExt::exclusive_scan(space, offset, offset, 0);
4647
}
4748

48-
template <typename ExecutionSpace, typename Predicates, typename RanksTo,
49-
typename Offset, typename FwdQueries, typename FwdIds, typename Ranks>
49+
template <typename ExecutionSpace, Concepts::Predicates Predicates,
50+
typename RanksTo, typename Offset, typename FwdQueries,
51+
typename FwdIds, typename Ranks>
5052
void forwardQueries(MPI_Comm comm, ExecutionSpace const &space,
5153
Predicates const &queries, RanksTo const &ranks_to,
5254
Offset const &offset, FwdQueries &fwd_queries,
@@ -112,8 +114,8 @@ void forwardQueries(MPI_Comm comm, ExecutionSpace const &space,
112114
}
113115
}
114116

115-
template <typename ExecutionSpace, typename Predicates, typename RanksTo,
116-
typename Offset, typename FwdQueries>
117+
template <typename ExecutionSpace, Concepts::Predicates Predicates,
118+
typename RanksTo, typename Offset, typename FwdQueries>
117119
void forwardQueries(MPI_Comm comm, ExecutionSpace const &space,
118120
Predicates const &queries, RanksTo const &ranks_to,
119121
Offset const &offset, FwdQueries &fwd_queries)
@@ -221,8 +223,9 @@ void communicateResultsBack(MPI_Comm comm, ExecutionSpace const &space,
221223
}
222224
}
223225

224-
template <typename ExecutionSpace, typename BottomTree, typename Predicates,
225-
typename Callback, typename RanksTo, typename Offset, typename Values>
226+
template <typename ExecutionSpace, typename BottomTree,
227+
Concepts::Predicates Predicates, typename Callback, typename RanksTo,
228+
typename Offset, typename Values>
226229
void forwardQueriesAndCommunicateResults(
227230
MPI_Comm comm, ExecutionSpace const &space, BottomTree const &bottom_tree,
228231
Predicates const &predicates, Callback const &callback,
@@ -259,8 +262,8 @@ void forwardQueriesAndCommunicateResults(
259262
Kokkos::Profiling::popRegion();
260263
}
261264

262-
template <typename ExecutionSpace, typename Predicates, typename Distances,
263-
typename Values, typename Offset>
265+
template <typename ExecutionSpace, Concepts::Predicates Predicates,
266+
typename Distances, typename Values, typename Offset>
264267
void filterResults(ExecutionSpace const &space, Predicates const &queries,
265268
Distances const &distances, Values &values, Offset &offset)
266269
{

src/interpolation/ArborX_InterpMovingLeastSquares.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ template <typename MemorySpace, typename FloatingCalculationType = double>
6262
class MovingLeastSquares
6363
{
6464
public:
65-
template <typename ExecutionSpace, typename SourcePoints,
66-
typename TargetPoints, typename CRBFunc = CRBF::Wendland<0>,
65+
template <typename ExecutionSpace, Concepts::AccessTraits SourcePoints,
66+
Concepts::AccessTraits TargetPoints,
67+
typename CRBFunc = CRBF::Wendland<0>,
6768
typename PolynomialDegree = PolynomialDegree<2>>
6869
MovingLeastSquares(ExecutionSpace const &space,
6970
SourcePoints const &source_points,

0 commit comments

Comments
 (0)