OpenMPCD
Public Types | Public Member Functions | List of all members
OpenMPCD::Histogram Class Reference

Represents a histogram. More...

#include <Histogram.hpp>

Public Types

typedef unsigned long BinContent
 The type of bin contents. More...
 
typedef std::vector< BinContentContainer
 The container for bins. More...
 

Public Member Functions

 Histogram (const std::string &name, const Configuration &conf)
 The constructor. More...
 
 Histogram (const FP low, const FP high, const unsigned int binCount)
 The constructor. More...
 
void fill (const FP val)
 Adds an entry to the histogram. More...
 
BinContent getUnderflows () const
 Returns the number of underflows. More...
 
BinContent getOverflows () const
 Returns the number of overflows. More...
 
const ContainergetBins () const
 Returns the bins. More...
 
FP getLowEnd () const
 Returns the lower end of the histogram. More...
 
FP getHighEnd () const
 Returns the upper end of the histogram. More...
 
FP getBinSize () const
 Returns the bin size. More...
 
FP getIntegral () const
 Returns the integral of the histogram. More...
 
const Graph getNormalizedGraph (const FP binPoint=0.5) const
 Returns the graph corresponding to this histogram, with the area normalized to 1. More...
 
void save (const std::string &filename, const FP binPoint=0.5) const
 Saves the histogram at the given path. More...
 

Detailed Description

Represents a histogram.

Definition at line 20 of file Histogram.hpp.

Member Typedef Documentation

◆ BinContent

typedef unsigned long OpenMPCD::Histogram::BinContent

The type of bin contents.

Definition at line 23 of file Histogram.hpp.

◆ Container

The container for bins.

Definition at line 24 of file Histogram.hpp.

Constructor & Destructor Documentation

◆ Histogram() [1/2]

OpenMPCD::Histogram::Histogram ( const std::string &  name,
const Configuration conf 
)

The constructor.

Parameters
[in]nameThe histogram name.
[in]confThe simulation configuration.

Definition at line 9 of file Histogram.cpp.

◆ Histogram() [2/2]

OpenMPCD::Histogram::Histogram ( const FP  low,
const FP  high,
const unsigned int  binCount 
)
inline

The constructor.

Parameters
[in]lowThe lowest bin's lower end.
[in]highThe highest bin's highest end.
[in]binCountThe number of bins.

Definition at line 40 of file Histogram.hpp.

Member Function Documentation

◆ fill()

void OpenMPCD::Histogram::fill ( const FP  val)

Adds an entry to the histogram.

Parameters
[in]valThe value to add.

Definition at line 21 of file Histogram.cpp.

◆ getBins()

const Container& OpenMPCD::Histogram::getBins ( ) const
inline

Returns the bins.

Definition at line 71 of file Histogram.hpp.

◆ getBinSize()

FP OpenMPCD::Histogram::getBinSize ( ) const
inline

Returns the bin size.

Definition at line 95 of file Histogram.hpp.

◆ getHighEnd()

FP OpenMPCD::Histogram::getHighEnd ( ) const
inline

Returns the upper end of the histogram.

Definition at line 87 of file Histogram.hpp.

◆ getIntegral()

OpenMPCD::FP OpenMPCD::Histogram::getIntegral ( ) const

Returns the integral of the histogram.

Definition at line 45 of file Histogram.cpp.

◆ getLowEnd()

FP OpenMPCD::Histogram::getLowEnd ( ) const
inline

Returns the lower end of the histogram.

Definition at line 79 of file Histogram.hpp.

◆ getNormalizedGraph()

const OpenMPCD::Graph OpenMPCD::Histogram::getNormalizedGraph ( const FP  binPoint = 0.5) const

Returns the graph corresponding to this histogram, with the area normalized to 1.

Parameters
[in]binPointSince the bin has a non-zero width and the graph only consists of points, this parameter can be used to control where the graph point corresponding to a bin is situated. 0 means the point is at the leftmost end of the bin, 1 corresponds to the rightmost end, and the values inbetween scale linearly.
Exceptions
InvalidArgumentExceptionThrows if binPoint is not in the range [0,1].

Definition at line 55 of file Histogram.cpp.

◆ getOverflows()

BinContent OpenMPCD::Histogram::getOverflows ( ) const
inline

Returns the number of overflows.

Definition at line 63 of file Histogram.hpp.

◆ getUnderflows()

BinContent OpenMPCD::Histogram::getUnderflows ( ) const
inline

Returns the number of underflows.

Definition at line 55 of file Histogram.hpp.

◆ save()

void OpenMPCD::Histogram::save ( const std::string &  filename,
const FP  binPoint = 0.5 
) const

Saves the histogram at the given path.

Parameters
[in]filenameThe filename to save to.
[in]binPointSince the bin has a non-zero width and the graph only consists of points, this parameter can be used to control where the graph point corresponding to a bin is situated. 0 means the point is at the leftmost end of the bin, 1 corresponds to the rightmost end, and the values inbetween scale linearly.
Exceptions
InvalidArgumentExceptionThrows if binPoint is not in the range [0,1].

Definition at line 75 of file Histogram.cpp.


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