Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-16 08:19:14

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Utilities/Holders.hpp"
0012 #include "Acts/Utilities/MathHelpers.hpp"
0013 
0014 #include <array>
0015 #include <tuple>
0016 #include <vector>
0017 
0018 #include <boost/container/small_vector.hpp>
0019 
0020 namespace Acts {
0021 
0022 template <typename grid_t>
0023 class BinnedGroup;
0024 
0025 /// Iterator over a binned group grid neighborhood.
0026 /// @tparam grid_t Grid type used by the group.
0027 template <typename grid_t>
0028 class BinnedGroupIterator {
0029  public:
0030   /// Grid dimensionality
0031   static constexpr std::size_t DIM = grid_t::DIM;
0032 
0033   /// @brief Constructor
0034   /// Never take the ownership of the group
0035   ///
0036   /// @param [in] group The group we are iterating on
0037   /// @param [in] index Current local position in the grid
0038   /// @param [in] navigation The navigation pattern in the grid
0039   BinnedGroupIterator(
0040       BinnedGroup<grid_t>&& group, std::array<std::size_t, DIM> index,
0041       std::array<std::vector<std::size_t>, DIM> navigation) = delete;
0042 
0043   /// @brief Constructor
0044   /// Never take the ownership of the group
0045   ///
0046   /// @param [in] group The group we are iterating on
0047   /// @param [in] index Current local position in the grid
0048   /// @param [in] navigation The navigation pattern in the grid
0049   BinnedGroupIterator(
0050       const BinnedGroup<grid_t>&& group, std::array<std::size_t, DIM> index,
0051       std::array<std::vector<std::size_t>, DIM> navigation) = delete;
0052 
0053   /// @brief Constructor
0054   /// @param [in] group The group we are iterating on
0055   /// @param [in] index Current local position in the grid
0056   /// @param [in] navigation The navigation pattern in the grid
0057   BinnedGroupIterator(const BinnedGroup<grid_t>& group,
0058                       std::array<std::size_t, DIM> index,
0059                       std::array<std::vector<std::size_t>, DIM> navigation);
0060 
0061   /// @brief Equality operator
0062   /// @param [in] other The BinnedGroupIterator we are comparing against this one
0063   /// @return The result of the comparison
0064   bool operator==(const BinnedGroupIterator<grid_t>& other) const;
0065 
0066   /// @brief Increment the iterator by one (pre)
0067   /// @return The incremented iterator
0068   BinnedGroupIterator<grid_t>& operator++();
0069 
0070   /// @brief Return the current bin with the middle candidate, as well as all the
0071   /// bins with the possible bottom and top candidates
0072   ///
0073   /// @return The collection of all the bins in the grid
0074   std::tuple<boost::container::small_vector<std::size_t, ipow(3, grid_t::DIM)>,
0075              std::size_t,
0076              boost::container::small_vector<std::size_t, ipow(3, grid_t::DIM)>>
0077   operator*() const;
0078 
0079  private:
0080   /// @brief The group that contains the grid and the bin finders
0081   detail::RefHolder<const BinnedGroup<grid_t>> m_group{nullptr};
0082   /// @brief Current N-dimentional grid iterator
0083   typename grid_t::local_iterator_t m_gridItr;
0084   /// @brief End iterator;
0085   typename grid_t::local_iterator_t m_gridItrEnd;
0086 
0087   /// @brief Move to the next not-empty bin in the grid
0088   void findNotEmptyBin();
0089 };
0090 
0091 }  // namespace Acts
0092 
0093 #include "Acts/Seeding/BinnedGroupIterator.ipp"