From 15ddc4294bc19b95b4b970434eff87f40c61048c Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 11 Sep 2023 16:05:31 +0200 Subject: [PATCH] marked elements now in BisectionInfo member of meshclass instead of global --- libsrc/meshing/bisect.cpp | 65 ++++++++++++++++++++++-------------- libsrc/meshing/meshclass.hpp | 25 ++++++++++++++ 2 files changed, 65 insertions(+), 25 deletions(-) diff --git a/libsrc/meshing/bisect.cpp b/libsrc/meshing/bisect.cpp index 5b8abfde..1a835a83 100644 --- a/libsrc/meshing/bisect.cpp +++ b/libsrc/meshing/bisect.cpp @@ -8,20 +8,6 @@ namespace netgen { - class MarkedTet; - class MarkedPrism; - class MarkedIdentification; - class MarkedTri; - class MarkedQuad; - - typedef Array T_MTETS; - typedef NgArray T_MPRISMS; - typedef NgArray T_MIDS; - typedef NgArray T_MTRIS; - typedef NgArray T_MQUADS; - - - class MarkedTet { public: @@ -1867,20 +1853,25 @@ namespace netgen } } + BisectionInfo::BisectionInfo() + { + mtets = make_unique(); + mprisms = make_unique(); + mids = make_unique(); + mtris = make_unique(); + mquads = make_unique(); + } + BisectionInfo::~BisectionInfo() {} - - T_MTETS mtets; - T_MPRISMS mprisms; - T_MIDS mids; - T_MTRIS mtris; - T_MQUADS mquads; - - - void WriteMarkedElements(ostream & ost) + void WriteMarkedElements(const Mesh& mesh, ostream & ost) { ost << "Marked Elements\n"; - + const auto& mtets = *mesh.bisectioninfo.mtets; + const auto& mprisms = *mesh.bisectioninfo.mprisms; + const auto& mids = *mesh.bisectioninfo.mids; + const auto& mtris = *mesh.bisectioninfo.mtris; + const auto& mquads = *mesh.bisectioninfo.mquads; ost << mtets.Size() << "\n"; for(int i=0; i> auxstring; @@ -1964,6 +1961,11 @@ namespace netgen const NgArray< NgArray* > & idmaps, const string & refinfofile) { + auto& mtets = *mesh.bisectioninfo.mtets; + auto& mprisms = *mesh.bisectioninfo.mprisms; + auto& mids = *mesh.bisectioninfo.mids; + auto& mtris = *mesh.bisectioninfo.mtris; + auto& mquads = *mesh.bisectioninfo.mquads; if (mesh.GetDimension() < 2) throw Exception ("Mesh bisection is available in 2D and 3D"); // mtets.SetName ("bisection, tets"); @@ -2475,6 +2477,13 @@ namespace netgen T_MTRIS mtris_old; mtris_old.Copy(mtris); T_MQUADS mquads_old; mquads_old.Copy(mquads); */ + + auto& mtets = *mesh.bisectioninfo.mtets; + auto& mprisms = *mesh.bisectioninfo.mprisms; + auto& mids = *mesh.bisectioninfo.mids; + auto& mtris = *mesh.bisectioninfo.mtris; + auto& mquads = *mesh.bisectioninfo.mquads; + T_MTETS mtets_old (mtets); T_MPRISMS mprisms_old (mprisms); T_MIDS mids_old (mids); @@ -2700,6 +2709,12 @@ namespace netgen PrintMessage(1,"Mesh bisection"); PushStatus("Mesh bisection"); + auto& mtets = *mesh.bisectioninfo.mtets; + auto& mprisms = *mesh.bisectioninfo.mprisms; + auto& mids = *mesh.bisectioninfo.mids; + auto& mtris = *mesh.bisectioninfo.mtris; + auto& mquads = *mesh.bisectioninfo.mquads; + static int timer = NgProfiler::CreateTimer ("Bisect"); static int timer1 = NgProfiler::CreateTimer ("Bisect 1"); static int timer1a = NgProfiler::CreateTimer ("Bisect 1a"); @@ -4104,7 +4119,7 @@ namespace netgen PrintMessage(3,"writing marked-elements information to \"",refelementinfofilewrite,"\""); ofstream ofst(refelementinfofilewrite.c_str()); - WriteMarkedElements(ofst); + WriteMarkedElements(mesh, ofst); ofst.close(); } diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index d6d62ba5..a57de88f 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -35,6 +35,30 @@ namespace netgen class CurvedElements; class AnisotropicClusters; class ParallelMeshTopology; + + class MarkedTet; + class MarkedPrism; + class MarkedIdentification; + class MarkedTri; + class MarkedQuad; + + typedef Array T_MTETS; + typedef NgArray T_MPRISMS; + typedef NgArray T_MIDS; + typedef NgArray T_MTRIS; + typedef NgArray T_MQUADS; + + struct BisectionInfo + { + unique_ptr mtets; + unique_ptr mprisms; + unique_ptr mids; + unique_ptr mtris; + unique_ptr mquads; + + BisectionInfo(); + ~BisectionInfo(); + }; /// 2d/3d mesh class Mesh @@ -186,6 +210,7 @@ namespace netgen public: Signal<> updateSignal; + BisectionInfo bisectioninfo; // store coarse mesh before hp-refinement unique_ptr> hpelements;