BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IAxis Class Referenceabstract

Interface for one-dimensional axes. More...

Inheritance diagram for IAxis:
[legend]

Public Member Functions

 IAxis (const std::string &name)
 constructors More...
 
virtual ~IAxis ()
 destructor More...
 
virtual Bin1D bin (size_t index) const =0
 retrieve a 1d bin for the given index More...
 
virtual std::vector< double > binBoundaries () const
 
virtual double binCenter (size_t index) const =0
 
virtual std::vector< double > binCenters () const
 
double center () const
 Returns midpoint of axis. More...
 
virtual IAxisclone () const =0
 clone function More...
 
virtual bool contains (double value) const
 Returns true if axis contains given point. More...
 
virtual IAxiscreateClippedAxis (double left, double right) const
 Creates a new clipped axis. More...
 
virtual size_t findClosestIndex (double value) const =0
 find bin index which is best match for given value More...
 
std::string getName () const
 retrieve the label of the axis More...
 
virtual double lowerBound () const =0
 Returns value of first point of axis. More...
 
bool operator!= (const IAxis &right) const
 
bool operator== (const IAxis &right) const
 test for equality More...
 
virtual double operator[] (size_t index) const =0
 indexed accessor retrieves a sample More...
 
void setName (std::string name)
 Sets the axis label. More...
 
virtual size_t size () const =0
 retrieve the number of bins More...
 
double span () const
 Returns distance from first to last point. More...
 
virtual double upperBound () const =0
 Returns value of last point of axis. More...
 

Protected Member Functions

virtual bool equals (const IAxis &other) const
 
virtual void print (std::ostream &ostr) const =0
 

Private Member Functions

 IAxis (const IAxis &)
 
IAxisoperator= (const IAxis &)
 

Private Attributes

std::string m_name
 axis name More...
 

Friends

std::ostream & operator<< (std::ostream &ostr, const IAxis &m)
 

Detailed Description

Interface for one-dimensional axes.

Definition at line 25 of file IAxis.h.

Constructor & Destructor Documentation

◆ IAxis() [1/2]

IAxis::IAxis ( const std::string &  name)
inline

constructors

Definition at line 28 of file IAxis.h.

28 : m_name(name) {}
std::string m_name
axis name
Definition: IAxis.h:96
QString const & name(EShape k)
Definition: particles.cpp:21

◆ ~IAxis()

virtual IAxis::~IAxis ( )
inlinevirtual

destructor

Definition at line 34 of file IAxis.h.

34 {}

◆ IAxis() [2/2]

IAxis::IAxis ( const IAxis )
private

Member Function Documentation

◆ bin()

◆ binBoundaries()

std::vector< double > IAxis::binBoundaries ( ) const
virtual

Reimplemented in PointwiseAxis, VariableBinAxis, and FixedBinAxis.

Definition at line 27 of file IAxis.cpp.

28 {
29  throw std::runtime_error("IAxis::binBoundaries() -> Error. Not implemented.");
30 }

◆ binCenter()

virtual double IAxis::binCenter ( size_t  index) const
pure virtual

◆ binCenters()

std::vector< double > IAxis::binCenters ( ) const
virtual

Reimplemented in PointwiseAxis, VariableBinAxis, FixedBinAxis, and CustomBinAxis.

Definition at line 22 of file IAxis.cpp.

23 {
24  throw std::runtime_error("IAxis::binCenters() -> Error. Not implemented.");
25 }

Referenced by Histogram1D::binCenters(), and OutputDataReadWriteNumpyTXT::write1DRepresentation().

◆ center()

double IAxis::center ( ) const

Returns midpoint of axis.

Definition at line 47 of file IAxis.cpp.

48 {
49  return (upperBound() + lowerBound()) / 2;
50 }
virtual double upperBound() const =0
Returns value of last point of axis.
virtual double lowerBound() const =0
Returns value of first point of axis.

References lowerBound(), and upperBound().

Here is the call graph for this function:

◆ clone()

◆ contains()

bool IAxis::contains ( double  value) const
virtual

Returns true if axis contains given point.

Definition at line 37 of file IAxis.cpp.

38 {
39  return value >= lowerBound() && value < upperBound();
40 }

References lowerBound(), and upperBound().

Referenced by Histogram1D::crop(), Histogram2D::crop(), Histogram1D::fill(), RectangularDetector::indexOfSpecular(), and SphericalDetector::indexOfSpecular().

Here is the call graph for this function:

◆ createClippedAxis()

IAxis * IAxis::createClippedAxis ( double  left,
double  right 
) const
virtual

Creates a new clipped axis.

Reimplemented in PointwiseAxis, ConstKBinAxis, VariableBinAxis, FixedBinAxis, and CustomBinAxis.

Definition at line 32 of file IAxis.cpp.

