File indexing completed on 2025-01-18 09:11:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 template <typename grid_t>
0012 Acts::BinnedGroupIterator<grid_t>::BinnedGroupIterator(
0013 const Acts::BinnedGroup<grid_t>& group,
0014 std::array<std::size_t, Acts::BinnedGroupIterator<grid_t>::DIM> index,
0015 std::array<std::vector<std::size_t>, Acts::BinnedGroupIterator<grid_t>::DIM>
0016 navigation)
0017 : m_group(group), m_gridItr(group.grid(), index, navigation) {
0018 std::array<std::size_t, DIM> endline{};
0019 for (std::size_t i(0ul); i < DIM; ++i) {
0020 endline[i] = navigation[i].size();
0021 }
0022 m_gridItrEnd = typename grid_t::local_iterator_t(m_group->grid(), endline,
0023 std::move(navigation));
0024 findNotEmptyBin();
0025 }
0026
0027 template <typename grid_t>
0028 bool Acts::BinnedGroupIterator<grid_t>::operator==(
0029 const Acts::BinnedGroupIterator<grid_t>& other) const {
0030 return m_group.ptr == other.m_group.ptr && m_gridItr == other.m_gridItr;
0031 }
0032
0033 template <typename grid_t>
0034 Acts::BinnedGroupIterator<grid_t>&
0035 Acts::BinnedGroupIterator<grid_t>::operator++() {
0036 ++m_gridItr;
0037 findNotEmptyBin();
0038 return *this;
0039 }
0040
0041 template <typename grid_t>
0042 std::tuple<boost::container::small_vector<std::size_t,
0043 Acts::detail::ipow(3, grid_t::DIM)>,
0044 std::size_t,
0045 boost::container::small_vector<std::size_t,
0046 Acts::detail::ipow(3, grid_t::DIM)>>
0047 Acts::BinnedGroupIterator<grid_t>::operator*() const {
0048
0049
0050 std::array<std::size_t, DIM> localPosition = m_gridItr.localBinsIndices();
0051 std::size_t global_index =
0052 m_group->grid().globalBinFromLocalBins(localPosition);
0053
0054
0055 boost::container::small_vector<std::size_t, Acts::detail::ipow(3, DIM)>
0056 bottoms =
0057 m_group->m_bottomBinFinder->findBins(localPosition, m_group->grid());
0058 boost::container::small_vector<std::size_t, Acts::detail::ipow(3, DIM)> tops =
0059 m_group->m_topBinFinder->findBins(localPosition, m_group->grid());
0060
0061
0062
0063 #if defined(__GNUC__) && __GNUC__ >= 12 && !defined(__clang__)
0064 #pragma GCC diagnostic push
0065 #pragma GCC diagnostic ignored "-Wstringop-overread"
0066 #endif
0067 return {std::move(bottoms), global_index, std::move(tops)};
0068 #if defined(__GNUC__) && __GNUC__ >= 12 && !defined(__clang__)
0069 #pragma GCC diagnostic pop
0070 #endif
0071 }
0072
0073 template <typename grid_t>
0074 void Acts::BinnedGroupIterator<grid_t>::findNotEmptyBin() {
0075 if (m_gridItr == m_gridItrEnd) {
0076 return;
0077 }
0078
0079
0080 std::size_t dimCollection = (*m_gridItr).size();
0081
0082
0083 bool passesMask = false;
0084 if (m_gridItr != m_gridItrEnd) {
0085 passesMask = m_group->mask().at(m_gridItr.globalBinIndex());
0086 }
0087
0088 while ((dimCollection == 0ul || !passesMask) &&
0089 (++m_gridItr != m_gridItrEnd)) {
0090 dimCollection = (*m_gridItr).size();
0091 if (dimCollection == 0ul) {
0092 continue;
0093 }
0094 passesMask = m_group->mask().at(m_gridItr.globalBinIndex());
0095 }
0096 }