BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Axis containing arbitrary (non-equidistant) coordinate values. More...
Public Member Functions | |
template<class String , class Vector > | |
PointwiseAxis (String &&name, Vector &&coordinate_values) | |
~PointwiseAxis () override=default | |
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. More... | |
std::vector< double > | binCenters () const override |
double | center () const |
Returns midpoint of axis. More... | |
PointwiseAxis * | clone () const override |
clone function More... | |
virtual bool | contains (double value) const |
Returns true if axis contains given point. More... | |
PointwiseAxis * | createClippedAxis (double left, double right) const override |
Creates a new clipped axis. More... | |
size_t | findClosestIndex (double value) const override |
find index of the coordinate closest to the given value More... | |
std::string | getName () const |
retrieve the label of the axis More... | |
double | lowerBound () 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 | setName (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... | |
double | upperBound () const override |
Returns value of last on-axis point. More... | |
Private Member Functions | |
void | checkIndex (size_t index) const |
bool | equals (const IAxis &other) const override |
double | lowerBoundary (size_t index) const |
void | print (std::ostream &ostr) const override |
void | sanityCheck () const |
double | upperBoundary (size_t index) const |
Private Attributes | |
std::vector< double > | m_coordinates |
std::string | m_name |
axis name More... | |
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::getMidPoint. On-axis values are bounded by minimum/maximum values passed to the constructor.
Definition at line 37 of file PointwiseAxis.h.
|
inline |
Definition at line 40 of file PointwiseAxis.h.
References sanityCheck().
Referenced by clone(), and createClippedAxis().
|
overridedefault |
|
overridevirtual |
retrieve a 1d bin for the given index
Implements IAxis.
Definition at line 27 of file PointwiseAxis.cpp.
References checkIndex(), lowerBoundary(), and upperBoundary().
|
overridevirtual |
Reimplemented from IAxis.
Definition at line 62 of file PointwiseAxis.cpp.
References lowerBoundary(), m_coordinates, and upperBoundary().
|
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 43 of file PointwiseAxis.cpp.
References checkIndex(), and m_coordinates.
Referenced by operator[]().
|
inlineoverridevirtual |
|
inherited |
Returns midpoint of axis.
Definition at line 47 of file IAxis.cpp.
References IAxis::lowerBound(), and IAxis::upperBound().
|
private |
Definition at line 119 of file PointwiseAxis.cpp.
References m_coordinates.
Referenced by bin(), and binCenter().
|
overridevirtual |
clone function
Implements IAxis.
Definition at line 22 of file PointwiseAxis.cpp.
References PointwiseAxis(), IAxis::getName(), and m_coordinates.
|
virtualinherited |
Returns true if axis contains given point.
Definition at line 37 of file IAxis.cpp.
References IAxis::lowerBound(), and IAxis::upperBound().
Referenced by Histogram1D::crop(), Histogram2D::crop(), Histogram1D::fill(), RectangularDetector::indexOfSpecular(), and SphericalDetector::indexOfSpecular().
|
overridevirtual |
Creates a new clipped axis.
Reimplemented from IAxis.
Definition at line 73 of file PointwiseAxis.cpp.
References PointwiseAxis(), findClosestIndex(), IAxis::getName(), and m_coordinates.
|
overrideprivatevirtual |
Reimplemented from IAxis.
Definition at line 96 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 49 of file PointwiseAxis.cpp.
References lowerBoundary(), and m_coordinates.
Referenced by createClippedAxis().
|
inlineinherited |
retrieve the label of the axis
Definition at line 40 of file IAxis.h.
References IAxis::m_name.
Referenced by OutputData< T >::addAxis(), RegionOfInterest::clipAxisToRoi(), CustomBinAxis::clone(), FixedBinAxis::clone(), VariableBinAxis::clone(), ConstKBinAxis::clone(), clone(), FixedBinAxis::createClippedAxis(), VariableBinAxis::createClippedAxis(), ConstKBinAxis::createClippedAxis(), createClippedAxis(), ImportDataUtils::CreateSimplifiedOutputData(), IAxis::equals(), CustomBinAxis::print(), FixedBinAxis::print(), VariableBinAxis::print(), ConstKBinAxis::print(), print(), and TransformFromDomain::setAxisItem().
|
overridevirtual |
Returns value of first on-axis point.
Implements IAxis.
Definition at line 33 of file PointwiseAxis.cpp.
References lowerBoundary().
|
private |
Definition at line 105 of file PointwiseAxis.cpp.
References m_coordinates.
Referenced by bin(), binBoundaries(), findClosestIndex(), and lowerBound().
|
inlineinherited |
|
inlineinherited |
test for equality
Definition at line 69 of file IAxis.h.
References IAxis::equals().
|
inlineoverridevirtual |
indexed accessor retrieves a sample
Implements IAxis.
Definition at line 55 of file PointwiseAxis.h.
References binCenter().
|
overrideprivatevirtual |
Implements IAxis.
Definition at line 86 of file PointwiseAxis.cpp.
References IAxis::getName(), and m_coordinates.
|
private |
Definition at line 129 of file PointwiseAxis.cpp.
References m_coordinates, and min_axis_size.
Referenced by PointwiseAxis().
|
inlineinherited |
Sets the axis label.
Definition at line 43 of file IAxis.h.
References IAxis::m_name, and RealSpace::Particles::name().
|
inlineoverridevirtual |
retrieve the number of bins
Implements IAxis.
Definition at line 52 of file PointwiseAxis.h.
References m_coordinates.
|
inherited |
Returns distance from first to last point.
Definition at line 42 of file IAxis.cpp.
References IAxis::lowerBound(), and IAxis::upperBound().
Referenced by RectangularDetector::getHeight(), RectangularDetector::getWidth(), and DetectorUtils::isQuadratic().
|
overridevirtual |
Returns value of last on-axis point.
Implements IAxis.
Definition at line 38 of file PointwiseAxis.cpp.
References m_coordinates, and upperBoundary().
|
private |
Definition at line 112 of file PointwiseAxis.cpp.
References m_coordinates.
Referenced by bin(), binBoundaries(), and upperBound().
|
private |
Definition at line 90 of file PointwiseAxis.h.
Referenced by binBoundaries(), binCenter(), binCenters(), checkIndex(), clone(), createClippedAxis(), equals(), findClosestIndex(), lowerBoundary(), print(), sanityCheck(), size(), upperBound(), and upperBoundary().
|
privateinherited |
axis name
Definition at line 96 of file IAxis.h.
Referenced by IAxis::getName(), and IAxis::setName().