From 5af24134812c7ad33dd6b09a3428c92492cccad6 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Thu, 6 May 2021 21:46:56 +0200 Subject: [PATCH] disable edge/faces tables for Mesh class --- libsrc/meshing/python_mesh.cpp | 18 +++++------------- libsrc/meshing/topology.cpp | 19 ++++++++++++++++--- libsrc/meshing/topology.hpp | 2 ++ 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index fd88061c..7fa34d81 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -1127,22 +1127,14 @@ project_boundaries : Optional[str] = None )delimiter") + .def_static ("EnableTableClass", [] (string name, bool set) + { + MeshTopology::EnableTableStatic(name, set); + }, + py::arg("name"), py::arg("set")=true) .def ("EnableTable", [] (Mesh & self, string name, bool set) { const_cast(self.GetTopology()).EnableTable(name, set); - /* - if (name == "edges") - const_cast(self.GetTopology()).SetBuildEdges(set); - else if (name == "faces") - const_cast(self.GetTopology()).SetBuildFaces(set); - else if (name == "parentedges") - const_cast(self.GetTopology()).SetBuildParentEdges(set); - else if (name == "parentfaces") - const_cast(self.GetTopology()).SetBuildParentFaces(set); - else - throw Exception ("noting known about table "+name +"\n" - "knwon are 'edges', 'faces', 'parentedges', 'parentfaces'"); - */ }, py::arg("name"), py::arg("set")=true) diff --git a/libsrc/meshing/topology.cpp b/libsrc/meshing/topology.cpp index 1a3c462e..72b3c6b1 100644 --- a/libsrc/meshing/topology.cpp +++ b/libsrc/meshing/topology.cpp @@ -41,12 +41,12 @@ namespace netgen - + MeshTopology :: MeshTopology (const Mesh & amesh) : mesh(&amesh) { - buildedges = true; - buildfaces = true; + buildedges = static_buildedges; + buildfaces = static_buildfaces; timestamp = -1; } @@ -71,6 +71,19 @@ namespace netgen "knwon are 'edges', 'faces', 'parentedges', 'parentfaces'"); } + bool MeshTopology :: static_buildedges = false; + bool MeshTopology :: static_buildfaces = false; + + void MeshTopology :: EnableTableStatic (string name, bool set) + { + if (name == "edges") + static_buildedges = set; + else if (name == "faces") + static_buildfaces = set; + else + throw Exception ("noting known about table "+name +"\n" + "knwon are 'edges', 'faces'"); + } template diff --git a/libsrc/meshing/topology.hpp b/libsrc/meshing/topology.hpp index 53fbc0ff..a9864a90 100644 --- a/libsrc/meshing/topology.hpp +++ b/libsrc/meshing/topology.hpp @@ -47,6 +47,7 @@ class MeshTopology bool buildfaces; bool build_parent_edges = false; // may be changed to default = false bool build_parent_faces = false; // may be changed to default = false + static bool static_buildedges, static_buildfaces; NgArray edge2vert; NgArray face2vert; @@ -86,6 +87,7 @@ public: void SetBuildParentFaces (bool bh) { build_parent_faces = bh; } void EnableTable (string name, bool set); + static void EnableTableStatic (string name, bool set); bool HasEdges () const { return buildedges; } bool HasFaces () const { return buildfaces; }