first add corner points to mesh, and then edge points (for consistent orientation on periodic edges)

This commit is contained in:
Joachim Schöberl 2017-03-08 18:07:45 +01:00
parent 9c0f1b5bdb
commit 5efaa2f85b

View File

@ -238,6 +238,29 @@ namespace netgen
} }
} }
// first add all vertices (for compatible orientation on periodic bnds)
{
double diam2 = Dist2(pmin, pmax);
for (int i = 0; i < splines.Size(); i++)
for (int j : { 1, 2 })
{
Point<2> hnewp = (j == 1) ? splines[i]->StartPI() : splines[i]->EndPI();
Point<3> newp(hnewp(0), hnewp(1), 0);
int layer = GetSpline(i).layer;
int npi = -1;
for (PointIndex pi = PointIndex::BASE;
pi < mesh2d.GetNP()+PointIndex::BASE; pi++)
if (Dist2 (mesh2d.Point(pi), newp) < 1e-12 * diam2 && mesh2d.Point(pi).GetLayer() == layer)
npi = pi;
if (npi == -1)
{
npi = mesh2d.AddPoint (newp, layer);
searchtree.Insert (newp, npi);
}
}
}
for (int i = 0; i < splines.Size(); i++) for (int i = 0; i < splines.Size(); i++)
if (GetSpline(i).copyfrom == -1) if (GetSpline(i).copyfrom == -1)
{ {