LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
util::GridContainerBase3D< DATUM, IXMAN > Class Template Reference

Base class for a container of data arranged on a 3D-grid. More...

#include "GridContainers.h"

Inheritance diagram for util::GridContainerBase3D< DATUM, IXMAN >:
util::GridContainerBase2D< DATUM, IXMAN > util::GridContainerBase1D< DATUM, IXMAN > util::details::GridContainerBase< DATUM, IXMAN >

Public Types

using Datum_t = DATUM
 type of contained datum More...
 
using Indexer_t = IXMAN
 
using Grid_t = GridContainerBase< Datum_t, Indexer_t >
 this type More...
 
using CellIndex_t = typename Indexer_t::CellIndex_t
 type of index for direct access to the cell More...
 
using CellIndexOffset_t = typename Indexer_t::CellIndexOffset_t
 type of difference between indices More...
 
using CellDimIndex_t = typename Indexer_t::CellDimIndex_t
 type of difference between indices More...
 
using CellID_t = typename Indexer_t::CellID_t
 type of cell coordinate (x, y, z) More...
 
using Cell_t = std::vector< Datum_t >
 type of a single cell container More...
 
using Cells_t = std::vector< Cell_t >
 type of container holding all cells More...
 
using const_iterator = typename Cells_t::const_iterator
 type of iterator to all cells More...
 

Public Member Functions

Indexer_t const & indexManager () const
 Returns the index manager of the grid. More...
 
Data structure
size_t sizeZ () const
 Returns the size of the container in the third dimension (z) More...
 
bool hasZ (typename Base_t::CellDimIndex_t index) const
 Returns whether the specified x index is valid. More...
 
Data structure
size_t sizeY () const
 Returns the size of the container in the second dimension (y) More...
 
bool hasY (typename Base_t::CellDimIndex_t index) const
 Returns whether the specified x index is valid. More...
 
Data structure
bool hasX (typename Base_t::CellDimIndex_t index) const
 Returns whether the specified x index is valid. More...
 
size_t sizeX () const
 Returns the size of the container in the first dimension (x) More...
 
Data structure
size_t size () const
 Returns the total size of the container. More...
 
bool has (CellIndexOffset_t index) const
 Returns whether the specified index is valid. More...
 
Data access
CellIndex_t index (CellID_t const &id) const
 Return the index of the element from its cell coordinates (no check!) More...
 
CellIndexOffset_t indexOffset (CellID_t const &origin, CellID_t const &cellID) const
 Returns the difference in index from two cells. More...
 
Cell_toperator[] (CellID_t const &id)
 Returns a reference to the specified cell. More...
 
Cell_t const & operator[] (CellID_t const &id) const
 Returns a constant reference to the specified cell. More...
 
Cell_toperator[] (CellIndex_t index)
 Returns a reference to to the cell with specified index. More...
 
Cell_t const & operator[] (CellIndex_t index) const
 Returns a constant reference to the cell with specified index. More...
 
Data insertion
void insert (CellID_t const &cellID, Datum_t const &elem)
 Copies an element into the specified cell. More...
 
void insert (CellID_t const &cellID, Datum_t &&elem)
 Moves an element into the specified cell. More...
 
void insert (CellIndex_t index, Datum_t const &elem)
 Copies an element into the cell with the specified index. More...
 
void insert (CellIndex_t index, Datum_t &&elem)
 Moves an element into the cell with the specified index. More...
 

Static Public Member Functions

static constexpr unsigned int dims ()
 

Protected Member Functions

Cell_tcell (CellID_t const &cellID)
 Returns a reference to the specified cell. More...
 
Cell_t const & cell (CellID_t const &cellID) const
 Returns a constant reference to the specified cell. More...
 

Protected Attributes

Indexer_t indices
 manager of the indices of the container More...
 
Cells_t data
 organised collection of points More...
 

Private Types

using Base_t = GridContainerBase2D< DATUM, IXMAN >
 

Detailed Description

template<typename DATUM, typename IXMAN>
class util::GridContainerBase3D< DATUM, IXMAN >

Base class for a container of data arranged on a 3D-grid.

Template Parameters
DATUMtype of datum to be contained
IXMANtype of the grid index manager

