OGS
|
Basic Histogram implementation.
Creates histogram from input data of type T
.
Definition at line 30 of file Histogram.h.
#include <Histogram.h>
Public Types | |
using | Data |
Public Member Functions | |
template<typename InputIterator > | |
Histogram (InputIterator first, InputIterator last, const int nr_bins=16, const bool computeHistogram=true) | |
Underlying input data vector type. | |
Histogram (std::vector< T > data, const unsigned int nr_bins=16, const bool computeHistogram=true) | |
void | update () |
void | setMinimum (const T &minimum) |
void | setMaximum (const T &maximum) |
const Data & | getSortedData () const |
const std::vector< std::size_t > & | getBinCounts () const |
const unsigned int & | getNumberOfBins () const |
const T & | getMinimum () const |
const T & | getMaximum () const |
const T & | getBinWidth () const |
void | prettyPrint (std::ostream &os, const unsigned int line_width=16) const |
int | write (std::string const &file_name, std::string const &data_set_name, std::string const ¶m_name) const |
Protected Member Functions | |
void | init (const bool computeHistogram=true) |
Protected Attributes | |
Data | data_ |
const unsigned int | nr_bins_ |
std::vector< std::size_t > | histogram_ |
T | min_ |
T | max_ |
Minimum and maximum input data values. | |
T | bin_width_ |
Private Attributes | |
bool | dirty_ |
When set update() will recompute histogram. | |
using BaseLib::Histogram< T >::Data |
Definition at line 33 of file Histogram.h.
|
inline |
Underlying input data vector type.
Creates histogram of the given element in the range [first, last).
Input data is copied into std::vector
.
first | Range of elements to create histogram from. |
last | Range of elements to create histogram from. |
nr_bins | Number of bins in histogram. |
computeHistogram | Compute histogram if set. If not set user must call update() before accessing data. |
Definition at line 48 of file Histogram.h.
References BaseLib::Histogram< T >::init().
|
inlineexplicit |
Creates histogram from std::vector
.
data | Input vector. |
nr_bins | Number of bins in histogram. |
computeHistogram | Compute histogram if set. If not set user must call update() before accessing data. |
Definition at line 61 of file Histogram.h.
References BaseLib::Histogram< T >::init().
|
inline |
Definition at line 110 of file Histogram.h.
References BaseLib::Histogram< T >::histogram_.
Referenced by BaseLib::operator<<().
|
inline |
|
inline |
Definition at line 113 of file Histogram.h.
References BaseLib::Histogram< T >::max_.
Referenced by BaseLib::operator<<().
|
inline |
Definition at line 112 of file Histogram.h.
References BaseLib::Histogram< T >::min_.
Referenced by BaseLib::operator<<().
|
inline |
Definition at line 111 of file Histogram.h.
References BaseLib::Histogram< T >::nr_bins_.
Referenced by BaseLib::operator<<().
|
inline |
|
inlineprotected |
Initialize class members after constructor call.
Definition at line 125 of file Histogram.h.
References BaseLib::Histogram< T >::bin_width_, BaseLib::Histogram< T >::data_, BaseLib::Histogram< T >::dirty_, BaseLib::Histogram< T >::histogram_, BaseLib::Histogram< T >::max_, BaseLib::Histogram< T >::min_, BaseLib::Histogram< T >::nr_bins_, and BaseLib::Histogram< T >::update().
Referenced by BaseLib::Histogram< T >::Histogram(), and BaseLib::Histogram< T >::Histogram().
void BaseLib::Histogram< T >::prettyPrint | ( | std::ostream & | os, |
const unsigned int | line_width = 16 ) const |
Definition at line 55 of file Histogram.cpp.
|
inline |
Definition at line 103 of file Histogram.h.
References BaseLib::Histogram< T >::dirty_, and BaseLib::Histogram< T >::max_.
|
inline |
Definition at line 98 of file Histogram.h.
References BaseLib::Histogram< T >::dirty_, and BaseLib::Histogram< T >::min_.
|
inline |
Updates histogram using sorted data_
vector.
Start histogram creation with first element. Then find first element in the next histogram bin. Number of elements in the bin is the difference between these two iterators.
[0.1, 0.2, ..., 0.7 , ..., 0.7+binWidth = 0.9, 1.0 , ..., last] it itEnd - 1 itEnd
Definition at line 78 of file Histogram.h.
References BaseLib::Histogram< T >::bin_width_, BaseLib::Histogram< T >::data_, BaseLib::Histogram< T >::dirty_, BaseLib::Histogram< T >::histogram_, BaseLib::Histogram< T >::max_, BaseLib::Histogram< T >::min_, and BaseLib::Histogram< T >::nr_bins_.
Referenced by BaseLib::Histogram< T >::init().
int BaseLib::Histogram< T >::write | ( | std::string const & | file_name, |
std::string const & | data_set_name, | ||
std::string const & | param_name ) const |
Definition at line 22 of file Histogram.cpp.
References ERR().
Referenced by MeshToolsLib::ElementQualityInterface::writeHistogram().
|
protected |
Definition at line 144 of file Histogram.h.
Referenced by BaseLib::Histogram< T >::getBinWidth(), BaseLib::Histogram< T >::init(), and BaseLib::Histogram< T >::update().
|
protected |
Definition at line 140 of file Histogram.h.
Referenced by BaseLib::Histogram< T >::getSortedData(), BaseLib::Histogram< T >::init(), and BaseLib::Histogram< T >::update().
|
private |
When set update()
will recompute histogram.
Definition at line 147 of file Histogram.h.
Referenced by BaseLib::Histogram< T >::init(), BaseLib::Histogram< T >::setMaximum(), BaseLib::Histogram< T >::setMinimum(), and BaseLib::Histogram< T >::update().
|
protected |
Definition at line 142 of file Histogram.h.
Referenced by BaseLib::Histogram< T >::getBinCounts(), BaseLib::Histogram< T >::init(), and BaseLib::Histogram< T >::update().
|
protected |
Minimum and maximum input data values.
Definition at line 143 of file Histogram.h.
Referenced by BaseLib::Histogram< T >::getMaximum(), BaseLib::Histogram< T >::init(), BaseLib::Histogram< T >::setMaximum(), and BaseLib::Histogram< T >::update().
|
protected |
Definition at line 143 of file Histogram.h.
Referenced by BaseLib::Histogram< T >::getMinimum(), BaseLib::Histogram< T >::init(), BaseLib::Histogram< T >::setMinimum(), and BaseLib::Histogram< T >::update().
|
protected |
Definition at line 141 of file Histogram.h.
Referenced by BaseLib::Histogram< T >::getNumberOfBins(), BaseLib::Histogram< T >::init(), and BaseLib::Histogram< T >::update().