8 #ifndef UFO_UTILS_ROUNDINGEQUISPACEDBINSELECTOR_H_
9 #define UFO_UTILS_ROUNDINGEQUISPACEDBINSELECTOR_H_
14 #include "eckit/exception/Exceptions.h"
38 ASSERT_MSG(
binWidth > 0,
"Bin width must be positive");
46 boost::optional<IndexType>
numBins()
const override {
A finite or infinite collection of non-overlapping intervals (bins) of the same width.
Represents an infinite set of consecutive intervals (bins) of the same width.
ValueType binCenter(IndexType bin) const override
Return the value lying at the center of the bin with index bin.
ValueType binWidth() const override
Return the width of each bin.
ValueType inverseBinWidth() const override
Return the inverse of the width of each bin.
IndexType bin(ValueType value) const override
Return the index of the bin containing value, or the nearest bin if value lies outside all bins.
ValueType inverseBinWidth_
RoundingEquispacedBinSelector(ValueType binWidth, ValueType bin0Center=0)
Partition the real axis into bins of width binWidth, with the center of bin 0 located at bin0Center.
boost::optional< IndexType > numBins() const override
Return the number of bins or boost::none if the bin collection is infinite.