LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
geo::part::PartitionElement< Data > Class Template Reference

Unpartitioned element ("leaf") of a partitioned area. More...

#include "Partitions.h"

Inheritance diagram for geo::part::PartitionElement< Data >:
geo::part::PartitionWithData< Data > geo::part::Partition< Data > geo::part::PartitionBase geo::part::AreaOwner

Public Types

using Base_t = PartitionWithData< Data >
 Base class. More...
 
using Base_t = Partition< Data >
 Base class. More...
 
using Partition_t = Partition< Data >
 Base type of the partition. More...
 
using Data_t = typename Partition_t::Data_t
 Type of contained data. More...
 
using Area_t = typename Partition_t::Area_t
 Type of covered 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

virtual Data_tdata () const override
 Returns the datum directly stored (nullptr if none). More...
 
virtual Data_tatPoint (double w, double d) const override
 Returns stored datum only if point is covered, nullptr otherwise. 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...
 
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...
 

Detailed Description

template<typename Data>
class geo::part::PartitionElement< Data >

Unpartitioned element ("leaf") of a partitioned area.

Definition at line 308 of file Partitions.h.

Member Typedef Documentation

template<typename Data >
using geo::part::PartitionWithData< Data >::Area_t = typename Partition_t::Area_t
inherited

Type of covered area.

Definition at line 281 of file Partitions.h.

template<typename Data >
using geo::part::PartitionElement< Data >::Base_t = PartitionWithData<Data>

Base class.

Definition at line 311 of file Partitions.h.

template<typename Data >
using geo::part::PartitionWithData< Data >::Base_t = Partition<Data>

Base class.

Definition at line 278 of file Partitions.h.

template<typename Data >
using geo::part::PartitionWithData< Data >::Data_t = typename Partition_t::Data_t
inherited

Type of contained data.

Definition at line 280 of file Partitions.h.

template<typename Data >
using geo::part::PartitionWithData< Data >::Partition_t = Partition<Data>
inherited

Base type of the partition.

Definition at line 279 of file Partitions.h.

template<typename Data>
using geo::part::Partition< Data >::Subpartitions_t = std::vector<std::unique_ptr<Partition_t const>>
inherited

Type of list of subpartitions. It needs to preserve polymorphism.

Definition at line 196 of file Partitions.h.

Member Function Documentation

template<typename Data >
virtual Data_t* geo::part::PartitionWithData< Data >::atPoint ( double  w,
double  d 
) const
inlineoverridevirtualinherited

Returns stored datum only if point is covered, nullptr otherwise.

Implements geo::part::Partition< Data >.

Reimplemented in geo::part::PartitionContainer< Data >.

Definition at line 292 of file Partitions.h.

293  { return Base_t::contains(w, d)? myData: nullptr; }
bool contains(double w, double d) const
Returns whether the specified point is covered by this object.
Definition: Partitions.h:52
Float_t d
Definition: plot.C:237
Data_t * myData
The contained datum.
Definition: Partitions.h:296
Float_t w
Definition: plot.C:23
bool geo::part::AreaOwner::contains ( double  w,
double  d 
) const
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().

53  { return area().contains(w, d); }
bool contains(Data_t w, Data_t d) const
Returns whether the specified point is in the area.
Definition: SimpleGeo.h:408
Float_t d
Definition: plot.C:237
Area_t const & area() const
Returns the covered area.
Definition: Partitions.h:56
Float_t w
Definition: plot.C:23
template<typename Data >
virtual Data_t* geo::part::PartitionWithData< Data >::data ( ) const
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().

289 { return myData; }
Data_t * myData
The contained datum.
Definition: Partitions.h:296
template<typename Data>
std::string geo::part::Partition< Data >::describe ( std::string  indent,
std::string  firstIndent 
) const
inlineinherited

Returns a description of the partition.

Definition at line 221 of file Partitions.h.

222  { return doDescribe(indent, firstIndent); }
virtual std::string doDescribe(std::string indent, std::string firstIndent) const
Returns a description of the partition.
Definition: Partitions.h:260
std::string indent(std::size_t const i)
template<typename Data>
std::string geo::part::Partition< Data >::describe ( std::string  indent = "") const
inlineinherited

Returns a description of the partition.

Definition at line 225 of file Partitions.h.

References art::detail::describe().

226  { return describe(indent, indent); }
std::string indent(std::size_t const i)
std::string describe(std::string indent, std::string firstIndent) const
Returns a description of the partition.
Definition: Partitions.h:221
std::string geo::part::PartitionBase::describeArea ( std::string  indent,
std::string  firstIndent 
) const
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().

607 {
608  std::ostringstream sstr;
609  sstr << firstIndent << "partition covers ";
610  dumpArea(sstr);
611  return sstr.str();
612 } // geo::part::PartitionBase::describeArea()
void dumpArea(Stream &&out) const
Output the owned area into an output stream.
Definition: Partitions.h:60
template<typename Stream >
void geo::part::AreaOwner::dumpArea ( Stream &&  out) const
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().

60 { std::forward<Stream>(out) << area(); }
Area_t const & area() const
Returns the covered area.
Definition: Partitions.h:56
template<typename Data>
std::size_t geo::part::Partition< Data >::nParts ( ) const
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().

249 { return parts().size(); }
virtual Subpartitions_t const & parts() const
Returns a list of all subpartitions.
Definition: Partitions.h:256
template<typename Data>
virtual Subpartitions_t const& geo::part::Partition< Data >::parts ( ) const
inlineprotectedvirtualinherited

Returns a list of all subpartitions.

Reimplemented in geo::part::PartitionContainer< Data >.

Definition at line 256 of file Partitions.h.

Referenced by geo::part::Partition< Data >::walk().

256 { return NoSubparts; }
static Subpartitions_t const NoSubparts
Subpartitions (if any).
Definition: Partitions.h:253
template<typename Data>
template<typename Pred >
void geo::part::Partition< Data >::walk ( Pred &&  pred) const
inlineinherited

Applies pred to all partitions.

Template Parameters
Preda predicate type
Parameters
predthe 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:

void predicate(Partition<Data> const& part);

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().

246 { walk(this, pred); }
void walk(Pred &&pred) const
Applies pred to all partitions.
Definition: Partitions.h:246
template<typename Data >
template<typename Pred >
void geo::part::Partition< Data >::walk ( Partition_t const *  start,
Pred &&  pred 
)
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().

804  {
805  if (!start) return;
806  pred(*start);
807 
808  // recursive implementation
809  for (auto const& subPart: start->parts())
810  subPart->walk(std::forward<Pred>(pred));
811 
812 } // geo::part::Partition<Data>::walk()

Member Data Documentation

template<typename Data>
geo::part::Partition< Data >::Subpartitions_t const geo::part::Partition< Data >::NoSubparts
staticprotectedinherited

Subpartitions (if any).

Definition at line 253 of file Partitions.h.


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