Definition at line 218 of file GridContainers.h.

Member Typedef Documentation

template<typename DATUM , typename IXMAN >
using util::GridContainerBase3D< DATUM, IXMAN >::Base_t = GridContainerBase2D<DATUM, IXMAN>
private

Definition at line 219 of file GridContainers.h.

template<typename DATUM , typename IXMAN >
using util::details::GridContainerBase< DATUM, IXMAN >::Cell_t = std::vector<Datum_t>
inherited

type of a single cell container

Definition at line 64 of file GridContainers.h.

template<typename DATUM , typename IXMAN >
using util::details::GridContainerBase< DATUM, IXMAN >::CellDimIndex_t = typename Indexer_t::CellDimIndex_t
inherited

type of difference between indices

Definition at line 58 of file GridContainers.h.

template<typename DATUM , typename IXMAN >
using util::details::GridContainerBase< DATUM, IXMAN >::CellID_t = typename Indexer_t::CellID_t
inherited

type of cell coordinate (x, y, z)

Definition at line 61 of file GridContainers.h.

template<typename DATUM , typename IXMAN >
using util::details::GridContainerBase< DATUM, IXMAN >::CellIndex_t = typename Indexer_t::CellIndex_t
inherited

type of index for direct access to the cell

Definition at line 52 of file GridContainers.h.

template<typename DATUM , typename IXMAN >
using util::details::GridContainerBase< DATUM, IXMAN >::CellIndexOffset_t = typename Indexer_t::CellIndexOffset_t
inherited

type of difference between indices

Definition at line 55 of file GridContainers.h.

template<typename DATUM , typename IXMAN >
using util::details::GridContainerBase< DATUM, IXMAN >::Cells_t = std::vector<Cell_t>
inherited

type of container holding all cells

Definition at line 67 of file GridContainers.h.

template<typename DATUM , typename IXMAN >
using util::details::GridContainerBase< DATUM, IXMAN >::const_iterator = typename Cells_t::const_iterator
inherited

type of iterator to all cells

Definition at line 70 of file GridContainers.h.

template<typename DATUM , typename IXMAN >
using util::details::GridContainerBase< DATUM, IXMAN >::Datum_t = DATUM
inherited

type of contained datum

Definition at line 44 of file GridContainers.h.

template<typename DATUM , typename IXMAN >
using util::details::GridContainerBase< DATUM, IXMAN >::Grid_t = GridContainerBase<Datum_t, Indexer_t>
inherited

this type

Definition at line 47 of file GridContainers.h.

template<typename DATUM , typename IXMAN >
using util::details::GridContainerBase< DATUM, IXMAN >::Indexer_t = IXMAN
inherited

Definition at line 45 of file GridContainers.h.

Member Function Documentation

template<typename DATUM , typename IXMAN >
Cell_t& util::details::GridContainerBase< DATUM, IXMAN >::cell ( CellID_t const &  cellID)
inlineprotectedinherited

Returns a reference to the specified cell.

Definition at line 143 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::index().

Referenced by util::details::GridContainerBase< DATUM, IXMAN >::insert(), and util::details::GridContainerBase< DATUM, IXMAN >::operator[]().

143 { return data[index(cellID)]; }
Cells_t data
organised collection of points
CellIndex_t index(CellID_t const &id) const
Return the index of the element from its cell coordinates (no check!)
template<typename DATUM , typename IXMAN >
Cell_t const& util::details::GridContainerBase< DATUM, IXMAN >::cell ( CellID_t const &  cellID) const
inlineprotectedinherited

Returns a constant reference to the specified cell.

Definition at line 146 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::index().

146 { return data[index(cellID)]; }
Cells_t data
organised collection of points
CellIndex_t index(CellID_t const &id) const
Return the index of the element from its cell coordinates (no check!)
template<typename DATUM , typename IXMAN >
static constexpr unsigned int util::details::GridContainerBase< DATUM, IXMAN >::dims ( )
inlinestaticinherited

Definition at line 49 of file GridContainers.h.

49 { return IXMAN::dims(); }
template<typename DATUM , typename IXMAN >
bool util::details::GridContainerBase< DATUM, IXMAN >::has ( CellIndexOffset_t  index) const
inlineinherited

