From 8d51db278fb130afa43cce8557756d65c2f41d7a Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 16 Jun 2021 10:48:38 +0200 Subject: [PATCH] debugging header for utility functions --- libsrc/meshing/debugging.hpp | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 libsrc/meshing/debugging.hpp diff --git a/libsrc/meshing/debugging.hpp b/libsrc/meshing/debugging.hpp new file mode 100644 index 00000000..941f4beb --- /dev/null +++ b/libsrc/meshing/debugging.hpp @@ -0,0 +1,51 @@ +#include + + +namespace netgen +{ + inline unique_ptr GetOpenElements( const Mesh & m, int dom = 0 ) + { + static Timer t("GetOpenElements"); RegionTimer rt(t); + auto mesh = make_unique(); + *mesh = m; + + Array interesting_points(mesh->GetNP()); + interesting_points = false; + + mesh->FindOpenElements(dom); + NgArray openelements; + openelements = mesh->OpenElements(); + + for (auto & el : openelements) + for (auto i : el.PNums()) + interesting_points[i] = true; + + for (auto & el : mesh->VolumeElements()) + { + int num_interesting_points = 0; + + for (auto pi : el.PNums()) + if(interesting_points[pi]) + num_interesting_points++; + + if(num_interesting_points==0) + el.Delete(); + el.SetIndex(num_interesting_points); + } + + mesh->SetMaterial(1, "1_point"); + mesh->SetMaterial(2, "2_points"); + mesh->SetMaterial(3, "3_points"); + mesh->SetMaterial(4, "4_points"); + mesh->Compress(); + + mesh->ClearSurfaceElements(); + + for (auto & el : openelements) + mesh->AddSurfaceElement( el ); + + return mesh; + } + + +}