enable tables to disable edge/face generation if not needed

This commit is contained in:
Joachim Schöberl 2018-03-11 16:28:43 +01:00
parent 777b5ed216
commit 07b84024ca
2 changed files with 11 additions and 3 deletions

View File

@ -122,7 +122,6 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
py::class_<Transformation<3>> (m, "Trafo") py::class_<Transformation<3>> (m, "Trafo")
.def(py::init<Vec<3>>()) .def(py::init<Vec<3>>())
.def("__call__", [] (Transformation<3> trafo, Point<3> p) { return trafo(p); }) .def("__call__", [] (Transformation<3> trafo, Point<3> p) { return trafo(p); })
// .def ("__str__", &ToString<Transformation<3>>)
; ;
m.def ("SetTransformation", FunctionPointer m.def ("SetTransformation", FunctionPointer
@ -786,6 +785,15 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
} }
)) ))
.def ("EnableTable", [] (Mesh & self, string name, bool set)
{
if (name == "edges")
const_cast<MeshTopology&>(self.GetTopology()).SetBuildEdges(set);
if (name == "faces")
const_cast<MeshTopology&>(self.GetTopology()).SetBuildFaces(set);
},
py::arg("name"), py::arg("set")=true)
.def ("Scale", FunctionPointer([](Mesh & self, double factor) .def ("Scale", FunctionPointer([](Mesh & self, double factor)
{ {
for(auto i = 0; i<self.GetNP();i++) for(auto i = 0; i<self.GetNP();i++)

View File

@ -44,8 +44,8 @@ namespace netgen
MeshTopology :: MeshTopology (const Mesh & amesh) MeshTopology :: MeshTopology (const Mesh & amesh)
: mesh(&amesh) : mesh(&amesh)
{ {
buildedges = 1; buildedges = true;
buildfaces = 1; buildfaces = true;
timestamp = -1; timestamp = -1;
} }