Mantid
Loading...
Searching...
No Matches
ConvertAxisByFormula.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2013 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
11#include "MantidAlgorithms/DllConfig.h"
12#include "MantidHistogramData/HistogramX.h"
13
14// forward declaration
15namespace mu {
16class Parser;
17}
18
19namespace Mantid {
20
21namespace API {
22class SpectrumInfo;
23}
24
25namespace Algorithms {
29class MANTID_ALGORITHMS_DLL ConvertAxisByFormula : public ConvertUnits {
30public:
31 const std::string name() const override;
33 const std::string summary() const override {
34 return "Converts the X or Y axis of a MatrixWorkspace via a user defined "
35 "math formula.";
36 }
37
38 int version() const override;
39 const std::vector<std::string> seeAlso() const override { return {"ConvertUnits"}; }
40 const std::string category() const override;
41
42protected:
43 const std::string workspaceMethodName() const override { return ""; }
44 const std::string workspaceMethodInputProperty() const override { return ""; }
45
46private:
47 void init() override;
48 void exec() override;
49
51 class Variable {
52 public:
53 Variable(const std::string &name) : name(name), value(0.0), isGeometric(false) {}
54 Variable(const std::string &name, bool isGeometric) : name(name), value(0.0), isGeometric(isGeometric) {}
55 std::string name;
56 double value;
58 };
59 using Variable_ptr = std::shared_ptr<Variable>;
60
61 void setAxisValue(const double value, const std::vector<Variable_ptr> &variables);
62 void calculateValues(mu::Parser &p, HistogramData::HistogramX &xValues, const std::vector<Variable_ptr> &variables);
63 void setGeometryValues(const API::SpectrumInfo &specInfo, const size_t index,
64 const std::vector<Variable_ptr> &variables);
65 double evaluateResult(mu::Parser &p);
66};
67
68} // namespace Algorithms
69} // namespace Mantid
std::string name
Definition Run.cpp:60
double value
The value of the point.
Definition FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
A simple internal structure to hold information on variables.
Variable(const std::string &name, bool isGeometric)
ConvertAxisByFormula : Performs a unit conversion based on a supplied formula.
const std::string workspaceMethodInputProperty() const override
Returns the name of the input workspace property used by the calling object.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
const std::string workspaceMethodName() const override
const std::string summary() const override
Summary of algorithms purpose.
Converts the units in which a workspace is represented.
Helper class which provides the Collimation Length for SANS instruments.