33 {
34  throw std::runtime_error("IAxis::createClippedAxis() -> Error. Not implemented.");
35 }

Referenced by DataUtils::createClippedDataSet().

◆ equals()

bool IAxis::equals ( const IAxis other) const
protectedvirtual

Reimplemented in PointwiseAxis, ConstKBinAxis, VariableBinAxis, FixedBinAxis, and CustomBinAxis.

Definition at line 17 of file IAxis.cpp.

18 {
19  return getName() == other.getName();
20 }
std::string getName() const
retrieve the label of the axis
Definition: IAxis.h:40

References getName().

Referenced by CustomBinAxis::equals(), FixedBinAxis::equals(), VariableBinAxis::equals(), ConstKBinAxis::equals(), PointwiseAxis::equals(), and operator==().

Here is the call graph for this function:

◆ findClosestIndex()

virtual size_t IAxis::findClosestIndex ( double  value) const
pure virtual

◆ getName()

◆ lowerBound()

◆ operator!=()

bool IAxis::operator!= ( const IAxis right) const
inline

Definition at line 70 of file IAxis.h.

70 { return !(*this == right); }

◆ operator=()

IAxis& IAxis::operator= ( const IAxis )
private

◆ operator==()

bool IAxis::operator== ( const IAxis right) const
inline

test for equality

Definition at line 69 of file IAxis.h.

69 { return equals(right); }
virtual bool equals(const IAxis &other) const
Definition: IAxis.cpp:17

References equals().

Here is the call graph for this function:

◆ operator[]()

virtual double IAxis::operator[] ( size_t  index) const
pure virtual

indexed accessor retrieves a sample

Implemented in PointwiseAxis, VariableBinAxis, and FixedBinAxis.

◆ print()

virtual void IAxis::print ( std::ostream &  ostr) const
protectedpure virtual

◆ setName()

void IAxis::setName ( std::string  name)
inline

Sets the axis label.

Definition at line 43 of file IAxis.h.

43 { m_name = name; }

References m_name, and RealSpace::Particles::name().

Here is the call graph for this function:

◆ size()

virtual size_t IAxis::size ( ) const
pure virtual

retrieve the number of bins

Implemented in PointwiseAxis, VariableBinAxis, and FixedBinAxis.

Referenced by DepthProbeConverter::DepthProbeConverter(), DepthProbeElement::DepthProbeElement(), OffSpecularConverter::OffSpecularConverter(), OutputData< T >::addAxis(), Histogram2D::addContent(), ConvolutionDetectorResolution::apply1dConvolution(), ConvolutionDetectorResolution::apply2dConvolution(), DepthProbeComputationTerm::compute(), DataUtils::coordinateFromBinf(), DataUtils::create2DArrayfromOutputData(), DepthProbeSimulation::createIntensityData(), DataUtils::createRearrangedDataSet(), ImportDataUtils::CreateSimplifiedOutputData(), HistoUtils::FindPeaks(), DepthProbeSimulation::generateSimulationElements(), IDetector2D::getGlobalIndex(), RectangularDetector::getNbinsX(), IHistogram::getNbinsX(), RectangularDetector::getNbinsY(), IHistogram::getNbinsY(), OutputData< T >::hasSameDimensions(), RegionOfInterest::initFrom(), OffSpecularSimulation::intensityMapSize(), DetectorUtils::isQuadratic(), DepthProbeSimulation::numberOfSimulationElements(), DepthProbeSimulation::rawResults(), TransformFromDomain::setAxisItem(), DepthProbeSimulation::setBeamParameters(), OffSpecularSimulation::setBeamParameters(), DepthProbeSimulation::setRawResults(), TransformFromDomain::setSphericalDetector(), OffSpecularSimulation::transferDetectorImage(), OffSpecularSimulation::transferResultsToIntensityMap(), SpecularBeamItem::updateToData(), OutputDataReadWriteNumpyTXT::write2DRepresentation(), and OutputDataReadWriteINT::writeOutputData().

◆ span()

double IAxis::span ( ) const

Returns distance from first to last point.

Definition at line 42 of file IAxis.cpp.

43 {
44  return upperBound() - lowerBound();
45 }

References lowerBound(), and upperBound().

Referenced by RectangularDetector::getHeight(), RectangularDetector::getWidth(), and DetectorUtils::isQuadratic().

Here is the call graph for this function:

◆ upperBound()

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  ostr,
const IAxis m 
)
friend

Definition at line 72 of file IAxis.h.

73  {
74  m.print(ostr);
75  return ostr;
76  }
virtual void print(std::ostream &ostr) const =0

Member Data Documentation

◆ m_name

std::string IAxis::m_name
private

axis name

Definition at line 96 of file IAxis.h.

Referenced by getName(), and setName().


The documentation for this class was generated from the following files: