0021073: EDF 1683 NETGENPLUGIN: Local size on edge creates unreguler 1D elements

Fix regressions
This commit is contained in:
eap 2010-11-23 14:31:55 +00:00
parent 164a30901f
commit d6274da122

View File

@ -596,7 +596,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
ARRAY<MeshPoint> & ps, ARRAY<MeshPoint> & ps,
ARRAY<double> & params, ARRAY<double> & params,
Mesh & mesh) Mesh & mesh)
@@ -49,23 +49,19 @@ @@ -49,23 +49,18 @@
hvalue[0] = 0; hvalue[0] = 0;
pnt = c->Value(s0); pnt = c->Value(s0);
@ -609,11 +609,12 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
{ {
oldpnt = pnt; oldpnt = pnt;
pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0)); pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0));
+ double dist = pnt.Distance(oldpnt); - hvalue[i] = hvalue[i-1] +
hvalue[i] = hvalue[i-1] + - 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
- pnt.Distance(oldpnt); - pnt.Distance(oldpnt);
+ dist; + double dist = pnt.Distance(oldpnt);
+ hvalue[i] = hvalue[i-1] + min( 1.0,
+ 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*dist);
//(*testout) << "mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) " << mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) //(*testout) << "mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) " << mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))
// << " pnt.Distance(oldpnt) " << pnt.Distance(oldpnt) << endl; // << " pnt.Distance(oldpnt) " << pnt.Distance(oldpnt) << endl;
@ -624,7 +625,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
} }
// nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS])); // nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS]));
@@ -74,13 +70,16 @@ @@ -74,13 +69,16 @@
ps.SetSize(nsubedges-1); ps.SetSize(nsubedges-1);
params.SetSize(nsubedges+1); params.SetSize(nsubedges+1);
@ -637,13 +638,13 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
{ {
- params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0); - params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
+ // EAP. For nsubedges comparable to DIVIDEEDGESECTIONS (issue 0021073) + // EAP. For nsubedges comparable to DIVIDEEDGESECTIONS (issue 0021073)
+ double d1 = i1 - (hvalue[i1]-i)/(hvalue[i1]-hvalue[i1-1]); + double d1 = i1 - (hvalue[i1] - i*hvalue[DIVIDEEDGESECTIONS]/nsubedges)/(hvalue[i1]-hvalue[i1-1]);
+ params[i] = s0+(d1/double(DIVIDEEDGESECTIONS))*(s1-s0); + params[i] = s0+(d1/double(DIVIDEEDGESECTIONS))*(s1-s0);
+ //params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0); + //params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
pnt = c->Value(params[i]); pnt = c->Value(params[i]);
ps[i-1] = MeshPoint (Point3d(pnt.X(), pnt.Y(), pnt.Z())); ps[i-1] = MeshPoint (Point3d(pnt.X(), pnt.Y(), pnt.Z()));
i++; i++;
@@ -112,7 +111,7 @@ @@ -112,7 +110,7 @@
static void FindEdges (OCCGeometry & geom, Mesh & mesh) static void FindEdges (OCCGeometry & geom, Mesh & mesh)
{ {
@ -652,7 +653,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
multithread.task = "Edge meshing"; multithread.task = "Edge meshing";
(*testout) << "edge meshing" << endl; (*testout) << "edge meshing" << endl;
@@ -124,6 +123,7 @@ @@ -124,6 +122,7 @@
(*testout) << "nedges = " << nedges << endl; (*testout) << "nedges = " << nedges << endl;
double eps = 1e-6 * geom.GetBoundingBox().Diam(); double eps = 1e-6 * geom.GetBoundingBox().Diam();
@ -660,7 +661,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
for (int i = 1; i <= nvertices; i++) for (int i = 1; i <= nvertices; i++)
{ {
@@ -133,7 +133,7 @@ @@ -133,7 +132,7 @@
bool exists = 0; bool exists = 0;
if (merge_solids) if (merge_solids)
for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++) for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++)
@ -669,7 +670,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
{ {
exists = 1; exists = 1;
break; break;
@@ -163,6 +163,7 @@ @@ -163,6 +162,7 @@
{ {
TopoDS_Face face = TopoDS::Face(exp1.Current()); TopoDS_Face face = TopoDS::Face(exp1.Current());
int facenr = geom.fmap.FindIndex(face); int facenr = geom.fmap.FindIndex(face);
@ -677,7 +678,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
if (face2solid[0][facenr-1] == 0) if (face2solid[0][facenr-1] == 0)
face2solid[0][facenr-1] = solidnr; face2solid[0][facenr-1] = solidnr;
@@ -184,6 +185,9 @@ @@ -184,6 +184,9 @@
int facenr = 0; int facenr = 0;
int edgenr = 0; int edgenr = 0;
@ -687,7 +688,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
(*testout) << "faces = " << geom.fmap.Extent() << endl; (*testout) << "faces = " << geom.fmap.Extent() << endl;
int curr = 0; int curr = 0;
@@ -232,6 +236,11 @@ @@ -232,6 +235,11 @@
continue; continue;
} }
@ -699,7 +700,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) == if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) ==
geom.vmap.FindIndex(TopExp::LastVertex (edge))) geom.vmap.FindIndex(TopExp::LastVertex (edge)))
{ {
@@ -276,8 +285,8 @@ @@ -276,8 +284,8 @@
pnums.Last() = -1; pnums.Last() = -1;
for (PointIndex pi = 1; pi < first_ep; pi++) for (PointIndex pi = 1; pi < first_ep; pi++)
{ {
@ -710,7 +711,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
} }
} }
@@ -287,7 +296,7 @@ @@ -287,7 +295,7 @@
bool exists = 0; bool exists = 0;
int j; int j;
for (j = first_ep; j <= mesh.GetNP(); j++) for (j = first_ep; j <= mesh.GetNP(); j++)
@ -719,7 +720,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
{ {
exists = 1; exists = 1;
break; break;
@@ -394,7 +403,7 @@ @@ -394,7 +402,7 @@
int i, j, k; int i, j, k;
int changed; int changed;
@ -728,7 +729,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
multithread.task = "Surface meshing"; multithread.task = "Surface meshing";
geom.facemeshstatus = 0; geom.facemeshstatus = 0;
@@ -751,7 +760,7 @@ @@ -751,7 +759,7 @@
multithread.task = savetask; multithread.task = savetask;
} }
@ -737,7 +738,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
{ {
double hret; double hret;
kappa *= mparam.curvaturesafety; kappa *= mparam.curvaturesafety;
@@ -779,7 +788,7 @@ @@ -779,7 +787,7 @@
double nq = n*q; double nq = n*q;
Point<3> p = p0 + 0.5*n; Point<3> p = p0 + 0.5*n;
@ -746,7 +747,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
if (lambda >= 0 && lambda <= 1) if (lambda >= 0 && lambda <= 1)
{ {
@@ -799,55 +808,55 @@ @@ -799,55 +807,55 @@
@ -822,7 +823,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
//(*testout) << "curvature " << curvature << endl; //(*testout) << "curvature " << curvature << endl;
@@ -886,51 +895,47 @@ @@ -886,51 +894,47 @@
pm1.SetX(0.5*(par0.X()+par2.X())); pm1.SetY(0.5*(par0.Y()+par2.Y())); pm1.SetX(0.5*(par0.X()+par2.X())); pm1.SetY(0.5*(par0.Y()+par2.Y()));
pm2.SetX(0.5*(par1.X()+par0.X())); pm2.SetY(0.5*(par1.Y()+par0.Y())); pm2.SetX(0.5*(par1.X()+par0.X())); pm2.SetY(0.5*(par1.Y()+par0.Y()));
@ -889,7 +890,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
(*testout) << pnt.X() << " " << pnt.Y() << " " << pnt.Z() << endl; (*testout) << pnt.X() << " " << pnt.Y() << " " << pnt.Z() << endl;
*/ */
} }
@@ -970,7 +975,7 @@ @@ -970,7 +974,7 @@
if (mparam.uselocalh) if (mparam.uselocalh)
{ {
@ -898,7 +899,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
multithread.percent = 0; multithread.percent = 0;
mesh->SetLocalH (bb.PMin(), bb.PMax(), mparam.grading); mesh->SetLocalH (bb.PMin(), bb.PMax(), mparam.grading);
@@ -1075,7 +1080,6 @@ @@ -1075,7 +1079,6 @@
if (triangulation.IsNull()) continue; if (triangulation.IsNull()) continue;
BRepAdaptor_Surface sf(face, Standard_True); BRepAdaptor_Surface sf(face, Standard_True);
@ -906,7 +907,7 @@ diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_ne
int ntriangles = triangulation -> NbTriangles(); int ntriangles = triangulation -> NbTriangles();
for (int j = 1; j <= ntriangles; j++) for (int j = 1; j <= ntriangles; j++)
@@ -1096,7 +1100,7 @@ @@ -1096,7 +1099,7 @@
maxside = max (maxside, p[1].Distance(p[2])); maxside = max (maxside, p[1].Distance(p[2]));
//cout << "\rFace " << i << " pos11 ntriangles " << ntriangles << " maxside " << maxside << flush; //cout << "\rFace " << i << " pos11 ntriangles " << ntriangles << " maxside " << maxside << flush;