OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
WHistogramND< N, T > Class Template Referenceabstract

This template should handly arbitrary N-dimensional histograms. More...

#include <WHistogramND.h>

+ Inheritance diagram for WHistogramND< N, T >:
+ Collaboration diagram for WHistogramND< N, T >:

Public Types

typedef boost::array< size_t, N > SizeArray
 Shorthand for N-dimensional indices, counter, etc. More...
 
typedef boost::array< T, N > TArray
 Shorthand for N-dimensional values of type T. More...
 

Public Member Functions

 WHistogramND (TArray min, TArray max, SizeArray buckets)
 Default constructor. More...
 
 WHistogramND (const WHistogramND &hist)
 Copy constructor. More...
 
virtual ~WHistogramND ()
 Default destructor. More...
 
virtual size_t operator() (SizeArray index) const =0
 Get the count of the specified bucket. More...
 
virtual size_t size () const
 Returns the number of buckets in the HistogramND with the actual mapping. More...
 
virtual TArray getMinima () const
 Returns the minimum value(s). More...
 
virtual TArray getMaxima () const
 Returns the maximum value(s). More...
 
virtual T getBucketSize (SizeArray index) const =0
 Return the measure of one specific bucket. More...
 
virtual boost::array< std::pair< T, T >, N > getIntervalForIndex (SizeArray index) const =0
 Returns the actual (right-open) interval in each dimension associated with the given index. More...
 

Protected Member Functions

 WHistogramND ()
 Default constructor is protected to allow subclassing constructors not to use initialization lists which would imply C++11 or GNU++11 style initializers for boost::array members. More...
 
void reset (TArray min, TArray max, SizeArray buckets)
 Initializes all members. More...
 

Protected Attributes

TArray m_min
 The smallest value in each dimension. More...
 
TArray m_max
 The biggest value in each dimension. More...
 
SizeArray m_buckets
 The number of buckets. More...
 
size_t m_nbBuckets
 Total number of buckets. More...
 

Detailed Description

template<std::size_t N, typename T = double>
class WHistogramND< N, T >

This template should handly arbitrary N-dimensional histograms.

Template Parameters
Nspecifies the dimensionality
Tspecifies the type of data. Normally this should be double or float. Interface for an N-dimensional histogram.

Definition at line 42 of file WHistogramND.h.

Member Typedef Documentation

◆ SizeArray

template<std::size_t N, typename T = double>
typedef boost::array< size_t, N > WHistogramND< N, T >::SizeArray

Shorthand for N-dimensional indices, counter, etc.

Definition at line 48 of file WHistogramND.h.

◆ TArray

template<std::size_t N, typename T = double>
typedef boost::array< T, N > WHistogramND< N, T >::TArray

Shorthand for N-dimensional values of type T.

Definition at line 53 of file WHistogramND.h.

Constructor & Destructor Documentation

◆ WHistogramND() [1/3]

template<std::size_t N, typename T >
WHistogramND< N, T >::WHistogramND ( TArray  min,
TArray  max,
SizeArray  buckets 
)

Default constructor.

Creates an empty N-dimensional histogram covering the specified min and max values with the specified number of buckets.

Parameters
minthe smallest value(s) in each dimension
maxthe largest value(s) in each dimension
bucketsthe number of buckets in each direction (may be non uniform).

Definition at line 172 of file WHistogramND.h.

◆ WHistogramND() [2/3]

template<std::size_t N, typename T >
WHistogramND< N, T >::WHistogramND ( const WHistogramND< N, T > &  hist)

Copy constructor.

Creates a deep copy of the specified ND histogram.

Parameters
histthe HistogramND to copy.

Definition at line 203 of file WHistogramND.h.

References WHistogramND< N, T >::m_buckets, WHistogramND< N, T >::m_max, WHistogramND< N, T >::m_min, and WHistogramND< N, T >::m_nbBuckets.

◆ ~WHistogramND()

