copy pnums for 'same' edges

This commit is contained in:
Joachim Schoeberl 2021-09-02 21:48:05 +02:00
parent 1c6be3b363
commit 2a4eaa60cd

View File

@ -221,7 +221,7 @@ namespace netgen
void DivideEdge (TopoDS_Edge & edge, NgArray<MeshPoint> & ps, void DivideEdge (TopoDS_Edge & edge, NgArray<MeshPoint> & ps,
NgArray<double> & params, Mesh & mesh, Array<double> & params, Mesh & mesh,
const MeshingParameters & mparam) const MeshingParameters & mparam)
{ {
double s0, s1; double s0, s1;
@ -307,6 +307,9 @@ namespace netgen
int nvertices = geom.vmap.Extent(); int nvertices = geom.vmap.Extent();
int nedges = geom.emap.Extent(); int nedges = geom.emap.Extent();
Array<Array<PointIndex>> alledgepnums(nedges);
Array<Array<double>> alledgeparams(nedges);
(*testout) << "nvertices = " << nvertices << endl; (*testout) << "nvertices = " << nvertices << endl;
(*testout) << "nedges = " << nedges << endl; (*testout) << "nedges = " << nedges << endl;
@ -467,8 +470,8 @@ namespace netgen
cof = BRep_Tool::CurveOnSurface (edge, face, s0, s1); cof = BRep_Tool::CurveOnSurface (edge, face, s0, s1);
int geomedgenr = geom.emap.FindIndex(edge); int geomedgenr = geom.emap.FindIndex(edge);
NgArray<PointIndex> pnums; Array<PointIndex> pnums;
NgArray <double> params; Array<double> params;
// check for identifications // check for identifications
@ -533,8 +536,16 @@ namespace netgen
if (!copy_identified) if (!copy_identified)
{ {
NgArray <MeshPoint> mp;
if (alledgepnums[geomedgenr-1].Size())
{
pnums = alledgepnums[geomedgenr-1];
params = alledgeparams[geomedgenr-1];
}
else
{
NgArray <MeshPoint> mp;
DivideEdge (edge, mp, params, mesh, mparam); DivideEdge (edge, mp, params, mesh, mparam);
pnums.SetSize(mp.Size()+2); pnums.SetSize(mp.Size()+2);
@ -562,6 +573,7 @@ namespace netgen
bool exists = false; bool exists = false;
tsearch.Start(); tsearch.Start();
/*
// for (PointIndex j = first_ep; j < mesh.Points().End(); j++) // for (PointIndex j = first_ep; j < mesh.Points().End(); j++)
for (PointIndex j = first_ep; j < *mesh.Points().Range().end(); j++) for (PointIndex j = first_ep; j < *mesh.Points().Range().end(); j++)
if ((mesh.Point(j)-Point<3>(mp[i-1])).Length() < eps) if ((mesh.Point(j)-Point<3>(mp[i-1])).Length() < eps)
@ -570,7 +582,7 @@ namespace netgen
pnums[i] = j; pnums[i] = j;
break; break;
} }
*/
tsearch.Stop(); tsearch.Stop();
if (!exists) if (!exists)
@ -579,6 +591,9 @@ namespace netgen
} }
alledgepnums[geomedgenr-1] = pnums;
alledgeparams[geomedgenr-1] = params;
}
if(geom.enames.Size() && geom.enames[curr-1] != "") if(geom.enames.Size() && geom.enames[curr-1] != "")
mesh.SetCD2Name(geomedgenr, geom.enames[curr-1]); mesh.SetCD2Name(geomedgenr, geom.enames[curr-1]);
@ -602,20 +617,17 @@ namespace netgen
seg.epgeominfo[0].edgenr = geomedgenr; seg.epgeominfo[0].edgenr = geomedgenr;
seg.epgeominfo[1].edgenr = geomedgenr; seg.epgeominfo[1].edgenr = geomedgenr;
gp_Pnt2d p2d1, p2d2;
double s0 = params[i-1]; double s0 = params[i-1];
double s1 = params[i]; double s1 = params[i];
double delta = s1-s0; double delta = s1-s0;
s0 += 1e-10*delta; // fixes normal-vector roundoff problem when endpoint is cone-tip s0 += 1e-10*delta; // fixes normal-vector roundoff problem when endpoint is cone-tip
s1 -= 1e-10*delta; s1 -= 1e-10*delta;
p2d1 = cof->Value(s0); gp_Pnt2d p2d1 = cof->Value(s0);
p2d2 = cof->Value(s1); gp_Pnt2d p2d2 = cof->Value(s1);
// if (i == 1) p2d = cof->Value(s0); seg.epgeominfo[0].u = p2d1.X();
seg.epgeominfo[0].u = p2d1.X(); // + 1e-10 * vec.X(); seg.epgeominfo[0].v = p2d1.Y();
seg.epgeominfo[0].v = p2d1.Y(); // + 1e-10 * vec.Y(); seg.epgeominfo[1].u = p2d2.X();
// if (i == mp.Size()+1) p2d = cof -> Value(s1); seg.epgeominfo[1].v = p2d2.Y();
seg.epgeominfo[1].u = p2d2.X(); // - 1e-10 * vec.X();
seg.epgeominfo[1].v = p2d2.Y(); // - 1e-10 * vec.Y();
/* /*
if (occface->IsUPeriodic()) if (occface->IsUPeriodic())