Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::API::RefAxis Class Reference

A class to represent the axis of a 2D (or more) workspace where the value at a given point on the axis varies along the other dimension. More...

#include <RefAxis.h>

Inheritance diagram for Mantid::API::RefAxis:
Mantid::API::NumericAxis Mantid::API::Axis

Public Member Functions

Axisclone (const MatrixWorkspace *const parentWorkspace) override
 Virtual constructor.
 
Axisclone (const std::size_t length, const MatrixWorkspace *const parentWorkspace) override
 Virtual constructor for axis of different length.
 
std::vector< double > createBinBoundaries () const override
 Create bin boundaries from the point values.
 
bool equalWithinTolerance (const Axis &axis2, const double tolerance) const override
 Check if two numeric axis are equivalent to a given tolerance.
 
double getMax () const override
 returns max value defined on axis
 
double getMin () const override
 returns min value defined on axis
 
const std::vector< double > & getValues () const override
 Return a const reference to the values.
 
size_t indexOfValue (const double value) const override
 Returns the index of the value wrt bin edge representation of the axis.
 
std::size_t length () const override
 Get the length of the axis.
 
double operator() (const std::size_t &index, const std::size_t &verticalIndex) const override
 Get a value at the specified index.
 
bool operator== (const Axis &) const override
 Check if two axis defined as spectra or numeric axis are equivalent.
 
 RefAxis (const MatrixWorkspace *const parentWorkspace)
 Constructor.
 
void setValue (const std::size_t &index, const double &value) override
 Method not available for RefAxis.
 
- Public Member Functions inherited from Mantid::API::NumericAxis
bool isNumeric () const override
 Is the axis numeric - always true for this class.
 
std::string label (const std::size_t &index) const override
 Returns a text label which shows the value corresponding to a bin index.
 
 NumericAxis (const std::size_t &length)
 Constructor.
 
 NumericAxis (std::vector< double > centres)
 Constructor taking a set of centre point values.
 
bool operator== (const NumericAxis &) const
 Check if two NumericAxis are equivalent.
 
- Public Member Functions inherited from Mantid::API::Axis
 Axis ()
 Constructor.
 
double getValue (const std::size_t &index, const std::size_t &verticalIndex=0) const
 Gets the value at the specified index.
 
virtual bool isSpectra () const
 Returns true is the axis is a Spectra axis.
 
virtual bool isText () const
 Returns true if the axis is Text.
 
virtual const std::shared_ptr< Kernel::Unit > & setUnit (const std::string &unitName)
 Set the unit on the Axis.
 
virtual specnum_t spectraNo (const std::size_t &index) const
 Get the spectrum number.
 
std::string & title ()
 Returns a reference to the user-defined title for this axis.
 
const std::string & title () const
 Returns the user-defined title for this axis.
 
std::shared_ptr< Kernel::Unit > & unit ()
 The unit object for this workspace (non const version)
 
const std::shared_ptr< Kernel::Unit > & unit () const
 The unit for this axis.
 
virtual ~Axis ()=default
 

Private Member Functions

const RefAxisoperator= (const RefAxis &)
 Private, undefined copy assignment operator.
 
 RefAxis (const RefAxis &)
 Private, undefined 'regular' copy constructor.
 
 RefAxis (const RefAxis &right, const MatrixWorkspace *const parentWorkspace)
 Private, specialised copy constructor.
 

Private Attributes

const MatrixWorkspace *const m_parentWS
 A pointer to the workspace holding the axis.
 

Additional Inherited Members

- Protected Member Functions inherited from Mantid::API::NumericAxis
std::string formatLabel (const double value) const
 Get number label.
 
 NumericAxis ()
 Default constructor.
 
- Protected Member Functions inherited from Mantid::API::Axis
 Axis (const Axis &)=default
 
Axisoperator= (const Axis &)=default
 
- Protected Attributes inherited from Mantid::API::NumericAxis
std::vector< double > m_values
 A vector holding the centre values.
 

Detailed Description

A class to represent the axis of a 2D (or more) workspace where the value at a given point on the axis varies along the other dimension.

This class does not hold the axis values itself; they are held by the X vectors of the workspace itself. An axis of this kind is always of numeric type.

Author
Russell Taylor, Tessella Support Services plc
Date
18/05/2008

Definition at line 23 of file RefAxis.h.

Constructor & Destructor Documentation

◆ RefAxis() [1/3]

Mantid::API::RefAxis::RefAxis ( const MatrixWorkspace *const  parentWorkspace)

Constructor.

Parameters
parentWorkspace:: A pointer to the workspace that holds this axis

Definition at line 17 of file RefAxis.cpp.

◆ RefAxis() [2/3]

Mantid::API::RefAxis::RefAxis ( const RefAxis right,
const MatrixWorkspace *const  parentWorkspace 
)
private

Private, specialised copy constructor.

Needed because it's necessary to pass in a pointer to the parent of the new workspace, rather than having the copy point to the parent of the copied axis.

Parameters
right:: The axis to copy
parentWorkspace:: A pointer to the parent workspace of the new axis

Definition at line 27 of file RefAxis.cpp.

◆ RefAxis() [3/3]

Mantid::API::RefAxis::RefAxis ( const RefAxis )
private

Private, undefined 'regular' copy constructor.

