Mantid
Loading...
Searching...
No Matches
SymmetryElement.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 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 +
9
10#include <memory>
11#include <stdexcept>
12#include <utility>
13
14namespace Mantid::Geometry {
15
17SymmetryElement::SymmetryElement(std::string symbol) : m_hmSymbol(std::move(symbol)) {}
18
20
22SymmetryElement_sptr SymmetryElementIdentity::clone() const { return std::make_shared<SymmetryElementIdentity>(); }
23
26 : SymmetryElement("-1"), m_inversionPoint(inversionPoint) {}
27
30 return std::make_shared<SymmetryElementInversion>(m_inversionPoint);
31}
32
34SymmetryElementWithAxis::SymmetryElementWithAxis(const std::string &symbol, const V3R &axis, const V3R &translation)
35 : SymmetryElement(symbol), m_translation(translation) {
36 setAxis(axis);
37}
38
41 if (axis == V3R(0, 0, 0)) {
42 throw std::invalid_argument("Axis cannot be (0,0,0).");
43 }
44
45 m_axis = axis;
46}
47
49SymmetryElementRotation::SymmetryElementRotation(const std::string &symbol, const V3R &axis, const V3R &translation,
50 const SymmetryElementRotation::RotationSense &rotationSense)
51 : SymmetryElementWithAxis(symbol, axis, translation), m_rotationSense(rotationSense) {}
52
55 return std::make_shared<SymmetryElementRotation>(m_hmSymbol, m_axis, m_translation, m_rotationSense);
56}
57
59SymmetryElementMirror::SymmetryElementMirror(const std::string &symbol, const V3R &axis, const V3R &translation)
60 : SymmetryElementWithAxis(symbol, axis, translation) {}
61
64 return std::make_shared<SymmetryElementMirror>(m_hmSymbol, m_axis, m_translation);
65}
66
69 : SymmetryElement("t"), m_translation(translation) {}
70
73 return std::make_shared<SymmetryElementTranslation>(m_translation);
74}
75
76} // namespace Mantid::Geometry
SymmetryElement_sptr clone() const override
Returns a clone of the identity element.
SymmetryElement_sptr clone() const override
Returns a clone of the inversion element.
SymmetryElementInversion(const V3R &inversionPoint=V3R(0, 0, 0))
Constructor with inversion point, default is (0,0,0).
SymmetryElementMirror(const std::string &symbol, const V3R &axis, const V3R &translation=V3R(0, 0, 0))
Constructor for mirror planes.
SymmetryElement_sptr clone() const override
Returns a clone of the mirror plane.
SymmetryElementRotation(const std::string &symbol, const V3R &axis, const V3R &translation=V3R(0, 0, 0), const RotationSense &rotationSense=Positive)
Constructor for rotation-,rotoinversion- and screw-axes.
SymmetryElement_sptr clone() const override
Returns a clone of the symmetry element.
SymmetryElementTranslation(const V3R &translation)
Constructor for translation element, requires translation vector.
SymmetryElement_sptr clone() const override
Returns a clone of the translation.
SymmetryElementWithAxis does not represent any symmetry element directly.
void setAxis(const V3R &axis)
Sets the axis, throws std::invalid_argument if the axis is (0,0,0).
SymmetryElementWithAxis(const std::string &symbol, const V3R &axis, const V3R &translation)
Constructor for SymmetryElementWithAxis.
SymmetryElement is an interface for representing symmetry elements that occur for example in space an...
SymmetryElement(std::string symbol)
Constructor with symbol argument.
std::shared_ptr< SymmetryElement > SymmetryElement_sptr
STL namespace.