UFO
EquispacedBinSelectorBase.h
Go to the documentation of this file.
1 /*
2  * (C) Crown copyright 2021, Met Office
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  */
7 
8 #ifndef UFO_UTILS_EQUISPACEDBINSELECTORBASE_H_
9 #define UFO_UTILS_EQUISPACEDBINSELECTORBASE_H_
10 
11 #include <boost/optional.hpp>
12 
13 namespace ufo
14 {
15 
16 /// \brief A finite or infinite collection of non-overlapping intervals (_bins_) of the same width.
17 ///
18 /// Call the bin() function to find the bin containing a particular value.
20  public:
21  // If necessary, these could be made template parameters.
22  typedef float ValueType;
23  typedef int IndexType;
24 
26 
27  /// \brief Return the index of the bin containing \p value, or the nearest bin
28  /// if \p value lies outside all bins.
29  virtual IndexType bin(ValueType value) const = 0;
30 
31  /// \brief Return the number of bins or boost::none if the bin collection is infinite.
32  virtual boost::optional<IndexType> numBins() const = 0;
33 
34  /// \brief Return the width of each bin.
35  virtual ValueType binWidth() const = 0;
36 
37  /// \brief Return the inverse of the width of each bin.
38  virtual ValueType inverseBinWidth() const = 0;
39 
40  /// \brief Return the value lying at the center of the bin with index \p bin.
41  virtual ValueType binCenter(IndexType bin) const = 0;
42 };
43 
44 } // namespace ufo
45 
46 #endif // UFO_UTILS_EQUISPACEDBINSELECTORBASE_H_
A finite or infinite collection of non-overlapping intervals (bins) of the same width.
virtual ValueType binCenter(IndexType bin) const =0
Return the value lying at the center of the bin with index bin.
virtual ValueType inverseBinWidth() const =0
Return the inverse of the width of each bin.
virtual IndexType bin(ValueType value) const =0
Return the index of the bin containing value, or the nearest bin if value lies outside all bins.
virtual ValueType binWidth() const =0
Return the width of each bin.
virtual boost::optional< IndexType > numBins() const =0
Return the number of bins or boost::none if the bin collection is infinite.
Definition: RunCRTM.h:27