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

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

#include <Acts/Utilities/AnyGridView.hpp>

Collaboration diagram for Acts::AnyGridConstView< 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 = const IGrid*
 Type of pointer to grid, const or non-const depending on isConst.

Public Member Functions

template<typename... Axes>
 AnyGridConstView (const Grid< T, Axes... > &grid)
 Constructor from const concrete Grid reference.
 AnyGridConstView (const IGrid &grid)
 Constructor from const IGrid reference.
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.
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 const grid.

Detailed Description

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

Type-safe view into a grid with const 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 const access only. It ensures that the grid being viewed contains values of the expected type T.

Example usage:

const Grid<double, Axis> grid(...);
double value = view.atLocalBins({1}); // Read-only access
AnyGridConstView(const IGrid &grid)
Constructor from const IGrid reference.
Definition AnyGridView.hpp:165
class for describing a regular multi-dimensional grid
Definition Grid.hpp:141

Member Typedef Documentation

◆ AnyIndexType

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

Type for indices, imported from IGrid.

◆ AnyPointType

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

Type for points, imported from IGrid.

◆ GridPointerType

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

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

Constructor & Destructor Documentation

◆ AnyGridConstView() [1/2]

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

Constructor from const IGrid reference.

Parameters
gridThe grid to view
Note
This constructor creates a const view of the grid

◆ AnyGridConstView() [2/2]

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

Constructor from 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 const view of the grid

Member Function Documentation

◆ atLocalBins()

template<typename T>
const T & Acts::AnyGridConstView< 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::AnyGridConstView< 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::AnyGridConstView< 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::AnyGridConstView< T >::dimensions ( ) const

Get the number of dimensions of the grid.

Returns
The number of dimensions

◆ lowerLeftBinEdge()

template<typename T>
AnyPointType Acts::AnyGridConstView< 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::AnyGridConstView< T >::numLocalBins ( ) const

Get the number of bins along each axis.

Returns
Vector containing the number of bins for each axis

◆ upperRightBinEdge()

template<typename T>
AnyPointType Acts::AnyGridConstView< 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::AnyGridConstView< T >::m_grid

Type-erased pointer to the underlying const grid.