CombineImprove() 2D: optimize all faces at once

This commit is contained in:
Matthias Hochsteger 2019-10-14 16:19:52 +02:00
parent 0f095281d9
commit 6ca6a5e791
2 changed files with 85 additions and 87 deletions

View File

@ -568,22 +568,11 @@ namespace netgen
void MeshOptimize2d :: CombineImprove (Mesh & mesh)
{
if (!faceindex)
{
SplitImprove(mesh);
PrintMessage (3, "Combine improve");
for (faceindex = 1; faceindex <= mesh.GetNFD(); faceindex++)
{
CombineImprove (mesh);
if (multithread.terminate)
throw NgException ("Meshing stopped");
}
faceindex = 0;
return;
}
SplitImprove(mesh);
PrintMessage (3, "Combine improve");
if (multithread.terminate)
throw NgException ("Meshing stopped");
static Timer timer ("Combineimprove 2D");
RegionTimer reg (timer);
@ -597,18 +586,25 @@ namespace netgen
Array<SurfaceElementIndex> seia;
mesh.GetSurfaceElementsOfFace (faceindex, seia);
if(faceindex)
mesh.GetSurfaceElementsOfFace (faceindex, seia);
else
{
seia.SetSize(mesh.GetNSE());
ParallelFor( IntRange(mesh.GetNSE()), [&seia] (auto i) NETGEN_LAMBDA_INLINE
{ seia[i] = i; });
}
for (SurfaceElementIndex sei : seia)
if (mesh[sei].GetNP() != 3)
return;
int surfnr = 0;
if (faceindex)
surfnr = mesh.GetFaceDescriptor (faceindex).SurfNr();
bool mixed = false;
ParallelFor( Range(seia), [&] (auto i) NETGEN_LAMBDA_INLINE
{
if (mesh[seia[i]].GetNP() != 3)
mixed = true;
});
if(mixed)
return;
int np = mesh.GetNP();
@ -651,6 +647,8 @@ namespace netgen
for (int k = 0; k < 3; k++)
if (hel[k] == pi)
{
const int faceindex = hel.GetIndex();
const int surfnr = mesh.GetFaceDescriptor (faceindex).SurfNr();
GetNormalVector (surfnr, mesh[pi], hel.GeomInfoPi(k+1), normals[pi]);
break;
}

View File

@ -685,45 +685,45 @@
"hinge.stl": [
{
"ne1d": 456,
"ne2d": 1224,
"ne3d": 2038,
"quality_histogram": "[0, 0, 0, 0, 0, 3, 6, 19, 29, 40, 76, 138, 161, 261, 320, 286, 277, 232, 148, 42]",
"total_badness": 2873.2214111
"ne2d": 1218,
"ne3d": 2007,
"quality_histogram": "[0, 0, 0, 0, 0, 2, 7, 22, 35, 43, 69, 124, 175, 266, 301, 273, 272, 226, 144, 48]",
"total_badness": 2839.693559
},
{
"ne1d": 298,
"ne2d": 596,
"ne3d": 767,
"quality_histogram": "[0, 0, 1, 10, 8, 6, 20, 17, 35, 48, 56, 101, 95, 108, 73, 77, 49, 40, 21, 2]",
"total_badness": 1334.5519444
"ne2d": 606,
"ne3d": 782,
"quality_histogram": "[0, 0, 1, 9, 6, 5, 18, 17, 33, 53, 60, 95, 99, 112, 83, 73, 47, 49, 20, 2]",
"total_badness": 1342.4305041
},
{
"ne1d": 370,
"ne2d": 846,
"ne3d": 1140,
"quality_histogram": "[0, 0, 0, 1, 2, 9, 15, 17, 27, 44, 69, 118, 143, 133, 176, 168, 96, 61, 51, 10]",
"total_badness": 1773.0754642
"ne2d": 854,
"ne3d": 1136,
"quality_histogram": "[0, 0, 0, 1, 3, 9, 21, 24, 34, 44, 70, 113, 151, 137, 158, 154, 97, 68, 43, 9]",
"total_badness": 1798.68351
},
{
"ne1d": 516,
"ne2d": 1566,
"ne3d": 2529,
"quality_histogram": "[0, 0, 0, 0, 0, 2, 4, 12, 27, 53, 110, 151, 242, 298, 395, 355, 324, 296, 203, 57]",
"total_badness": 3539.0006937
"ne2d": 1574,
"ne3d": 2551,
"quality_histogram": "[0, 0, 0, 0, 0, 2, 4, 9, 22, 56, 91, 150, 262, 288, 378, 368, 350, 304, 214, 53]",
"total_badness": 3546.3587224
},
{
"ne1d": 722,
"ne2d": 2866,
"ne3d": 6641,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 2, 4, 22, 39, 63, 158, 347, 598, 883, 1056, 1125, 1156, 945, 243]",
"total_badness": 8521.5496278
"ne2d": 2872,
"ne3d": 6679,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 1, 4, 22, 38, 58, 158, 368, 659, 826, 1064, 1147, 1157, 900, 277]",
"total_badness": 8576.0981512
},
{
"ne1d": 1862,
"ne2d": 19490,
"ne3d": 138145,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 12, 42, 164, 454, 1165, 3079, 7378, 13727, 21879, 28700, 30921, 23185, 7439]",
"total_badness": 169166.81415
"ne2d": 19494,
"ne3d": 137231,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 1, 7, 48, 161, 424, 1135, 2966, 6918, 13385, 21373, 28847, 31139, 23298, 7529]",
"total_badness": 167698.91174
}
],
"lshape3d.geo": [
@ -893,31 +893,31 @@
"part1.stl": [
{
"ne1d": 170,
"ne2d": 436,
"ne3d": 1274,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 3, 10, 12, 31, 68, 104, 114, 149, 189, 199, 148, 132, 98, 17]",
"total_badness": 1812.8134062
"ne2d": 448,
"ne3d": 1242,
"quality_histogram": "[0, 0, 0, 0, 0, 2, 3, 9, 14, 27, 62, 80, 118, 165, 171, 191, 160, 126, 91, 23]",
"total_badness": 1762.3248217
},
{
"ne1d": 134,
"ne2d": 276,
"ne3d": 504,
"quality_histogram": "[0, 0, 0, 1, 4, 0, 7, 6, 20, 26, 32, 43, 59, 68, 74, 61, 43, 39, 18, 3]",
"total_badness": 791.50880644
"ne2d": 288,
"ne3d": 521,
"quality_histogram": "[0, 0, 1, 2, 5, 7, 6, 10, 18, 23, 40, 41, 47, 59, 72, 76, 56, 37, 18, 3]",
"total_badness": 839.17126404
},
{
"ne1d": 194,
"ne2d": 590,
"ne3d": 1688,
"quality_histogram": "[0, 0, 0, 0, 0, 1, 0, 2, 4, 15, 35, 70, 127, 179, 237, 295, 293, 240, 156, 34]",
"total_badness": 2247.145727
"ne2d": 594,
"ne3d": 1666,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 2, 5, 16, 23, 59, 118, 160, 264, 288, 282, 255, 167, 27]",
"total_badness": 2197.5763632
},
{
"ne1d": 266,
"ne2d": 986,
"ne3d": 4120,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 1, 0, 3, 9, 30, 60, 164, 343, 555, 738, 768, 818, 486, 145]",
"total_badness": 5216.1612676
"ne3d": 4090,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 1, 0, 2, 11, 35, 59, 152, 324, 579, 738, 770, 768, 506, 145]",
"total_badness": 5178.06234
},
{
"ne1d": 674,
@ -974,45 +974,45 @@
"plane.stl": [
{
"ne1d": 890,
"ne2d": 2600,
"ne3d": 8187,
"quality_histogram": "[4, 14, 31, 31, 52, 43, 39, 66, 137, 205, 329, 452, 712, 916, 1161, 1269, 1162, 923, 510, 131]",
"total_badness": 12484.653426
"ne2d": 2620,
"ne3d": 8323,
"quality_histogram": "[5, 21, 28, 32, 53, 48, 47, 80, 151, 239, 321, 490, 681, 901, 1189, 1198, 1208, 892, 597, 142]",
"total_badness": 12887.967725
},
{
"ne1d": 572,
"ne2d": 1180,
"ne3d": 1679,
"quality_histogram": "[3, 23, 38, 46, 50, 78, 94, 132, 138, 164, 167, 143, 142, 134, 114, 83, 64, 39, 20, 7]",
"total_badness": 4208.4459264
"ne2d": 1196,
"ne3d": 1793,
"quality_histogram": "[11, 31, 38, 55, 69, 104, 109, 132, 143, 150, 154, 158, 135, 136, 121, 82, 79, 51, 30, 5]",
"total_badness": 4800.1708991
},
{
"ne1d": 724,
"ne2d": 1718,
"ne3d": 3253,
"quality_histogram": "[4, 18, 38, 40, 50, 32, 60, 65, 115, 141, 204, 272, 353, 384, 426, 392, 308, 197, 125, 29]",
"total_badness": 6003.270597
"ne2d": 1726,
"ne3d": 3259,
"quality_histogram": "[5, 19, 38, 39, 48, 38, 53, 68, 126, 153, 210, 276, 357, 394, 388, 356, 323, 218, 123, 27]",
"total_badness": 6069.660571
},
{
"ne1d": 956,
"ne2d": 2812,
"ne3d": 8628,
"quality_histogram": "[3, 11, 28, 48, 49, 52, 57, 65, 85, 151, 228, 381, 614, 897, 1208, 1356, 1426, 1137, 649, 183]",
"total_badness": 12760.118913
"ne2d": 2820,
"ne3d": 8391,
"quality_histogram": "[3, 12, 32, 49, 46, 54, 59, 63, 86, 144, 250, 389, 575, 816, 1238, 1375, 1331, 1047, 665, 157]",
"total_badness": 12510.073302
},
{
"ne1d": 1554,
"ne2d": 6384,
"ne3d": 31436,
"quality_histogram": "[3, 7, 13, 5, 28, 50, 58, 74, 110, 186, 361, 708, 1401, 2494, 3893, 5404, 6143, 5665, 3793, 1040]",
"total_badness": 40918.999105
"ne2d": 6388,
"ne3d": 31455,
"quality_histogram": "[3, 7, 11, 8, 27, 51, 59, 79, 108, 196, 350, 697, 1388, 2535, 4050, 5292, 6175, 5518, 3822, 1079]",
"total_badness": 40980.318629
},
{
"ne1d": 2992,
"ne2d": 23312,
"ne3d": 279091,
"quality_histogram": "[4, 10, 11, 11, 5, 29, 38, 96, 197, 478, 1129, 2682, 6574, 15333, 28982, 45307, 58111, 60865, 45633, 13596]",
"total_badness": 344025.56886
"ne2d": 23328,
"ne3d": 276363,
"quality_histogram": "[4, 10, 12, 10, 7, 20, 37, 80, 203, 470, 1122, 2731, 6675, 14971, 28708, 44685, 57676, 60478, 45018, 13446]",
"total_badness": 340678.17837
}
],
"revolution.geo": [