ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::GridLocalIterator< T, Axes > Class Template Reference

Grid iterator using the local position. More...

#include <Acts/Utilities/GridIterator.hpp>

Inheritance diagram for Acts::GridLocalIterator< T, Axes >:
[legend]

Public Types

using difference_type = std::ptrdiff_t
 Type for iterator arithmetic.
using iterator_category = std::bidirectional_iterator_tag
 Iterator category for standard algorithms.
using pointer = value_type*
 Pointer type to grid values.
using reference = value_type&
 Reference type to grid values.
using value_type = T
 Type of values stored in grid bins.

Public Member Functions

 GridLocalIterator ()=default
 Default constructor.
 GridLocalIterator (const Grid< T, Axes... > &grid, const std::array< std::size_t, DIM > &indices)
 Constructor.
 GridLocalIterator (const Grid< T, Axes... > &grid, const std::array< std::size_t, DIM > &indices, std::array< std::vector< std::size_t >, DIM > navigation)
 Constructor with custom navigation pattern.
 GridLocalIterator (const GridLocalIterator< T, Axes... > &other)=default
 Copy constructor.
 GridLocalIterator (Grid< T, Axes... > &&grid, const std::array< std::size_t, DIM > &indices)=delete
 Constructor taking ownership of the grid is not allowed.
 GridLocalIterator (Grid< T, Axes... > &&grid, const std::array< std::size_t, DIM > &indices, std::array< std::vector< std::size_t >, DIM > navigation)=delete
 Constructor taking ownership of the grid is not allowed.
 GridLocalIterator (GridLocalIterator< T, Axes... > &&other) noexcept
 Move constructor.
 ~GridLocalIterator ()=default
 Default destructor.
std::size_t globalBinIndex () const
 Retrieve the global bin index.
std::array< std::size_t, DIMlocalBinsIndices () const
 Retrieve the local position.
const value_typeoperator* () const
 Return stored value at given local position.
GridLocalIterator< T, Axes... > & operator++ ()
 Increment operator (pre).
GridLocalIterator< T, Axes... > operator++ (int)
 Increment operator (post).
GridLocalIterator< T, Axes... > & operator= (const GridLocalIterator< T, Axes... > &other)=default
 Copy assignment operator.
GridLocalIterator< T, Axes... > & operator= (GridLocalIterator< T, Axes... > &&other) noexcept
 Move assignment operator.
bool operator== (const GridLocalIterator< T, Axes... > &other) const
 Equality operator.

Static Public Attributes

static constexpr std::size_t DIM = sizeof...(Axes)
 Dimensionality of the grid (number of axes).

Detailed Description

template<typename T, class... Axes>
class Acts::GridLocalIterator< T, Axes >

Grid iterator using the local position.

This iterates on all local bins in the grid, and can exclude under- and over-flows Can also allow for custom navigation pattern along axes

Template Parameters
TThe type stored in the grid bins
Axes... The types of the axes in the grid

Member Typedef Documentation

◆ difference_type

template<typename T, class... Axes>
using Acts::GridLocalIterator< T, Axes >::difference_type = std::ptrdiff_t

Type for iterator arithmetic.

◆ iterator_category

template<typename T, class... Axes>
using Acts::GridLocalIterator< T, Axes >::iterator_category = std::bidirectional_iterator_tag

Iterator category for standard algorithms.

◆ pointer

template<typename T, class... Axes>
using Acts::GridLocalIterator< T, Axes >::pointer = value_type*

Pointer type to grid values.

◆ reference

template<typename T, class... Axes>
using Acts::GridLocalIterator< T, Axes >::reference = value_type&

Reference type to grid values.

◆ value_type

template<typename T, class... Axes>
using Acts::GridLocalIterator< T, Axes >::value_type = T

Type of values stored in grid bins.

Constructor & Destructor Documentation

◆ GridLocalIterator() [1/7]

template<typename T, class... Axes>
Acts::GridLocalIterator< T, Axes >::GridLocalIterator ( )
default

Default constructor.

◆ GridLocalIterator() [2/7]

template<typename T, class... Axes>
Acts::GridLocalIterator< T, Axes >::GridLocalIterator ( Grid< T, Axes... > && grid,
const std::array< std::size_t, DIM > & indices )
delete

Constructor taking ownership of the grid is not allowed.

Parameters
[in]gridThe grid
[in]indicesThe local position

◆ GridLocalIterator() [3/7]

template<typename T, class... Axes>
Acts::GridLocalIterator< T, Axes >::GridLocalIterator ( Grid< T, Axes... > && grid,
const std::array< std::size_t, DIM > & indices,
std::array< std::vector< std::size_t >, DIM > navigation )
delete

