![]() |
OGS
|
Basic Histogram implementation.
Creates histogram from input data of type T
.
Definition at line 32 of file Histogram.h.
#include <Histogram.h>
Public Types | |
using | Data = typename std::vector< double > |
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. More... | |
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. More... | |
T | bin_width_ |
Private Attributes | |
bool | dirty_ |
When set update() will recompute histogram. More... | |
using BaseLib::Histogram< T >::Data = typename std::vector<double> |
Definition at line 35 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 50 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 63 of file Histogram.h.
References BaseLib::Histogram< T >::init().
|
inline |
Definition at line 112 of file Histogram.h.
References BaseLib::Histogram< T >::histogram_.
Referenced by BaseLib::operator<<(), and BaseLib::Histogram< T >::write().
|
inline |
Definition at line 116 of file Histogram.h.
References BaseLib::Histogram< T >::bin_width_.
Referenced by BaseLib::Histogram< T >::write().
|
inline |
Definition at line 115 of file Histogram.h.
References BaseLib::Histogram< T >::max_.
Referenced by BaseLib::operator<<().
|
inline |
Definition at line 114 of file Histogram.h.
References BaseLib::Histogram< T >::min_.
Referenced by BaseLib::operator<<(), and BaseLib::Histogram< T >::write().
|
inline |
Definition at line 113 of file Histogram.h.
References BaseLib::Histogram< T >::nr_bins_.
Referenced by BaseLib::operator<<(), and BaseLib::Histogram< T >::write().
|
inline |
|
inlineprotected |
Initialize class members after constructor call.
Definition at line 172 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().
|
inline |
Definition at line 118 of file Histogram.h.
References BaseLib::Histogram< T >::bin_width_, BaseLib::Histogram< T >::histogram_, BaseLib::Histogram< T >::min_, and BaseLib::Histogram< T >::nr_bins_.
|
inline |
Definition at line 105 of file Histogram.h.
References BaseLib::Histogram< T >::dirty_, and BaseLib::Histogram< T >::max_.
|
inline |
Definition at line 100 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 80 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().
|
inline |
Definition at line 138 of file Histogram.h.
References ERR(), BaseLib::Histogram< T >::getBinCounts(), BaseLib::Histogram< T >::getBinWidth(), BaseLib::Histogram< T >::getMinimum(), and BaseLib::Histogram< T >::getNumberOfBins().
Referenced by MeshLib::ElementQualityInterface::writeHistogram().
|
protected |
Definition at line 191 of file Histogram.h.
Referenced by BaseLib::Histogram< T >::getBinWidth(), BaseLib::Histogram< T >::init(), BaseLib::Histogram< T >::prettyPrint(), and BaseLib::Histogram< T >::update().
|
protected |
Definition at line 187 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 194 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 189 of file Histogram.h.
Referenced by BaseLib::Histogram< T >::getBinCounts(), BaseLib::Histogram< T >::init(), BaseLib::Histogram< T >::prettyPrint(), and BaseLib::Histogram< T >::update().
|
protected |
Minimum and maximum input data values.
Definition at line 190 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 190 of file Histogram.h.
Referenced by BaseLib::Histogram< T >::getMinimum(), BaseLib::Histogram< T >::init(), BaseLib::Histogram< T >::prettyPrint(), BaseLib::Histogram< T >::setMinimum(), and BaseLib::Histogram< T >::update().
|
protected |
Definition at line 188 of file Histogram.h.
Referenced by BaseLib::Histogram< T >::getNumberOfBins(), BaseLib::Histogram< T >::init(), BaseLib::Histogram< T >::prettyPrint(), and BaseLib::Histogram< T >::update().