Merge branch 'fix_occ_surface_meshing_close_edges' into 'master'

occ - use search tree to identify points in parameter space

See merge request jschoeberl/netgen!458
This commit is contained in:
Joachim Schöberl 2021-12-01 11:03:08 +00:00
commit f74f648aa4

View File

@ -325,85 +325,48 @@ namespace netgen
{ {
static Timer t("MeshSurface: Find edges and points - Parameter"); RegionTimer r(t); static Timer t("MeshSurface: Find edges and points - Parameter"); RegionTimer r(t);
int cntp = 0; Array<PointGeomInfo> gis(2*segments.Size());
/*
for (int i = 1; i <= mesh.GetNSeg(); i++)
if (mesh.LineSegment(i).si == k)
cntp+=2;
*/
cntp = 2*segments.Size();
//for (Segment & seg : mesh.LineSegments())
//if (seg.si == k)
//cntp += 2;
NgArray<PointGeomInfo> gis;
gis.SetAllocSize (cntp);
gis.SetSize (0); gis.SetSize (0);
//for (int i = 1; i <= mesh.GetNSeg(); i++) Box<2> uv_box(Box<2>::EMPTY_BOX);
for(auto & seg : segments) for(auto & seg : segments)
{ for(auto i : Range(2))
//Segment & seg = mesh.LineSegment(i); uv_box.Add( {seg.epgeominfo[i].u, seg.epgeominfo[i].v } );
//if (seg.si == k)
{
PointGeomInfo gi0, gi1;
gi0.trignum = gi1.trignum = k;
gi0.u = seg.epgeominfo[0].u;
gi0.v = seg.epgeominfo[0].v;
gi1.u = seg.epgeominfo[1].u;
gi1.v = seg.epgeominfo[1].v;
int locpnum[2] = {0, 0}; BoxTree<2> uv_tree(uv_box);
Array<int> found_points;
for (int j = 0; j < 2; j++) for(auto & seg : segments)
{ {
PointGeomInfo gi = (j == 0) ? gi0 : gi1; PointGeomInfo gi[2];
gi[0].trignum = gi[1].trignum = k;
gi[0].u = seg.epgeominfo[0].u;
gi[0].v = seg.epgeominfo[0].v;
gi[1].u = seg.epgeominfo[1].u;
gi[1].v = seg.epgeominfo[1].v;
/* int locpnum[2] = {0, 0};
int l;
for (l = 0; l < gis.Size() && locpnum[j] == 0; l++)
{
double dist = sqr (gis[l].u-gi.u)+sqr(gis[l].v-gi.v);
if (dist < 1e-10) for (int j = 0; j < 2; j++)
locpnum[j] = l+1; {
} Point<2> uv = {gi[j].u, gi[j].v};
uv_tree.GetIntersecting(uv, uv, found_points);
if (locpnum[j] == 0) if(found_points.Size())
{ locpnum[j] = found_points[0];
PointIndex pi = seg[j]; else
meshing.AddPoint (mesh.Point(pi), pi); {
PointIndex pi = seg[j];
meshing.AddPoint (mesh.Point(pi), pi);
gis.SetSize (gis.Size()+1); gis.Append (gi[j]);
gis[l] = gi; locpnum[j] = gis.Size();
locpnum[j] = l+1; uv_tree.Insert(uv, locpnum[j]);
} }
*/ }
for (int l = 0; l < gis.Size(); l++)
{
double dist = sqr (gis[l].u-gi.u)+sqr(gis[l].v-gi.v);
if (dist < 1e-10)
{
locpnum[j] = l+1;
break;
}
}
if (locpnum[j] == 0) meshing.AddBoundaryElement (locpnum[0], locpnum[1], gi[0], gi[1]);
{ }
PointIndex pi = seg[j];
meshing.AddPoint (mesh.Point(pi), pi);
gis.Append (gi);
locpnum[j] = gis.Size();
}
}
meshing.AddBoundaryElement (locpnum[0], locpnum[1], gi0, gi1);
}
}
} }