Constructor taking ownership of the grid is not allowed.

Parameters
[in]gridThe grid
[in]indicesThe local position
[in]navigationThe custom navigation pattern for each axis
Precondition
None of the navigation vectors is allowed to be an empty vector

◆ GridLocalIterator() [4/7]

template<typename T, class... Axes>
Acts::GridLocalIterator< T, Axes >::GridLocalIterator ( const Grid< T, Axes... > & grid,
const std::array< std::size_t, DIM > & indices )

Constructor.

Parameters
[in]gridThe grid
[in]indicesThe local position
Precondition
The local bins must be a valid local position in the grid

◆ GridLocalIterator() [5/7]

template<typename T, class... Axes>
Acts::GridLocalIterator< T, Axes >::GridLocalIterator ( const Grid< T, Axes... > & grid,
const std::array< std::size_t, DIM > & indices,
std::array< std::vector< std::size_t >, DIM > navigation )

Constructor with custom navigation pattern.

Parameters
[in]gridThe grid
[in]indicesThe local position
[in]navigationThe custom navigation pattern for each axis
Precondition
The local bins must be a valid local position in the grid. The navigation pattern must be consistent with the local bins (i.e. size <= num bins in the axis) in the grid and have no repetitions.
None of the navigation vectors is allowed to be an empty vector

◆ GridLocalIterator() [6/7]

template<typename T, class... Axes>
Acts::GridLocalIterator< T, Axes >::GridLocalIterator ( const GridLocalIterator< T, Axes... > & other)
default

Copy constructor.

Parameters
[in]otherThe GridLocalIterator to be copied

◆ GridLocalIterator() [7/7]

template<typename T, class... Axes>
Acts::GridLocalIterator< T, Axes >::GridLocalIterator ( GridLocalIterator< T, Axes... > && other)
noexcept

Move constructor.

Parameters
[in]otherThe GridLocalIterator to be moved

This will invalidate the other GridLocalIterator

◆ ~GridLocalIterator()

template<typename T, class... Axes>
Acts::GridLocalIterator< T, Axes >::~GridLocalIterator ( )
default

Default destructor.

Member Function Documentation

◆ globalBinIndex()

template<typename T, class... Axes>
std::size_t Acts::GridLocalIterator< T, Axes >::globalBinIndex ( ) const

Retrieve the global bin index.

Returns
The current global bin index in the grid

◆ localBinsIndices()

template<typename T, class... Axes>
std::array< std::size_t, DIM > Acts::GridLocalIterator< T, Axes >::localBinsIndices ( ) const

Retrieve the local position.

Returns
The current local position in the grid

◆ operator*()

template<typename T, class... Axes>
const value_type & Acts::GridLocalIterator< T, Axes >::operator* ( ) const

Return stored value at given local position.

Returns
The stored value in the grid from that given local position

◆ operator++() [1/2]

template<typename T, class... Axes>
GridLocalIterator< T, Axes... > & Acts::GridLocalIterator< T, Axes >::operator++ ( )

Increment operator (pre).

Returns
The local iterator after the increment

This will increase the local position by one

◆ operator++() [2/2]

template<typename T, class... Axes>
GridLocalIterator< T, Axes... > Acts::GridLocalIterator< T, Axes >::operator++ ( int )

Increment operator (post).

Returns
The local iterator before the increment

This will increase the local position by one

◆ operator=() [1/2]

template<typename T, class... Axes>
GridLocalIterator< T, Axes... > & Acts::GridLocalIterator< T, Axes >::operator= ( const GridLocalIterator< T, Axes... > & other)
default

Copy assignment operator.

Parameters
[in]otherThe GridLocalIterator to be copied
Returns
The copied GridLocalIterator

◆ operator=() [2/2]

template<typename T, class... Axes>
GridLocalIterator< T, Axes... > & Acts::GridLocalIterator< T, Axes >::operator= ( GridLocalIterator< T, Axes... > && other)
noexcept

Move assignment operator.

Parameters
[in]otherThe GridLocalIterator to be moved
Returns
The moved GridLocalIterator

This will invalidate the other GridLocalIterator

◆ operator==()

template<typename T, class... Axes>
bool Acts::GridLocalIterator< T, Axes >::operator== ( const GridLocalIterator< T, Axes... > & other) const

Equality operator.

Parameters
[in]otherThe other GridLocalIterator to be compared against this one
Returns
The result of the comparison

Member Data Documentation

◆ DIM

template<typename T, class... Axes>
std::size_t Acts::GridLocalIterator< T, Axes >::DIM = sizeof...(Axes)
staticconstexpr

Dimensionality of the grid (number of axes).