LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
Base element of a partitioned structure. More...
#include "Partitions.h"
Public Types | |
using | Data_t = Data |
Type of data stored in the partition. More... | |
using | Partition_t = Partition< Data > |
This type. More... | |
using | Area_t = PartitionBase::Area_t |
Type of area. More... | |
using | Subpartitions_t = std::vector< std::unique_ptr< Partition_t const >> |
Type of list of subpartitions. It needs to preserve polymorphism. More... | |
using | AreaRangeMember_t = AreaOwner::AreaRangeMember_t |
Public Member Functions | |
Partition (Area_t const &area) | |
Constructor: sets the covered area and no subpartitions. More... | |
virtual | ~Partition ()=default |
Destructor (default, virtual). More... | |
virtual Data_t * | data () const |
Returns the datum directly stored (nullptr if none). More... | |
virtual Data_t * | atPoint (double w, double d) const =0 |
Returns the (sub)partition including the specified coordinates. 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 | |
virtual Subpartitions_t const & | parts () const |
Returns a list of all subpartitions. More... | |
virtual std::string | doDescribe (std::string indent, std::string firstIndent) const |
Returns a description of the partition. 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) |
Static Protected Attributes | |
static Subpartitions_t const | NoSubparts |
Subpartitions (if any). More... | |
Base element of a partitioned structure.
Data | type of data contained in the partition |
An area partition is represented by a hierarchy of partition objects, each one containing a non-owning pointer to the data pertaining its area.
The partition classes all derive from this Partition
class, which provides access to the data, the area definition and a few utility functions:
describe()
methodwalk()
applies a specified operation to all the partitions in the hierarchy, in an undefined orderatPoint()
returns the data of the partition covering the specified locationThe hierarchy is such that a partition object (Partition
) knows or can find of all the subpartitions it contains, but it does not have any knowledge of the partition containing it (if any).
The partition classes do not provide algorithms to establish their relations.
Definition at line 183 of file Partitions.h.
using geo::part::Partition< Data >::Area_t = PartitionBase::Area_t |
Type of area.
Definition at line 188 of file Partitions.h.
|
inherited |
Definition at line 145 of file Partitions.h.
using geo::part::Partition< Data >::Data_t = Data |
Type of data stored in the partition.
Definition at line 186 of file Partitions.h.
using geo::part::Partition< Data >::Partition_t = Partition<Data> |
This type.
Definition at line 187 of file Partitions.h.
using geo::part::Partition< Data >::Subpartitions_t = std::vector<std::unique_ptr<Partition_t const>> |
Type of list of subpartitions. It needs to preserve polymorphism.
Definition at line 191 of file Partitions.h.
|
inline |
Constructor: sets the covered area and no subpartitions.
Definition at line 194 of file Partitions.h.
|
virtualdefault |
Destructor (default, virtual).
|
inlineinherited |
Returns the covered area.
Definition at line 53 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()().
|
pure virtual |
Returns the (sub)partition including the specified coordinates.
w | width coordinate of the point |
d | depth coordinate of the point |
nullptr
if noneThis method returns a pointer to the datum associated to the area the specified point (w
, d
) belongs to. The area is searched for among all the included partitions.
Implemented in geo::part::PartitionContainer< Data >, and geo::part::PartitionWithData< Data >.
|
inlineinherited |
Returns whether the specified point is covered by this object.
Definition at line 50 of file Partitions.h.
References geo::part::AreaOwner::area(), and lar::util::simple_geo::Rectangle< Data >::contains().
|
inlinevirtual |
Returns the datum directly stored (nullptr if none).
Reimplemented in geo::part::PartitionWithData< Data >.
Definition at line 200 of file Partitions.h.
Referenced by geo::DriftPartitions::computeCoverage().
|
inline |
Returns a description of the partition.
Definition at line 215 of file Partitions.h.
|
inline |
Returns a description of the partition.
Definition at line 221 of file Partitions.h.
References geo::part::Partition< Data >::describe(), and art::detail::indent().
Referenced by geo::part::Partition< Data >::describe().
|
inlineprotectedinherited |
Returns a description of the partition area.
Definition at line 575 of file Partitions.h.
References geo::part::AreaOwner::dumpArea(), and part.
Referenced by geo::part::Partition< Data >::doDescribe().
|
inlineprotectedvirtual |
Returns a description of the partition.
Reimplemented in geo::part::GridPartition< Data >, geo::part::PartitionContainer< Data >, and geo::part::PartitionWithData< Data >.
Definition at line 256 of file Partitions.h.
References geo::part::PartitionBase::describeArea().
|
inlineinherited |
Output the owned area into an output stream.
Definition at line 57 of file Partitions.h.
References geo::part::AreaOwner::area().
Referenced by geo::part::PartitionBase::describeArea().
|
inline |
Returns the number of subparts in the partition (0 if simple element).
Definition at line 247 of file Partitions.h.
Referenced by geo::part::GridPartition< Data >::detectSeparators().
|
inlineprotectedvirtual |
Returns a list of all subpartitions.
Reimplemented in geo::part::PartitionContainer< Data >.
Definition at line 253 of file Partitions.h.
Referenced by geo::part::Partition< Data >::walk().
|
inline |
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 241 of file Partitions.h.
|
staticprotected |
Applies pred
to start partition first, and then to all subpartitions.
Definition at line 748 of file Partitions.h.
References geo::part::Partition< Data >::parts().
|
staticprotected |
Subpartitions (if any).
Definition at line 250 of file Partitions.h.