Mantid
Loading...
Searching...
No Matches
SymmetryOperation.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2014 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 "MantidGeometry/DllConfig.h"
12#include "MantidKernel/Matrix.h"
13
14#include <memory>
15
16namespace Mantid {
17namespace Geometry {
18
106class MANTID_GEOMETRY_DLL SymmetryOperation {
107public:
109 SymmetryOperation(const std::string &identifier);
110 SymmetryOperation(const Kernel::IntMatrix &matrix, const V3R &vector);
111 SymmetryOperation(const Kernel::DblMatrix &matrix, const V3R &vector);
112
113 const Kernel::IntMatrix &matrix() const;
114 const V3R &vector() const;
115 const V3R &reducedVector() const;
116
117 size_t order() const;
118 std::string identifier() const;
119
120 bool isIdentity() const;
121 bool hasTranslation() const;
122
124 template <typename T> T operator*(const T &operand) const { return m_matrixVectorPair * operand; }
125
126 Kernel::V3D transformHKL(const Kernel::V3D &hkl) const;
127
128 SymmetryOperation operator*(const SymmetryOperation &operand) const;
129 SymmetryOperation inverse() const;
130
131 SymmetryOperation operator^(size_t exponent) const;
132
133 bool operator!=(const SymmetryOperation &other) const;
134 bool operator==(const SymmetryOperation &other) const;
135 bool operator<(const SymmetryOperation &other) const;
136
137protected:
138 void init(const MatrixVectorPair<int, V3R> &matrixVectorPair);
139
140 size_t getOrderFromMatrix(const Kernel::IntMatrix &matrix) const;
141 V3R getReducedVector(const Kernel::IntMatrix &matrix, const V3R &vector) const;
142
143 size_t m_order;
146 std::string m_identifier;
147
149};
150
151MANTID_GEOMETRY_DLL std::ostream &operator<<(std::ostream &stream, const SymmetryOperation &operation);
152MANTID_GEOMETRY_DLL std::istream &operator>>(std::istream &stream, SymmetryOperation &operation);
153
154MANTID_GEOMETRY_DLL V3R getWrappedVector(const V3R &vector);
155MANTID_GEOMETRY_DLL Kernel::V3D getWrappedVector(const Kernel::V3D &vector);
156
158
159template <typename T, typename U> Kernel::Matrix<T> convertMatrix(const Kernel::Matrix<U> &matrix) {
160 Kernel::Matrix<T> converted(matrix.numRows(), matrix.numCols());
161
162 for (size_t i = 0; i < converted.numRows(); ++i) {
163 for (size_t j = 0; j < converted.numCols(); ++j) {
164 converted[i][j] = static_cast<int>(matrix[i][j]);
165 }
166 }
167
168 return converted;
169}
170
171} // namespace Geometry
172} // namespace Mantid
Crystallographic symmetry operations are composed of a rotational component, which is represented by ...
T operator*(const T &operand) const
Returns the transformed vector.
MatrixVectorPair< int, V3R > m_matrixVectorPair
size_t numRows() const
Return the number of rows in the matrix.
Definition: Matrix.h:144
size_t numCols() const
Return the number of columns in the matrix.
Definition: Matrix.h:147
Class for 3D vectors.
Definition: V3D.h:34
MatrixWorkspace_sptr MANTID_API_DLL operator*(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Multiply two workspaces.
MANTID_GEOMETRY_DLL std::istream & operator>>(std::istream &stream, SymmetryOperation &operation)
Reads identifier from stream and tries to parse as a symbol.
Kernel::Matrix< T > convertMatrix(const Kernel::Matrix< U > &matrix)
MANTID_GEOMETRY_DLL std::ostream & operator<<(std::ostream &stream, const PointGroup &self)
Returns a streamed representation of the PointGroup object.
Definition: PointGroup.cpp:312
MANTID_GEOMETRY_DLL V3R getWrappedVector(const V3R &vector)
Wraps a V3R to the interval (0, 1].
MANTID_GEOMETRY_DLL SymmetryOperation getUnitCellIntervalOperation(const SymmetryOperation &symOp)
Returns a SymmetryOperation with the vector wrapped to the interval (0, 1].
Helper class which provides the Collimation Length for SANS instruments.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr bool operator!=(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr bool operator<(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
std::common_type_t< wide_integer< Bits, Signed >, wide_integer< Bits2, Signed2 > > constexpr operator^(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)