From 781ea7103eac1c88694ee4b52472b2d9963c38d9 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Fri, 10 Sep 2021 12:42:41 +0200 Subject: [PATCH] FaceDescriptor array to Python --- libsrc/meshing/meshclass.hpp | 12 ++++++++---- libsrc/meshing/python_mesh.cpp | 7 +++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index c6d40df9..1a6b9e80 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -81,7 +81,7 @@ namespace netgen the face-index of the surface element maps into this table. */ - NgArray facedecoding; + Array facedecoding; /** @@ -712,15 +712,19 @@ namespace netgen { return facedecoding.Size(); } const FaceDescriptor & GetFaceDescriptor (int i) const - { return facedecoding.Get(i); } + { return facedecoding[i-1]; } + // { return facedecoding.Get(i); } + + auto & FaceDescriptors () const { return facedecoding; } const EdgeDescriptor & GetEdgeDescriptor (int i) const { return edgedecoding[i]; } /// - FaceDescriptor & GetFaceDescriptor (int i) - { return facedecoding.Elem(i); } + FaceDescriptor & GetFaceDescriptor (int i) + { return facedecoding[i-1]; } + // { return facedecoding.Elem(i); } int IdentifyPeriodicBoundaries(const string& s1, const string& s2, diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index f0a761df..84b77622 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -848,6 +848,13 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) .def("FaceDescriptor", static_cast (&Mesh::GetFaceDescriptor), py::return_value_policy::reference) .def("GetNFaceDescriptors", &Mesh::GetNFD) + + .def("FaceDescriptors", + // static_cast&(Mesh::*)()> (&Mesh::FaceDescriptors), + &Mesh::FaceDescriptors, + py::return_value_policy::reference) + + .def("GetNDomains", &Mesh::GetNDomains) .def("GetVolumeNeighboursOfSurfaceElement", [](Mesh & self, size_t sel)