ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::NeighborHoodIndices Class Reference

This object can be iterated to produce up to two sequences of integer indices, corresponding to the half-open integer ranges [begin1, end1[ and [begin2, end2[. More...

#include <Acts/Utilities/NeighborHoodIndices.hpp>

Classes

class  iterator
 Iterator over the neighborhood index sequence. More...

Public Member Functions

 NeighborHoodIndices (std::size_t begin, std::size_t end)
 Constructor for continuous range.
 NeighborHoodIndices (std::size_t begin1, std::size_t end1, std::size_t begin2, std::size_t end2)
 Constructor for wrapped range (two segments).
iterator begin () const
 Get begin iterator.
std::vector< std::size_t > collect () const
 Collect all indices into a vector.
iterator end () const
 Get end iterator.
std::size_t size () const
 Get total number of indices in the sequence.

Detailed Description

This object can be iterated to produce up to two sequences of integer indices, corresponding to the half-open integer ranges [begin1, end1[ and [begin2, end2[.

The goal is to emulate the effect of enumerating a range of neighbor indices on an axis (which may go out of bounds and wrap around since we have AxisBoundaryType::Closed), inserting them into an std::vector, and discarding duplicates, without paying the price of duplicate removal and dynamic memory allocation in hot magnetic field interpolation code.

Iterable indices for neighborhood lookups with optional wrap-around.

Constructor & Destructor Documentation

◆ NeighborHoodIndices() [1/2]

Acts::NeighborHoodIndices::NeighborHoodIndices ( std::size_t begin,
std::size_t end )

Constructor for continuous range.

Parameters
beginStart index
endEnd index (exclusive)

◆ NeighborHoodIndices() [2/2]

Acts::NeighborHoodIndices::NeighborHoodIndices ( std::size_t begin1,
std::size_t end1,
std::size_t begin2,
std::size_t end2 )

Constructor for wrapped range (two segments).

Parameters
begin1Start of first segment
end1End of first segment (exclusive)
begin2Start of second segment
end2End of second segment (exclusive)

Member Function Documentation

◆ begin()

iterator Acts::NeighborHoodIndices::begin ( ) const

Get begin iterator.

Returns
Iterator to first index

◆ collect()

std::vector< std::size_t > Acts::NeighborHoodIndices::collect ( ) const

Collect all indices into a vector.

Returns
Vector containing all indices

◆ end()

iterator Acts::NeighborHoodIndices::end ( ) const

Get end iterator.

Returns
Iterator past last index

◆ size()

std::size_t Acts::NeighborHoodIndices::size ( ) const

Get total number of indices in the sequence.

Returns
Number of indices