18 #ifndef LAREXAMPLES_ALGORITHMS_REMOVEISOLATEDSPACEPOINTS_SPACEPARTITION_H 19 #define LAREXAMPLES_ALGORITHMS_REMOVEISOLATEDSPACEPOINTS_SPACEPARTITION_H 85 template <
typename Po
int>
89 template <
typename Po
int>
93 template <
typename Po
int>
101 template <
typename Coord>
134 template <
typename Coord>
160 std::ptrdiff_t findCell(
Coord_t c)
const;
221 template <
typename Po
intIter>
259 {
return data.indexManager(); }
263 {
return data.has(ofs); }
295 template <
typename Cont,
typename Data>
297 static Data x(Cont
const&
p) {
return p[0]; }
298 static Data y(Cont
const&
p) {
return p[1]; }
299 static Data z(Cont
const&
p) {
return p[2]; }
302 template <
typename Po
int>
305 template <
typename Po
int>
308 template <
typename Po
int>
312 template <
typename Po
int>
321 template <
typename T>
327 template <
typename T>
334 template <
typename T>
355 template <
typename Coord>
379 template <
typename Coord>
381 {
return (lower <= c) && (upper >=
c); }
383 template <
typename Coord>
385 {
return lower == upper; }
388 template <
typename Coord>
390 {
return lower <= upper; }
392 template <
typename Coord>
394 {
return upper - lower; }
396 template <
typename Coord>
398 {
return (upper == as.
upper) && (lower == as.
lower); }
400 template <
typename Coord>
402 {
return (upper != than.
upper) || (lower != than.
lower); }
408 template <
typename Coord>
411 :
Base_t(low, high), cellSize(cs)
414 template <
typename Coord>
417 :
Base_t(range), cellSize(cs)
421 template <
typename Coord>
423 {
return std::ptrdiff_t(Base_t::offset(c) / cellSize); }
429 template <
typename Po
intIter>
451 template <
typename Po
intIter>
456 PointIter it =
begin;
459 data.insert(pointIndex(*it), it);
467 template <
typename Po
intIter>
474 if (!
data.hasX(xc)) {
475 throw std::runtime_error
481 if (!
data.hasY(yc)) {
482 throw std::runtime_error
488 if (!
data.hasZ(zc)) {
489 throw std::runtime_error
501 #endif // LAREXAMPLES_ALGORITHMS_REMOVEISOLATEDSPACEPOINTS_SPACEPARTITION_H end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
A container of points sorted in cells.
Range_t zRange
coordinates of the contained volume on z axis
Range_t yRange
coordinates of the contained volume on z axis
Coord_t size() const
Returns the size of the range (no check)
Coord_t cellSize
length of the side of each cubic cell
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
CellIndexOffset_t pointIndex(Point_t const &point) const
Range_t xRange
coordinates of the contained volume on x axis
typename details::PointTraits_t< Point >::Coord_t ExtractCoordType_t
type of Point coordinate
typename Grid_t::Indexer_t Indexer_t
type of index manager of the grid
Coord_t cellSize
size of a single cell
bool contains(Coord_t c) const
Returns whether c is contained in the range (inclusve)
enum geo::coordinates Coord_t
details::ExtractCoordType_t< Point_t > Coord_t
type of point coordinate
bool operator!=(ModuleKeyAndType const &a, ModuleKeyAndType const &b) noexcept
bool has(CellIndexOffset_t ofs) const
Returns whether there is a cell with the specified index (signed!)
Coord_t upper
upper boundary
std::array< size_t, 3 > diceVolume(CoordRangeCells< Coord > const &rangeX, CoordRangeCells< Coord > const &rangeY, CoordRangeCells< Coord > const &rangeZ)
Returns the dimensions of a grid diced with the specified size.
Coord_t lower
lower boundary
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
auto extractPositionY(Point const &point)
bool operator!=(const Range_t &than) const
Returns whether the specified range has limits different than this.
SpacePartition(Range_t rangeX, Range_t rangeY, Range_t rangeZ)
Constructs the partition in a given volume with the given cell size.
static constexpr double as
bool valid() const
Returns whether the range is valid (empty is also valid)
decltype(*(PointIter())) Point_t
type of the point
Coord_t offset(Coord_t c) const
Returns the distance of the specified coordinate from the lower bound.
typename Indexer_t::CellIndexOffset_t CellIndexOffset_t
type of difference between cell indices
typename Grid_t::Cell_t Cell_t
type of cell
decltype(extractPositionX(std::decay_t< Point >())) Coord_t
type of Point coordinate
bool operator==(const Range_t &as) const
Returns whether the specified range has the same limits as this.
bool empty() const
Returns whether the range is empty.
typename Indexer_t::CellDimIndex_t CellDimIndex_t
type of difference between indices
auto array(Array const &a)
Returns a manipulator which will print the specified array.
LArSoft-specific namespace.
Grid_t data
container of points
auto extractPositionX(Point const &point)
typename Grid_t::CellDimIndex_t CellDimIndex_t
typename Indexer_t::CellID_t CellID_t
type of cell index
std::ptrdiff_t findCell(Coord_t c) const
Returns the index of the cell for coordinate c.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Containers with indices in 1, 2 and 3 dimensions.
Indexer_t const & indexManager() const
Returns the index manager of the grid.
auto extractPositionZ(Point const &point)
std::string to_string(ModuleType const mt)
CoordRangeCells(Coord_t low, Coord_t high, Coord_t cs)
Constructor: assigns range and cell size.
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Coord_t Coord_t
data type for coordinate
Base class for a container of data arranged on a 3D-grid.
bool operator==(ModuleKeyAndType const &a, ModuleKeyAndType const &b) noexcept
void fill(PointIter begin, PointIter end)
typename Indexer_t::CellIndex_t CellIndex_t