mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 04:50:34 +05:00
Merge branch 'optimize_calcpartition' into 'master'
optimize CalcPartition() and PartitionBoundary() See merge request jschoeberl/netgen!340
This commit is contained in:
commit
c842de7c3d
@ -18,29 +18,44 @@ namespace netgen
|
||||
{
|
||||
double fperel, oldf, f;
|
||||
|
||||
int n = 10000;
|
||||
|
||||
NgArray<Point<2> > xi(n);
|
||||
NgArray<double> hi(n);
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
int n = 1;
|
||||
NgArray<Point<2> > xi;
|
||||
NgArray<double> hi;
|
||||
|
||||
// do one extra step
|
||||
int not_fine_enough = 2;
|
||||
|
||||
while(not_fine_enough && n < 10000)
|
||||
{
|
||||
not_fine_enough--;
|
||||
n*=4;
|
||||
|
||||
xi.SetSize(n);
|
||||
hi.SetSize(n);
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
xi[i] = spline.GetPoint ( (i+0.5) / n );
|
||||
hi[i] = mesh.GetH (Point<3> (xi[i](0), xi[i](1), 0));
|
||||
xi[i] = spline.GetPoint ( (i+0.5) / n );
|
||||
hi[i] = mesh.GetH (Point<3> (xi[i](0), xi[i](1), 0));
|
||||
}
|
||||
|
||||
// limit slope
|
||||
double gradh = min(1/elto0,mp.grading);
|
||||
for (int i = 0; i < n-1; i++)
|
||||
// limit slope
|
||||
double gradh = min(1/elto0,mp.grading);
|
||||
for (int i = 0; i < n-1; i++)
|
||||
{
|
||||
double hnext = hi[i] + gradh * (xi[i+1]-xi[i]).Length();
|
||||
hi[i+1] = min(hi[i+1], hnext);
|
||||
double hnext = hi[i] + gradh * (xi[i+1]-xi[i]).Length();
|
||||
if(hnext > 2*hi[i])
|
||||
not_fine_enough = 2;
|
||||
hi[i+1] = min(hi[i+1], hnext);
|
||||
}
|
||||
for (int i = n-1; i > 1; i--)
|
||||
for (int i = n-1; i > 1; i--)
|
||||
{
|
||||
double hnext = hi[i] + gradh * (xi[i-1]-xi[i]).Length();
|
||||
hi[i-1] = min(hi[i-1], hnext);
|
||||
double hnext = hi[i] + gradh * (xi[i-1]-xi[i]).Length();
|
||||
if(hnext > 2*hi[i])
|
||||
not_fine_enough = 2;
|
||||
hi[i-1] = min(hi[i-1], hnext);
|
||||
}
|
||||
}
|
||||
|
||||
points.SetSize (0);
|
||||
|
||||
@ -227,6 +242,10 @@ namespace netgen
|
||||
mesh2d.RestrictLocalHLine (Point<3>(p1(0),p1(1),0),
|
||||
Point<3>(p2(0),p2(1),0), len/mp.segmentsperedge);
|
||||
|
||||
// skip curvature restrictions for straight lines
|
||||
if(spline.MaxCurvature()==0)
|
||||
continue;
|
||||
|
||||
double hcurve = min (spline.hmax, h/spline.reffak);
|
||||
double hl = GetDomainMaxh (spline.leftdom);
|
||||
if (hl > 0) hcurve = min2 (hcurve, hl);
|
||||
|
@ -1513,8 +1513,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 84,
|
||||
"ne2d": 436,
|
||||
"ne1d": 70,
|
||||
"ne2d": 403,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -1528,8 +1528,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 86,
|
||||
"ne2d": 476,
|
||||
"ne1d": 71,
|
||||
"ne2d": 394,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -1543,8 +1543,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 86,
|
||||
"ne2d": 490,
|
||||
"ne1d": 72,
|
||||
"ne2d": 395,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -1558,8 +1558,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 84,
|
||||
"ne2d": 436,
|
||||
"ne1d": 70,
|
||||
"ne2d": 403,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -1573,8 +1573,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 84,
|
||||
"ne2d": 460,
|
||||
"ne1d": 74,
|
||||
"ne2d": 410,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -1588,8 +1588,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 88,
|
||||
"ne2d": 496,
|
||||
"ne1d": 82,
|
||||
"ne2d": 442,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2229,18 +2229,18 @@
|
||||
},
|
||||
{
|
||||
"angles_tet": [
|
||||
16.884,
|
||||
16.888,
|
||||
145.04
|
||||
],
|
||||
"angles_trig": [
|
||||
16.408,
|
||||
17.592,
|
||||
134.95
|
||||
],
|
||||
"ne1d": 240,
|
||||
"ne2d": 1830,
|
||||
"ne3d": 3859,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 6, 25, 68, 162, 284, 407, 508, 515, 505, 411, 383, 323, 208, 54]",
|
||||
"total_badness": 5750.8446823
|
||||
"ne3d": 3886,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 1, 3, 27, 70, 177, 288, 405, 522, 502, 496, 407, 393, 336, 210, 49]",
|
||||
"total_badness": 5799.4091506
|
||||
},
|
||||
{
|
||||
"angles_tet": [
|
||||
@ -2270,7 +2270,7 @@
|
||||
"ne2d": 6864,
|
||||
"ne3d": 33174,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 2, 2, 52, 185, 571, 1253, 2563, 4038, 5675, 6688, 6259, 4556, 1330]",
|
||||
"total_badness": 41696.548837
|
||||
"total_badness": 41696.548838
|
||||
},
|
||||
{
|
||||
"angles_tet": [
|
||||
@ -2713,8 +2713,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 35,
|
||||
"ne2d": 121,
|
||||
"ne1d": 24,
|
||||
"ne2d": 82,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2728,8 +2728,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 30,
|
||||
"ne2d": 98,
|
||||
"ne1d": 16,
|
||||
"ne2d": 44,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2743,8 +2743,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 30,
|
||||
"ne2d": 96,
|
||||
"ne1d": 11,
|
||||
"ne2d": 29,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2758,8 +2758,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 35,
|
||||
"ne2d": 121,
|
||||
"ne1d": 24,
|
||||
"ne2d": 82,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2773,8 +2773,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 44,
|
||||
"ne2d": 190,
|
||||
"ne1d": 36,
|
||||
"ne2d": 146,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2788,8 +2788,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 58,
|
||||
"ne2d": 396,
|
||||
"ne1d": 22,
|
||||
"ne2d": 82,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2805,8 +2805,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 32,
|
||||
"ne2d": 158,
|
||||
"ne1d": 28,
|
||||
"ne2d": 146,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2820,8 +2820,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 32,
|
||||
"ne2d": 130,
|
||||
"ne1d": 22,
|
||||
"ne2d": 134,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2835,8 +2835,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 32,
|
||||
"ne2d": 140,
|
||||
"ne1d": 28,
|
||||
"ne2d": 142,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2850,8 +2850,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 32,
|
||||
"ne2d": 158,
|
||||
"ne1d": 28,
|
||||
"ne2d": 146,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2865,8 +2865,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 45,
|
||||
"ne2d": 313,
|
||||
"ne1d": 39,
|
||||
"ne2d": 290,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2880,8 +2880,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 81,
|
||||
"ne2d": 843,
|
||||
"ne1d": 79,
|
||||
"ne2d": 837,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2897,8 +2897,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 32,
|
||||
"ne2d": 134,
|
||||
"ne1d": 28,
|
||||
"ne2d": 122,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2912,8 +2912,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 32,
|
||||
"ne2d": 108,
|
||||
"ne1d": 22,
|
||||
"ne2d": 110,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2927,7 +2927,7 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 32,
|
||||
"ne1d": 28,
|
||||
"ne2d": 118,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
@ -2942,8 +2942,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 32,
|
||||
"ne2d": 134,
|
||||
"ne1d": 28,
|
||||
"ne2d": 122,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2957,8 +2957,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 45,
|
||||
"ne2d": 253,
|
||||
"ne1d": 39,
|
||||
"ne2d": 239,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
@ -2972,8 +2972,8 @@
|
||||
0.0,
|
||||
0.0
|
||||
],
|
||||
"ne1d": 81,
|
||||
"ne2d": 709,
|
||||
"ne1d": 79,
|
||||
"ne2d": 705,
|
||||
"ne3d": 0,
|
||||
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
|
||||
"total_badness": 0.0
|
||||
|
Loading…
Reference in New Issue
Block a user