Fix maxh issue for splines

This commit is contained in:
Matthias Hochsteger 2020-10-19 13:19:25 +02:00
parent 2b5d00b259
commit 9d5661fdc5

View File

@ -242,23 +242,28 @@ namespace netgen
mesh2d.RestrictLocalHLine (Point<3>(p1(0),p1(1),0), mesh2d.RestrictLocalHLine (Point<3>(p1(0),p1(1),0),
Point<3>(p2(0),p2(1),0), len/mp.segmentsperedge); 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 hcurve = min (spline.hmax, h/spline.reffak);
double hl = GetDomainMaxh (spline.leftdom); double hl = GetDomainMaxh (spline.leftdom);
if (hl > 0) hcurve = min2 (hcurve, hl); if (hl > 0) hcurve = min2 (hcurve, hl);
double hr = GetDomainMaxh (spline.rightdom); double hr = GetDomainMaxh (spline.rightdom);
if (hr > 0) hcurve = min2 (hcurve, hr); if (hr > 0) hcurve = min2 (hcurve, hr);
int np = 1000; // skip curvature restrictions for straight lines
for (double t = 0.5/np; t < 1; t += 1.0/np) if(spline.MaxCurvature()==0)
{ {
Point<2> x = spline.GetPoint(t); mesh2d.RestrictLocalHLine (Point<3>(p1(0),p1(1),0),
double hc = 1.0/mp.curvaturesafety / (1e-99+spline.CalcCurvature (t)); Point<3>(p2(0),p2(1),0), hcurve);
mesh2d.RestrictLocalH (Point<3> (x(0), x(1), 0), min2(hc, hcurve)); }
} else
{
int np = 1000;
for (double t = 0.5/np; t < 1; t += 1.0/np)
{
Point<2> x = spline.GetPoint(t);
double hc = 1.0/mp.curvaturesafety / (1e-99+spline.CalcCurvature (t));
mesh2d.RestrictLocalH (Point<3> (x(0), x(1), 0), min2(hc, hcurve));
}
}
} }
for (auto mspnt : mp.meshsize_points) for (auto mspnt : mp.meshsize_points)