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 <string>
15#include <vector>
16
17namespace Mantid {
18namespace API {
19//----------------------------------------------------------------------
20// Forward declaration
21//----------------------------------------------------------------------
22class MatrixWorkspace;
23
29class MANTID_API_DLL NumericAxis : public Axis {
30public:
31 NumericAxis(const std::size_t &length);
32 NumericAxis(std::vector<double> centres);
33
34 Axis *clone(const MatrixWorkspace *const parentWorkspace) override;
35 Axis *clone(const std::size_t length, const MatrixWorkspace *const parentWorkspace) override;
37 bool isNumeric() const override { return true; }
38 std::size_t length() const override { return m_values.size(); }
40 double operator()(const std::size_t &index, const std::size_t &verticalIndex = 0) const override;
42 void setValue(const std::size_t &index, const double &value) override;
43 size_t indexOfValue(const double value) const override;
44 bool operator==(const NumericAxis &) const;
45 bool operator==(const Axis &) const override;
46 virtual bool equalWithinTolerance(const Axis &axis2, const double tolerance) const;
47 std::string label(const std::size_t &index) const override;
49 virtual std::vector<double> createBinBoundaries() const;
51 virtual const std::vector<double> &getValues() const;
53 double getMin() const override { return m_values.front(); }
55 double getMax() const override { return m_values.back(); }
56
57protected:
60
62 std::vector<double> m_values;
63
65 std::string formatLabel(const double value) const;
66};
67
68} // namespace API
69} // 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:29
double getMax() const override
returns max value defined on axis
Definition NumericAxis.h:55
double getMin() const override
returns min value defined on axis
Definition NumericAxis.h:53
std::size_t length() const override
Get the length of the axis.
Definition NumericAxis.h:38
std::vector< double > m_values
A vector holding the centre values.
Definition NumericAxis.h:62
NumericAxis()
Default constructor.
bool isNumeric() const override
Is the axis numeric - always true for this class.
Definition NumericAxis.h:37
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)