mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
Build neighbors list in parallel
Check in new results (part1.stl does not mesh with very_coarse anymore)
This commit is contained in:
parent
64a685c2ea
commit
18bdd9df93
@ -187,6 +187,7 @@ namespace netgen
|
||||
|
||||
Array<SurfaceElementIndex> seia;
|
||||
bool mixed = false;
|
||||
|
||||
if(faceindex==0)
|
||||
{
|
||||
seia.SetSize(mesh.GetNSE());
|
||||
@ -213,8 +214,7 @@ namespace netgen
|
||||
return GenericImprove(mesh);
|
||||
|
||||
Array<Neighbour> neighbors(mesh.GetNSE());
|
||||
INDEX_2_HASHTABLE<trionedge> other(2*seia.Size() + 2);
|
||||
|
||||
auto elements_on_node = mesh.CreatePoint2SurfaceElementTable(faceindex);
|
||||
|
||||
Array<bool> swapped(mesh.GetNSE());
|
||||
Array<int,PointIndex> pdef(mesh.GetNP());
|
||||
@ -254,9 +254,9 @@ namespace netgen
|
||||
POINTTYPE typ = mesh[sel[j]].Type();
|
||||
if (typ == FIXEDPOINT || typ == EDGEPOINT)
|
||||
{
|
||||
pangle[sel[j]] +=
|
||||
AtomicAdd(pangle[sel[j]],
|
||||
Angle (mesh[sel[(j+1)%3]] - mesh[sel[j]],
|
||||
mesh[sel[(j+2)%3]] - mesh[sel[j]]);
|
||||
mesh[sel[(j+2)%3]] - mesh[sel[j]]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -280,14 +280,6 @@ namespace netgen
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
for (int i = 0; i < seia.Size(); i++)
|
||||
{
|
||||
const Element2d & sel = mesh[seia[i]];
|
||||
for (int j = 0; j < 3; j++)
|
||||
pdef[sel[j]]++;
|
||||
}
|
||||
*/
|
||||
ParallelForRange( Range(seia), [&] (auto myrange)
|
||||
{
|
||||
for (auto i : myrange)
|
||||
@ -300,58 +292,41 @@ namespace netgen
|
||||
neighbors[sei].SetNr (j, -1);
|
||||
neighbors[sei].SetOrientation (j, 0);
|
||||
}
|
||||
|
||||
const auto sel = mesh[sei];
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
PointIndex pi1 = sel.PNumMod(j+2);
|
||||
PointIndex pi2 = sel.PNumMod(j+3);
|
||||
|
||||
for (auto sei_other : elements_on_node[pi1])
|
||||
{
|
||||
if(sei_other==sei) continue;
|
||||
const auto & other = mesh[sei_other];
|
||||
int pi1_other = -1;
|
||||
int pi2_other = -1;
|
||||
bool common_edge = false;
|
||||
for (int k = 0; k < 3; k++)
|
||||
{
|
||||
if(other[k] == pi1)
|
||||
pi1_other = k;
|
||||
if(other[k] == pi2)
|
||||
{
|
||||
pi2_other = k;
|
||||
common_edge = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(common_edge)
|
||||
{
|
||||
neighbors[sei].SetNr (j, sei_other);
|
||||
neighbors[sei].SetOrientation (j, 3-pi1_other-pi2_other);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
timer_nb.Start();
|
||||
for (SurfaceElementIndex sei : seia)
|
||||
{
|
||||
const Element2d & sel = mesh[sei];
|
||||
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
PointIndex pi1 = sel.PNumMod(j+2);
|
||||
PointIndex pi2 = sel.PNumMod(j+3);
|
||||
|
||||
// double loch = mesh.GetH(mesh[pi1]);
|
||||
|
||||
// INDEX_2 edge(pi1, pi2);
|
||||
// edge.Sort();
|
||||
|
||||
if (mesh.IsSegment (pi1, pi2))
|
||||
continue;
|
||||
|
||||
/*
|
||||
if (segments.Used (edge))
|
||||
continue;
|
||||
*/
|
||||
INDEX_2 ii2 (pi1, pi2);
|
||||
if (other.Used (ii2))
|
||||
{
|
||||
// INDEX_2 i2s(ii2);
|
||||
// i2s.Sort();
|
||||
|
||||
/*
|
||||
int i2 = other.Get(ii2).tnr;
|
||||
int j2 = other.Get(ii2).sidenr;
|
||||
*/
|
||||
auto othertrig = other.Get(ii2);
|
||||
SurfaceElementIndex i2 = othertrig.tnr;
|
||||
int j2 = othertrig.sidenr;
|
||||
|
||||
neighbors[sei].SetNr (j, i2);
|
||||
neighbors[sei].SetOrientation (j, j2);
|
||||
neighbors[i2].SetNr (j2, sei);
|
||||
neighbors[i2].SetOrientation (j2, j);
|
||||
}
|
||||
else
|
||||
{
|
||||
other.Set (INDEX_2 (pi2, pi1), trionedge (sei, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
timer_nb.Stop();
|
||||
|
||||
for (SurfaceElementIndex sei : seia)
|
||||
swapped[sei] = false;
|
||||
|
@ -306,7 +306,6 @@ int STLSurfaceMeshing (STLGeometry & geom, class Mesh & mesh, const MeshingParam
|
||||
|
||||
mesh.CalcSurfacesOfNode();
|
||||
optmesh.EdgeSwapping (mesh, 0);
|
||||
mesh.CalcSurfacesOfNode();
|
||||
optmesh.ImproveMesh (mesh, mparam);
|
||||
}
|
||||
|
||||
|
@ -685,45 +685,45 @@
|
||||
"hinge.stl": [
|
||||
{
|
||||
"ne1d": 456,
|
||||
"ne2d": 1230,
|
||||
"ne3d": 2006,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 2, 5, 9, 24, 42, 72, 137, 165, 225, 325, 287, 304, 216, 146, 47]",
|
||||
"total_badness": 2804.4326922
|
||||
"ne2d": 1214,
|
||||
"ne3d": 2019,
|
||||
"quality_histogram": "[0, 0, 0, 0, 1, 1, 7, 10, 25, 53, 64, 135, 179, 260, 313, 277, 264, 228, 159, 43]",
|
||||
"total_badness": 2840.0751587
|
||||
},
|
||||
{
|
||||
"ne1d": 298,
|
||||
"ne2d": 612,
|
||||
"ne3d": 800,
|
||||
"quality_histogram": "[0, 0, 1, 5, 8, 14, 26, 21, 33, 47, 74, 78, 98, 89, 89, 80, 63, 44, 24, 6]",
|
||||
"total_badness": 1384.3451953
|
||||
"ne2d": 594,
|
||||
"ne3d": 803,
|
||||
"quality_histogram": "[0, 0, 3, 10, 11, 10, 24, 29, 44, 52, 53, 101, 86, 104, 78, 76, 66, 29, 22, 5]",
|
||||
"total_badness": 1443.356934
|
||||
},
|
||||
{
|
||||
"ne1d": 370,
|
||||
"ne2d": 860,
|
||||
"ne3d": 1148,
|
||||
"quality_histogram": "[0, 0, 0, 0, 2, 4, 16, 24, 25, 32, 78, 104, 135, 154, 165, 176, 112, 66, 43, 12]",
|
||||
"total_badness": 1761.6622395
|
||||
"ne2d": 842,
|
||||
"ne3d": 1114,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 9, 18, 23, 29, 45, 67, 110, 146, 130, 166, 151, 102, 53, 52, 13]",
|
||||
"total_badness": 1737.5505204
|
||||
},
|
||||
{
|
||||
"ne1d": 516,
|
||||
"ne2d": 1584,
|
||||
"ne3d": 2528,
|
||||
"quality_histogram": "[0, 0, 0, 0, 2, 1, 9, 16, 23, 49, 125, 185, 212, 311, 338, 362, 347, 313, 191, 44]",
|
||||
"total_badness": 3559.0498754
|
||||
"ne2d": 1566,
|
||||
"ne3d": 2515,
|
||||
"quality_histogram": "[0, 0, 0, 0, 1, 1, 2, 16, 33, 61, 109, 161, 234, 325, 376, 358, 314, 287, 192, 45]",
|
||||
"total_badness": 3545.6814623
|
||||
},
|
||||
{
|
||||
"ne1d": 722,
|
||||
"ne2d": 2888,
|
||||
"ne3d": 6747,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 1, 2, 3, 15, 27, 51, 174, 373, 644, 867, 1088, 1146, 1180, 929, 247]",
|
||||
"total_badness": 8655.9198144
|
||||
"ne2d": 2870,
|
||||
"ne3d": 6691,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 1, 2, 4, 17, 35, 66, 156, 354, 634, 871, 1042, 1219, 1171, 879, 240]",
|
||||
"total_badness": 8595.0420119
|
||||
},
|
||||
{
|
||||
"ne1d": 1862,
|
||||
"ne2d": 19516,
|
||||
"ne3d": 137265,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 1, 3, 5, 47, 136, 444, 1131, 2812, 6902, 13203, 22054, 29007, 30796, 23323, 7401]",
|
||||
"total_badness": 167751.20764
|
||||
"ne2d": 19490,
|
||||
"ne3d": 137799,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 1, 4, 44, 149, 433, 1143, 3044, 7194, 13730, 22017, 28888, 30587, 23088, 7477]",
|
||||
"total_badness": 168663.12974
|
||||
}
|
||||
],
|
||||
"lshape3d.geo": [
|
||||
@ -893,45 +893,38 @@
|
||||
"part1.stl": [
|
||||
{
|
||||
"ne1d": 170,
|
||||
"ne2d": 454,
|
||||
"ne3d": 1231,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 2, 4, 16, 11, 28, 52, 63, 111, 142, 191, 162, 178, 143, 94, 34]",
|
||||
"total_badness": 1732.0556803
|
||||
},
|
||||
{
|
||||
"ne1d": 112,
|
||||
"ne2d": 212,
|
||||
"ne3d": 329,
|
||||
"quality_histogram": "[0, 0, 1, 2, 6, 8, 7, 12, 15, 28, 32, 46, 35, 35, 33, 26, 24, 8, 8, 3]",
|
||||
"total_badness": 600.29793129
|
||||
"ne2d": 436,
|
||||
"ne3d": 1229,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 2, 3, 19, 29, 55, 87, 110, 138, 175, 205, 157, 142, 78, 29]",
|
||||
"total_badness": 1729.0401722
|
||||
},
|
||||
{
|
||||
"ne1d": 134,
|
||||
"ne2d": 288,
|
||||
"ne3d": 502,
|
||||
"quality_histogram": "[0, 0, 0, 3, 0, 8, 3, 6, 12, 12, 31, 38, 65, 61, 63, 78, 51, 46, 18, 7]",
|
||||
"total_badness": 773.39426016
|
||||
"ne2d": 278,
|
||||
"ne3d": 495,
|
||||
"quality_histogram": "[0, 0, 0, 1, 2, 1, 3, 5, 14, 29, 31, 32, 59, 65, 55, 70, 58, 44, 23, 3]",
|
||||
"total_badness": 754.26258256
|
||||
},
|
||||
{
|
||||
"ne1d": 194,
|
||||
"ne2d": 596,
|
||||
"ne3d": 1754,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 3, 13, 28, 71, 147, 204, 282, 267, 286, 247, 166, 40]",
|
||||
"total_badness": 2331.111722
|
||||
"ne2d": 588,
|
||||
"ne3d": 1673,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 1, 4, 9, 19, 53, 115, 189, 242, 295, 314, 237, 151, 44]",
|
||||
"total_badness": 2197.2722054
|
||||
},
|
||||
{
|
||||
"ne1d": 266,
|
||||
"ne2d": 990,
|
||||
"ne3d": 4027,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 1, 3, 6, 26, 75, 146, 296, 557, 678, 795, 780, 509, 155]",
|
||||
"total_badness": 5077.23567
|
||||
"ne2d": 986,
|
||||
"ne3d": 4070,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 2, 0, 1, 11, 26, 61, 171, 329, 503, 679, 791, 819, 526, 151]",
|
||||
"total_badness": 5135.4720603
|
||||
},
|
||||
{
|
||||
"ne1d": 674,
|
||||
"ne2d": 6870,
|
||||
"ne3d": 81452,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 3, 4, 25, 77, 250, 594, 1752, 4117, 8196, 12789, 16981, 18438, 13807, 4419]",
|
||||
"total_badness": 99550.92563
|
||||
"ne2d": 6854,
|
||||
"ne3d": 83365,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 2, 7, 13, 62, 230, 706, 1754, 4117, 8217, 13027, 17521, 18882, 14312, 4515]",
|
||||
"total_badness": 101790.83606
|
||||
}
|
||||
],
|
||||
"period.geo": [
|
||||
@ -981,45 +974,45 @@
|
||||
"plane.stl": [
|
||||
{
|
||||
"ne1d": 890,
|
||||
"ne2d": 2644,
|
||||
"ne3d": 8437,
|
||||
"quality_histogram": "[4, 11, 34, 34, 47, 50, 47, 73, 116, 174, 285, 458, 661, 938, 1281, 1251, 1245, 989, 581, 158]",
|
||||
"total_badness": 12699.585283
|
||||
"ne2d": 2594,
|
||||
"ne3d": 8251,
|
||||
"quality_histogram": "[4, 12, 36, 32, 44, 50, 57, 71, 152, 239, 330, 506, 691, 890, 1189, 1240, 1122, 915, 537, 134]",
|
||||
"total_badness": 12713.488612
|
||||
},
|
||||
{
|
||||
"ne1d": 572,
|
||||
"ne2d": 1216,
|
||||
"ne3d": 1895,
|
||||
"quality_histogram": "[2, 19, 47, 57, 49, 63, 79, 93, 109, 155, 175, 199, 174, 176, 167, 136, 98, 57, 35, 5]",
|
||||
"total_badness": 4388.7508089
|
||||
"ne1d": 570,
|
||||
"ne2d": 1162,
|
||||
"ne3d": 1656,
|
||||
"quality_histogram": "[6, 27, 35, 54, 64, 75, 98, 116, 138, 141, 155, 129, 151, 124, 127, 78, 75, 33, 26, 4]",
|
||||
"total_badness": 4280.7158528
|
||||
},
|
||||
{
|
||||
"ne1d": 724,
|
||||
"ne2d": 1752,
|
||||
"ne3d": 3251,
|
||||
"quality_histogram": "[3, 18, 30, 51, 30, 49, 50, 70, 104, 143, 167, 291, 330, 404, 438, 402, 312, 195, 130, 34]",
|
||||
"total_badness": 5918.1573233
|
||||
"ne2d": 1706,
|
||||
"ne3d": 3203,
|
||||
"quality_histogram": "[6, 13, 36, 37, 49, 52, 75, 69, 129, 151, 215, 276, 365, 365, 390, 373, 301, 185, 94, 22]",
|
||||
"total_badness": 6020.5769171
|
||||
},
|
||||
{
|
||||
"ne1d": 956,
|
||||
"ne2d": 2886,
|
||||
"ne3d": 8911,
|
||||
"quality_histogram": "[3, 13, 24, 44, 52, 48, 50, 62, 86, 136, 201, 367, 548, 881, 1299, 1464, 1419, 1260, 761, 193]",
|
||||
"total_badness": 12992.010429
|
||||
"ne2d": 2816,
|
||||
"ne3d": 8620,
|
||||
"quality_histogram": "[3, 12, 31, 46, 42, 59, 51, 64, 79, 151, 222, 364, 608, 987, 1214, 1341, 1385, 1113, 673, 175]",
|
||||
"total_badness": 12750.84491
|
||||
},
|
||||
{
|
||||
"ne1d": 1554,
|
||||
"ne2d": 6466,
|
||||
"ne3d": 32098,
|
||||
"quality_histogram": "[5, 6, 8, 6, 24, 52, 56, 72, 117, 168, 382, 731, 1379, 2486, 3961, 5463, 6259, 5888, 3926, 1109]",
|
||||
"total_badness": 41680.677329
|
||||
"ne2d": 6388,
|
||||
"ne3d": 31408,
|
||||
"quality_histogram": "[4, 7, 11, 6, 23, 53, 61, 72, 104, 183, 368, 718, 1410, 2572, 3955, 5242, 6125, 5690, 3772, 1032]",
|
||||
"total_badness": 40921.343431
|
||||
},
|
||||
{
|
||||
"ne1d": 2992,
|
||||
"ne2d": 23400,
|
||||
"ne3d": 315912,
|
||||
"quality_histogram": "[9, 29, 30, 35, 91, 431, 1451, 3248, 5258, 8159, 12957, 19461, 28353, 38474, 46243, 48391, 44070, 33858, 19987, 5377]",
|
||||
"total_badness": 451886.52052
|
||||
"ne2d": 23312,
|
||||
"ne3d": 279657,
|
||||
"quality_histogram": "[4, 11, 13, 15, 12, 35, 54, 98, 217, 519, 1182, 2752, 6855, 15439, 29353, 45547, 58301, 60932, 44659, 13659]",
|
||||
"total_badness": 345287.15441
|
||||
}
|
||||
],
|
||||
"revolution.geo": [
|
||||
@ -1076,10 +1069,10 @@
|
||||
},
|
||||
{
|
||||
"ne1d": 530,
|
||||
"ne2d": 2688,
|
||||
"ne3d": 7916,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 6, 15, 31, 62, 150, 285, 487, 728, 1064, 1322, 1395, 1296, 847, 228]",
|
||||
"total_badness": 10396.315052
|
||||
"ne2d": 2690,
|
||||
"ne3d": 7903,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 4, 12, 30, 98, 166, 287, 493, 782, 1078, 1284, 1426, 1211, 797, 235]",
|
||||
"total_badness": 10438.866877
|
||||
},
|
||||
{
|
||||
"ne1d": 668,
|
||||
|
@ -58,6 +58,8 @@ def getMeshingparameters(filename):
|
||||
return standard[:3] # this gets too big for finer meshsizes
|
||||
if filename == "screw.step":
|
||||
return standard[3:] # coarser meshes don't work here
|
||||
if filename == "part1.stl":
|
||||
return standard[0:1] + standard[2:] # very coarse does not work
|
||||
return standard
|
||||
|
||||
_geofiles = [f for f in getFiles(".geo")] + [f for f in getFiles(".stl")]
|
||||
|
Loading…
Reference in New Issue
Block a user