Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:00

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/GridIterator.hpp"
0012 #include "Acts/Utilities/Holders.hpp"
0013 #include "Acts/Utilities/detail/grid_helper.hpp"
0014 
0015 #include <array>
0016 #include <memory>
0017 #include <tuple>
0018 
0019 #include <boost/container/small_vector.hpp>
0020 
0021 namespace Acts {
0022 template <typename grid_t>
0023 class BinnedGroup;
0024 
0025 template <typename grid_t>
0026 class BinnedGroupIterator {
0027  public:
0028   static constexpr std::size_t DIM = grid_t::DIM;
0029 
0030   /// @brief Constructor
0031   /// Never take the ownership of the group
0032   ///
0033   /// @param [in] group The group we are iterating on
0034   /// @param [in] index Current local position in the grid
0035   /// @param [in] navigation The navigation pattern in the grid
0036   BinnedGroupIterator(
0037       Acts::BinnedGroup<grid_t>&& group, std::array<std::size_t, DIM> index,
0038       std::array<std::vector<std::size_t>, DIM> navigation) = delete;
0039 
0040   /// @brief Constructor
0041   /// Never take the ownership of the group
0042   ///
0043   /// @param [in] group The group we are iterating on
0044   /// @param [in] index Current local position in the grid
0045   /// @param [in] navigation The navigation pattern in the grid
0046   BinnedGroupIterator(const Acts::BinnedGroup<grid_t>&& group,
0047                       std::array<std::size_t, DIM> index,
0048                       std::array<std::vector<std::size_t>, DIM> navigation) =
0049       delete;
0050 
0051   /// @brief Constructor
0052   /// @param [in] group The group we are iterating on
0053   /// @param [in] index Current local position in the grid
0054   /// @param [in] navigation The navigation pattern in the grid
0055   BinnedGroupIterator(const Acts::BinnedGroup<grid_t>& group,
0056                       std::array<std::size_t, DIM> index,
0057                       std::array<std::vector<std::size_t>, DIM> navigation);
0058 
0059   /// Do not allow Copy operations
0060 
0061   /// @brief Copy Constructor
0062   /// @param [in] other The BinnedGroupIterator to copy
0063   BinnedGroupIterator(const BinnedGroupIterator<grid_t>& other) = delete;
0064   /// @brief Copy assignment
0065   /// @param [in] other The BinnedGroupIterator to copy
0066   /// @return The copied BinnedGroupIterator
0067   BinnedGroupIterator<grid_t>& operator=(
0068       const BinnedGroupIterator<grid_t>& other) = delete;
0069 
0070   /// @brief Move Constructor
0071   /// @param [in] other The BinnedGroupIterator to move
0072   BinnedGroupIterator(BinnedGroupIterator<grid_t>&& other) noexcept = default;
0073   /// @brief Move assignment
0074   /// @param [in] other The BinnedGroupIterator to move
0075   /// @return The moved BinnedGroupIterator
0076   BinnedGroupIterator<grid_t>& operator=(BinnedGroupIterator&& other) noexcept =
0077       default;
0078 
0079   /// @brief Default Destructor
0080   ~BinnedGroupIterator() = default;
0081 
0082   /// @brief Equality operator
0083   /// @param [in] other The BinnedGroupIterator we are comparing against this one
0084   /// @return The result of the comparison
0085   bool operator==(const BinnedGroupIterator<grid_t>& other) const;
0086 
0087   /// @brief Increment the iterator by one (pre)
0088   /// @return The incremented iterator
0089   BinnedGroupIterator<grid_t>& operator++();
0090 
0091   /// @brief Return the current bin with the middle candidate, as well as all the
0092   /// bins with the possible bottom and top candidates
0093   ///
0094   /// @return The collection of all the bins in the grid
0095   std::tuple<boost::container::small_vector<std::size_t,
0096                                             Acts::detail::ipow(3, grid_t::DIM)>,
0097              std::size_t,
0098              boost::container::small_vector<std::size_t,
0099                                             Acts::detail::ipow(3, grid_t::DIM)>>
0100   operator*() const;
0101 
0102  private:
0103   /// @brief Move to the next not-empty bin in the grid
0104   void findNotEmptyBin();
0105 
0106  private:
0107   /// @brief The group that contains the grid and the bin finders
0108   Acts::detail::RefHolder<const Acts::BinnedGroup<grid_t>> m_group{nullptr};
0109   /// @brief Current N-dimentional grid iterator
0110   typename grid_t::local_iterator_t m_gridItr;
0111   /// @brief End iterator;
0112   typename grid_t::local_iterator_t m_gridItrEnd;
0113 };
0114 
0115 }  // namespace Acts
0116 
0117 #include "Acts/Seeding/BinnedGroupIterator.ipp"