BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
|
Axis with fixed bin size.
Definition at line 23 of file FixedBinAxis.h.
Public Member Functions | |
FixedBinAxis (const std::string &name, size_t nbins, double start, double end) | |
FixedBinAxis constructor. More... | |
~FixedBinAxis () override=default | |
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 |
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... | |
FixedBinAxis * | clone () const override |
virtual bool | contains (double value) const |
Returns true if axis contains given point. More... | |
size_t | findClosestIndex (double value) const override |
find bin index which is best match for given value More... | |
double | max () const override |
Returns value of last point of axis. More... | |
double | min () const override |
Returns value of first point of axis. 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 |
Returns the number of bins. More... | |
double | span () const |
Returns distance from first to last point. More... | |
Protected Member Functions | |
bool | equals (const IAxis &other) const override |
void | print (std::ostream &ostr) const override |
Private Attributes | |
double | m_end |
std::string | m_name |
axis name More... | |
size_t | m_nbins |
double | m_start |
FixedBinAxis::FixedBinAxis | ( | const std::string & | name, |
size_t | nbins, | ||
double | start, | ||
double | end | ||
) |
FixedBinAxis constructor.
name | Axis name |
nbins | number of bins |
start | low edge of first bin |
end | upper edge of last bin |
Definition at line 21 of file FixedBinAxis.cpp.
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(), clone(), PointwiseAxis::clone(), VariableBinAxis::clone(), IAxis::equals(), ConstKBinAxis::print(), CustomBinAxis::print(), print(), PointwiseAxis::print(), and VariableBinAxis::print().
|
overridevirtual |
retrieve a 1d bin for the given index
Implements IAxis.
Definition at line 44 of file FixedBinAxis.cpp.
References m_end, m_nbins, and m_start.
Referenced by binBoundaries(), binCenters(), and clip().
|
overridevirtual |
Reimplemented from IAxis.
Definition at line 74 of file FixedBinAxis.cpp.
References bin(), Bin1D::m_lower, Bin1D::m_upper, and size().
|
inlineoverridevirtual |
|
overridevirtual |
Reimplemented from IAxis.
Definition at line 65 of file FixedBinAxis.cpp.
References bin(), Bin1D::center(), and size().
|
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().
|
overridevirtual |
Clips this axis to the given values.
Reimplemented from IAxis.
Definition at line 84 of file FixedBinAxis.cpp.
References bin(), Bin1D::center(), findClosestIndex(), m_end, Bin1D::m_lower, m_nbins, m_start, Bin1D::m_upper, max(), min(), and size().
|
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 |
Implements IAxis.
Definition at line 29 of file FixedBinAxis.cpp.
References FixedBinAxis(), IAxis::axisName(), m_end, m_nbins, and m_start.
|
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().
|
overrideprotectedvirtual |
Reimplemented from IAxis.
Definition at line 115 of file FixedBinAxis.cpp.
References BaseUtils::algo::almostEqual(), IAxis::equals(), m_end, m_start, and size().
|
overridevirtual |
|
inlineoverridevirtual |
Returns value of last point of axis.
Implements IAxis.
Definition at line 42 of file FixedBinAxis.h.
References m_end.
Referenced by clip(), findClosestIndex(), and print().
|
inlineoverridevirtual |
Returns value of first point of axis.
Implements IAxis.
Definition at line 41 of file FixedBinAxis.h.
References m_start.
Referenced by clip(), findClosestIndex(), and print().
|
inlineinherited |
|
inlineinherited |
test for equality
Definition at line 89 of file IAxis.h.
References IAxis::equals().
|
overridevirtual |
indexed accessor retrieves a sample
Implements IAxis.
Definition at line 35 of file FixedBinAxis.cpp.
|
overrideprotectedvirtual |
Implements IAxis.
Definition at line 108 of file FixedBinAxis.cpp.
References IAxis::axisName(), max(), min(), and size().
|
inlineinherited |
|
inlineoverridevirtual |
Returns the number of bins.
Implements IAxis.
Definition at line 35 of file FixedBinAxis.h.
References m_nbins.
Referenced by binBoundaries(), binCenters(), clip(), equals(), and print().
|
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 61 of file FixedBinAxis.h.
Referenced by bin(), clip(), clone(), equals(), findClosestIndex(), max(), and operator[]().
|
privateinherited |
axis name
Definition at line 103 of file IAxis.h.
Referenced by IAxis::axisName(), and IAxis::setAxisName().
|
private |
Definition at line 59 of file FixedBinAxis.h.
Referenced by bin(), clip(), clone(), findClosestIndex(), operator[](), and size().
|
private |
Definition at line 60 of file FixedBinAxis.h.
Referenced by bin(), clip(), clone(), equals(), findClosestIndex(), min(), and operator[]().