9#include <boost/python/class.hpp>
10#include <boost/python/copy_const_reference.hpp>
11#include <boost/python/make_constructor.hpp>
12#include <boost/python/operators.hpp>
13#include <boost/python/return_arg.hpp>
14#include <boost/python/return_internal_reference.hpp>
15#include <boost/python/return_value_policy.hpp>
30 if (
index < self.getNumDims()) {
44void setItem(VMD &self,
const size_t index,
const VMD_t
value) {
45 if (
index < self.getNumDims()) {
55 class_<VMD>(
"VMD", init<>(arg(
"self"),
"Default constructor gives an object with 1 dimension"))
56 .def(init<VMD_t, VMD_t>(
"Constructs a 2 dimensional vector at the point given",
57 (arg(
"self"), arg(
"val0"), arg(
"val1"))))
58 .def(init<VMD_t, VMD_t, VMD_t>(
"Constructs a 3 dimensional vector at the point given",
59 (arg(
"self"), arg(
"val0"), arg(
"val1"), arg(
"val2"))))
60 .def(init<VMD_t, VMD_t, VMD_t, VMD_t>(
"Constructs a 4 dimensional vector at the point given",
61 (arg(
"self"), arg(
"val0"), arg(
"val1"), arg(
"val2"), arg(
"val3"))))
62 .def(init<VMD_t, VMD_t, VMD_t, VMD_t, VMD_t>(
63 "Constructs a 5 dimensional vector at the point given",
64 (arg(
"self"), arg(
"val0"), arg(
"val1"), arg(
"val2"), arg(
"val3"), arg(
"val4"))))
65 .def(init<VMD_t, VMD_t, VMD_t, VMD_t, VMD_t, VMD_t>(
66 "Constructs a 6 dimensional vector at the point given",
67 (arg(
"self"), arg(
"val0"), arg(
"val1"), arg(
"val2"), arg(
"val3"), arg(
"val4"), arg(
"val5"))))
69 .def(
"getNumDims", &VMD::getNumDims, arg(
"self"),
"Returns the number of dimensions the contained in the vector")
71 .def(
"scalar_prod", &VMD::scalar_prod, (arg(
"self"), arg(
"other")),
72 "Returns the scalar product of this vector with another. If the "
73 "number of dimensions do not match a RuntimeError is raised")
75 .def(
"cross_prod", &VMD::cross_prod, (arg(
"self"), arg(
"other")),
76 "Returns the cross product of this vector with another. If the "
77 "number of dimensions do not match a RuntimeError is raised")
79 .def(
"norm", &VMD::norm, arg(
"self"),
"Returns the length of the vector")
81 .def(
"norm2", &VMD::norm2, arg(
"self"),
"Returns the the squared length of the vector")
83 .def(
"normalize", &VMD::normalize, arg(
"self"),
84 "Normalizes the length of the vector "
85 "to unity and returns the length "
86 "before it was normalized")
88 .def(
"angle", &VMD::angle, (arg(
"self"), arg(
"other")),
89 "Returns the angle between the vectors in "
90 "radians (0 < theta < pi). If the dimensions "
91 "do not match a RuntimeError is raised")
95 .def(
"__getitem__", &
getItem, (arg(
"self"), arg(
"value")))
96 .def(
"__setitem__", &setItem, (arg(
"self"), arg(
"index"), arg(
"value")))
100 .def(
"__add__", &VMD::operator+, (arg(
"left"), arg(
"right")))
101 .def(
"__iadd__", &VMD::operator+=, return_self<>(), (arg(
"self"), arg(
"other")))
102 .def(
"__sub__", &VMD::operator-, (arg(
"left"), arg(
"right")))
103 .def(
"__isub__", &VMD::operator-=, return_self<>(), (arg(
"self"), arg(
"other")))
double value
The value of the point.
std::map< DeltaEMode::Type, std::string > index
PyObject * getItem(WorkspaceGroup &self, const int &index)
#define GNU_DIAG_OFF(x)
This is a collection of macros for turning compiler warnings off in a controlled manner.
float VMD_t
Underlying data type for the VMD type.
std::string to_string(const wide_integer< Bits, Signed > &n)