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

Type-safe view into a grid with mutable access. More...

#include <Acts/Utilities/AnyGridView.hpp>

Collaboration diagram for Acts::AnyGridView< T >:
[legend]

Public Types

using AnyIndexType = IGrid::AnyIndexType
 Type for indices, imported from IGrid.
using AnyPointType = IGrid::AnyPointType
 Type for points, imported from IGrid.
using GridPointerType = IGrid*
 Type of pointer to grid, const or non-const depending on isConst.

Public Member Functions

 AnyGridView (AnyGridView &&) noexcept=default
 Move constructor.
 AnyGridView (const AnyGridView &other)=default
 Copy constructor.
template<typename... Axes>
 AnyGridView (Grid< T, Axes... > &grid)
 Constructor from non-const concrete Grid reference.
 AnyGridView (IGrid &grid)
 Constructor from non-const IGrid reference.
T & atLocalBins (const AnyIndexType &indices)
 Access value at given local bin indices with mutable access.
const T & atLocalBins (const AnyIndexType &indices) const
 Access value at given local bin indices with const access.
AnyPointType binCenter (const IGrid::AnyIndexType &indices) const
 Get the center position of a bin for given indices.
void checkType ()
 Check if the grid's value type matches the template parameter T.
std::size_t dimensions () const
 Get the number of dimensions of the grid.
AnyPointType lowerLeftBinEdge (const IGrid::AnyIndexType &indices) const
 Get the lower left edge position of a bin for given indices.
AnyIndexType numLocalBins () const
 Get the number of bins along each axis.
AnyGridViewoperator= (AnyGridView &&) noexcept=default
 Move assignment operator.
AnyGridViewoperator= (const AnyGridView &other)=default
 Copy assignment operator.
AnyPointType upperRightBinEdge (const IGrid::AnyIndexType &indices) const
 Get the upper right edge position of a bin for given indices.

Public Attributes

GridPointerType m_grid
 Type-erased pointer to the underlying grid.

Detailed Description

template<typename T>
class Acts::AnyGridView< T >

Type-safe view into a grid with mutable access.

Template Parameters
TType of values stored in the grid

This class provides a type-safe interface to access grid objects through the type-erased IGrid interface with mutable access. It ensures that the grid being viewed contains values of the expected type T.

Example usage:

view.atLocalBins({1}) = 42.0; // Modify the grid through the view
AnyGridView(IGrid &grid)
Constructor from non-const IGrid reference.
Definition AnyGridView.hpp:44
class for describing a regular multi-dimensional grid
Definition Grid.hpp:141

Member Typedef Documentation

◆ AnyIndexType

template<typename T>
using Acts::AnyGridView< T >::AnyIndexType = IGrid::AnyIndexType

Type for indices, imported from IGrid.

◆ AnyPointType

template<typename T>
using Acts::AnyGridView< T >::AnyPointType = IGrid::AnyPointType

Type for points, imported from IGrid.

◆ GridPointerType

template<typename T>
using Acts::AnyGridView< T >::GridPointerType = IGrid*

Type of pointer to grid, const or non-const depending on isConst.

Constructor & Destructor Documentation

◆ AnyGridView() [1/4]

template<typename T>
Acts::AnyGridView< T >::AnyGridView ( IGrid & grid)
explicit

Constructor from non-const IGrid reference.

Parameters
gridThe grid to view

◆ AnyGridView() [2/4]

template<typename T>
template<typename... Axes>
Acts::AnyGridView< T >::AnyGridView ( Grid< T, Axes... > & grid)
explicit

Constructor from non-const concrete Grid reference.

Template Parameters
AxesParameter pack of axis types defining the grid
Parameters
gridThe concrete grid to view
Note
This constructor creates a mutable view of the grid

◆ AnyGridView() [3/4]

template<typename T>
Acts::AnyGridView< T >::AnyGridView ( const AnyGridView< T > & other)
default

Copy constructor.

Parameters
otherThe AnyGridView to copy from

◆ AnyGridView() [4/4]

template<typename T>
Acts::AnyGridView< T >::AnyGridView ( AnyGridView< T > && )
defaultnoexcept

Move constructor.

Member Function Documentation

◆ atLocalBins() [1/2]

template<typename T>
T & Acts::AnyGridView< T >::atLocalBins ( const AnyIndexType & indices)

Access value at given local bin indices with mutable access.

Parameters
indicesThe local bin indices
Returns
Reference to the value at the specified bin
Note
This method provides mutable access to grid values
Exceptions
std::invalid_argumentif indices size doesn't match grid dimensions
std::out_of_rangeif indices are out of bounds

◆ atLocalBins() [2/2]

template<typename T>
const T & Acts::AnyGridView< T >::atLocalBins ( const AnyIndexType & indices) const

Access value at given local bin indices with const access.

Parameters
indicesThe local bin indices
Returns
Const reference to the value at the specified bin
Exceptions
std::invalid_argumentif indices size doesn't match grid dimensions
std::out_of_rangeif indices are out of bounds

◆ binCenter()

template<typename T>
AnyPointType Acts::AnyGridView< T >::binCenter ( const IGrid::AnyIndexType & indices) const

Get the center position of a bin for given indices.

Parameters
indicesThe local bin indices
Returns
The center position of the bin

◆ checkType()

template<typename T>
void Acts::AnyGridView< T >::checkType ( )

Check if the grid's value type matches the template parameter T.

Exceptions
std::invalid_argumentif there's a type mismatch

◆ dimensions()

template<typename T>
std::size_t Acts::AnyGridView< T >::dimensions ( ) const

Get the number of dimensions of the grid.

Returns
The number of dimensions

◆ lowerLeftBinEdge()

template<typename T>
AnyPointType Acts::AnyGridView< T >::lowerLeftBinEdge ( const IGrid::AnyIndexType & indices) const

Get the lower left edge position of a bin for given indices.

Parameters
indicesThe local bin indices
Returns
The lower left edge position of the bin

◆ numLocalBins()

template<typename T>
AnyIndexType Acts::AnyGridView< T >::numLocalBins ( ) const

Get the number of bins along each axis.

Returns
Vector containing the number of bins for each axis

◆ operator=() [1/2]

template<typename T>
AnyGridView & Acts::AnyGridView< T >::operator= ( AnyGridView< T > && )
defaultnoexcept

Move assignment operator.

Returns
Reference to this AnyGridView after moving

◆ operator=() [2/2]

template<typename T>
AnyGridView & Acts::AnyGridView< T >::operator= ( const AnyGridView< T > & other)
default

Copy assignment operator.

Parameters
otherThe AnyGridView to copy from
Returns
Reference to this AnyGridView after copying

◆ upperRightBinEdge()

template<typename T>
AnyPointType Acts::AnyGridView< T >::upperRightBinEdge ( const IGrid::AnyIndexType & indices) const

Get the upper right edge position of a bin for given indices.

Parameters
indicesThe local bin indices
Returns
The upper right edge position of the bin

Member Data Documentation

◆ m_grid

template<typename T>
GridPointerType Acts::AnyGridView< T >::m_grid

Type-erased pointer to the underlying grid.