diff --git a/libsrc/include/nginterface_v2.hpp b/libsrc/include/nginterface_v2.hpp index 6c70a9ef..d06c7de9 100644 --- a/libsrc/include/nginterface_v2.hpp +++ b/libsrc/include/nginterface_v2.hpp @@ -389,6 +389,8 @@ namespace netgen // also added from nginterface.h, still 1-based, need redesign void HPRefinement (int levels, double parameter = 0.125, bool setorders = true,bool ref_level = false); + void SplitAlefeld (); + size_t GetNP() const; int GetSurfaceElementSurfaceNumber (size_t ei) const; int GetSurfaceElementFDNumber (size_t ei) const; diff --git a/libsrc/interface/nginterface.cpp b/libsrc/interface/nginterface.cpp index 4da0eed9..c76a94d4 100644 --- a/libsrc/interface/nginterface.cpp +++ b/libsrc/interface/nginterface.cpp @@ -1122,7 +1122,7 @@ void Ng_HPRefinement (int levels, double parameter, bool setorders, { NgLock meshlock (mesh->MajorMutex(), true); Refinement & ref = const_cast (mesh->GetGeometry()->GetRefinement()); - HPRefinement (*mesh, &ref, levels, parameter, setorders, ref_level); + HPRefinement (*mesh, &ref, SPLIT_HP, levels, parameter, setorders, ref_level); /* Refinement * ref; diff --git a/libsrc/interface/nginterface_v2.cpp b/libsrc/interface/nginterface_v2.cpp index a953dce0..c2f295bb 100644 --- a/libsrc/interface/nginterface_v2.cpp +++ b/libsrc/interface/nginterface_v2.cpp @@ -1226,8 +1226,16 @@ namespace netgen { NgLock meshlock (mesh->MajorMutex(), true); Refinement & ref = const_cast (mesh->GetGeometry()->GetRefinement()); - ::netgen::HPRefinement (*mesh, &ref, levels, parameter, setorders, ref_level); + ::netgen::HPRefinement (*mesh, &ref, SPLIT_HP, levels, parameter, setorders, ref_level); } + + void Ngx_Mesh::SplitAlefeld () + { + NgLock meshlock (mesh->MajorMutex(), true); + Refinement & ref = const_cast (mesh->GetGeometry()->GetRefinement()); + ::netgen::HPRefinement (*mesh, &ref, SPLIT_ALEFELD, 1, 0.5, true, true); + } + int Ngx_Mesh::GetElementOrder (int enr) const { diff --git a/libsrc/meshing/hprefinement.cpp b/libsrc/meshing/hprefinement.cpp index a3b38f1e..583ed5cb 100644 --- a/libsrc/meshing/hprefinement.cpp +++ b/libsrc/meshing/hprefinement.cpp @@ -557,7 +557,7 @@ namespace netgen NgBitArray & cornerpoint, NgBitArray & edgepoint, INDEX_3_HASHTABLE & faces, INDEX_2_HASHTABLE & face_edges, INDEX_2_HASHTABLE & surf_edges, NgArray & facepoint, int & levels, int & act_ref); - bool ClassifyHPElements (Mesh & mesh, NgArray & elements, int & act_ref, int & levels); + bool ClassifyHPElements (Mesh & mesh, NgArray & elements, SplittingType split, int & act_ref, int & levels); void InitHPElements(Mesh & mesh, NgArray & elements) @@ -1309,7 +1309,8 @@ namespace netgen /* ***************************** HPRefinement ********************************** */ - void HPRefinement (Mesh & mesh, Refinement * ref, int levels, double fac1, bool setorders, bool reflevels) + void HPRefinement (Mesh & mesh, Refinement * ref, SplittingType split, + int levels, double fac1, bool setorders, bool reflevels) { PrintMessage (1, "HP Refinement called, levels = ", levels); @@ -1336,12 +1337,12 @@ namespace netgen nplevel.Append (mesh.GetNP()); int act_ref=1; - bool sing = ClassifyHPElements (mesh,hpelements, act_ref, levels); + bool sing = ClassifyHPElements (mesh,hpelements, split, act_ref, levels); sing = true; // iterate at least once while(sing) { - PrintMessage(0, " Start new hp-refinement: step ", act_ref); + PrintMessage(3, " Start new hp-refinement: step ", act_ref); DoRefinement (mesh, hpelements, ref, fac1); DoRefineDummies (mesh, hpelements, ref); @@ -1445,7 +1446,7 @@ namespace netgen act_ref++; - sing = ClassifyHPElements(mesh,hpelements, act_ref, levels); + sing = ClassifyHPElements(mesh,hpelements, split, act_ref, levels); } PrintMessage(3, " HP-Refinement done with ", --act_ref, " refinement steps."); @@ -1824,9 +1825,8 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE & edges, INDEX_2_HAS - bool ClassifyHPElements (Mesh & mesh, NgArray & elements, int & act_ref, int & levels) + bool ClassifyHPElements (Mesh & mesh, NgArray & elements, SplittingType split, int & act_ref, int & levels) { - cout << "in classify" << endl; INDEX_2_HASHTABLE edges(mesh.GetNSeg()+1); NgBitArray edgepoint(mesh.GetNP()); INDEX_2_HASHTABLE edgepoint_dom(mesh.GetNSeg()+1); @@ -1846,8 +1846,8 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE & edges, INDEX_2_HAS cornerpoint, edgepoint, faces, face_edges, surf_edges, facepoint, levels, act_ref); - if (act_ref == 1) - sing = true; // Joachim + if (act_ref == 1 && split == SPLIT_ALEFELD) + sing = true; if(sing==0) return(sing); int cnt_undef = 0, cnt_nonimplement = 0; @@ -1894,13 +1894,14 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE & edges, INDEX_2_HAS case HP_TRIG: { int dim = mesh.GetDimension(); - const FaceDescriptor & fd = mesh.GetFaceDescriptor (hpel.GetIndex()); - hpel.type = HP_TRIG_ALEFELD; - - /* - hpel.type = ClassifyTrig(hpel, edges, edgepoint_dom, cornerpoint, edgepoint, - faces, face_edges, surf_edges, facepoint, dim, fd); - */ + const FaceDescriptor & fd = mesh.GetFaceDescriptor (hpel.GetIndex()); + + if (split == SPLIT_HP) + hpel.type = ClassifyTrig(hpel, edges, edgepoint_dom, cornerpoint, edgepoint, + faces, face_edges, surf_edges, facepoint, dim, fd); + else + hpel.type = HP_TRIG_ALEFELD; + dd = 2; continue; break; diff --git a/libsrc/meshing/hprefinement.hpp b/libsrc/meshing/hprefinement.hpp index c03a2ba9..3095a38b 100644 --- a/libsrc/meshing/hprefinement.hpp +++ b/libsrc/meshing/hprefinement.hpp @@ -313,9 +313,16 @@ public: }; -DLL_HEADER extern void HPRefinement (Mesh & mesh, Refinement * ref, int levels, +enum SplittingType { SPLIT_HP, SPLIT_ALEFELD }; + +DLL_HEADER extern void HPRefinement (Mesh & mesh, Refinement * ref, SplittingType split, int levels, double fac1=0.125, bool setorders=true, bool ref_level = false); +inline void HPRefinement (Mesh & mesh, Refinement * ref, int levels, + double fac1=0.125, bool setorders=true, bool ref_level = false) +{ + HPRefinement (mesh, ref, SPLIT_HP, levels, fac1, setorders, ref_level); +} #endif