mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
* Bug-fix for division by zero error in the OpenCascade "Dist" function
* Added further "division by zero" protection at various other locations
This commit is contained in:
parent
9c9c630df0
commit
1316c224d2
@ -15,6 +15,7 @@ namespace netgen
|
|||||||
|
|
||||||
#define DIVIDEEDGESECTIONS 1000
|
#define DIVIDEEDGESECTIONS 1000
|
||||||
#define IGNORECURVELENGTH 1e-4
|
#define IGNORECURVELENGTH 1e-4
|
||||||
|
#define VSMALL 1e-10
|
||||||
|
|
||||||
|
|
||||||
bool merge_solids = 1;
|
bool merge_solids = 1;
|
||||||
@ -26,7 +27,7 @@ namespace netgen
|
|||||||
double nq = n*q;
|
double nq = n*q;
|
||||||
|
|
||||||
Point<3> p = p0 + 0.5*n;
|
Point<3> p = p0 + 0.5*n;
|
||||||
double lambda = (p-l.p0)*n / nq;
|
double lambda = (p-l.p0)*n / (nq + VSMALL);
|
||||||
|
|
||||||
if (lambda >= 0 && lambda <= 1)
|
if (lambda >= 0 && lambda <= 1)
|
||||||
{
|
{
|
||||||
@ -62,7 +63,7 @@ namespace netgen
|
|||||||
if (mparam.maxh * kappa < 1)
|
if (mparam.maxh * kappa < 1)
|
||||||
hret = mparam.maxh;
|
hret = mparam.maxh;
|
||||||
else
|
else
|
||||||
hret = 1 / kappa;
|
hret = 1 / (kappa + VSMALL);
|
||||||
|
|
||||||
if (mparam.maxh < hret)
|
if (mparam.maxh < hret)
|
||||||
hret = mparam.maxh;
|
hret = mparam.maxh;
|
||||||
@ -633,7 +634,7 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
(*testout) << "mesh face " << k << endl;
|
(*testout) << "mesh face " << k << endl;
|
||||||
multithread.percent = 100 * k / (mesh.GetNFD()+1e-10);
|
multithread.percent = 100 * k / (mesh.GetNFD() + VSMALL);
|
||||||
geom.facemeshstatus[k-1] = -1;
|
geom.facemeshstatus[k-1] = -1;
|
||||||
|
|
||||||
|
|
||||||
@ -901,7 +902,7 @@ namespace netgen
|
|||||||
// if (k != 36) continue;
|
// if (k != 36) continue;
|
||||||
|
|
||||||
// (*testout) << "optimize face " << k << endl;
|
// (*testout) << "optimize face " << k << endl;
|
||||||
multithread.percent = 100 * k / (mesh.GetNFD()+1e-10);
|
multithread.percent = 100 * k / (mesh.GetNFD() + VSMALL);
|
||||||
|
|
||||||
FaceDescriptor & fd = mesh.GetFaceDescriptor(k);
|
FaceDescriptor & fd = mesh.GetFaceDescriptor(k);
|
||||||
|
|
||||||
@ -1229,7 +1230,7 @@ namespace netgen
|
|||||||
mindist = min (mindist, line.Dist(lines[num]));
|
mindist = min (mindist, line.Dist(lines[num]));
|
||||||
}
|
}
|
||||||
|
|
||||||
mindist *= occparam.resthcloseedgefac;
|
mindist /= (occparam.resthcloseedgefac + VSMALL);
|
||||||
|
|
||||||
if (mindist < 1e-3)
|
if (mindist < 1e-3)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user