diff --git a/libsrc/include/nginterface_v2_impl.hpp b/libsrc/include/nginterface_v2_impl.hpp index b71560f9..45baf3b3 100644 --- a/libsrc/include/nginterface_v2_impl.hpp +++ b/libsrc/include/nginterface_v2_impl.hpp @@ -13,10 +13,16 @@ NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<0> (size_t nr) const template <> NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<1> (size_t nr) const { + /* if(mesh->GetDimension()==3) return (*mesh)[SegmentIndex(nr)].edgenr; else return (*mesh)[SegmentIndex(nr)].si; + */ + if(mesh->GetDimension()==3) + return mesh->LineSegments()[nr].edgenr; + else + return mesh->LineSegments()[nr].si; } template <> @@ -66,7 +72,8 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<0> (size_t nr) const template <> NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (size_t nr) const { - const Segment & el = mesh->LineSegment (SegmentIndex(nr)); + // const Segment & el = mesh->LineSegment (SegmentIndex(nr)); + const Segment & el = mesh->LineSegments()[nr]; Ng_Element ret; ret.type = NG_ELEMENT_TYPE(el.GetType()); diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index 563a5591..60866ca8 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -33,7 +33,7 @@ namespace netgen T_POINTS points; /// line-segments at edges - Array segments; + Array segments; /// surface elements, 2d-inner elements T_SURFELEMENTS surfelements; /// volume elements @@ -255,8 +255,12 @@ namespace netgen const Segment & operator[] (SegmentIndex si) const { return segments[si]; } Segment & operator[] (SegmentIndex si) { return segments[si]; } + /* const Array & LineSegments() const { return segments; } Array & LineSegments() { return segments; } + */ + const auto & LineSegments() const { return segments; } + auto & LineSegments() { return segments; } Array pointelements; // only via python interface diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index b3a7210a..c4277474 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -425,7 +425,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) ExportArray(m); ExportArray(m); - ExportArray(m); + ExportArray(m); ExportArray(m); ExportArray(m); ExportArray(m); @@ -553,7 +553,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) py::return_value_policy::reference) .def("Elements1D", - static_cast&(Mesh::*)()> (&Mesh::LineSegments), + static_cast&(Mesh::*)()> (&Mesh::LineSegments), py::return_value_policy::reference) .def("Elements0D", FunctionPointer([] (Mesh & self) -> Array&