parent edges for red refinement (thx Guosheng)

This commit is contained in:
Joachim Schoeberl 2021-03-31 07:50:18 +02:00
parent 44c10f663a
commit 096b419f6e
2 changed files with 259 additions and 183 deletions

View File

@ -34,6 +34,9 @@ namespace netgen
mesh.mlbetweennodes = INDEX_2(PointIndex::BASE-1,PointIndex::BASE-1); mesh.mlbetweennodes = INDEX_2(PointIndex::BASE-1,PointIndex::BASE-1);
} }
if (mesh.level_nv.Size() == 0)
mesh.level_nv.Append (mesh.GetNV());
INDEX_2_HASHTABLE<PointIndex> between(mesh.GetNP() + 5); INDEX_2_HASHTABLE<PointIndex> between(mesh.GetNP() + 5);
@ -739,6 +742,7 @@ namespace netgen
mesh.ComputeNVertices(); mesh.ComputeNVertices();
mesh.RebuildSurfaceElementLists(); mesh.RebuildSurfaceElementLists();
mesh.level_nv.Append (mesh.GetNV());
#ifdef PARALLEL #ifdef PARALLEL
if (mesh.GetCommunicator().Size() > 1) if (mesh.GetCommunicator().Size() > 1)

View File

@ -751,6 +751,7 @@ namespace netgen
} }
else else
{ {
bool bisect_edge = false;
// edge is splitting edge in middle of triangle: // edge is splitting edge in middle of triangle:
for (int j = 1; j <= 2; j++) for (int j = 1; j <= 2; j++)
{ {
@ -799,9 +800,81 @@ namespace netgen
if (auto cverts = edge2vert[ednr]; cverts[1] == paedge3[1]) if (auto cverts = edge2vert[ednr]; cverts[1] == paedge3[1])
paedgenr3 = ednr; paedgenr3 = ednr;
if (paedgenr1 != -1 && paedgenr2 != -1) if (paedgenr1 != -1 && paedgenr2 != -1){
bisect_edge = true;
parent_edges[i] = { orient1+2*orient2+4*orient_inner, { paedgenr1, paedgenr2, paedgenr3 } }; parent_edges[i] = { orient1+2*orient2+4*orient_inner, { paedgenr1, paedgenr2, paedgenr3 } };
} }
}
if (!bisect_edge) // not a bisect edge (then a red edge)
{
INT<2> paedge1, paedge2, paedge3;
int orient1 = 0, orient2 = 0, orient3=0;
int orient_inner = 0;
paedge1 = INT<2> (pa0[0], pa0[1]);
paedge2 = INT<2> (pa1[0], pa1[1]);
// find common vertex and the thrid pa edge
if (pa0[0]==pa1[0]){// 00
//orient1 = 0;
orient2 = 1;
if (pa0[1]<pa1[1]){
orient3 = 1;
paedge3 = INT<2> (pa0[1], pa1[1]);
}else{
//orient3 = 0;
paedge3 = INT<2> (pa1[1], pa0[1]);
}
}
else if (pa0[0]==pa1[1]){//01
//orient1 = 0;
//orient2 = 0;
if (pa0[1]<pa1[0]){
orient3 = 1;
paedge3 = INT<2> (pa0[1], pa1[0]);
}else{
//orient3 = 0;
paedge3 = INT<2> (pa1[0], pa0[1]);
}
}
else if (pa0[1]==pa1[0]){//10
orient1 = 1;
orient2 = 1;
if (pa0[0]<pa1[1]){
orient3 = 1;
paedge3 = INT<2> (pa0[0], pa1[1]);
}else{
//orient3 = 0;
paedge3 = INT<2> (pa1[1], pa0[0]);
}
}
else if (pa0[1]==pa1[1]){//11
orient1 = 1;
//orient2 = 0;
if (pa0[0]<pa1[0]){
orient3 = 1;
paedge3 = INT<2> (pa0[0], pa1[0]);
}else{
//orient3 = 0;
paedge3 = INT<2> (pa1[0], pa0[0]);
}
}
int paedgenr1=-1, paedgenr2=-1, paedgenr3=-1;
for (int ednr : vert2edge[paedge1[0]])
if (auto cverts = edge2vert[ednr]; cverts[1] == paedge1[1])
paedgenr1 = ednr;
for (int ednr : vert2edge[paedge2[0]])
if (auto cverts = edge2vert[ednr]; cverts[1] == paedge2[1])
paedgenr2 = ednr;
for (int ednr : vert2edge[paedge3[0]])
if (auto cverts = edge2vert[ednr]; cverts[1] == paedge3[1])
paedgenr3 = ednr;
parent_edges[i] = { 8+orient1+2*orient2+4*orient3, { paedgenr1, paedgenr2, paedgenr3 } };
//cout <<8+orient1+2*orient2+4*orient3 <<":"<<paedgenr1 <<", "<< paedgenr2 << ", "<< paedgenr3 << endl;
}
// TODO: quad edges // TODO: quad edges
@ -876,7 +949,6 @@ namespace netgen
} }
*/ */
} }
} }