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/VMD.h"
13#include <memory>
14
15#include <memory>
16
17namespace Mantid {
18namespace Geometry {
19class IMDDimension;
20}
21namespace API {
22class CoordTransform;
23class IMDWorkspace;
24class MDGeometryNotificationHelper;
25class Workspace;
26
36class MANTID_API_DLL MDGeometry {
37public:
38 MDGeometry();
39 MDGeometry(const MDGeometry &other);
40 MDGeometry &operator=(const MDGeometry &other);
41 virtual ~MDGeometry();
42 void initGeometry(const std::vector<std::shared_ptr<Geometry::IMDDimension>> &dimensions);
43
44 // --------------------------------------------------------------------------------------------
45 // These are the main methods for dimensions, that CAN be overridden (e.g. by
46 // MatrixWorkspace)
47 virtual size_t getNumDims() const;
48 virtual size_t getNumNonIntegratedDims() const;
49 virtual std::shared_ptr<const Mantid::Geometry::IMDDimension> getDimension(size_t index) const;
50 virtual std::shared_ptr<const Mantid::Geometry::IMDDimension> getDimensionWithId(std::string id) const;
51 size_t getDimensionIndexByName(const std::string &name) const;
52 size_t getDimensionIndexById(const std::string &id) const;
53 std::vector<std::shared_ptr<const Geometry::IMDDimension>> getNonIntegratedDimensions() const;
54 virtual std::vector<coord_t> estimateResolution() const;
55
56 // --------------------------------------------------------------------------------------------
57 std::shared_ptr<const Mantid::Geometry::IMDDimension> getXDimension() const;
58 std::shared_ptr<const Mantid::Geometry::IMDDimension> getYDimension() const;
59 std::shared_ptr<const Mantid::Geometry::IMDDimension> getZDimension() const;
60 std::shared_ptr<const Mantid::Geometry::IMDDimension> getTDimension() const;
61
62 std::string getGeometryXML() const;
63
64 void addDimension(const std::shared_ptr<Mantid::Geometry::IMDDimension> &dim);
65 void addDimension(Mantid::Geometry::IMDDimension *dim);
66
67 // --------------------------------------------------------------------------------------------
68 Mantid::Kernel::VMD &getBasisVector(size_t index);
69 const Mantid::Kernel::VMD &getBasisVector(size_t index) const;
70 void setBasisVector(size_t index, const Mantid::Kernel::VMD &vec);
71 bool allBasisNormalized() const;
72
73 // --------------------------------------------------------------------------------------------
74 bool hasOriginalWorkspace(size_t index = 0) const;
75 size_t numOriginalWorkspaces() const;
76 std::shared_ptr<Workspace> getOriginalWorkspace(size_t index = 0) const;
77 void setOriginalWorkspace(std::shared_ptr<Workspace> ws, size_t index = 0);
78 Mantid::API::CoordTransform const *getTransformFromOriginal(size_t index = 0) const;
79 void setTransformFromOriginal(Mantid::API::CoordTransform *transform, size_t index = 0);
80 Mantid::API::CoordTransform const *getTransformToOriginal(size_t index = 0) const;
81 void setTransformToOriginal(Mantid::API::CoordTransform *transform, size_t index = 0);
82
83 void transformDimensions(std::vector<double> const &scaling, std::vector<double> const &offset);
84
85 size_t getNumberTransformsToOriginal() const;
86 size_t getNumberTransformsFromOriginal() const;
87
88 // --------------------------------------------------------------------------------------------
91 Mantid::Kernel::VMD &getOrigin() { return m_origin; }
92
95 const Mantid::Kernel::VMD &getOrigin() const { return m_origin; }
96
100 void setOrigin(const Mantid::Kernel::VMD &orig) { m_origin = orig; }
104 void setWTransf(const Kernel::DblMatrix &WTransf) { m_Wtransf = WTransf; }
108 const Kernel::DblMatrix &getWTransf() const { return m_Wtransf; }
109
111 void clearTransforms();
113 void clearOriginalWorkspaces();
114
116
117protected:
119 void deleteNotificationReceived(const std::shared_ptr<const Workspace> &replaced);
120
122 void replaceNotificationReceived(const std::shared_ptr<const Workspace> &deleted);
123
125 std::vector<std::shared_ptr<Geometry::IMDDimension>> m_dimensions;
126
129 std::vector<std::shared_ptr<Workspace>> m_originalWorkspaces;
130
134
137 std::vector<std::shared_ptr<const Mantid::API::CoordTransform>> m_transforms_FromOriginal;
138
141 std::vector<std::shared_ptr<const Mantid::API::CoordTransform>> m_transforms_ToOriginal;
142
144 std::unique_ptr<MDGeometryNotificationHelper> m_notificationHelper;
145
152 Kernel::DblMatrix m_Wtransf; // TODO: should be reconciled with the vectors
153 // below and be either always synchroneous or
154 // only one set remains
157 std::vector<Mantid::Kernel::VMD> m_basisVectors;
158};
159
160} // namespace API
161} // namespace Mantid
std::string name
Definition Run.cpp:60
std::map< DeltaEMode::Type, std::string > index
std::vector< T > const * vec
Unique SingleValueParameter Declaration for InputNDimensions.
Describes the geometry (i.e.
Definition MDGeometry.h:36
Kernel::DblMatrix m_Wtransf
the matrix which transforms momentums from orthogonal Q-system to Orthogonal HKL or non-orthogonal HK...
Definition MDGeometry.h:152
Mantid::Kernel::VMD & getOrigin()
Definition MDGeometry.h:91
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:157
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:137
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:133
const Mantid::Kernel::VMD & getOrigin() const
Definition MDGeometry.h:95
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:125
void setOrigin(const Mantid::Kernel::VMD &orig)
Sets the origin of this geometry.
Definition MDGeometry.h:100
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:141
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:108
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:129
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:104
std::unique_ptr< MDGeometryNotificationHelper > m_notificationHelper
Helper that deals with notifications and observing the ADS.
Definition MDGeometry.h:144
The class describes one dimension of multidimensional dataset representing an orthogonal dimension an...
Helper class which provides the Collimation Length for SANS instruments.