Go to the documentation of this file.
8 #ifndef UFO_UTILS_EQUISPACEDBINSELECTOR_H_
9 #define UFO_UTILS_EQUISPACEDBINSELECTOR_H_
13 #include "eckit/exception/Exceptions.h"
36 ASSERT_MSG(upperBound > lowerBound,
"Upper bound must be larger than lower bound");
37 ASSERT_MSG(
numBins > 0,
"Number of bins must be positive");
44 binIndex = std::max(
IndexType(0), binIndex);
45 binIndex = std::min(
numBins_ - 1, binIndex);
78 #endif // UFO_UTILS_EQUISPACEDBINSELECTOR_H_
IndexType numBins() const
Return the number of bins.
ValueType binWidth() const
Return the width of each bin.
EquispacedBinSelector(ValueType lowerBound, ValueType upperBound, IndexType numBins)
Partition the interval [lowerBound, upperBound] into numBins bins of the same width.
ValueType binCenter(IndexType bin) const
Return the value lying at the center of the bin with index bin.
ValueType inverseBinWidth() const
Return the inverse of the width of each bin.
Represents a set of consecutive intervals (bins) of the same width.
ValueType inverseBinWidth_
IndexType bin(ValueType value) const
Return the (0-based) index of the bin containing value, or the nearest bin if value lies outside all ...