more hprefs

This commit is contained in:
Joachim Schoeberl 2023-09-23 21:23:33 +02:00
parent b013a05dd5
commit d123c4a9f3
6 changed files with 365 additions and 23 deletions

View File

@ -20,6 +20,8 @@ HPREF_ELEMENT_TYPE ClassifyTet(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges
if (debug < 4) debug = 0;
*testout << "new el" << endl;
for (int j = 0; j < 4; j++)
for (int k = 0; k < 4; k++)
{
@ -183,7 +185,7 @@ HPREF_ELEMENT_TYPE ClassifyTet(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges
// << isface[0] << isface[1] << isface[2] << isface[3]
// << ", num = " << isface[0]+isface[1]+isface[2]+isface[3] << endl;
bool sp1 = cp1
|| (ep1 && !isedge1 && !isedge2 && !isedge3)
|| (fp1 && !isfedge1 && !isfedge2 && !isfedge3);
@ -206,6 +208,11 @@ HPREF_ELEMENT_TYPE ClassifyTet(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges
bool se4 = isedge4 || (isfedge4 && !isface[0] && !isface[3]);
bool se5 = isedge5 || (isfedge5 && !isface[0] && !isface[2]);
bool se6 = isedge6 || (isfedge6 && !isface[0] && !isface[1]);
*testout << "sp = " << sp1 << sp2 << sp3 << sp4 << endl;
*testout << "se = " << se1 << se2 << se3 << se4 << se5 << se6 << endl;
*testout << "sf = " << isface[0] << isface[1] << isface[2] << isface[3] << endl;
switch (isface[0]+isface[1]+isface[2]+isface[3])
{
@ -399,6 +406,9 @@ HPREF_ELEMENT_TYPE ClassifyTet(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges
type = HP_TET_1F_0E_1VA;
if (!fp1 && ep2 && ep3 & !ep4)
type = HP_TET_1F_0E_2V;
if (!sp1 && sp2 && sp3 && sp4)
type = HP_TET_1F_0E_3V;
break;
}
case 1:
@ -413,6 +423,8 @@ HPREF_ELEMENT_TYPE ClassifyTet(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges
type = HP_TET_1F_1E_2VB;
if (!sp1 && !sp2 && sp3 && sp4)
type = HP_TET_1F_1E_2VC;
if (!sp1 && sp2 && sp3 && sp4)
type = HP_TET_1F_1EA_3V;
}
if (se4) // V2-V3
{
@ -420,6 +432,8 @@ HPREF_ELEMENT_TYPE ClassifyTet(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges
type = HP_TET_1F_1EB_0V;
if (!sp1 && sp2 && !sp3 && !sp4)
type = HP_TET_1F_1E_1VA;
if (!sp1 && sp2 && sp3 && sp4)
type = HP_TET_1F_1E_3V;
}
if (se5) // V2-V4
{
@ -430,12 +444,26 @@ HPREF_ELEMENT_TYPE ClassifyTet(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges
}
case 2:
{
if (isedge1 && isedge2)
{
if (sp1 && sp2 && sp3 && !sp4)
type = HP_TET_1F_2Eoo_3V;
}
if (isedge6 && isedge3)
if (!cp1 && !cp2 && !cp3)
type = HP_TET_1F_2E_0VA;
if (isedge6 && isedge2)
if (!cp1 && !cp2 && !cp4)
type = HP_TET_1F_2E_0VB;
{
if (!cp1 && !cp2 && !cp4)
type = HP_TET_1F_2E_0VB;
}
if (se4 && se5)
{ // 2 edges in face
if (!sp1 && sp2 && !sp3 && !sp4)
type = HP_TET_1F_2E_1V;
if (!sp1 && sp2 && sp3 && sp4)
type = HP_TET_1F_2E_3V;
}
break;
}
default:
@ -525,7 +553,7 @@ HPREF_ELEMENT_TYPE ClassifyTet(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges
<< el.pnums[3] << endl
<< "cp = " << cp1 << cp2 << cp3 << cp4 << endl
<< "ep = " << ep1 << ep2 << ep3 << ep4 << endl
<< "fp = " << fp1 << fp2 << fp3 << fp4 << endl
<< "fp = " << fp1 << fp2 << fp3 << fp4 << endl
<< "isedge = " << isedge1 << isedge2 << isedge3
<< isedge4 << isedge5 << isedge6 << endl
<< "isfedge = " << isfedge1 << isfedge2 << isfedge3
@ -1713,17 +1741,17 @@ HPREF_ELEMENT_TYPE ClassifyHex7 (HPRefElement & el, INDEX_2_HASHTABLE<int> & edg
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)
{
HPREF_ELEMENT_TYPE type = HP_NONE;
// HPREF_ELEMENT_TYPE type = HP_NONE;
// no singular
// singular bottom
// singular top
// indices of bot,top-faces combinations
int index[6][2] = {{0,1},{1,0},{2,4},{4,2},{3,5},{5,3}};
int p[8];
const ELEMENT_FACE * elfaces = MeshTopology::GetFaces1 (HEX);
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges1 (HEX);
// int index[6][2] = {{0,1},{1,0},{2,4},{4,2},{3,5},{5,3}};
// int p[8];
// const ELEMENT_FACE * elfaces = MeshTopology::GetFaces1 (HEX);
// const ELEMENT_EDGE * eledges = MeshTopology::GetEdges1 (HEX);
INDEX_3 fbot = { el.pnums[0], el.pnums[1], el.pnums[2] };
INDEX_3 ftop = { el.pnums[4], el.pnums[5], el.pnums[6] };

View File

@ -78,6 +78,42 @@
// singular face 1-2-5
// HP_PYRAMID_1FB_0E_0V
int refpyramid_1fb_0e_0v_splitedges[][3] =
{
{ 1, 4, 6 },
{ 2, 3, 7 },
{ 5, 3, 8 },
{ 5, 4, 9 },
{ 0, 0, 0 },
};
HPREF_ELEMENT_TYPE refpyramid_1fb_0e_0v_newelstypes[] =
{
HP_HEX7_1FB,
HP_PRISM,
HP_NONE,
};
int refpyramid_1fb_0e_0v_newels[][8] =
{
{ 6, 7, 8, 9, 1, 2, 5 },
{ 3, 7, 8, 4, 6, 9 },
};
HPRef_Struct refpyramid_1fb_0e_0v =
{
HP_PYRAMID,
refpyramid_1fb_0e_0v_splitedges,
0, 0,
refpyramid_1fb_0e_0v_newelstypes,
refpyramid_1fb_0e_0v_newels
};
// singular face 1-2-5 singular point 5
// HP_PYRAMID_1FB_0E_1VA
int refpyramid_1fb_0e_1va_splitedges[][3] =

View File

@ -1,4 +1,157 @@
enum VNUM { V1, V2, V3, V4,
E12, E13, E14,
E21, E23, E24,
E31, E32, E34,
E41, E42, E43,
F123, F124, F134,
F213, F214, F234,
F312, F314, F324,
F412, F413, F423
};
class El
{
public:
HPREF_ELEMENT_TYPE type;
std::vector<VNUM> vertices;
El (HPREF_ELEMENT_TYPE atype,
std::vector<VNUM> avertices)
: type(atype), vertices(avertices) { }
};
extern std::map<HPREF_ELEMENT_TYPE, HPRef_Struct*> & GetHPRegistry();
template <HPREF_ELEMENT_TYPE GEOM>
class HPRefStruct : public HPRef_Struct
{
typedef int int3[3];
typedef int int4[4];
typedef int int8[8];
std::vector<std::array<int,3>> refedges;
std::vector<std::array<int,4>> reffaces;
std::vector<HPREF_ELEMENT_TYPE> neweltypes_vec;
std::vector<std::array<int,8>> newelverts;
public:
HPRefStruct(HPREF_ELEMENT_TYPE type,
std::vector<El> list)
{
GetHPRegistry()[type] = this;
geom = GEOM;
std::map<VNUM, int> mapnums;
int ii = 0;
for (auto v : { V1, V2, V3, V4})
mapnums[v] = ++ii;
for (auto el : list)
for (auto v : el.vertices)
if (mapnums.count(v)==0)
mapnums[v] = ++ii;
int elist[][3] =
{ { 1, 2, E12 },
{ 1, 3, E13 },
{ 1, 4, E14 },
{ 2, 1, E21 },
{ 2, 3, E23 },
{ 2, 4, E24 },
{ 3, 1, E31 },
{ 3, 2, E32 },
{ 3, 4, E34 },
{ 4, 1, E41 },
{ 4, 2, E42 },
{ 4, 3, E43 }
};
int flist[][4] =
{ { 1, 2, 3, F123 },
{ 1, 2, 4, F124 },
{ 1, 3, 4, F134 },
{ 2, 1, 3, F213 },
{ 2, 1, 4, F214 },
{ 2, 3, 4, F234 },
{ 3, 1, 2, F312 },
{ 3, 1, 4, F314 },
{ 3, 2, 4, F324 },
{ 4, 1, 2, F412 },
{ 4, 1, 3, F413 },
{ 4, 2, 3, F423 }
};
for (auto [i1,i2,inew] : elist)
if (mapnums.count(VNUM(inew)))
refedges.push_back( { i1, i2, mapnums[VNUM(inew)] });
refedges.push_back( { 0, 0, 0 } );
splitedges = (int3*) &refedges[0][0];
for (auto [i1,i2,i3,inew] : flist)
if (mapnums.count(VNUM(inew)))
reffaces.push_back( { i1, i2, i3, mapnums[VNUM(inew)] });
reffaces.push_back( { 0, 0, 0 } );
splitfaces = (int4*) &reffaces[0][0];
splitelements = nullptr;
for (auto el : list)
{
neweltypes_vec.push_back (el.type);
std::array<int,8> verts;
for (int j = 0; j < std::min(verts.size(), el.vertices.size()); j++)
verts[j] = mapnums[VNUM(el.vertices[j])];
newelverts.push_back(verts);
}
neweltypes_vec.push_back (HP_NONE);
neweltypes = &neweltypes_vec[0];
newels = (int8*) &newelverts[0][0];
/*
int ind = 0;
cout << "rule, split edges:" << endl;
while (splitedges[ind][0])
{
cout << splitedges[ind][0] << "-" << splitedges[ind][1] << ": " << splitedges[ind][2] << endl;
ind++;
}
ind = 0;
cout << "rule, split faces:" << endl;
while (splitfaces[ind][0])
{
cout << splitfaces[ind][0] << "-" << splitfaces[ind][1]
<< "-" << splitfaces[ind][2] << ": " << splitfaces[ind][3] << endl;
ind++;
}
ind = 0;
cout << "rule, new els:" << endl;
while (neweltypes[ind] != HP_NONE)
{
cout << "new type " << neweltypes[ind] << ", verts: ";
for (int j = 0; j < 8; j++)
cout << newels[ind][j] << " ";
ind++;
}
*/
}
};
// HP_NONETET
int refnonetet_splitedges[][3] =
@ -82,6 +235,16 @@ HPRef_Struct reftet_0e_1v =
reftet_0e_1v_newels
};
/*
// new syntax ???
HPRef_Struct2 str =
{
HP_TET_0E_1V, HP_TET,
El(HP_TET_0E_1V, { V1, V12, V13, V14 })
};
*/
// HP_TET_0E_2V
@ -2994,7 +3157,7 @@ HPRef_Struct reftet_1f_0e_0v =
/*
// HP_TET_1F_0E_1VA ... singular vertex in face
int reftet_1f_0e_1va_splitedges[][3] =
{
@ -3028,8 +3191,18 @@ HPRef_Struct reftet_1f_0e_1va =
reftet_1f_0e_1va_newelstypes,
reftet_1f_0e_1va_newels
};
*/
HPRefStruct<HP_TET> reftet_1f_0e_1va
{
HP_TET_1F_0E_1VA,
{
El(HP_HEX7_1FA, { V4, V3, E23, E24, E41, E31, E21 }),
El(HP_TET_1F_0E_1VA, { E21, V2, E23, E24 }),
El(HP_TET, { E21, E41, E31, V1 })
}
};
@ -3117,6 +3290,33 @@ HPRef_Struct reftet_1f_0e_2v =
HPRefStruct<HP_TET> reftet_1f_0e_3v
{
HP_TET_1F_0E_3V,
{
El(HP_TET, { V1, E21, E31, E41 }),
El(HP_PRISM_1FA_0E_0V, { F234, F423, F324, E21, E41, E31 }),
El(HP_PRISM_1FB_1EA_0V, { E32, F324, E31, E23, F234, E21 }),
El(HP_PRISM_1FB_1EA_0V, { E43, F423, E41, E34, F324, E31 }),
El(HP_PRISM_1FB_1EA_0V, { E24, F234, E21, E42, F423, E41 }),
El(HP_TET_1F_0E_0V, { E21, E24, E23, F234 }),
El(HP_TET_1F_0E_1VA, { E21, V2, E23, E24 }),
El(HP_TET_1F_0E_0V, { E31, E32, E34, F324 }),
El(HP_TET_1F_0E_1VA, { E31, V3, E34, E32 }),
El(HP_TET_1F_0E_0V, { E41, E43, E42, F423 }),
El(HP_TET_1F_0E_1VA, { E41, V4, E42, E43 }),
}
};
// HP_TET_1F_1EA_0V ... sing edge is 1..2
int reftet_1f_1ea_0v_splitedges[][3] =
@ -3428,12 +3628,49 @@ HPRef_Struct reftet_1f_1e_2vb =
// HP_TET_1F_1EA_3V
HPRefStruct<HP_TET> reftet_1f_1ea_3v
{
HP_TET_1F_1EA_3V,
{
El(HP_PRISM, { E14, E41, F214, E13, E31, F213 }),
El(HP_PRISM_SINGEDGE, { V1, E13, E14, E21, F213, F214 }),
El(HP_HEX7_1FB, { E31, E41, F214, F213, F324, F423, F234 }),
El(HP_PRISM_1FB_0E_0V, { F234, E23, F213, F324, E32, E31 }),
El(HP_PRISM_1FB_0E_0V, { F423, E42, E41, F234, E24, F214 }),
El(HP_PRISM_1FB_0E_0V, { F324, E34, E31, F423, E43, E41 }),
El(HP_TET_1F_0E_0V, { E31, E32, E34, F324 }),
El(HP_TET_1F_0E_1VA, { E31, V3, E34, E32 }),
El(HP_TET_1F_0E_0V, { E41, E43, E42, F423 }),
El(HP_TET_1F_0E_1VA, { E41, V4, E42, E43 }),
// El(HP_PYRAMID_1FB_0E_0V, { E24, E23, F213, F214, F234 }), // TODO
El(HP_PYRAMID, { E24, E23, F213, F214, F234 }),
El(HP_PYRAMID_1FB_0E_1VA, { E23, E24, F214, F213, V2 }),
El(HP_TET_1E_1VA, { V2, E21, F214, F213 }),
}
};
HPRefStruct<HP_TET> reftet_1f_2eoo_3v
{
HP_TET_1F_2Eoo_3V,
{
El(HP_TET, { E14, E41, F214, F314 }),
El(HP_PRISM_1FA_0E_0V, { V4, E34, E24, E41, F314, F214 }),
El(HP_PRISM, { F123, F213, F312, E14, F214, F314 }),
El(HP_PRISM_SINGEDGE, { E12, F123, E14, E21, F213, F214 }),
El(HP_PRISM_SINGEDGE, { E13, E14, F123, E31, F314, F312 }),
El(HP_HEX_1F_0E_0V, { E32, E23, E24, E34, F312, F213, F214, F314 }),
El(HP_TET_1E_1VA, { V1, E12, F123, E14 }),
El(HP_TET_1E_1VA, { V1, E13, E14, F123 }),
El(HP_PYRAMID_1FB_0E_1VA, { E34, E32, F312, F314, V3 }),
El(HP_PYRAMID_1FB_0E_1VA, { E23, E24, F214, F213, V2 }),
El(HP_TET_1E_1VA, { V2, E21, F214, F213 }),
El(HP_TET_1E_1VA, { V3, E31, F312, F314 }),
}
};
// HP_TET_1F_2E_0VA singular edge in face 234 is 34, and edge not in face is 14
int reftet_1f_2e_0va_splitedges[][3] =
@ -3547,6 +3784,21 @@ HPRef_Struct reftet_1f_2e_0vb =
// HP_TET_1F_2E_1V e4,e5 (E23,E24), V2
HPRefStruct<HP_TET> reftet_1f_2e_1v
{
HP_TET_1F_2E_1V,
{
El(HP_TET, { V1, E21, E31, E41 }),
El(HP_PRISM_1FA_0E_0V, { F234, E43, E34, E21, E41, E31 }),
El(HP_PRISM_1FB_1EA_0V, { V3, E34, E31, E23, F234, E21 }),
El(HP_PRISM_1FB_1EA_0V, { E24, F234, E21, V4, E43, E41 }),
El(HP_TET_1F_1E_1VA, { E21, V2, E23, F234 }),
El(HP_TET_1F_1E_1VB, { E21, V2, F234, E24 }),
}
};

View File

@ -119,7 +119,13 @@ namespace netgen
param[k][l]=0.;
}
}
std::map<HPREF_ELEMENT_TYPE, HPRef_Struct*> & GetHPRegistry()\
{
static std::map<HPREF_ELEMENT_TYPE, HPRef_Struct*> registry;
return registry;
}
HPRef_Struct * Get_HPRef_Struct (HPREF_ELEMENT_TYPE type)
{
@ -387,12 +393,14 @@ namespace netgen
case HP_TET_1F_0E_0V:
hps = &reftet_1f_0e_0v; break;
case HP_TET_1F_0E_1VA:
hps = &reftet_1f_0e_1va; break;
// case HP_TET_1F_0E_1VA:
// hps = &reftet_1f_0e_1va; break;
case HP_TET_1F_0E_1VB:
hps = &reftet_1f_0e_1vb; break;
case HP_TET_1F_0E_2V:
hps = &reftet_1f_0e_2v; break;
// case HP_TET_1F_0E_3V:
// hps = &reftet_1f_0e_3v; break;
case HP_TET_1F_1EA_0V:
hps = &reftet_1f_1ea_0v; break;
case HP_TET_1F_1EB_0V:
@ -419,7 +427,7 @@ namespace netgen
hps = &reftet_2f_1e_0vb; break;
case HP_TET_3F_0E_0V:
hps = &reftet_3f_0e_0v; break;
case HP_PRISM:
hps = &refprism; break;
case HP_PRISM_SINGEDGE:
@ -534,6 +542,8 @@ namespace netgen
hps = &refpyramid_0e_1v; break;
case HP_PYRAMID_EDGES:
hps = &refpyramid_edges; break;
case HP_PYRAMID_1FB_0E_0V:
hps = &refpyramid_1fb_0e_0v; break;
case HP_PYRAMID_1FB_0E_1VA:
hps = &refpyramid_1fb_0e_1va; break;
@ -565,7 +575,10 @@ namespace netgen
default:
{
hps = NULL;
if (GetHPRegistry().count(type))
hps = GetHPRegistry()[type];
else
hps = NULL;
}
}
@ -1919,7 +1932,13 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
case HP_TET:
{
hpel.type = ClassifyTet(hpel, edges, edgepoint_dom, cornerpoint, edgepoint, faces,face_edges, surf_edges, facepoint);
// if (i != 20) hpel.type = HP_NONETET;
/*
// if (i != 182)
if ( (!hpel.PNums().Contains(40)) || (!hpel.PNums().Contains(41)) )
hpel.type = HP_NONETET;
else
cout << "type = " << hpel.type << endl;
*/
break;
}
case HP_PRISM:

View File

@ -162,15 +162,21 @@ enum HPREF_ELEMENT_TYPE {
HP_TET_1F_0E_1VA, // 1 sing vertex in face (V2) FIX ... (needs HEX7)
HP_TET_1F_0E_1VB, // 1 sing vertex not in face (V1)
HP_TET_1F_0E_2V, // 2 sing vertex in face (V2,V3) NEW .. done
HP_TET_1F_0E_3V, // 3 sing vertex in face (V2,V3,V4) NEWNEW
HP_TET_1F_1EA_0V, // 1 sing edge not in face
HP_TET_1F_1EB_0V, // 1 sing edge in face
HP_TET_1F_1E_1VA, // 1 sing edge in face e23, sing vert 2 NEW done
HP_TET_1F_1E_1VB, // 1 sing edge in face e24, sing vert 2 NEW done
HP_TET_1F_1E_2VA, // 1 sing edge not in face (e12), sing v2,v3 NEW done
HP_TET_1F_1E_2VB, // 1 sing edge not in face (e12), sing v2,v4 NEW done
HP_TET_1F_1E_2VC, // 1 sing edge not in face (e12), sing v3,v4 NEW
HP_TET_1F_1E_2VC, // 1 sing edge not in face (e12), sing v3,v4 NEW
HP_TET_1F_1EA_3V, // 1 sing edge out of face e12, sing v2, v3, v4 NEWNEW WIP, need Pyramid with 1 sing trig-face
HP_TET_1F_1E_3V, // 1 sing edge in face e23, sing v2, v3, v4 NEWNEW
HP_TET_1F_2Eoo_3V, // 2e out of face: f234, e12, e13, v1,v2,v3 NEWNEW
HP_TET_1F_2E_0VA, // edge6 && fedge3 .. 1 in face, 1 not in face NEW done
HP_TET_1F_2E_0VB, // edge6 && fedge2 .. 1 in face, 1 not in face NEW done
HP_TET_1F_2E_1V, // e4,e5 (E23,E24), V2 NEW NEW WIP
HP_TET_1F_2E_3V, // e4,e5 (E23,E24), V2,V3,V4 NEW NEW
HP_TET_2F_0E_0V = 600, // 2 singular faces
HP_TET_2F_0E_1V, // 2 singular faces f234, f134, sing point V4 NEW
@ -240,6 +246,7 @@ enum HPREF_ELEMENT_TYPE {
HP_PYRAMID = 2000,
HP_PYRAMID_0E_1V,
HP_PYRAMID_EDGES,
HP_PYRAMID_1FB_0E_0V, // 1 trig face F125
HP_PYRAMID_1FB_0E_1VA, // 1 trig face, top vertex
HP_HEX = 3000,
@ -330,7 +337,7 @@ public:
PointIndex & PNum(int i) {return pnums[(i-1)]; };
int GetIndex () const { return index; };
double singedge_left, singedge_right;
auto PNums() const { return FlatArray<const PointIndex>(np, &pnums[0]); }
// EdgePointGeomInfo epgeominfo[2];

View File

@ -1327,7 +1327,7 @@ namespace netgen
else
#endif
{
(*testout) << "illegal face : " << i << endl;
(*testout) << "illegal face : " << i << ", cnt = " << face_els[i]+face_surfels[i] << endl;
(*testout) << "points = "
<< face2vert[i][0] << ","
<< face2vert[i][1] << ","
@ -1348,7 +1348,7 @@ namespace netgen
for (int l = 0; l < nf; l++)
if (elfaces[l] == i)
{
// (*testout) << "is face of element " << vertels[k] << endl;
(*testout) << "is face of element " << vertels[k] << endl;
if (mesh->coarsemesh && mesh->hpelements->Size() == mesh->GetNE() )
{