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
13// forward declaration
14namespace mu {
15class Parser;
16}
17
18namespace Mantid {
19
20namespace API {
21class SpectrumInfo;
22}
23
24namespace Algorithms {
28class MANTID_ALGORITHMS_DLL ConvertAxisByFormula : public ConvertUnits {
29public:
30 const std::string name() const override;
32 const std::string summary() const override {
33 return "Converts the X or Y axis of a MatrixWorkspace via a user defined "
34 "math formula.";
35 }
36
37 int version() const override;
38 const std::vector<std::string> seeAlso() const override { return {"ConvertUnits"}; }
39 const std::string category() const override;
40
41protected:
42 const std::string workspaceMethodName() const override { return ""; }
43 const std::string workspaceMethodInputProperty() const override { return ""; }
44
45private:
46 void init() override;
47 void exec() override;
48
50 class Variable {
51 public:
52 Variable(const std::string &name) : name(name), value(0.0), isGeometric(false) {}
53 Variable(const std::string &name, bool isGeometric) : name(name), value(0.0), isGeometric(isGeometric) {}
54 std::string name;
55 double value;
57 };
58 using Variable_ptr = std::shared_ptr<Variable>;
59
60 void setAxisValue(const double value, const std::vector<Variable_ptr> &variables);
61 void calculateValues(mu::Parser &p, std::vector<double> &vec, std::vector<Variable_ptr> variables);
62 void setGeometryValues(const API::SpectrumInfo &specInfo, const size_t index,
63 const std::vector<Variable_ptr> &variables);
64 double evaluateResult(mu::Parser &p);
65};
66
67} // namespace Algorithms
68} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
Definition: SpectrumInfo.h:53
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.
Definition: ConvertUnits.h:52
Helper class which provides the Collimation Length for SANS instruments.