16 #ifndef LARDATA_UTILITIES_GRIDCONTAINERS_H
17 #define LARDATA_UTILITIES_GRIDCONTAINERS_H
41 template <
typename DATUM,
typename IXMAN>
51 static constexpr
unsigned int dims() {
return IXMAN::dims(); }
100 {
return indices.offset(origin, cellID); }
121 {
cell(cellID).push_back(elem); }
125 {
cell(cellID).push_back(std::move(elem)); }
133 {
data[
index].push_back(std::move(elem)); }
166 template <
typename DATUM,
typename IXMAN>
170 "GridContainerBase1D must have dimensions 1 or larger.");
174 using Base_t::GridContainerBase;
199 template <
typename DATUM,
typename IXMAN>
203 "GridContainerBase2D must have dimensions 2 or larger.");
207 using Base_t::GridContainerBase1D;
232 template <
typename DATUM,
typename IXMAN>
236 "GridContainerBase3D must have dimensions 3 or larger.");
240 using Base_t::GridContainerBase2D;
266 template <
typename DATUM>
278 template <
typename DATUM>
284 #endif // LARDATA_UTILITIES_GRIDCONTAINERS_H
CellIndexOffset_t indexOffset(CellID_t const &origin, CellID_t const &cellID) const
Returns the difference in index from two cells.
static constexpr unsigned int dims()
Cells_t data
organised collection of points
bool hasX(typename Base_t::CellDimIndex_t index) const
Returns whether the specified x index is valid.
bool hasZ(typename Base_t::CellDimIndex_t index) const
Returns whether the specified x index is valid.
size_t sizeX() const
Returns the size of the container in the first dimension (x)
Cell_t & cell(CellID_t const &cellID)
Returns a reference to the specified cell.
Indexer_t const & indexManager() const
Returns the index manager of the grid.
std::vector< Datum_t > Cell_t
type of a single cell container
typename Cells_t::const_iterator const_iterator
type of iterator to all cells
size_t sizeY() const
Returns the size of the container in the second dimension (y)
size_t sizeZ() const
Returns the size of the container in the third dimension (z)
void insert(CellID_t const &cellID, Datum_t const &elem)
Copies an element into the specified cell.
std::vector< Cell_t > Cells_t
type of container holding all cells
Cell_t & operator[](CellID_t const &id)
Returns a reference to the specified cell.
typename Indexer_t::CellID_t CellID_t
type of cell coordinate (x, y, z)
then echo ***************************************echo array
PointIter Datum_t
type of contained datum
Indexer_t indices
manager of the indices of the container
Base class for a container of data arranged on a grid.
typename Indexer_t::CellIndex_t CellIndex_t
type of index for direct access to the cell
Base class for a container of data arranged on a 2D-grid.
typename Indexer_t::CellIndexOffset_t CellIndexOffset_t
type of difference between indices
Cell_t const & cell(CellID_t const &cellID) const
Returns a constant reference to the specified cell.
typename Indexer_t::CellDimIndex_t CellDimIndex_t
type of difference between indices
void insert(CellID_t const &cellID, Datum_t &&elem)
Moves an element into the specified cell.
bool has(CellIndexOffset_t index) const
Returns whether the specified index is valid.
void insert(CellIndex_t index, Datum_t &&elem)
Moves an element into the cell with the specified index.
CellIndex_t index(CellID_t const &id) const
Return the index of the element from its cell coordinates (no check!)
void insert(CellIndex_t index, Datum_t const &elem)
Copies an element into the cell with the specified index.
Base class for a container of data arranged on a 1D-grid.
bool hasY(typename Base_t::CellDimIndex_t index) const
Returns whether the specified x index is valid.
constexpr Point origin()
Returns a origin position with a point of the specified type.
Base class for a container of data arranged on a 3D-grid.
Classes to manage containers with indices in 1, 2 and 3 dimensions.
size_t size() const
Returns the total size of the container.