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;});
}
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)
{
Insert (box.PMin(), box.PMax(), pi);

View File

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

View File

@ -6,6 +6,14 @@
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);
#ifdef OPENGL
extern DLL_HEADER void Render(bool blocking = false);