template<std::size_t N, typename T >
WHistogramND< N, T >::~WHistogramND
virtual

Default destructor.

Definition at line 198 of file WHistogramND.h.

◆ WHistogramND() [3/3]

template<std::size_t N, typename T >
WHistogramND< N, T >::WHistogramND
protected

Default constructor is protected to allow subclassing constructors not to use initialization lists which would imply C++11 or GNU++11 style initializers for boost::array members.

To workaround, reset() member function is provided.

Definition at line 167 of file WHistogramND.h.

Member Function Documentation

◆ getBucketSize()

template<std::size_t N, typename T = double>
virtual T WHistogramND< N, T >::getBucketSize ( SizeArray  index) const
pure virtual

Return the measure of one specific bucket.

For one dimensional Histograms this is the width of the bucket, for two dimensions this is the area, for three dims this is the volume, etc.

Parameters
indexthe measure for this bucket is queried.
Returns
the size of a bucket.

◆ getIntervalForIndex()

template<std::size_t N, typename T = double>
virtual boost::array< std::pair< T, T >, N > WHistogramND< N, T >::getIntervalForIndex ( SizeArray  index) const
pure virtual

Returns the actual (right-open) interval in each dimension associated with the given index.

Parameters
indexfor this bucket the intervals will be returned
Returns
the right-open interval in each dimension.

◆ getMaxima()

template<std::size_t N, typename T >
WHistogramND< N, T >::TArray WHistogramND< N, T >::getMaxima
virtual

Returns the maximum value(s).

Returns
maximum

Definition at line 224 of file WHistogramND.h.

◆ getMinima()

template<std::size_t N, typename T >
WHistogramND< N, T >::TArray WHistogramND< N, T >::getMinima
virtual

Returns the minimum value(s).

Returns
minimum

Definition at line 218 of file WHistogramND.h.

◆ operator()()

template<std::size_t N, typename T = double>
virtual size_t WHistogramND< N, T >::operator() ( SizeArray  index) const
pure virtual

Get the count of the specified bucket.

Parameters
indexin each dimension
Returns
elements in the bucket.

◆ reset()

template<std::size_t N, typename T >
void WHistogramND< N, T >::reset ( TArray  min,
TArray  max,
SizeArray  buckets 
)
protected

Initializes all members.

This exists because to circumvent boost::array initializers in c'tor init lists and reduces code duplication, as it is used in this abstract class as well as in its base classes.

Parameters
minMinimal values in each dimension.
maxMaximal values in each dimension.
buckets#buckets in each dimension.

Definition at line 178 of file WHistogramND.h.

◆ size()

template<std::size_t N, typename T >
size_t WHistogramND< N, T >::size
virtual

Returns the number of buckets in the HistogramND with the actual mapping.

Returns
number of buckets

Definition at line 212 of file WHistogramND.h.

Referenced by WHistogram2DTest::testInitialization(), and WHistogram2DTest::testInsert().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_buckets

template<std::size_t N, typename T = double>
SizeArray WHistogramND< N, T >::m_buckets
protected

The number of buckets.

Definition at line 156 of file WHistogramND.h.

Referenced by WHistogramND< N, T >::WHistogramND().

◆ m_max

template<std::size_t N, typename T = double>
TArray WHistogramND< N, T >::m_max
protected

The biggest value in each dimension.

Definition at line 151 of file WHistogramND.h.

Referenced by WHistogramND< N, T >::WHistogramND().

◆ m_min

template<std::size_t N, typename T = double>
TArray WHistogramND< N, T >::m_min
protected

The smallest value in each dimension.

Definition at line 146 of file WHistogramND.h.

Referenced by WHistogramND< N, T >::WHistogramND().

◆ m_nbBuckets

template<std::size_t N, typename T = double>
size_t WHistogramND< N, T >::m_nbBuckets
protected

Total number of buckets.

Definition at line 161 of file WHistogramND.h.

Referenced by WHistogramND< N, T >::WHistogramND().


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