18 #ifndef LARDATA_UTILITIES_GRIDCONTAINERINDICES_H
19 #define LARDATA_UTILITIES_GRIDCONTAINERINDICES_H
35 template <
unsigned int DIMS>
41 static constexpr
unsigned int dims() {
return DIMS; }
53 using CellID_t = std::array<CellDimIndex_t, dims()>;
99 template <
unsigned int DIMS = 1U>
103 static_assert(DIMS >= 1U,
104 "Dimensions for GridContainerIndicesBase1D must be at least 1");
109 using Base_t::GridContainerIndicesBase;
127 template <
unsigned int DIMS = 2U>
129 static_assert(DIMS >= 2U,
130 "Dimensions for GridContainerIndicesBase2D must be at least 2");
136 using Base_t::GridContainerIndicesBase1D;
154 template <
unsigned int DIMS = 3U>
156 static_assert(DIMS >= 3U,
157 "Dimensions for GridContainerIndicesBase3D must be at least 3");
162 using Base_t::GridContainerIndicesBase2D;
191 #endif // LARDATA_UTILITIES_GRIDCONTAINERINDICES_H
static constexpr unsigned int dims()
Returns the number of dimensions in this object.
std::ptrdiff_t CellIndexOffset_t
type of difference between indices
size_t size() const
Returns the number of cells in the grid.
Base_t::LinIndex_t LinIndex_t
Type of the linear index.
CellIndexOffset_t CellDimIndex_t
type of difference between indices along a dimension
Index manager for a container of data arranged on a >=2-dim grid.
CellIndex_t index(CellID_t id) const
Returns the index of the element from its cell coordinates (no check!)
IndexManager_t indices
the actual worker
typename IndexManager_t::LinIndex_t CellIndex_t
type of index for direct access to the cell
TensorIndices class to flatten multi-dimension indices into linear.
std::array< CellDimIndex_t, dims()> CellID_t
type of cell coordinate (x, y, z)
size_t sizeZ() const
Returns the number of cells on the z axis of the grid.
then echo ***************************************echo array
Index manager for a container of data arranged on a DIMS-dimension grid.
bool hasZ(typename Base_t::CellDimIndex_t index) const
Returns whether the specified z index is valid.
bool hasX(typename Base_t::CellDimIndex_t index) const
Returns whether the specified x index is valid.
Index manager for a container of data arranged on a >=3-dim grid.
CellIndexOffset_t offset(CellID_t const &origin, CellID_t const &cellID) const
Returns the difference in index of cellID respect to origin.
size_t sizeY() const
Returns the number of cells on the y axis of the grid.
bool hasLinIndex(LinIndex_t linIndex) const
Returns whether the specified linear index is valid in this tensor.
Index manager for a container of data arranged on a >=1-dim grid.
CellIndex_t operator[](CellID_t id) const
Returns the index of the element from its cell coordinates (no check!)
DimSize_t size() const
Returns the size of the minor tensor.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
bool hasY(typename Base_t::CellDimIndex_t index) const
Returns whether the specified y index is valid.
constexpr Point origin()
Returns a origin position with a point of the specified type.
size_t sizeX() const
Returns the number of cells on the x axis of the grid.