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")
.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<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)

View File

@ -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 <typename FUNC>

View File

@ -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<INDEX_2> edge2vert;
NgArray<INDEX_4> 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; }