From 02fd6d2712f108b3071dc6189b49f1d5bd4bceb9 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 21 Nov 2016 14:54:11 +0100 Subject: [PATCH 1/2] export edgenr to python as well --- libsrc/meshing/python_mesh.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index 7d581090..9bd09d3b 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -195,12 +195,13 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) py::class_(m, "Element1D") .def("__init__", - [](Segment *instance, py::list vertices, py::list surfaces, int index) + [](Segment *instance, py::list vertices, py::list surfaces, int index, int edgenr) { new (instance) Segment(); for (int i = 0; i < 2; i++) (*instance)[i] = py::extract(vertices[i])(); instance -> si = index; + instance -> edgenr = edgenr; if (len(surfaces)) { instance->surfnr1 = py::extract(surfaces[0])(); @@ -210,6 +211,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) py::arg("vertices"), py::arg("surfaces")=py::list(), py::arg("index")=1, + py:: arg("edgenr")=-1, "create segment element" ) .def("__repr__", &ToString) @@ -231,8 +233,12 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) })) .def_property_readonly("index", FunctionPointer([](const Segment &self) -> size_t { - return self.edgenr; + return self.si; })) + .def_property_readonly("edgenr", FunctionPointer([](const Segment & self) -> size_t + { + return self.edgenr; + })) ; From 61e13dbc8b5dc803a67188a7f66f4b1aefd06474 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 21 Nov 2016 16:35:46 +0100 Subject: [PATCH 2/2] remove edgenr at constructor --- libsrc/meshing/python_mesh.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index 9bd09d3b..769655f4 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -195,13 +195,14 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) py::class_(m, "Element1D") .def("__init__", - [](Segment *instance, py::list vertices, py::list surfaces, int index, int edgenr) + [](Segment *instance, py::list vertices, py::list surfaces, int index) { new (instance) Segment(); for (int i = 0; i < 2; i++) (*instance)[i] = py::extract(vertices[i])(); instance -> si = index; - instance -> edgenr = edgenr; + // needed for codim2 in 3d + instance -> edgenr = index; if (len(surfaces)) { instance->surfnr1 = py::extract(surfaces[0])(); @@ -211,7 +212,6 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) py::arg("vertices"), py::arg("surfaces")=py::list(), py::arg("index")=1, - py:: arg("edgenr")=-1, "create segment element" ) .def("__repr__", &ToString)