Member Function Documentation

◆ clone() [1/2]

Axis * Mantid::API::RefAxis::clone ( const MatrixWorkspace *const  parentWorkspace)
overridevirtual

Virtual constructor.

Parameters
parentWorkspace:: A pointer to the workspace that will hold the new axis
Returns
A pointer to a copy of the Axis on which the method is called

Reimplemented from Mantid::API::NumericAxis.

Definition at line 35 of file RefAxis.cpp.

Referenced by clone().

◆ clone() [2/2]

Axis * Mantid::API::RefAxis::clone ( const std::size_t  length,
const MatrixWorkspace *const  parentWorkspace 
)
overridevirtual

Virtual constructor for axis of different length.

Reimplemented from Mantid::API::NumericAxis.

Definition at line 37 of file RefAxis.cpp.

References clone(), and length().

◆ createBinBoundaries()

std::vector< double > Mantid::API::RefAxis::createBinBoundaries ( ) const
overridevirtual

Create bin boundaries from the point values.

Create a set of bin boundaries from the centre point values.

Returns
A vector of bin boundaries

Reimplemented from Mantid::API::NumericAxis.

Definition at line 99 of file RefAxis.cpp.

◆ equalWithinTolerance()

bool Mantid::API::RefAxis::equalWithinTolerance ( const Axis axis2,
const double  tolerance 
) const
overridevirtual

Check if two numeric axis are equivalent to a given tolerance.

Parameters
axis2:: Reference to the axis to compare to
tolerance:: Tolerance to compare to
Returns
true if self and second axis are equal

Reimplemented from Mantid::API::NumericAxis.

Definition at line 89 of file RefAxis.cpp.

References operator==(), tolerance, and UNUSED_ARG.

◆ getMax()

double Mantid::API::RefAxis::getMax ( ) const
overridevirtual

returns max value defined on axis

Reimplemented from Mantid::API::NumericAxis.

Definition at line 111 of file RefAxis.cpp.

◆ getMin()

double Mantid::API::RefAxis::getMin ( ) const
overridevirtual

returns min value defined on axis

Reimplemented from Mantid::API::NumericAxis.

Definition at line 107 of file RefAxis.cpp.

◆ getValues()

const std::vector< double > & Mantid::API::RefAxis::getValues ( ) const
overridevirtual

Return a const reference to the values.

Get a const reference to the vector of values in this axis.

Returns
the values vector

Reimplemented from Mantid::API::NumericAxis.

Definition at line 103 of file RefAxis.cpp.

◆ indexOfValue()

size_t Mantid::API::RefAxis::indexOfValue ( const double  value) const
overridevirtual

Returns the index of the value wrt bin edge representation of the axis.

Parameters
valueA value to find in a bin
Returns
The index of the bin holding the value

Reimplemented from Mantid::API::NumericAxis.

Definition at line 94 of file RefAxis.cpp.

References UNUSED_ARG, and value.

◆ length()

std::size_t Mantid::API::RefAxis::length ( ) const
overridevirtual

Get the length of the axis.

Reimplemented from Mantid::API::NumericAxis.

Definition at line 42 of file RefAxis.cpp.

References m_parentWS, and Mantid::API::MatrixWorkspace::x().

Referenced by clone(), and operator==().

◆ operator()()

double Mantid::API::RefAxis::operator() ( const std::size_t &  index,
const std::size_t &  verticalIndex 
) const
overridevirtual

Get a value at the specified index.

Get the axis value at the position given.

In this case, the values are held in the X vectors of the workspace itself.

Parameters
indexThe position along the axis for which the value is required
verticalIndexThe position along the orthogonal axis
Returns
The value of the axis as a double
Exceptions
IndexErrorIf 'index' is not in the range of this axis
std::range_errorIf 'verticalIndex' is not in the range of the parent workspace

Reimplemented from Mantid::API::NumericAxis.

Definition at line 54 of file RefAxis.cpp.

References index, m_parentWS, Mantid::API::MatrixWorkspace::x(), and Mantid::Geometry::x.

◆ operator=()

const RefAxis & Mantid::API::RefAxis::operator= ( const RefAxis )
private

Private, undefined copy assignment operator.

◆ operator==()

bool Mantid::API::RefAxis::operator== ( const Axis axis2) const
overridevirtual

Check if two axis defined as spectra or numeric axis are equivalent.

Parameters
axis2:: Reference to the axis to compare to
Returns
true is self and second axis are equal

Reimplemented from Mantid::API::NumericAxis.

Definition at line 76 of file RefAxis.cpp.

References Mantid::API::Axis::length(), and length().

Referenced by equalWithinTolerance().

◆ setValue()

void Mantid::API::RefAxis::setValue ( const std::size_t &  index,
const double &  value 
)
overridevirtual

Method not available for RefAxis.

Will always throw.

Parameters
indexlocation for setting
valuethe value to set

Reimplemented from Mantid::API::NumericAxis.

Definition at line 66 of file RefAxis.cpp.

References index, UNUSED_ARG, and value.

Member Data Documentation

◆ m_parentWS

const MatrixWorkspace* const Mantid::API::RefAxis::m_parentWS
private

A pointer to the workspace holding the axis.

Definition at line 51 of file RefAxis.h.

Referenced by length(), and operator()().


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