LArSoft
v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
|
Partition of area sorted across a dimension. More...
#include "Partitions.h"
Public Types | |
using | Base_t = PartitionContainer< Data > |
Base class. More... | |
using | Partition_t = Partition< Data > |
Base type of the partition. More... | |
using | Sorter_t = Sorter |
Type of sorter being used. More... | |
using | Data_t = typename Partition_t::Data_t |
using | Area_t = typename Partition_t::Area_t |
using | Subpartitions_t = typename Base_t::Subpartitions_t |
using | AreaRangeMember_t = AreaOwner::AreaRangeMember_t |
Public Member Functions | |
SortedPartition (Area_t const &area, Subpartitions_t &&subpartitions, Data_t *defData=nullptr, Sorter_t sorter={}) | |
Constructor: sets the partition. More... | |
virtual Data_t * | atPoint (double w, double d) const override |
Returns stored datum only if point is covered, nullptr otherwise. More... | |
virtual Data_t * | data () const override |
Returns the datum directly stored (nullptr if none). More... | |
std::string | describe (std::string indent, std::string firstIndent) const |
Returns a description of the partition. More... | |
std::string | describe (std::string indent="") const |
Returns a description of the partition. More... | |
template<typename Pred > | |
void | walk (Pred &&pred) const |
Applies pred to all partitions. More... | |
std::size_t | nParts () const |
Returns the number of subparts in the partition (0 if simple element). More... | |
bool | contains (double w, double d) const |
Returns whether the specified point is covered by this object. More... | |
Area_t const & | area () const |
Returns the covered area. More... | |
template<typename Stream > | |
void | dumpArea (Stream &&out) const |
Output the owned area into an output stream. More... | |
Protected Member Functions | |
Partition_t const * | findPartWithKey (double key) const |
Returns the only partition which could contain the specified key . More... | |
void | initParts () |
Performs initialization on the specified subpartition list. More... | |
std::size_t | size () const |
Returns the number of contained subpartitions. More... | |
virtual Subpartitions_t const & | parts () const override |
Returns a list of the subpartitions owned. More... | |
virtual Partition_t const * | findPart (double w, double d) const =0 |
Returns the only partition which could contain the specified width. More... | |
virtual std::string | doDescribe (std::string indent, std::string firstIndent) const override |
Describes this and each of the subpartitions. More... | |
virtual std::string | describeIntro () const |
Introduction to the description of the subpartitions. More... | |
std::string | describeArea (std::string indent, std::string firstIndent) const |
Returns a description of the partition area. More... | |
Static Protected Member Functions | |
template<typename Pred > | |
static void | walk (Partition_t const *start, Pred &&pred) |
Protected Attributes | |
Sorter_t | sorter |
Object used for sorting and binary search. More... | |
Subpartitions_t | myParts |
List of subpartitions. More... | |
Static Protected Attributes | |
static Subpartitions_t const | NoSubparts |
Subpartitions (if any). More... | |
Partition of area sorted across a dimension.
Data | type of data contained in the partition |
Sorter | type of functor providing comparison of partitions |
The sorter is a functor containing comparison functions. It must be compatible with both std::sort()
and std::lower_bound()
functions. The former requirement implies that the sorter can compare two constant pointers to partitions. The latter also implies that the sorter can compare a constant pointer to partition to a "key" (a real number), and vice versa. The meaning of this comparison is not prescribed; existing implementations interpret that value as a width or depth coordinate.
A copy of the sorter is kept in this partition.
Definition at line 396 of file Partitions.h.
using geo::part::SortedPartition< Data, Sorter >::Area_t = typename Partition_t::Area_t |
Definition at line 405 of file Partitions.h.
|
inherited |
Definition at line 147 of file Partitions.h.
using geo::part::SortedPartition< Data, Sorter >::Base_t = PartitionContainer<Data> |
Base class.
Definition at line 399 of file Partitions.h.
using geo::part::SortedPartition< Data, Sorter >::Data_t = typename Partition_t::Data_t |
Definition at line 404 of file Partitions.h.
using geo::part::SortedPartition< Data, Sorter >::Partition_t = Partition<Data> |
Base type of the partition.
Definition at line 400 of file Partitions.h.
using geo::part::SortedPartition< Data, Sorter >::Sorter_t = Sorter |
Type of sorter being used.
Definition at line 401 of file Partitions.h.
using geo::part::SortedPartition< Data, Sorter >::Subpartitions_t = typename Base_t::Subpartitions_t |
Definition at line 406 of file Partitions.h.
|
inline |
Constructor: sets the partition.
area | overall area covered |
subpartitions | list of subpartitions (pointers) |
defData | datum to be returned for points not covered by subpartitions |
sorter | instance of the sorter to be used |
The subpartitions will be moved from the argument and will be sorted using the comparison contained in the sorter
. Note that this will invalidate existing pointers to the sub-partitions.
It is required and assumed that the subpartitions do not overlap and that the points covered by them are a subset of area
. Neither of theses requirements is checked.
Definition at line 424 of file Partitions.h.
|
inlineinherited |
Returns the covered area.
Definition at line 56 of file Partitions.h.
References geo::part::AreaOwner::myArea.
Referenced by geo::part::AreaOwner::contains(), geo::part::AreaOwner::dumpArea(), makeTPCPartitionElement(), geo::part::details::RangeLowerBoundExtractor< Range >::operator()(), and geo::part::details::PartitionRangeLowerBoundExtractor< Range >::operator()().
|
overridevirtualinherited |
Returns stored datum only if point is covered, nullptr
otherwise.
Reimplemented from geo::part::PartitionWithData< Data >.
Definition at line 841 of file Partitions.h.
References geo::part::PartitionContainer< Data >::doDescribe(), and part.
|
inlineinherited |
Returns whether the specified point is covered by this object.
Definition at line 52 of file Partitions.h.
References geo::part::AreaOwner::area(), and lar::util::simple_geo::Rectangle< Data >::contains().
|
inlineoverridevirtualinherited |
Returns the datum directly stored (nullptr if none).
Reimplemented from geo::part::Partition< Data >.
Definition at line 289 of file Partitions.h.
Referenced by geo::part::GridPartition< Data >::doDescribe().
|
inlineinherited |
Returns a description of the partition.
Definition at line 221 of file Partitions.h.
|
inlineinherited |
Returns a description of the partition.
Definition at line 225 of file Partitions.h.
References art::detail::describe().
|
inlineprotectedinherited |
Returns a description of the partition area.
Definition at line 606 of file Partitions.h.
References geo::part::AreaOwner::dumpArea(), and part.
Referenced by geo::part::Partition< Data >::doDescribe(), and geo::part::GridPartition< Data >::part().
|
protectedvirtualinherited |
Introduction to the description of the subpartitions.
Definition at line 875 of file Partitions.h.
References util::flags::to_string().
Referenced by geo::part::GridPartition< Data >::doDescribe().
|
overrideprotectedvirtualinherited |
Describes this and each of the subpartitions.
Reimplemented from geo::part::PartitionWithData< Data >.
Reimplemented in geo::part::GridPartition< Data >.
Definition at line 854 of file Partitions.h.
References geo::part::describePartitionData(), and part.
Referenced by geo::part::PartitionContainer< Data >::atPoint().
|
inlineinherited |
Output the owned area into an output stream.
Definition at line 60 of file Partitions.h.
References geo::part::AreaOwner::area().
Referenced by geo::part::PartitionBase::describeArea().
|
protectedpure virtualinherited |
Returns the only partition which could contain the specified width.
Implemented in geo::part::GridPartition< Data >.
|
protected |
Returns the only partition which could contain the specified key
.
Definition at line 884 of file Partitions.h.
|
protected |
Performs initialization on the specified subpartition list.
Definition at line 895 of file Partitions.h.
References evd::details::begin(), and evd::details::end().
|
inlineinherited |
Returns the number of subparts in the partition (0 if simple element).
Definition at line 249 of file Partitions.h.
Referenced by geo::part::GridPartition< Data >::detectSeparators().
|
inlineoverrideprotectedvirtualinherited |
Returns a list of the subpartitions owned.
Reimplemented from geo::part::Partition< Data >.
Definition at line 343 of file Partitions.h.
Referenced by geo::part::GridPartition< Data >::computeDepthSeps(), and geo::part::GridPartition< Data >::computeWidthSeps().
|
inlineprotectedinherited |
Returns the number of contained subpartitions.
Definition at line 340 of file Partitions.h.
Referenced by geo::part::GridPartition< Data >::GridPartition().
|
inlineinherited |
Applies pred
to all partitions.
Pred | a predicate type |
pred | the predicate to be applied |
The predicate pred
is applied to this partition first, and then to all subpartitions in no specified order.
The predicate is any object behaving like a unary function of signature:
If the predicate returns a value, that value is ignored. The predicate is forwarded while "walking" through the partitions.
Definition at line 246 of file Partitions.h.
References geo::part::Partition< Data >::walk().
Referenced by geo::DriftPartitions::computeCoverage(), and geo::part::Partition< Data >::walk().
|
staticprotectedinherited |
Applies pred
to start partition first, and then to all subpartitions.
Definition at line 804 of file Partitions.h.
References geo::part::PartitionWithData< Data >::doDescribe(), and geo::part::Partition< Data >::parts().
|
protectedinherited |
List of subpartitions.
Definition at line 337 of file Partitions.h.
|
staticprotectedinherited |
Subpartitions (if any).
Definition at line 253 of file Partitions.h.
|
protected |
Object used for sorting and binary search.
Definition at line 435 of file Partitions.h.