mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 22:20:35 +05:00
Merge branch 'getitemMeshPoint' into 'master'
Getitem mesh point getitem for more intuitive access to point coordinates See merge request !7
This commit is contained in:
commit
38b6f377ff
@ -106,13 +106,18 @@ DLL_HEADER void ExportNetgenMeshing()
|
|||||||
.def("__str__", &ToString<MeshPoint>)
|
.def("__str__", &ToString<MeshPoint>)
|
||||||
.def("__repr__", &ToString<MeshPoint>)
|
.def("__repr__", &ToString<MeshPoint>)
|
||||||
.add_property("p", FunctionPointer([](const MeshPoint & self)
|
.add_property("p", FunctionPointer([](const MeshPoint & self)
|
||||||
{
|
{
|
||||||
bp::list l;
|
bp::list l;
|
||||||
l.append ( self[0] );
|
l.append ( self[0] );
|
||||||
l.append ( self[1] );
|
l.append ( self[1] );
|
||||||
l.append ( self[2] );
|
l.append ( self[2] );
|
||||||
return bp::tuple(l);
|
return bp::tuple(l);
|
||||||
}))
|
}))
|
||||||
|
.def("__getitem__", FunctionPointer([](const MeshPoint & self, int index) {
|
||||||
|
if(index<0 || index>2)
|
||||||
|
bp::exec("raise IndexError()\n");
|
||||||
|
return self[index];
|
||||||
|
}))
|
||||||
;
|
;
|
||||||
|
|
||||||
bp::class_<Element>("Element3D")
|
bp::class_<Element>("Element3D")
|
||||||
|
Loading…
Reference in New Issue
Block a user