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