Mantid
Loading...
Searching...
No Matches
SymmetryOperation.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 +
11
12#include <boost/python/class.hpp>
13#include <boost/python/enum.hpp>
14#include <boost/python/list.hpp>
15#include <boost/python/register_ptr_to_python.hpp>
16#include <boost/python/scope.hpp>
17
20
21using namespace boost::python;
22
23namespace //<unnamed>
24{
25using namespace Mantid::PythonInterface;
26
27Mantid::Kernel::V3D applyToVector(const SymmetryOperation &self, const object &hkl) {
28 return self.transformHKL(Converters::PyObjectToV3D(hkl)());
29}
30
31Mantid::Kernel::V3D applyToCoordinates(const SymmetryOperation &self, const object &coordinates) {
32 return self.operator*<Mantid::Kernel::V3D>(Converters::PyObjectToV3D(coordinates)());
33}
34} // namespace
35
37 register_ptr_to_python<std::shared_ptr<SymmetryOperation>>();
38
39 class_<SymmetryOperation>("SymmetryOperation")
40 .def("getOrder", &SymmetryOperation::order, arg("self"),
41 "Returns the order of the symmetry operation, which indicates how "
42 "often the operation needs to be applied to a point to arrive at "
43 "identity.")
44 .def("getIdentifier", &SymmetryOperation::identifier, arg("self"),
45 "The identifier of the operation in x,y,z-notation.")
46 .def("transformCoordinates", &applyToCoordinates, (arg("self"), arg("coordinates")),
47 "Returns transformed coordinates. For transforming HKLs, use "
48 "transformHKL.")
49 .def("transformHKL", &applyToVector, (arg("self"), arg("hkl")),
50 "Returns transformed HKLs. For transformation of coordinates use "
51 "transformCoordinates.")
52 .def("apply", &applyToVector, (arg("self"), arg("hkl")), "An alias for transformHKL.");
53
55}
void export_SymmetryOperation()
Crystallographic symmetry operations are composed of a rotational component, which is represented by ...
std::string identifier() const
Returns the string-identifier for this symmetry operation.
Kernel::V3D transformHKL(const Kernel::V3D &hkl) const
Transforms an index triplet hkl.
size_t order() const
Returns the order of the symmetry operation.
Class for 3D vectors.
Definition: V3D.h:34
Takes a Python object and if it supports indexing and is of length 3 then it will attempt to convert ...
Definition: PyObjectToV3D.h:22
A struct to help export std::vector types.
static void wrap(std::string const &python_name)
a python wrapper