Mantid
Loading...
Searching...
No Matches
Axis.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2008 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidAPI/DllConfig.h"
12
13#include <memory>
14#include <string>
15
16namespace Mantid {
17namespace API {
18//----------------------------------------------------------------------
19// Forward declaration
20//----------------------------------------------------------------------
21class MatrixWorkspace;
22
28class MANTID_API_DLL Axis {
29public:
30 Axis();
31 virtual ~Axis() = default;
32
34 virtual Axis *clone(const MatrixWorkspace *const parentWorkspace) = 0;
36 virtual Axis *clone(const std::size_t length, const MatrixWorkspace *const parentWorkspace) = 0;
37
38 const std::string &title() const;
39 std::string &title();
40
41 const Kernel::Unit_sptr &unit() const;
42 Kernel::Unit_sptr &unit();
43
45 virtual const Kernel::Unit_sptr &setUnit(const std::string &unitName);
46
48 virtual bool isSpectra() const { return false; }
50 virtual bool isNumeric() const { return false; }
52 virtual bool isText() const { return false; }
53
57 virtual double operator()(const std::size_t &index, const std::size_t &verticalIndex = 0) const = 0;
60 double getValue(const std::size_t &index, const std::size_t &verticalIndex = 0) const;
62 virtual double getMin() const = 0;
64 virtual double getMax() const = 0;
68 virtual void setValue(const std::size_t &index, const double &value) = 0;
70 virtual size_t indexOfValue(const double value) const = 0;
71
73 virtual specnum_t spectraNo(const std::size_t &index) const;
74
76 virtual std::size_t length() const = 0;
77
80 virtual bool operator==(const Axis &) const = 0;
81
85 virtual std::string label(const std::size_t &index) const = 0;
86
87protected:
88 Axis(const Axis &) = default;
89 Axis &operator=(const Axis &) = default;
90
91private:
93 std::string m_title;
96};
97
98} // namespace API
99} // namespace Mantid
double value
The value of the point.
Definition FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
Class to represent the axis of a workspace.
Definition Axis.h:28
virtual double getMin() const =0
returns min value defined on axis
virtual double getMax() const =0
returns max value defined on axis
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,...
Axis(const Axis &)=default
virtual double operator()(const std::size_t &index, const std::size_t &verticalIndex=0) const =0
Returns the value at a specified index.
virtual bool isText() const
Returns true if the axis is Text.
Definition Axis.h:52
virtual size_t indexOfValue(const double value) const =0
Find the index of the given double value.
virtual std::size_t length() const =0
Get the length of the axis.
Kernel::Unit_sptr m_unit
The unit for this axis.
Definition Axis.h:95
virtual ~Axis()=default
virtual Axis * clone(const MatrixWorkspace *const parentWorkspace)=0
Virtual constructor.
Axis & operator=(const Axis &)=default
virtual Axis * clone(const std::size_t length, const MatrixWorkspace *const parentWorkspace)=0
Virtual constructor for axis of different length.
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 ...
virtual void setValue(const std::size_t &index, const double &value)=0
Sets the value at the specified index.
std::string m_title
The user-defined title for this axis.
Definition Axis.h:93
virtual bool isNumeric() const
Returns true if the axis is numeric.
Definition Axis.h:50
virtual bool isSpectra() const
Returns true is the axis is a Spectra axis.
Definition Axis.h:48
Base MatrixWorkspace Abstract Class.
std::shared_ptr< Unit > Unit_sptr
Shared pointer to the Unit base class.
Definition Unit_fwd.h:17
Helper class which provides the Collimation Length for SANS instruments.
int32_t specnum_t
Typedef for a spectrum Number.
Definition IDTypes.h:14