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

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from Mantid::API::NumericAxis
std::string formatLabel (const double value) const
 Get number label. More...
 
 NumericAxis ()
 Default constructor. More...
 
- 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. More...
 

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: