little cleanup in adfront2

This commit is contained in:
Christopher Lackner 2019-10-23 14:44:07 +02:00
parent df1f445c8f
commit c361d1712d
3 changed files with 35 additions and 20 deletions

View File

@ -904,6 +904,14 @@ public:
GetFirstIntersecting(pmin, pmax, [&pis](auto pi) { pis.Append(pi); return false;}); GetFirstIntersecting(pmin, pmax, [&pis](auto pi) { pis.Append(pi); return false;});
} }
void GetIntersecting(const Point<dim> & pmin,
const Point<dim> & pmax,
Array<T> & pis) const
{
pis.SetSize0();
GetFirstIntersecting(pmin, pmax, [&pis](auto pi) { pis.Append(pi); return false;});
}
void Insert (const Box<dim> & box, T pi) void Insert (const Box<dim> & box, T pi)
{ {
Insert (box.PMin(), box.PMax(), pi); Insert (box.PMin(), box.PMax(), pi);

View File

@ -292,7 +292,7 @@ namespace netgen
loclines.Append(lines[baselineindex].L()); loclines.Append(lines[baselineindex].L());
lindex.Append(baselineindex); lindex.Append(baselineindex);
NgArrayMem<int, 1000> nearlines(0); ArrayMem<int, 1000> nearlines(0);
NgArrayMem<int, 1000> nearpoints(0); NgArrayMem<int, 1000> nearpoints(0);
// dominating costs !! // dominating costs !!
@ -300,14 +300,14 @@ namespace netgen
p0 + Vec3d(xh, xh, xh), p0 + Vec3d(xh, xh, xh),
nearlines); nearlines);
// only cone points, other points are from linesearchtree // only special points that are not in adfront,
cpointsearchtree.GetIntersecting (p0 - Vec3d(xh, xh, xh), // other points are from linesearchtree
p0 + Vec3d(xh, xh, xh), cpointsearchtree.GetIntersecting(p0 - Vec3d(xh, xh, xh),
nearpoints); p0 + Vec3d(xh, xh, xh),
nearpoints);
for (int ii = 0; ii < nearlines.Size(); ii++) for(auto i : nearlines)
{ {
int i = nearlines[ii];
if (lines[i].Valid() && i != baselineindex) if (lines[i].Valid() && i != baselineindex)
{ {
loclines.Append(lines[i].L()); loclines.Append(lines[i].L());
@ -318,38 +318,37 @@ namespace netgen
// static NgArray<int> invpindex; // static NgArray<int> invpindex;
invpindex.SetSize (points.Size()); invpindex.SetSize (points.Size());
// invpindex = -1; // invpindex = -1;
for (int i = 0; i < nearpoints.Size(); i++) for(auto pi : nearpoints)
invpindex[nearpoints[i]] = -1; invpindex[pi] = -1;
for (int i = 0; i < loclines.Size(); i++) for(const auto& li : loclines)
{ {
invpindex[loclines[i].I1()] = 0; invpindex[li.I1()] = 0;
invpindex[loclines[i].I2()] = 0; invpindex[li.I2()] = 0;
} }
for (int i = 0; i < loclines.Size(); i++) for(auto& line : loclines)
{ {
for (int j = 0; j < 2; j++) for(auto i : Range(2))
{ {
int pi = loclines[i][j]; auto& pi = line[i];
if (invpindex[pi] == 0) if (invpindex[pi] == 0)
{ {
pindex.Append (pi); pindex.Append (pi);
invpindex[pi] = pindex.Size(); invpindex[pi] = pindex.Size();
locpoints.Append (points[pi].P()); locpoints.Append (points[pi].P());
loclines[i][j] = locpoints.Size(); pi = locpoints.Size();
} }
else else
loclines[i][j] = invpindex[pi]; pi = invpindex[pi];
} }
} }
// double xh2 = xh*xh; // double xh2 = xh*xh;
for (int ii = 0; ii < nearpoints.Size(); ii++) for(auto i : nearpoints)
{ {
int i = nearpoints[ii];
if (points[i].Valid() && if (points[i].Valid() &&
points[i].OnSurface() && points[i].OnSurface() &&
// Dist2 (points.Get(i).P(), p0) <= xh2 && // Dist2 (points.Get(i).P(), p0) <= xh2 &&

View File

@ -6,6 +6,14 @@
namespace netgen namespace netgen
{ {
ostream& operator << (ostream& ost, const MultiPointGeomInfo& mpgi)
{
for(auto i : Range(mpgi.GetNPGI()))
{
ost << "gi[" << i << "] = " << mpgi.GetPGI(i+1) << endl;
}
return ost;
}
static void glrender (int wait); static void glrender (int wait);
#ifdef OPENGL #ifdef OPENGL
extern DLL_HEADER void Render(bool blocking = false); extern DLL_HEADER void Render(bool blocking = false);