Merge branch 'uz/splits' into 'master'

Expsosing splits in Netgen and Powell-Sabin split

See merge request ngsolve/netgen!623
This commit is contained in:
Schöberl, Joachim 2024-01-16 12:51:18 +01:00
commit 3dc0383f3f
4 changed files with 73 additions and 21 deletions

View File

@ -775,18 +775,7 @@ HPRef_Struct reftrig_3singedges =
reftrig_3singedges_newels
};
// HP_TRIG_3SINGEDGES
// HP_TRIG_ALFELD
int reftrig_Alfeld_splitedges[][3] =
{
{ 0, 0, 0 }
@ -818,3 +807,42 @@ HPRef_Struct reftrig_Alfeld =
reftrig_Alfeld_newels
};
// HP_TRIG_POWELL
int reftrig_Powell_splitedges[][3] =
{
{ 1, 2, 4 },
{ 2, 3, 5 },
{ 3, 1, 6 },
{ 0, 0, 0 },
};
int reftrig_Powell_splitfaces[][4] =
{
{ 1, 2, 3, 7 },
{ 0, 0, 0, 0 }
};
HPREF_ELEMENT_TYPE reftrig_Powell_newelstypes[] =
{
HP_TRIG, HP_TRIG, HP_TRIG, HP_TRIG, HP_TRIG, HP_TRIG,
HP_NONE,
};
int reftrig_Powell_newels[][8] =
{
{ 1, 4, 7 },
{ 4, 2, 7 },
{ 2, 5, 7 },
{ 5, 3, 7 },
{ 3, 6, 7 },
{ 6, 1, 7 },
};
HPRef_Struct reftrig_Powell =
{
HP_TRIG,
reftrig_Powell_splitedges,
reftrig_Powell_splitfaces,
0,
reftrig_Powell_newelstypes,
reftrig_Powell_newels
};

View File

@ -185,6 +185,8 @@ namespace netgen
case HP_TRIG_ALFELD:
hps = &reftrig_Alfeld; break;
case HP_TRIG_POWELL:
hps = &reftrig_Powell; break;
case HP_QUAD:
@ -675,8 +677,9 @@ namespace netgen
INDEX_3_HASHTABLE<int> newfacepts(elements.Size()+1);
// prepare new points
// fac1 = max(0.001,min(0.33,fac1));
double fac2;
fac2 = max(0.001,min(0.33,fac1));
PrintMessage(3, " in HP-REFINEMENT with fac1 ", fac1);
*testout << " in HP-REFINEMENT with fac1 " << fac1 << endl;
@ -726,8 +729,8 @@ namespace netgen
{
Point<3> np;
for( int l=0;l<3;l++)
np(l) = (1-2*fac1)*mesh.Point(i3.I1())(l)
+ fac1*mesh.Point(i3.I2())(l) + fac1*mesh.Point(i3.I3())(l);
np(l) = (1-2*fac2)*mesh.Point(i3.I1())(l)
+ fac2*mesh.Point(i3.I2())(l) + fac2*mesh.Point(i3.I3())(l);
int npi = mesh.AddPoint (np);
newfacepts.Set (i3, npi);
}
@ -815,9 +818,9 @@ namespace netgen
for (int l = 0; l < 3; l++)
newparam[hprs->splitfaces[j][3]-1][l] =
(1-2*fac1) * el.param[hprs->splitfaces[j][0]-1][l] +
fac1 * el.param[hprs->splitfaces[j][1]-1][l] +
fac1 * el.param[hprs->splitfaces[j][2]-1][l];
(1-2*fac2) * el.param[hprs->splitfaces[j][0]-1][l] +
fac2 * el.param[hprs->splitfaces[j][1]-1][l] +
fac2 * el.param[hprs->splitfaces[j][2]-1][l];
j++;
}
// split elements
@ -1906,6 +1909,8 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
if (act_ref == 1 && split == SPLIT_ALFELD)
sing = true;
if (act_ref == 1 && split == SPLIT_POWELL)
sing = true;
if(sing==0) return(sing);
int cnt_undef = 0, cnt_nonimplement = 0;
@ -1969,8 +1974,10 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
if (split == SPLIT_HP)
hpel.type = ClassifyTrig(hpel, edges, edgepoint_dom, cornerpoint, edgepoint,
faces, face_edges, surf_edges, facepoint, dim, fd);
else
else if (split == SPLIT_ALFELD)
hpel.type = HP_TRIG_ALFELD;
else if (split == SPLIT_POWELL)
hpel.type = HP_TRIG_POWELL;
dd = 2;
break;

View File

@ -46,6 +46,7 @@ enum HPREF_ELEMENT_TYPE {
HP_TRIG_3SINGEDGES = 40,
HP_TRIG_ALFELD,
HP_TRIG_POWELL,
HP_QUAD = 50,
HP_QUAD_SINGCORNER,
@ -347,7 +348,7 @@ public:
};
enum SplittingType { SPLIT_HP, SPLIT_ALFELD };
enum SplittingType { SPLIT_HP, SPLIT_ALFELD, SPLIT_POWELL};
DLL_HEADER extern void HPRefinement (Mesh & mesh, Refinement * ref, SplittingType split, int levels,
double fac1=0.125, bool setorders=true, bool ref_level = false);

View File

@ -1350,7 +1350,23 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
}), py::arg("adaptive")=false, py::call_guard<py::gil_scoped_release>())
.def("ZRefine", &Mesh::ZRefine)
.def("Split2Tets", &Mesh::Split2Tets)
.def ("SplitAlfeld", FunctionPointer
([](Mesh & self)
{
NgLock meshlock (self.MajorMutex(), true);
Refinement & ref = const_cast<Refinement&> (self.GetGeometry()->GetRefinement());
::netgen::HPRefinement (self, &ref, SPLIT_ALFELD, 1, 0.5, true, true);
}
), py::call_guard<py::gil_scoped_release>())
.def ("SplitPowellSabin", FunctionPointer
([](Mesh & self)
{
NgLock meshlock (self.MajorMutex(), true);
Refinement & ref = const_cast<Refinement&> (self.GetGeometry()->GetRefinement());
::netgen::HPRefinement (self, &ref, SPLIT_POWELL, 1, 0.5, true, true);
}
), py::call_guard<py::gil_scoped_release>())
.def ("SecondOrder", [](Mesh & self)
{
self.GetGeometry()->GetRefinement().MakeSecondOrder(self);