mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
export __getitem__ and __len__ for Vec
This commit is contained in:
parent
d113da7739
commit
21ba19bf10
@ -113,6 +113,8 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
.def(-py::self)
|
.def(-py::self)
|
||||||
.def(double()*py::self)
|
.def(double()*py::self)
|
||||||
.def("Norm", &Vec<2>::Length)
|
.def("Norm", &Vec<2>::Length)
|
||||||
|
.def("__getitem__", [](Vec<2>& vec, int index) { return vec[index]; })
|
||||||
|
.def("__len__", [](Vec<2>& /*unused*/) { return 2; })
|
||||||
;
|
;
|
||||||
|
|
||||||
py::class_<Vec<3>> (m, "Vec3d")
|
py::class_<Vec<3>> (m, "Vec3d")
|
||||||
@ -123,6 +125,8 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
.def(-py::self)
|
.def(-py::self)
|
||||||
.def(double()*py::self)
|
.def(double()*py::self)
|
||||||
.def("Norm", &Vec<3>::Length)
|
.def("Norm", &Vec<3>::Length)
|
||||||
|
.def("__getitem__", [](Vec<3>& vec, int index) { return vec[index]; })
|
||||||
|
.def("__len__", [](Vec<3>& /*unused*/) { return 3; })
|
||||||
;
|
;
|
||||||
|
|
||||||
m.def ("Vec", FunctionPointer
|
m.def ("Vec", FunctionPointer
|
||||||
|
Loading…
Reference in New Issue
Block a user