16 #ifndef BORNAGAIN_BASE_AXIS_IAXIS_H
17 #define BORNAGAIN_BASE_AXIS_IAXIS_H
42 virtual size_t size()
const = 0;
45 virtual double min()
const = 0;
48 virtual double max()
const = 0;
52 std::pair<double, double>
bounds()
const;
63 virtual std::vector<double>
binCenters()
const;
79 virtual bool contains(
double value)
const;
82 virtual void clip(
double lower,
double upper);
99 virtual void print(std::ostream& ostr)
const = 0;
Abstract base class for one-dimensional axes.
double span() const
Returns distance from first to last point.
virtual bool contains(double value) const
Returns true if axis contains given point.
void setAxisName(std::string name)
Sets the axis label.
virtual std::vector< double > binCenters() const
bool operator==(const IAxis &right) const
test for equality
virtual std::vector< double > binBoundaries() const
virtual size_t findClosestIndex(double value) const =0
find bin index which is best match for given value
virtual bool equals(const IAxis &other) const
virtual double max() const =0
Returns value of last point of axis.
virtual void print(std::ostream &ostr) const =0
virtual IAxis * clone() const =0
friend std::ostream & operator<<(std::ostream &ostr, const IAxis &m)
virtual double min() const =0
Returns value of first point of axis.
virtual Bin1D bin(size_t index) const =0
retrieve a 1d bin for the given index
virtual size_t size() const =0
Returns the number of bins.
std::string m_name
axis name
std::pair< double, double > bounds() const
Returns lower and upper bound in a pair. first is lower, second is upper.
IAxis(const IAxis &)=delete
virtual double operator[](size_t index) const =0
indexed accessor retrieves a sample
bool operator!=(const IAxis &right) const
virtual double binCenter(size_t index) const =0
std::string axisName() const
Returns the label of the axis.
virtual void clip(double lower, double upper)
Clips this axis to the given values.
double center() const
Returns midpoint of axis.