
#include <Core/Containers/Grid.hpp>
Inheritance diagram for Ra::Core::Grid< T, D >:
Collaboration diagram for Ra::Core::Grid< T, D >:Classes | |
| class | Iterator |
| A vector of signed offsets. More... | |
Public Types | |
| using | IdxVector |
| Dimension of our grid. | |
| using | OffsetVector = Eigen::Matrix<int, D, 1> |
| A vector of the size of the grid along each dimension. | |
Public Member Functions | |
| Grid (const IdxVector &size=IdxVector::Zero(), const T &val=T()) | |
| Construct a grid of a given size and fill it with the given value. | |
| Grid (const IdxVector &size, const T *values) | |
| Construct a grid of a given size with values in ()-major format. | |
| Grid (const Grid< T, D > &other)=default | |
| Copy constructor and assignment operator. | |
| Grid & | operator= (const Grid< T, D > &other)=default |
| uint | size () const |
| Returns the number of elements stored. | |
| const IdxVector & | sizeVector () const |
| Returns the size vector (a D-dimensional vector with the size along each dimension). | |
| bool | empty () const |
| Returns true if the grid is empty (i.e. if size() ==0). | |
| void | clear () |
| Erases all data and makes the grid empty. | |
| const T & | at (const IdxVector &idx) const |
| Access an element with a D-dimensional index. | |
| T & | at (const IdxVector &idx) |
| const T & | at (uint idx) const |
| Access an element with a linear index. | |
| T & | at (uint idx) |
| const T & | at (const Iterator &it) const |
| Access an element with an iterator. | |
| T & | at (const Iterator &it) |
| const T * | data () const |
| Read only access to the underlying data. | |
| T * | data () |
| Read-write access to the underlying data. | |
| Iterator | begin () |
| Get an iterator on this grid at the first element. | |
| Iterator | begin () const |
| Iterator | end () |
| Get an iterator on this grid past the last element. | |
| Iterator | end () const |
Static Public Attributes | |
| static const uint | Dimension = D |
Protected Attributes | |
| IdxVector | m_size |
| Indicate the extends of the grid along each dimension. | |
| std::vector< T > | m_data |
| Storage for the grid data. | |
This class stores a D-dimensional grid of elements of arbitrary type. in a contiguous memory block. Elements are stored in column-major order. e.g. for a 3x3x3 array the element vector looks like [A000, A100, A200, A010,... A222]. Elements are accessible with a D-dimensional Vector, or linearly with iterators, thanks to the std-like interface provided.
| using Ra::Core::Grid< T, D >::IdxVector |
| using Ra::Core::Grid< T, D >::OffsetVector = Eigen::Matrix<int, D, 1> |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
|
protected |
|
protected |