OpenWalnut  1.4.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
WHistogramND< N, T > Class Template Reference

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

#include <WHistogramND.h>

List of all members.

Public Types

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

Public Member Functions

 WHistogramND (TArray min, TArray max, SizeArray buckets)
 Default constructor.
 WHistogramND (const WHistogramND &hist)
 Copy constructor.
virtual ~WHistogramND ()
 Default destructor.
virtual size_t operator() (SizeArray index) const =0
 Get the count of the specified bucket.
virtual size_t size () const
 Returns the number of buckets in the HistogramND with the actual mapping.
virtual TArray getMinima () const
 Returns the minimum value(s).
virtual TArray getMaxima () const
 Returns the maximum value(s).
virtual T getBucketSize (SizeArray index) const =0
 Return the measure of one specific bucket.
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.

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.
void reset (TArray min, TArray max, SizeArray buckets)
 Initializes all members.

Protected Attributes

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

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

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.

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

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.

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.

template<std::size_t N, typename T >
WHistogramND< N, T >::~WHistogramND ( ) [virtual]

Default destructor.

Definition at line 198 of file WHistogramND.h.

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

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.

Implemented in WHistogram2D.

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.

Implemented in WHistogram2D.

template<std::size_t N, typename T >
WHistogramND< N, T >::TArray WHistogramND< N, T >::getMaxima ( ) const [virtual]

Returns the maximum value(s).

Returns:
maximum

Definition at line 224 of file WHistogramND.h.

template<std::size_t N, typename T >
WHistogramND< N, T >::TArray WHistogramND< N, T >::getMinima ( ) const [virtual]

Returns the minimum value(s).

Returns:
minimum

Definition at line 218 of file WHistogramND.h.

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.

Implemented in WHistogram2D.

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.

template<std::size_t N, typename T >
size_t WHistogramND< N, T >::size ( ) const [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().


Member Data Documentation

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

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

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

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: