-
Notifications
You must be signed in to change notification settings - Fork 39
ArborX::BruteForce::query
Damien L-G edited this page Jan 22, 2021
·
3 revisions
ArborX
/ Spatial indexes / ArborX::BruteForce
template <typename ExecutionSpace, typename Predicates, typename Callback>
void query(ExecutionSpace const& space,
Predicates const& predicates,
Callback const& callback) const; // (1)
template <typename ExecutionSpace, typename Predicates, typename Indices,
typename Offsets>
void query(ExecutionSpace const& space,
Predicates const& predicates,
Indices& indices,
Offsets& offsets) const; // (2)
template <typename ExecutionSpace, typename Predicates, typename Callback,
typename Values, typename Offsets>
void query(ExecutionSpace const& space,
Predicates const& predicates,
Callback const& callback,
Values& values,
Offsets& offsets) const; // (3)
- Finds all primitives meeting the passed predicates and invoke the callback when a primitive meets a predicate
Conceptually equivalent to
for (auto predicate : predicates)
for (auto primitive : primitives)
if (predicate(primitive))
callback(predicate, primitive);
- Finds all primitives meeting the predicates and record results in
{indices, offsets
}.indices
stores the indices of the objects that satisfy the predicates.offsets
stores the locations in theindices
view that start a predicate, that is,predicates(i)
is satisfied byprimitives(indices(j))
foroffsets(i) <= j < offsets(i+1)
. Following the usual convention,offsets(n) == indices.size()
, wheren
is the number of queries that were performed andindices.size()
is the total number of collisions. - TODO
space |
- | execution space that specifies where to execute code |
predicates |
- | predicates to check against the primitives |
callback |
- | callable function object to invoke when a primitive satisfies a predicate |
indices |
- | position of the primitives that satisfy the predicates |
offsets |
- | predicate offsets in indices |
-
MemorySpace
must be accessible fromExecutionSpace
. (Kokkos::SpaceAccessibility<ExecutionSpace, MemorySpace>::accessible
must betrue
.) - A specialization of
ArborX::AccessTraits
must match thePredicates
as first template argument andArborX::PredicatesTag
as second argument. - The member type
ArborX::AccessTraits<Predicates,ArborX::PredicatesTag>::memory_space
must be accessible fromExecutionSpace
. - The static member function
ArborX::AccessTraits<Predicates,ArborX::PredicatesTag>::get()
return type must decay to a valid ArborX predicate.
Such predicate may be generated by one of the functions listed below: - TODO
Callback
-
Indices
andOffsets
must be (managed) Kokkos views of integral types accessibles fromExecutionSpace
.
(none)
O(M N) where M is the number of predicates (i.e. the value returned by ArborX::AccessTraits<Predicates,ArborX::PredicatesTag>::size(predicates)
) and N is the number of primitives stored in the data structure (this->size()
).
Memory allocation with Kokkos may throw.