BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
|
Axis containing arbitrary (non-equidistant) coordinate values. Lower boundary of the first bin and upper boundary of the last bin correspond to first and last passed coordinates. Other bin boundaries are computed as arithmetical mean of two adjacent coordinates. One should be aware, that bin centers reported by PointwiseAxis::binCenter do not coincide with the values produced by Bin1D::center. On-axis values are bounded by minimum/maximum values passed to the constructor.
Definition at line 33 of file PointwiseAxis.h.
Public Member Functions | |
template<class String , class Vector > | |
PointwiseAxis (String &&name, Vector &&coordinate_values) | |
~PointwiseAxis () override | |
std::string | axisName () const |
Returns the label of the axis. More... | |
Bin1D | bin (size_t index) const override |
retrieve a 1d bin for the given index More... | |
std::vector< double > | binBoundaries () const override |
double | binCenter (size_t index) const override |
Returns the coordinate corresponding to the given index. For this type of axis ("pointwise") this equals returning an explicitly defined coordinate. More... | |
std::vector< double > | binCenters () const override |
std::pair< double, double > | bounds () const |
Returns lower and upper bound in a pair. first is lower, second is upper. More... | |
double | center () const |
Returns midpoint of axis. More... | |
void | clip (double lower, double upper) override |
Clips this axis to the given values. More... | |
void | clip (std::pair< double, double > bounds) |
Convenience overload to clip this axis to the given values. bounds.first is lower, bounds.second is upper value. More... | |
PointwiseAxis * | clone () const override |
clone function More... | |
virtual bool | contains (double value) const |
Returns true if axis contains given point. More... | |
size_t | findClosestIndex (double value) const override |
find index of the coordinate closest to the given value More... | |
double | max () const override |
Returns value of last on-axis point. More... | |
double | min () const override |
Returns value of first on-axis point. More... | |
bool | operator!= (const IAxis &right) const |
bool | operator== (const IAxis &right) const |
test for equality More... | |
double | operator[] (size_t index) const override |
indexed accessor retrieves a sample More... | |
void | setAxisName (std::string name) |
Sets the axis label. More... | |
size_t | size () const override |
retrieve the number of bins More... | |
double | span () const |
Returns distance from first to last point. More... | |
Private Member Functions | |
void | checkIndex (size_t index) const |
bool | equals (const IAxis &other) const override |
double | maxary (size_t index) const |
double | minary (size_t index) const |
void | print (std::ostream &ostr) const override |
void | sanityCheck () const |
Private Attributes | |
std::vector< double > | m_coordinates |
std::string | m_name |
axis name More... | |
|
inline |
Definition at line 36 of file PointwiseAxis.h.
References sanityCheck().
Referenced by clone().
|
overridedefault |
|
inlineinherited |
Returns the label of the axis.
Definition at line 61 of file IAxis.h.
References IAxis::m_name.
Referenced by ConstKBinAxis::clone(), CustomBinAxis::clone(), FixedBinAxis::clone(), clone(), VariableBinAxis::clone(), IAxis::equals(), ConstKBinAxis::print(), CustomBinAxis::print(), FixedBinAxis::print(), print(), and VariableBinAxis::print().
|
overridevirtual |
retrieve a 1d bin for the given index
Implements IAxis.
Definition at line 30 of file PointwiseAxis.cpp.
References checkIndex(), maxary(), and minary().
|
overridevirtual |
Reimplemented from IAxis.
Definition at line 65 of file PointwiseAxis.cpp.
References m_coordinates, maxary(), and minary().
|
overridevirtual |
Returns the coordinate corresponding to the given index. For this type of axis ("pointwise") this equals returning an explicitly defined coordinate.
Implements IAxis.
Definition at line 46 of file PointwiseAxis.cpp.
References checkIndex(), and m_coordinates.
Referenced by operator[]().
|
inlineoverridevirtual |
|
inherited |
Returns lower and upper bound in a pair. first is lower, second is upper.
Definition at line 50 of file IAxis.cpp.
References IAxis::max(), and IAxis::min().
Referenced by IAxis::clip().
|
inherited |
Returns midpoint of axis.
Definition at line 60 of file IAxis.cpp.
References IAxis::max(), and IAxis::min().
|
private |
Definition at line 123 of file PointwiseAxis.cpp.
References m_coordinates.
Referenced by bin(), and binCenter().
|
overridevirtual |
Clips this axis to the given values.
Reimplemented from IAxis.
Definition at line 76 of file PointwiseAxis.cpp.
References findClosestIndex(), m_coordinates, and sanityCheck().
|
inherited |
Convenience overload to clip this axis to the given values. bounds.first is lower, bounds.second is upper value.
Definition at line 40 of file IAxis.cpp.
References IAxis::bounds(), and IAxis::clip().
|
overridevirtual |
clone function
Implements IAxis.
Definition at line 25 of file PointwiseAxis.cpp.
References PointwiseAxis(), IAxis::axisName(), and m_coordinates.
|
virtualinherited |
Returns true if axis contains given point.
Definition at line 45 of file IAxis.cpp.
References IAxis::max(), and IAxis::min().
Referenced by RectangularDetector::indexOfSpecular(), and SphericalDetector::indexOfSpecular().
|
overrideprivatevirtual |
Reimplemented from IAxis.
Definition at line 100 of file PointwiseAxis.cpp.
References IAxis::equals(), and m_coordinates.
|
overridevirtual |
find index of the coordinate closest to the given value
Implements IAxis.
Definition at line 52 of file PointwiseAxis.cpp.
References m_coordinates, and minary().
Referenced by clip().
|
overridevirtual |
Returns value of last on-axis point.
Implements IAxis.
Definition at line 41 of file PointwiseAxis.cpp.
References m_coordinates, and maxary().
|
private |
Definition at line 116 of file PointwiseAxis.cpp.
References m_coordinates.
Referenced by bin(), binBoundaries(), and max().
|
overridevirtual |
Returns value of first on-axis point.
Implements IAxis.
Definition at line 36 of file PointwiseAxis.cpp.
References minary().
|
private |
Definition at line 109 of file PointwiseAxis.cpp.
References m_coordinates.
Referenced by bin(), binBoundaries(), findClosestIndex(), and min().
|
inlineinherited |
|
inlineinherited |
test for equality
Definition at line 89 of file IAxis.h.
References IAxis::equals().
|
inlineoverridevirtual |
indexed accessor retrieves a sample
Implements IAxis.
Definition at line 52 of file PointwiseAxis.h.
References binCenter().
|
overrideprivatevirtual |
Implements IAxis.
Definition at line 90 of file PointwiseAxis.cpp.
References IAxis::axisName(), and m_coordinates.
|
private |
Definition at line 133 of file PointwiseAxis.cpp.
References m_coordinates, and min_axis_size.
Referenced by PointwiseAxis(), and clip().
|
inlineinherited |
|
inlineoverridevirtual |
retrieve the number of bins
Implements IAxis.
Definition at line 49 of file PointwiseAxis.h.
References m_coordinates.
|
inherited |
Returns distance from first to last point.
Definition at line 55 of file IAxis.cpp.
References IAxis::max(), and IAxis::min().
Referenced by RectangularDetector::height(), and RectangularDetector::width().
|
private |
Definition at line 86 of file PointwiseAxis.h.
Referenced by binBoundaries(), binCenter(), binCenters(), checkIndex(), clip(), clone(), equals(), findClosestIndex(), max(), maxary(), minary(), print(), sanityCheck(), and size().
|
privateinherited |
axis name
Definition at line 103 of file IAxis.h.
Referenced by IAxis::axisName(), and IAxis::setAxisName().