Skip to content

Commit 2cb560f

Browse files
committed
Update predicate helpers test to use a placeholder without a memory space
1 parent f5f2751 commit 2cb560f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/tstPredicateHelpers.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ struct Placeholder
3030
int n;
3131
};
3232

33+
struct PlaceholderWithoutMemory
34+
{
35+
int n;
36+
};
37+
3338
template <typename MemorySpace>
3439
struct ArborX::AccessTraits<Placeholder<MemorySpace>>
3540
{
@@ -43,6 +48,19 @@ struct ArborX::AccessTraits<Placeholder<MemorySpace>>
4348
}
4449
};
4550

51+
template <>
52+
struct ArborX::AccessTraits<PlaceholderWithoutMemory>
53+
{
54+
using Self = PlaceholderWithoutMemory;
55+
using memory_space = Kokkos::DefaultExecutionSpace::memory_space;
56+
57+
KOKKOS_FUNCTION static auto size(Self const &self) { return self.n; }
58+
KOKKOS_FUNCTION static auto get(Self const &, int i)
59+
{
60+
return ArborX::Point<2>{(float)i, (float)i};
61+
}
62+
};
63+
4664
struct IntersectsTag
4765
{};
4866
struct IntersectsWithRadiusTag
@@ -131,22 +149,32 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(make_predicates, DeviceType, ARBORX_DEVICE_TYPES)
131149
v.data(), v.size()));
132150

133151
Placeholder<MemorySpace> points_access{3};
152+
PlaceholderWithoutMemory points_access_nomem{3};
134153

135154
BOOST_TEST(checkPredicates(IntersectsTag{}, space,
136155
make_intersects(points_view), points_view));
137156
BOOST_TEST(checkPredicates(IntersectsTag{}, space,
138157
make_intersects(points_access), points_access));
158+
BOOST_TEST(checkPredicates(IntersectsTag{}, space,
159+
make_intersects(points_access_nomem),
160+
points_access_nomem));
139161

140162
float r = 1.f;
141163
BOOST_TEST(checkPredicates(IntersectsWithRadiusTag{}, space,
142164
make_intersects(points_view, r), points_view, r));
143165
BOOST_TEST(checkPredicates(IntersectsWithRadiusTag{}, space,
144166
make_intersects(points_access, r), points_access,
145167
r));
168+
BOOST_TEST(checkPredicates(IntersectsWithRadiusTag{}, space,
169+
make_intersects(points_access_nomem, r),
170+
points_access_nomem, r));
146171

147172
int const k = 3;
148173
BOOST_TEST(checkPredicates(NearestTag{}, space, make_nearest(points_view, k),
149174
points_view, k));
150175
BOOST_TEST(checkPredicates(NearestTag{}, space,
151176
make_nearest(points_access, k), points_access, k));
177+
BOOST_TEST(checkPredicates(NearestTag{}, space,
178+
make_nearest(points_access_nomem, k),
179+
points_access_nomem, k));
152180
}

0 commit comments

Comments
 (0)