Mantid
Loading...
Searching...
No Matches
MDGeometry.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2011 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
9#include "MantidAPI/DllConfig.h"
11#include "MantidKernel/Matrix.h"
12#include "MantidKernel/System.h"
13#include "MantidKernel/VMD.h"
14#include <memory>
15
16#include <memory>
17
18namespace Mantid {
19namespace Geometry {
20class IMDDimension;
21}
22namespace API {
23class CoordTransform;
24class IMDWorkspace;
25class MDGeometryNotificationHelper;
26class Workspace;
27
37class MANTID_API_DLL MDGeometry {
38public:
39 MDGeometry();
40 MDGeometry(const MDGeometry &other);
41 MDGeometry &operator=(const MDGeometry &other);
42 virtual ~MDGeometry();
43 void initGeometry(const std::vector<std::shared_ptr<Geometry::IMDDimension>> &dimensions);
44
45 // --------------------------------------------------------------------------------------------
46 // These are the main methods for dimensions, that CAN be overridden (e.g. by
47 // MatrixWorkspace)
48 virtual size_t getNumDims() const;
49 virtual size_t getNumNonIntegratedDims() const;
50 virtual std::shared_ptr<const Mantid::Geometry::IMDDimension> getDimension(size_t index) const;
51 virtual std::shared_ptr<const Mantid::Geometry::IMDDimension> getDimensionWithId(std::string id) const;
52 size_t getDimensionIndexByName(const std::string &name) const;
53 size_t getDimensionIndexById(const std::string &id) const;
54 std::vector<std::shared_ptr<const Geometry::IMDDimension>> getNonIntegratedDimensions() const;
55 virtual std::vector<coord_t> estimateResolution() const;
56
57 // --------------------------------------------------------------------------------------------
58 std::shared_ptr<const Mantid::Geometry::IMDDimension> getXDimension() const;
59 std::shared_ptr<const Mantid::Geometry::IMDDimension> getYDimension() const;
60 std::shared_ptr<const Mantid::Geometry::IMDDimension> getZDimension() const;
61 std::shared_ptr<const Mantid::Geometry::IMDDimension> getTDimension() const;
62
63 std::string getGeometryXML() const;
64
65 void addDimension(const std::shared_ptr<Mantid::Geometry::IMDDimension> &dim);
66 void addDimension(Mantid::Geometry::IMDDimension *dim);
67
68 // --------------------------------------------------------------------------------------------
69 Mantid::Kernel::VMD &getBasisVector(size_t index);
70 const Mantid::Kernel::VMD &getBasisVector(size_t index) const;
71 void setBasisVector(size_t index, const Mantid::Kernel::VMD &vec);
72 bool allBasisNormalized() const;
73
74 // --------------------------------------------------------------------------------------------
75 bool hasOriginalWorkspace(size_t index = 0) const;
76 size_t numOriginalWorkspaces() const;
77 std::shared_ptr<Workspace> getOriginalWorkspace(size_t index = 0) const;
78 void setOriginalWorkspace(std::shared_ptr<Workspace> ws, size_t index = 0);
79 Mantid::API::CoordTransform const *getTransformFromOriginal(size_t index = 0) const;
80 void setTransformFromOriginal(Mantid::API::CoordTransform *transform, size_t index = 0);
81 Mantid::API::CoordTransform const *getTransformToOriginal(size_t index = 0) const;
82 void setTransformToOriginal(Mantid::API::CoordTransform *transform, size_t index = 0);
83
84 void transformDimensions(std::vector<double> &scaling, std::vector<double> &offset);
85
86 size_t getNumberTransformsToOriginal() const;
87 size_t getNumberTransformsFromOriginal() const;
88
89 // --------------------------------------------------------------------------------------------
92 Mantid::Kernel::VMD &getOrigin() { return m_origin; }
93
96 const Mantid::Kernel::VMD &getOrigin() const { return m_origin; }
97
101 void setOrigin(const Mantid::Kernel::VMD &orig) { m_origin = orig; }
105 void setWTransf(const Kernel::DblMatrix &WTransf) { m_Wtransf = WTransf; }
109 const Kernel::DblMatrix &getWTransf() const { return m_Wtransf; }
110
112 void clearTransforms();
114 void clearOriginalWorkspaces();
115
117
118protected:
120 void deleteNotificationReceived(const std::shared_ptr<const Workspace> &deleted);
121
123 std::vector<std::shared_ptr<Geometry::IMDDimension>> m_dimensions;
124
127 std::vector<std::shared_ptr<Workspace>> m_originalWorkspaces;
128
132
135 std::vector<std::shared_ptr<const Mantid::API::CoordTransform>> m_transforms_FromOriginal;
136
139 std::vector<std::shared_ptr<const Mantid::API::CoordTransform>> m_transforms_ToOriginal;
140
142 std::unique_ptr<MDGeometryNotificationHelper> m_notificationHelper;
143
150 Kernel::DblMatrix m_Wtransf; // TODO: should be reconciled with the vectors
151 // below and be either always synchroneous or
152 // only one set remains
155 std::vector<Mantid::Kernel::VMD> m_basisVectors;
156};
157
158} // namespace API
159} // namespace Mantid
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
Unique SingleValueParameter Declaration for InputNDimensions.
Describes the geometry (i.e.
Definition: MDGeometry.h:37
Kernel::DblMatrix m_Wtransf
the matrix which transforms momentums from orthogonal Q-system to Orthogonal HKL or non-orthogonal HK...
Definition: MDGeometry.h:150
Mantid::Kernel::VMD & getOrigin()
Definition: MDGeometry.h:92
std::vector< Mantid::Kernel::VMD > m_basisVectors
Vector of the basis vector (in the original workspace) for each dimension of this workspace.
Definition: MDGeometry.h:155
std::vector< std::shared_ptr< const Mantid::API::CoordTransform > > m_transforms_FromOriginal
Coordinate Transformation that goes from the original workspace to this workspace's coordinates.
Definition: MDGeometry.h:135
Mantid::Kernel::VMD m_origin
Vector of the origin (in the original workspace) that corresponds to 0,0,0... in this workspace.
Definition: MDGeometry.h:131
const Mantid::Kernel::VMD & getOrigin() const
Definition: MDGeometry.h:96
std::vector< std::shared_ptr< Geometry::IMDDimension > > m_dimensions
Vector of the dimensions used, in the order X Y Z t, etc.
Definition: MDGeometry.h:123
void setOrigin(const Mantid::Kernel::VMD &orig)
Sets the origin of this geometry.
Definition: MDGeometry.h:101
std::vector< std::shared_ptr< const Mantid::API::CoordTransform > > m_transforms_ToOriginal
Coordinate Transformation that goes from this workspace's coordinates to the original workspace coord...
Definition: MDGeometry.h:139
const Kernel::DblMatrix & getWTransf() const
get the transformation from Qin crystal cartezian coordinate system to Q in orthogonal or real HKL co...
Definition: MDGeometry.h:109
std::vector< std::shared_ptr< Workspace > > m_originalWorkspaces
Pointer to the original workspace(s), if this workspace is a coordinate transformation from an origin...
Definition: MDGeometry.h:127
void setWTransf(const Kernel::DblMatrix &WTransf)
set the transformation from Q in crystal cartezian coordinate system to Q in orthogonal or real HKL c...
Definition: MDGeometry.h:105
std::unique_ptr< MDGeometryNotificationHelper > m_notificationHelper
Helper that deals with notifications and observing the ADS.
Definition: MDGeometry.h:142
The class describes one dimension of multidimensional dataset representing an orthogonal dimension an...
Definition: IMDDimension.h:39
Helper class which provides the Collimation Length for SANS instruments.