15 #ifndef BORNAGAIN_CORE_AXIS_IAXIS_H
16 #define BORNAGAIN_CORE_AXIS_IAXIS_H
28 IAxis(
const std::string& name) : m_name(name) {}
37 virtual size_t size()
const = 0;
40 std::string
getName()
const {
return m_name; }
43 void setName(std::string name) { m_name = name; }
57 virtual double getBinCenter(
size_t index)
const = 0;
64 bool operator!=(
const IAxis& right)
const {
return !(*
this == right); }
66 friend std::ostream& operator<<(std::ostream& ostr,
const IAxis& m)
72 virtual std::vector<double> getBinCenters()
const;
74 virtual std::vector<double> getBinBoundaries()
const;
80 virtual bool contains(
double value)
const;
82 virtual std::string pyString(
const std::string& units,
size_t offset)
const = 0;
85 virtual void print(std::ostream& ostr)
const = 0;
86 virtual bool equals(
const IAxis& other)
const;
Defines structs Bin1D, Bin1DCVector.
bool HaveSameNameAndShape(const IAxis &left, const IAxis &right)
global helper function for comparison of axes
Interface for one-dimensional axes.
virtual IAxis * createClippedAxis(double left, double right) const
Creates a new clipped axis.
virtual bool contains(double value) const
Returns true if axis contains given point.
bool operator==(const IAxis &right) const
test for equality
virtual size_t findClosestIndex(double value) const =0
find bin index which is best match for given value
virtual Bin1D getBin(size_t index) const =0
retrieve a 1d bin for the given index
virtual ~IAxis()
destructor
void setName(std::string name)
Sets the axis label.
virtual IAxis * clone() const =0
clone function
virtual double getMin() const =0
Returns value of first point of axis.
IAxis(const std::string &name)
constructors
virtual size_t size() const =0
retrieve the number of bins
virtual double operator[](size_t index) const =0
indexed accessor retrieves a sample
virtual double getMax() const =0
Returns value of last point of axis.
std::string getName() const
retrieve the label of the axis