mirror of
https://github.com/NGSolve/netgen.git
synced 2025-04-08 22:37:28 +05:00
Revert "only use hashtable in stlboundary"
This reverts commit dbbfebcf1a0cb3ddf4d97a07b275c804601a9027.
This commit is contained in:
parent
1fb048e399
commit
b45d022542
@ -852,25 +852,20 @@ STLBoundary :: STLBoundary (STLGeometry * ageometry)
|
|||||||
|
|
||||||
void STLBoundary :: AddOrDelSegment(const STLBoundarySeg & seg)
|
void STLBoundary :: AddOrDelSegment(const STLBoundarySeg & seg)
|
||||||
{
|
{
|
||||||
INDEX_2 op(seg.I1(), seg.I2());
|
bool found = false;
|
||||||
if(boundary_ht.Used(op))
|
for (int i = 1; i <= boundary.Size(); i++)
|
||||||
boundary_ht.Delete(op);
|
{
|
||||||
else
|
if (found) { boundary.Elem(i-1) = boundary.Get(i); }
|
||||||
boundary_ht[op] = seg;
|
if (boundary.Get(i) == seg) { found = true; }
|
||||||
// bool found = false;
|
}
|
||||||
// for (int i = 1; i <= boundary.Size(); i++)
|
if (!found)
|
||||||
// {
|
{
|
||||||
// if (found) { boundary.Elem(i-1) = boundary.Get(i); }
|
boundary.Append(seg);
|
||||||
// if (boundary.Get(i) == seg) { found = true; }
|
}
|
||||||
// }
|
else
|
||||||
// if (!found)
|
{
|
||||||
// {
|
boundary.SetSize(boundary.Size()-1);
|
||||||
// boundary.Append(seg);
|
}
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// boundary.SetSize(boundary.Size()-1);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void STLBoundary ::AddTriangle(const STLTriangle & t)
|
void STLBoundary ::AddTriangle(const STLTriangle & t)
|
||||||
@ -1014,7 +1009,18 @@ void STLBoundary ::AddTriangle(const STLTriangle & t)
|
|||||||
{
|
{
|
||||||
STLBoundarySeg bseg(seg[0], seg[1], geometry->GetPoints(), chart);
|
STLBoundarySeg bseg(seg[0], seg[1], geometry->GetPoints(), chart);
|
||||||
bseg.SetSmoothEdge (geometry->IsSmoothEdge (seg[0],seg[1]));
|
bseg.SetSmoothEdge (geometry->IsSmoothEdge (seg[0],seg[1]));
|
||||||
AddOrDelSegment(bseg);
|
|
||||||
|
INDEX_2 op(seg[1], seg[0]);
|
||||||
|
if (boundary_ht.Used(op))
|
||||||
|
{
|
||||||
|
// cout << "delete " << op << endl;
|
||||||
|
boundary_ht.Delete(op);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// cout << "insert " << seg << endl;
|
||||||
|
boundary_ht[seg] = bseg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// cout << "bounds = " << boundary << endl;
|
// cout << "bounds = " << boundary << endl;
|
||||||
@ -1100,8 +1106,12 @@ bool STLBoundary :: TestSeg(const Point<3>& p1, const Point<3> & p2, const Vec<3
|
|||||||
Point<3> c = Center (p1, p2);
|
Point<3> c = Center (p1, p2);
|
||||||
double dist1 = Dist (c, p1);
|
double dist1 = Dist (c, p1);
|
||||||
|
|
||||||
for (const auto& [index, seg] : boundary_ht)
|
int nseg = NOSegments();
|
||||||
|
for (j = 1; j <= nseg; j++)
|
||||||
{
|
{
|
||||||
|
const STLBoundarySeg & seg = GetSegment(j);
|
||||||
|
|
||||||
|
|
||||||
if (seg.IsSmoothEdge())
|
if (seg.IsSmoothEdge())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -187,31 +187,23 @@ class STLBoundary
|
|||||||
private:
|
private:
|
||||||
STLGeometry * geometry;
|
STLGeometry * geometry;
|
||||||
const STLChart * chart;
|
const STLChart * chart;
|
||||||
// NgArray<STLBoundarySeg> boundary;
|
NgArray<STLBoundarySeg> boundary;
|
||||||
ClosedHashTable<INDEX_2, STLBoundarySeg> boundary_ht;
|
ClosedHashTable<INDEX_2, STLBoundarySeg> boundary_ht;
|
||||||
BoxTree<2,INDEX_2> * searchtree = nullptr;
|
BoxTree<2,INDEX_2> * searchtree = nullptr;
|
||||||
public:
|
public:
|
||||||
STLBoundary(STLGeometry * ageometry);
|
STLBoundary(STLGeometry * ageometry);
|
||||||
~STLBoundary() { delete searchtree; }
|
~STLBoundary() { delete searchtree; }
|
||||||
|
|
||||||
void Clear() {/* boundary.SetSize(0)*/; boundary_ht = ClosedHashTable<INDEX_2,STLBoundarySeg>(); }
|
void Clear() {boundary.SetSize(0); boundary_ht = ClosedHashTable<INDEX_2,STLBoundarySeg>(); }
|
||||||
void SetChart (const STLChart * achart) { chart = achart; }
|
void SetChart (const STLChart * achart) { chart = achart; }
|
||||||
//don't check, if already exists!
|
//don't check, if already exists!
|
||||||
void AddNewSegment(const STLBoundarySeg & seg)
|
void AddNewSegment(const STLBoundarySeg & seg) {boundary.Append(seg);};
|
||||||
{
|
|
||||||
// boundary.Append(seg);
|
|
||||||
INDEX_2 op(seg.I1(), seg.I2());
|
|
||||||
boundary_ht[op] = seg;
|
|
||||||
};
|
|
||||||
//check if segment exists
|
//check if segment exists
|
||||||
void AddOrDelSegment(const STLBoundarySeg & seg);
|
void AddOrDelSegment(const STLBoundarySeg & seg);
|
||||||
//addordelsegment for all 3 triangle segments!
|
//addordelsegment for all 3 triangle segments!
|
||||||
void AddTriangle(const STLTriangle & t);
|
void AddTriangle(const STLTriangle & t);
|
||||||
int NOSegments() {
|
int NOSegments() {return boundary.Size();};
|
||||||
return boundary_ht.Size();
|
const STLBoundarySeg & GetSegment(int i) {return boundary.Get(i);}
|
||||||
// return boundary.Size();
|
|
||||||
};
|
|
||||||
// const STLBoundarySeg & GetSegment(int i) {return boundary.Get(i);}
|
|
||||||
|
|
||||||
void BuildSearchTree();
|
void BuildSearchTree();
|
||||||
void DeleteSearchTree();
|
void DeleteSearchTree();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user