LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
|
A container of points sorted in cells. More...
#include "SpacePartition.h"
Public Types | |
using | Coord_t = details::ExtractCoordType_t< Point_t > |
type of point coordinate More... | |
using | Range_t = CoordRangeCells< Coord_t > |
type of coordinate range More... | |
using | Indexer_t = typename Grid_t::Indexer_t |
type of index manager of the grid More... | |
using | CellIndexOffset_t = typename Indexer_t::CellIndexOffset_t |
type of difference between cell indices More... | |
using | CellIndex_t = typename Indexer_t::CellIndex_t |
using | CellID_t = typename Indexer_t::CellID_t |
type of cell index More... | |
using | Cell_t = typename Grid_t::Cell_t |
type of cell More... | |
Public Member Functions | |
SpacePartition (Range_t rangeX, Range_t rangeY, Range_t rangeZ) | |
Constructs the partition in a given volume with the given cell size. More... | |
void | fill (PointIter begin, PointIter end) |
CellIndexOffset_t | pointIndex (Point_t const &point) const |
Indexer_t const & | indexManager () const |
Returns the index manager of the grid. More... | |
bool | has (CellIndexOffset_t ofs) const |
Returns whether there is a cell with the specified index (signed!) More... | |
Cell_t const & | operator[] (CellIndex_t index) const |
Returns the cell with the specified index. More... | |
Grid_t::const_iterator | begin () const |
Returns a constant iterator pointing to the first cell. More... | |
Grid_t::const_iterator | end () const |
Returns a constant iterator pointing after the last cell. More... | |
Protected Types | |
using | CellDimIndex_t = typename Grid_t::CellDimIndex_t |
Protected Attributes | |
Coord_t | cellSize |
length of the side of each cubic cell More... | |
Range_t | xRange |
coordinates of the contained volume on x axis More... | |
Range_t | yRange |
coordinates of the contained volume on z axis More... | |
Range_t | zRange |
coordinates of the contained volume on z axis More... | |
Grid_t | data |
container of points More... | |
Private Types | |
using | Point_t = decltype(*(PointIter())) |
type of the point More... | |
using | Grid_t = util::GridContainer3D< PointIter > |
data container More... | |
A container of points sorted in cells.
PointIter | type of iterator to the point |
This container arranges its elements into a 3D grid according to their position in space. The "position" is defined by the PositionExtractor
class.
The container stores a bit on information for each cell (it is not sparse), therefore its size can become large very quickly. Currently each (empty) cell in the grid uses sizeof(std::vector<...>)
, that is 24, bytes.
Currently, no facility is provided to find an element, although from a copy of the element, its position in the container can be computed with pointIndex()
.
For example, suppose you need to arrange points in a box of 6 x 8 x 4 (arbitrary units) symmetric around the origin, each with 20 cells. This already makes a quite large container of 8000 elements.
Note that in the example the stored data is direct pointers to the data in order to save space (the data is 3 doubles big, that is 24 bytes, while a pointer is usually only 8 bytes). The class PositionExtractor
is specialized for double const*
in this same library.
Definition at line 222 of file SpacePartition.h.
using lar::example::SpacePartition< PointIter >::Cell_t = typename Grid_t::Cell_t |
type of cell
Definition at line 243 of file SpacePartition.h.
|
protected |
Definition at line 276 of file SpacePartition.h.
using lar::example::SpacePartition< PointIter >::CellID_t = typename Indexer_t::CellID_t |
using lar::example::SpacePartition< PointIter >::CellIndex_t = typename Indexer_t::CellIndex_t |
Definition at line 237 of file SpacePartition.h.
using lar::example::SpacePartition< PointIter >::CellIndexOffset_t = typename Indexer_t::CellIndexOffset_t |
type of difference between cell indices
Definition at line 235 of file SpacePartition.h.
using lar::example::SpacePartition< PointIter >::Coord_t = details::ExtractCoordType_t<Point_t> |
type of point coordinate
Definition at line 228 of file SpacePartition.h.
|
private |
data container
Definition at line 224 of file SpacePartition.h.
using lar::example::SpacePartition< PointIter >::Indexer_t = typename Grid_t::Indexer_t |
type of index manager of the grid
Definition at line 232 of file SpacePartition.h.
|
private |
type of the point
Definition at line 223 of file SpacePartition.h.
using lar::example::SpacePartition< PointIter >::Range_t = CoordRangeCells<Coord_t> |
type of coordinate range
Definition at line 229 of file SpacePartition.h.
lar::example::SpacePartition< PointIter >::SpacePartition | ( | Range_t | rangeX, |
Range_t | rangeY, | ||
Range_t | rangeZ | ||
) |
Constructs the partition in a given volume with the given cell size.
Definition at line 431 of file SpacePartition.h.
References lar::example::SpacePartition< PointIter >::fill().
Referenced by lar::example::CoordRangeCells< Coord >::findCell().
Grid_t::const_iterator lar::example::SpacePartition< PointIter >::begin | ( | ) | const |
Returns a constant iterator pointing to the first cell.
Grid_t::const_iterator lar::example::SpacePartition< PointIter >::end | ( | ) | const |
Returns a constant iterator pointing after the last cell.
void lar::example::SpacePartition< PointIter >::fill | ( | PointIter | begin, |
PointIter | end | ||
) |
Fills the partition with the points in the specified range
std::runtime_error | a point is outside the covered volume |
Definition at line 453 of file SpacePartition.h.
References evd::details::begin().
Referenced by lar::example::SpacePartition< PointIter >::SpacePartition().
|
inline |
Returns whether there is a cell with the specified index (signed!)
Definition at line 262 of file SpacePartition.h.
Referenced by lar::example::PointIsolationAlg< Coord >::isPointIsolatedWithinNeighborhood().
|
inline |
Returns the index manager of the grid.
Definition at line 258 of file SpacePartition.h.
|
inline |
Returns the cell with the specified index.
Definition at line 266 of file SpacePartition.h.
References evd::details::begin(), and evd::details::end().
lar::example::SpacePartition< PointIter >::CellIndexOffset_t lar::example::SpacePartition< PointIter >::pointIndex | ( | Point_t const & | point | ) | const |
Returns the index pertaining the point (might be invalid!)
std::runtime_error | point is outside the covered volume |
Definition at line 469 of file SpacePartition.h.
References lar::example::details::extractPositionX(), lar::example::details::extractPositionY(), lar::example::details::extractPositionZ(), util::flags::to_string(), x, y, and z.
|
protected |
length of the side of each cubic cell
Definition at line 278 of file SpacePartition.h.
|
protected |
container of points
Definition at line 284 of file SpacePartition.h.
|
protected |
coordinates of the contained volume on x axis
Definition at line 280 of file SpacePartition.h.
|
protected |
coordinates of the contained volume on z axis
Definition at line 281 of file SpacePartition.h.
|
protected |
coordinates of the contained volume on z axis
Definition at line 282 of file SpacePartition.h.