Mantid
Loading...
Searching...
No Matches
IncreasingAxisValidator.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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 +
8#include "MantidAPI/Axis.h"
10
11namespace Mantid::API {
12
15 return std::make_shared<IncreasingAxisValidator>(*this);
16}
17
25 const Axis *xAxis{nullptr};
26 try {
27 // 0 for X axis
28 xAxis = value->getAxis(0);
30 return "No X axis available in the workspace";
31 }
32
33 // Left-most axis value should be less than the right-most, if ws has
34 // more than one X axis value
35 if (xAxis->length() > 1 && xAxis->getValue(0) >= xAxis->getValue(xAxis->length() - 1))
36 return "X axis of the workspace should be increasing from left to "
37 "right";
38 else
39 return "";
40}
41
42} // namespace Mantid::API
double value
The value of the point.
Definition: FitMW.cpp:51
Class to represent the axis of a workspace.
Definition: Axis.h:30
std::string checkValidity(const MatrixWorkspace_sptr &value) const override
Check for validity.
Kernel::IValidator_sptr clone() const override
Clone the current state.
Exception for index errors.
Definition: Exception.h:284
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< IValidator > IValidator_sptr
A shared_ptr to an IValidator.
Definition: IValidator.h:26