Returns whether the specified index is valid.

Definition at line 84 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::indices.

84 { return indices.has(index); }
Indexer_t indices
manager of the indices of the container
CellIndex_t index(CellID_t const &id) const
Return the index of the element from its cell coordinates (no check!)
template<typename DATUM , typename IXMAN >
bool util::GridContainerBase1D< DATUM, IXMAN >::hasX ( typename Base_t::CellDimIndex_t  index) const
inlineinherited

Returns whether the specified x index is valid.

Definition at line 171 of file GridContainers.h.

References geo::vect::indices().

171 { return Base_t::indices.hasX(index); }
Indexer_t indices
manager of the indices of the container
CellIndex_t index(CellID_t const &id) const
Return the index of the element from its cell coordinates (no check!)
template<typename DATUM , typename IXMAN >
bool util::GridContainerBase2D< DATUM, IXMAN >::hasY ( typename Base_t::CellDimIndex_t  index) const
inlineinherited

Returns whether the specified x index is valid.

Definition at line 203 of file GridContainers.h.

References geo::vect::indices().

203 { return Base_t::indices.hasY(index); }
Indexer_t indices
manager of the indices of the container
CellIndex_t index(CellID_t const &id) const
Return the index of the element from its cell coordinates (no check!)
template<typename DATUM , typename IXMAN >
bool util::GridContainerBase3D< DATUM, IXMAN >::hasZ ( typename Base_t::CellDimIndex_t  index) const
inline

Returns whether the specified x index is valid.

Definition at line 232 of file GridContainers.h.

References geo::vect::indices().

232 { return Base_t::indices.hasZ(index); }
Indexer_t indices
manager of the indices of the container
CellIndex_t index(CellID_t const &id) const
Return the index of the element from its cell coordinates (no check!)
template<typename DATUM , typename IXMAN >
CellIndex_t util::details::GridContainerBase< DATUM, IXMAN >::index ( CellID_t const &  id) const
inlineinherited

Return the index of the element from its cell coordinates (no check!)

Definition at line 92 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::indices.

Referenced by util::details::GridContainerBase< DATUM, IXMAN >::cell(), util::details::GridContainerBase< DATUM, IXMAN >::insert(), and util::details::GridContainerBase< DATUM, IXMAN >::operator[]().

92 { return indices[id]; }
Indexer_t indices
manager of the indices of the container
template<typename DATUM , typename IXMAN >
Indexer_t const& util::details::GridContainerBase< DATUM, IXMAN >::indexManager ( ) const
inlineinherited

Returns the index manager of the grid.

Definition at line 135 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::indices.

135 { return indices; }
Indexer_t indices
manager of the indices of the container
template<typename DATUM , typename IXMAN >
CellIndexOffset_t util::details::GridContainerBase< DATUM, IXMAN >::indexOffset ( CellID_t const &  origin,
CellID_t const &  cellID 
) const
inlineinherited

Returns the difference in index from two cells.

Definition at line 95 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::indices.

96  {
97  return indices.offset(origin, cellID);
98  }
Indexer_t indices
manager of the indices of the container
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:229
template<typename DATUM , typename IXMAN >
void util::details::GridContainerBase< DATUM, IXMAN >::insert ( CellID_t const &  cellID,
Datum_t const &  elem 
)
inlineinherited

Copies an element into the specified cell.

Definition at line 118 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::cell().

118 { cell(cellID).push_back(elem); }
Cell_t & cell(CellID_t const &cellID)
Returns a reference to the specified cell.
template<typename DATUM , typename IXMAN >
void util::details::GridContainerBase< DATUM, IXMAN >::insert ( CellID_t const &  cellID,
Datum_t &&  elem 
)
inlineinherited

Moves an element into the specified cell.

Definition at line 121 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::cell().

122  {
123  cell(cellID).push_back(std::move(elem));
124  }
Cell_t & cell(CellID_t const &cellID)
Returns a reference to the specified cell.
template<typename DATUM , typename IXMAN >
void util::details::GridContainerBase< DATUM, IXMAN >::insert ( CellIndex_t  index,
Datum_t const &  elem 
)
inlineinherited

Copies an element into the cell with the specified index.

