disable edge/faces tables for Mesh class

This commit is contained in:
Joachim Schoeberl 2021-05-06 21:46:56 +02:00
parent 786013c857
commit 5af2413481
3 changed files with 23 additions and 16 deletions

View File

@ -1127,22 +1127,14 @@ project_boundaries : Optional[str] = None
)delimiter") )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) .def ("EnableTable", [] (Mesh & self, string name, bool set)
{ {
const_cast<MeshTopology&>(self.GetTopology()).EnableTable(name, set); const_cast<MeshTopology&>(self.GetTopology()).EnableTable(name, set);
/*
if (name == "edges")
const_cast<MeshTopology&>(self.GetTopology()).SetBuildEdges(set);
else if (name == "faces")
const_cast<MeshTopology&>(self.GetTopology()).SetBuildFaces(set);
else if (name == "parentedges")
const_cast<MeshTopology&>(self.GetTopology()).SetBuildParentEdges(set);
else if (name == "parentfaces")
const_cast<MeshTopology&>(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) py::arg("name"), py::arg("set")=true)

View File

@ -45,8 +45,8 @@ namespace netgen
MeshTopology :: MeshTopology (const Mesh & amesh) MeshTopology :: MeshTopology (const Mesh & amesh)
: mesh(&amesh) : mesh(&amesh)
{ {
buildedges = true; buildedges = static_buildedges;
buildfaces = true; buildfaces = static_buildfaces;
timestamp = -1; timestamp = -1;
} }
@ -71,6 +71,19 @@ namespace netgen
"knwon are 'edges', 'faces', 'parentedges', 'parentfaces'"); "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 <typename FUNC> template <typename FUNC>

View File

@ -47,6 +47,7 @@ class MeshTopology
bool buildfaces; bool buildfaces;
bool build_parent_edges = false; // may be changed to default = false bool build_parent_edges = false; // may be changed to default = false
bool build_parent_faces = 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<INDEX_2> edge2vert; NgArray<INDEX_2> edge2vert;
NgArray<INDEX_4> face2vert; NgArray<INDEX_4> face2vert;
@ -86,6 +87,7 @@ public:
void SetBuildParentFaces (bool bh) { build_parent_faces = bh; } void SetBuildParentFaces (bool bh) { build_parent_faces = bh; }
void EnableTable (string name, bool set); void EnableTable (string name, bool set);
static void EnableTableStatic (string name, bool set);
bool HasEdges () const { return buildedges; } bool HasEdges () const { return buildedges; }
bool HasFaces () const { return buildfaces; } bool HasFaces () const { return buildfaces; }