enum for macro-based element splitting

This commit is contained in:
Joachim Schoeberl 2023-07-12 17:26:32 -07:00
parent 82e88f3afb
commit 5b19ea6451
5 changed files with 37 additions and 19 deletions

View File

@ -389,6 +389,8 @@ namespace netgen
// also added from nginterface.h, still 1-based, need redesign // also added from nginterface.h, still 1-based, need redesign
void HPRefinement (int levels, double parameter = 0.125, void HPRefinement (int levels, double parameter = 0.125,
bool setorders = true,bool ref_level = false); bool setorders = true,bool ref_level = false);
void SplitAlefeld ();
size_t GetNP() const; size_t GetNP() const;
int GetSurfaceElementSurfaceNumber (size_t ei) const; int GetSurfaceElementSurfaceNumber (size_t ei) const;
int GetSurfaceElementFDNumber (size_t ei) const; int GetSurfaceElementFDNumber (size_t ei) const;

View File

@ -1122,7 +1122,7 @@ void Ng_HPRefinement (int levels, double parameter, bool setorders,
{ {
NgLock meshlock (mesh->MajorMutex(), true); NgLock meshlock (mesh->MajorMutex(), true);
Refinement & ref = const_cast<Refinement&> (mesh->GetGeometry()->GetRefinement()); Refinement & ref = const_cast<Refinement&> (mesh->GetGeometry()->GetRefinement());
HPRefinement (*mesh, &ref, levels, parameter, setorders, ref_level); HPRefinement (*mesh, &ref, SPLIT_HP, levels, parameter, setorders, ref_level);
/* /*
Refinement * ref; Refinement * ref;

View File

@ -1226,8 +1226,16 @@ namespace netgen
{ {
NgLock meshlock (mesh->MajorMutex(), true); NgLock meshlock (mesh->MajorMutex(), true);
Refinement & ref = const_cast<Refinement&> (mesh->GetGeometry()->GetRefinement()); Refinement & ref = const_cast<Refinement&> (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<Refinement&> (mesh->GetGeometry()->GetRefinement());
::netgen::HPRefinement (*mesh, &ref, SPLIT_ALEFELD, 1, 0.5, true, true);
}
int Ngx_Mesh::GetElementOrder (int enr) const int Ngx_Mesh::GetElementOrder (int enr) const
{ {

View File

@ -557,7 +557,7 @@ namespace netgen
NgBitArray & cornerpoint, NgBitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges, NgBitArray & cornerpoint, NgBitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
INDEX_2_HASHTABLE<int> & surf_edges, NgArray<int, PointIndex::BASE> & facepoint, int & levels, int & act_ref); INDEX_2_HASHTABLE<int> & surf_edges, NgArray<int, PointIndex::BASE> & facepoint, int & levels, int & act_ref);
bool ClassifyHPElements (Mesh & mesh, NgArray<HPRefElement> & elements, int & act_ref, int & levels); bool ClassifyHPElements (Mesh & mesh, NgArray<HPRefElement> & elements, SplittingType split, int & act_ref, int & levels);
void InitHPElements(Mesh & mesh, NgArray<HPRefElement> & elements) void InitHPElements(Mesh & mesh, NgArray<HPRefElement> & elements)
@ -1309,7 +1309,8 @@ namespace netgen
/* ***************************** HPRefinement ********************************** */ /* ***************************** 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); PrintMessage (1, "HP Refinement called, levels = ", levels);
@ -1336,12 +1337,12 @@ namespace netgen
nplevel.Append (mesh.GetNP()); nplevel.Append (mesh.GetNP());
int act_ref=1; 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 sing = true; // iterate at least once
while(sing) 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); DoRefinement (mesh, hpelements, ref, fac1);
DoRefineDummies (mesh, hpelements, ref); DoRefineDummies (mesh, hpelements, ref);
@ -1445,7 +1446,7 @@ namespace netgen
act_ref++; 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."); PrintMessage(3, " HP-Refinement done with ", --act_ref, " refinement steps.");
@ -1824,9 +1825,8 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
bool ClassifyHPElements (Mesh & mesh, NgArray<HPRefElement> & elements, int & act_ref, int & levels) bool ClassifyHPElements (Mesh & mesh, NgArray<HPRefElement> & elements, SplittingType split, int & act_ref, int & levels)
{ {
cout << "in classify" << endl;
INDEX_2_HASHTABLE<int> edges(mesh.GetNSeg()+1); INDEX_2_HASHTABLE<int> edges(mesh.GetNSeg()+1);
NgBitArray edgepoint(mesh.GetNP()); NgBitArray edgepoint(mesh.GetNP());
INDEX_2_HASHTABLE<int> edgepoint_dom(mesh.GetNSeg()+1); INDEX_2_HASHTABLE<int> edgepoint_dom(mesh.GetNSeg()+1);
@ -1846,8 +1846,8 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
cornerpoint, edgepoint, faces, face_edges, cornerpoint, edgepoint, faces, face_edges,
surf_edges, facepoint, levels, act_ref); surf_edges, facepoint, levels, act_ref);
if (act_ref == 1) if (act_ref == 1 && split == SPLIT_ALEFELD)
sing = true; // Joachim sing = true;
if(sing==0) return(sing); if(sing==0) return(sing);
int cnt_undef = 0, cnt_nonimplement = 0; int cnt_undef = 0, cnt_nonimplement = 0;
@ -1894,13 +1894,14 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
case HP_TRIG: case HP_TRIG:
{ {
int dim = mesh.GetDimension(); int dim = mesh.GetDimension();
const FaceDescriptor & fd = mesh.GetFaceDescriptor (hpel.GetIndex()); const FaceDescriptor & fd = mesh.GetFaceDescriptor (hpel.GetIndex());
hpel.type = HP_TRIG_ALEFELD;
if (split == SPLIT_HP)
/* hpel.type = ClassifyTrig(hpel, edges, edgepoint_dom, cornerpoint, edgepoint,
hpel.type = ClassifyTrig(hpel, edges, edgepoint_dom, cornerpoint, edgepoint, faces, face_edges, surf_edges, facepoint, dim, fd);
faces, face_edges, surf_edges, facepoint, dim, fd); else
*/ hpel.type = HP_TRIG_ALEFELD;
dd = 2; dd = 2;
continue; continue;
break; break;

View File

@ -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); 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 #endif