Definition at line 127 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::data, and util::details::GridContainerBase< DATUM, IXMAN >::index().

127 { data[index].push_back(elem); }
Cells_t data
organised collection of points
CellIndex_t index(CellID_t const &id) const
Return the index of the element from its cell coordinates (no check!)
template<typename DATUM , typename IXMAN >
void util::details::GridContainerBase< DATUM, IXMAN >::insert ( CellIndex_t  index,
Datum_t &&  elem 
)
inlineinherited

Moves an element into the cell with the specified index.

Definition at line 130 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::data, and util::details::GridContainerBase< DATUM, IXMAN >::index().

130 { data[index].push_back(std::move(elem)); }
Cells_t data
organised collection of points
CellIndex_t index(CellID_t const &id) const
Return the index of the element from its cell coordinates (no check!)
template<typename DATUM , typename IXMAN >
Cell_t& util::details::GridContainerBase< DATUM, IXMAN >::operator[] ( CellID_t const &  id)
inlineinherited

Returns a reference to the specified cell.

Definition at line 101 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::cell().

101 { return cell(id); }
Cell_t & cell(CellID_t const &cellID)
Returns a reference to the specified cell.
template<typename DATUM , typename IXMAN >
Cell_t const& util::details::GridContainerBase< DATUM, IXMAN >::operator[] ( CellID_t const &  id) const
inlineinherited

Returns a constant reference to the specified cell.

Definition at line 104 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::cell().

104 { return cell(id); }
Cell_t & cell(CellID_t const &cellID)
Returns a reference to the specified cell.
template<typename DATUM , typename IXMAN >
Cell_t& util::details::GridContainerBase< DATUM, IXMAN >::operator[] ( CellIndex_t  index)
inlineinherited

Returns a reference to to the cell with specified index.

Definition at line 107 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::data, and util::details::GridContainerBase< DATUM, IXMAN >::index().

107 { return data[index]; }
Cells_t data
organised collection of points
CellIndex_t index(CellID_t const &id) const
Return the index of the element from its cell coordinates (no check!)
template<typename DATUM , typename IXMAN >
Cell_t const& util::details::GridContainerBase< DATUM, IXMAN >::operator[] ( CellIndex_t  index) const
inlineinherited

Returns a constant reference to the cell with specified index.

Definition at line 110 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::data, and util::details::GridContainerBase< DATUM, IXMAN >::index().

110 { return data[index]; }
Cells_t data
organised collection of points
CellIndex_t index(CellID_t const &id) const
Return the index of the element from its cell coordinates (no check!)
template<typename DATUM , typename IXMAN >
size_t util::details::GridContainerBase< DATUM, IXMAN >::size ( ) const
inlineinherited

Returns the total size of the container.

Definition at line 81 of file GridContainers.h.

References util::details::GridContainerBase< DATUM, IXMAN >::indices.

81 { return indices.size(); }
Indexer_t indices
manager of the indices of the container
template<typename DATUM , typename IXMAN >
size_t util::GridContainerBase1D< DATUM, IXMAN >::sizeX ( ) const
inlineinherited

Returns the size of the container in the first dimension (x)

Definition at line 174 of file GridContainers.h.

References geo::vect::indices().

174 { return Base_t::indices.sizeX(); }
Indexer_t indices
manager of the indices of the container
template<typename DATUM , typename IXMAN >
size_t util::GridContainerBase2D< DATUM, IXMAN >::sizeY ( ) const
inlineinherited

Returns the size of the container in the second dimension (y)

Definition at line 200 of file GridContainers.h.

References geo::vect::indices().

200 { return Base_t::indices.sizeY(); }
Indexer_t indices
manager of the indices of the container
template<typename DATUM , typename IXMAN >
size_t util::GridContainerBase3D< DATUM, IXMAN >::sizeZ ( ) const
inline

Returns the size of the container in the third dimension (z)

Definition at line 229 of file GridContainers.h.

References geo::vect::indices().

229 { return Base_t::indices.sizeZ(); }
Indexer_t indices
manager of the indices of the container

Member Data Documentation

template<typename DATUM , typename IXMAN >
Cells_t util::details::GridContainerBase< DATUM, IXMAN >::data
protectedinherited

The documentation for this class was generated from the following file: