Mantid
Loading...
Searching...
No Matches
MDTransfInterface.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2010 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
10
12
15
17
18namespace Mantid {
19namespace MDAlgorithms {
58public:
61 virtual const std::string transfID() const = 0;
65 virtual std::vector<std::string> getEmodes() const { return std::vector<std::string>(1, std::string("Undefined")); }
66
67 //***************> the method below involved in the calculations of MD
68 // coordinates
85 virtual bool calcGenericVariables(std::vector<coord_t> &Coord, size_t n_ws_variabes) = 0;
86
97 virtual bool calcYDepCoordinates(std::vector<coord_t> &Coord, size_t i) = 0;
117 virtual bool calcMatrixCoordinates(const MantidVec &X, size_t i, size_t j, std::vector<coord_t> &Coord, double &s,
118 double &err) const {
119 UNUSED_ARG(i);
120 double X_ev = double(0.5 * (X[j] + X[j + 1])); // ! POSSIBLE FACTORY HERE
121 // !!! if the histogram
122 // interpolation is different
123 return calcMatrixCoord(X_ev, Coord, s, err);
124 }
125
141 virtual bool calcMatrixCoord(const double &X, std::vector<coord_t> &Coord, double &signal, double &errSq) const = 0;
142
143 /* clone method allowing to provide the copy of the particular class */
144 virtual MDTransfInterface *clone() const = 0;
145 // destructor
146 virtual ~MDTransfInterface() = default;
149 virtual void initialize(const MDWSDescription &) = 0;
150
163 virtual std::vector<double> getExtremumPoints(const double xMin, const double xMax, size_t det_num) const = 0;
164
165 //***************> the methods below are mainly involved in defining the
166 // target workspace properties.
167 // They also can be involved in the preparation to
168 // calculations of MD coordinates
169 // WARNING!!!! THESE METHODS ARE USED BEFORE INITIALIZE IS EXECUTED SO THEY
170 // CAN NOT RELY ON THE CONTENTS OF THE CLASS TO BE DEFINED (THEY ARE "VIRTUAL
171 // STATIC METHODS")
172
179 virtual const std::string inputUnitID(Kernel::DeltaEMode::Type dEmode,
180 API::MatrixWorkspace_const_sptr inWS) const = 0;
183 virtual std::vector<std::string> outputUnitID(Kernel::DeltaEMode::Type dEmode,
184 API::MatrixWorkspace_const_sptr inWS) const = 0;
185
190 virtual std::vector<std::string> getDefaultDimID(Kernel::DeltaEMode::Type dEmode,
191 API::MatrixWorkspace_const_sptr inWS) const = 0;
192
197 API::MatrixWorkspace_const_sptr inWS) const = 0;
198
207 Mantid::API::MatrixWorkspace_sptr underlyingWorkspace) const = 0;
208};
209
210using MDTransf_sptr = std::shared_ptr<MDTransfInterface>;
211using MDTransf_const_sptr = std::shared_ptr<const MDTransfInterface>;
212
213} // namespace MDAlgorithms
214} // namespace Mantid
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Definition: System.h:64
Interface to set of sub-classes used by ConvertToMD algorithm and responsible for conversion of input...
virtual bool calcYDepCoordinates(std::vector< coord_t > &Coord, size_t i)=0
generalizes the code to calculate Y-variables within the detector's loop of the workspace
virtual std::vector< std::string > getEmodes() const
MD transformation can often be used together with energy analysis mode; This function should be overl...
virtual void setDisplayNormalization(Mantid::API::IMDWorkspace_sptr mdWorkspace, Mantid::API::MatrixWorkspace_sptr underlyingWorkspace) const =0
Sets the display normalization.
virtual std::vector< std::string > getDefaultDimID(Kernel::DeltaEMode::Type dEmode, API::MatrixWorkspace_const_sptr inWS) const =0
when one builds MD workspace, he needs a dimension names/ID-s which can be different for different Q-...
virtual std::vector< std::string > outputUnitID(Kernel::DeltaEMode::Type dEmode, API::MatrixWorkspace_const_sptr inWS) const =0
The transformation generates output MD events in particular units.
virtual const std::string inputUnitID(Kernel::DeltaEMode::Type dEmode, API::MatrixWorkspace_const_sptr inWS) const =0
returns the unit ID for the input units, the particular transformation expects.
virtual bool calcMatrixCoordinates(const MantidVec &X, size_t i, size_t j, std::vector< coord_t > &Coord, double &s, double &err) const
Calculate all remaining coordinates, defined within the inner loop.
virtual bool calcMatrixCoord(const double &X, std::vector< coord_t > &Coord, double &signal, double &errSq) const =0
The method to calculate all remaining coordinates, defined within the inner loop given that the input...
virtual void initialize(const MDWSDescription &)=0
set up transformation from the class, which can provide all variables necessary for the conversion
virtual bool calcGenericVariables(std::vector< coord_t > &Coord, size_t n_ws_variabes)=0
Method deployed out of the loop and calculates all variables needed within the loop.
virtual unsigned int getNMatrixDimensions(Kernel::DeltaEMode::Type mode, API::MatrixWorkspace_const_sptr inWS) const =0
return the number of dimensions, calculated by the transformation from the workspace.
virtual const std::string transfID() const =0
The method returns the name, under which the transformation would be known to a user.
virtual std::vector< double > getExtremumPoints(const double xMin, const double xMax, size_t det_num) const =0
method returns the vector of input coordinates values where the transformed coordinates reach its ext...
virtual MDTransfInterface * clone() const =0
helper class describes the properties of target MD workspace, which should be obtained as the result ...
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< IMDWorkspace > IMDWorkspace_sptr
Shared pointer to the IMDWorkspace base class.
Definition: IMDWorkspace.h:146
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< const MDTransfInterface > MDTransf_const_sptr
std::shared_ptr< MDTransfInterface > MDTransf_sptr
Helper class which provides the Collimation Length for SANS instruments.
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
Definition: cow_ptr.h:172
Type
Define the available energy transfer modes It is important to assign enums proper numbers,...
Definition: DeltaEMode.h:29