Mantid
Loading...
Searching...
No Matches
NumericAxis.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//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12#include "MantidAPI/Axis.h"
13
14#include <span>
15#include <string>
16#include <vector>
17
18namespace Mantid {
19namespace API {
20//----------------------------------------------------------------------
21// Forward declaration
22//----------------------------------------------------------------------
23class MatrixWorkspace;
24
30class MANTID_API_DLL NumericAxis : public Axis {
31public:
32 NumericAxis(const std::size_t &length);
33 NumericAxis(std::vector<double> centres);
36 NumericAxis(std::span<double const> centres);
37
38 Axis *clone(const MatrixWorkspace *const parentWorkspace) override;
39 Axis *clone(const std::size_t length, const MatrixWorkspace *const parentWorkspace) override;
41 bool isNumeric() const override { return true; }
42 std::size_t length() const override { return m_values.size(); }
44 double operator()(const std::size_t &index, const std::size_t &verticalIndex = 0) const override;
46 void setValue(const std::size_t &index, const double &value) override;
47 size_t indexOfValue(const double value) const override;
48 bool operator==(const NumericAxis &) const;
49 bool operator==(const Axis &) const override;
50 virtual bool equalWithinTolerance(const Axis &axis2, const double tolerance) const;
51 std::string label(const std::size_t &index) const override;
53 virtual std::vector<double> createBinBoundaries() const;
55 virtual const std::vector<double> &getValues() const;
57 double getMin() const override { return m_values.front(); }
59 double getMax() const override { return m_values.back(); }
60
61protected:
64
66 std::vector<double> m_values;
67
69 std::string formatLabel(const double value) const;
70};
71
72} // namespace API
73} // namespace Mantid
double value
The value of the point.
Definition FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
double tolerance
Class to represent the axis of a workspace.
Definition Axis.h:30
Base MatrixWorkspace Abstract Class.
Class to represent a numeric axis of a workspace.
Definition NumericAxis.h:30
double getMax() const override
returns max value defined on axis
Definition NumericAxis.h:59
double getMin() const override
returns min value defined on axis
Definition NumericAxis.h:57
std::size_t length() const override
Get the length of the axis.
Definition NumericAxis.h:42
std::vector< double > m_values
A vector holding the centre values.
Definition NumericAxis.h:66
NumericAxis()
Default constructor.
bool isNumeric() const override
Is the axis numeric - always true for this class.
Definition NumericAxis.h:41
Helper class which provides the Collimation Length for SANS instruments.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)