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 {
54public:
57 virtual const std::string transfID() const = 0;
61 virtual std::vector<std::string> getEmodes() const { return std::vector<std::string>(1, std::string("Undefined")); }
62
63 //***************> the method below involved in the calculations of MD
64 // coordinates
81 virtual bool calcGenericVariables(std::vector<coord_t> &Coord, size_t n_ws_variabes) = 0;
82
93 virtual bool calcYDepCoordinates(std::vector<coord_t> &Coord, size_t i) = 0;
113 virtual bool calcMatrixCoordinates(const MantidVec &X, size_t i, size_t j, std::vector<coord_t> &Coord, double &s,
114 double &err) const {
115 UNUSED_ARG(i);
116 double X_ev = double(0.5 * (X[j] + X[j + 1])); // ! POSSIBLE FACTORY HERE
117 // !!! if the histogram
118 // interpolation is different
119 return calcMatrixCoord(X_ev, Coord, s, err);
120 }
121
137 virtual bool calcMatrixCoord(const double &X, std::vector<coord_t> &Coord, double &signal, double &errSq) const = 0;
138
139 /* clone method allowing to provide the copy of the particular class */
140 virtual MDTransfInterface *clone() const = 0;
141 // destructor
142 virtual ~MDTransfInterface() = default;
145 virtual void initialize(const MDWSDescription &) = 0;
146
159 virtual std::vector<double> getExtremumPoints(const double xMin, const double xMax, size_t det_num) const = 0;
160
161 //***************> the methods below are mainly involved in defining the
162 // target workspace properties.
163 // They also can be involved in the preparation to
164 // calculations of MD coordinates
165 // WARNING!!!! THESE METHODS ARE USED BEFORE INITIALIZE IS EXECUTED SO THEY
166 // CAN NOT RELY ON THE CONTENTS OF THE CLASS TO BE DEFINED (THEY ARE "VIRTUAL
167 // STATIC METHODS")
168
175 virtual const std::string inputUnitID(Kernel::DeltaEMode::Type dEmode,
176 API::MatrixWorkspace_const_sptr inWS) const = 0;
179 virtual std::vector<std::string> outputUnitID(Kernel::DeltaEMode::Type dEmode,
180 API::MatrixWorkspace_const_sptr inWS) const = 0;
181
186 virtual std::vector<std::string> getDefaultDimID(Kernel::DeltaEMode::Type dEmode,
187 API::MatrixWorkspace_const_sptr inWS) const = 0;
188
193 API::MatrixWorkspace_const_sptr inWS) const = 0;
194
203 Mantid::API::MatrixWorkspace_sptr underlyingWorkspace) const = 0;
204};
205
206using MDTransf_sptr = std::shared_ptr<MDTransfInterface>;
207using MDTransf_const_sptr = std::shared_ptr<const MDTransfInterface>;
208
209} // namespace MDAlgorithms
210} // namespace Mantid
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Definition System.h:48
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.
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