From b7e5abbbace0db353811a2e849590631faa7b4f7 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Tue, 1 Sep 2015 19:21:52 +0200 Subject: [PATCH] set/get material names --- libsrc/meshing/meshclass.cpp | 4 ++++ libsrc/meshing/python_mesh.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index 1dbd1b2d..c344d65a 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -5595,6 +5595,10 @@ namespace netgen if ( !bcnames.Size() ) return defaultstring; + + if (bcnr < 0 || bcnr >= bcnames.Size()) + throw NgException ("illegal bc-number"); + if ( bcnames[bcnr] ) return *bcnames[bcnr]; else diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index 11c82c2b..e27d3433 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -317,7 +317,12 @@ DLL_HEADER void ExportNetgenMeshing() })) .def ("SetBCName", &Mesh::SetBCName) - + .def ("GetBCName", FunctionPointer([](Mesh & self, int bc)->string + { return self.GetBCName(bc); })) + .def ("SetMaterial", &Mesh::SetMaterial) + .def ("GetMaterial", FunctionPointer([](Mesh & self, int domnr) + { return string(self.GetMaterial(domnr)); })) + .def ("GenerateVolumeMesh", FunctionPointer ([](Mesh & self) {