25 namespace Experimental {
32 template <
size_t kDIM = 2
u,
size_t bSize = 100
u,
33 typename reference_generator =
34 detail::PolyhedronReferenceGenerator<1u, false>>
42 using Query = std::array<ActsScalar, kDIM>;
45 using Entry = std::pair<Query, std::shared_ptr<Surface>>;
54 const std::vector<std::shared_ptr<Surface>>&
surfaces,
55 const std::array<BinningValue, kDIM>& casts,
56 const reference_generator& rgen =
61 throw std::invalid_argument(
62 "KdtSurfaces: dimension and/or cast rules are incorrect.");
65 std::vector<Entry> kdtEntries;
70 std::vector<Query> castedReferences;
71 castedReferences.reserve(references.size());
72 for (
const auto&
r : references) {
75 fillCasts(
r, rc, std::make_integer_sequence<std::size_t, kDIM>{});
76 castedReferences.push_back(rc);
79 kdtEntries.push_back({
cog(castedReferences),
s});
90 std::vector<std::shared_ptr<Surface>>
surfaces(
93 std::vector<std::shared_ptr<Surface>> surfacePtrs;
94 auto surfaceQuery =
m_kdt->rangeSearchWithKey(range);
95 std::for_each(surfaceQuery.begin(), surfaceQuery.end(),
96 [&](
auto&
s) { surfacePtrs.push_back(
s.second); });
108 qRange[ibv] = extent.
range(
v);
115 std::unique_ptr<KDTS>
m_kdt =
nullptr;
126 template <
typename Array, std::size_t...
idx>
128 std::index_sequence<idx...> )
const {
143 Query cog(
const std::vector<Query>& cQueries)
const {
145 if (cQueries.size() == 1) {
146 return cQueries.front();
150 float weight = 1. / cQueries.size();
151 for (
auto& q : cQueries) {
153 std::plus<ActsScalar>());
155 std::for_each(
c.begin(),
c.end(), [&](
auto&
v) {
v *= weight; });
164 template <
size_t kDIM = 2
u,
size_t bSize = 100
u,
165 typename reference_generator =
166 detail::PolyhedronReferenceGenerator<1u, false>>
179 if (
m_kdt ==
nullptr) {
180 throw std::invalid_argument(
181 "KdtSurfacesProvider: no KDTree structure provided.");
192 std::shared_ptr<KdtSurfaces<kDIM, bSize, reference_generator>>
m_kdt =