Merge remote-tracking branch 'origin/master' into boundarylayer_fixes

This commit is contained in:
Matthias Hochsteger 2024-10-24 11:08:58 +02:00
commit 6aa634ce1f
9 changed files with 65 additions and 48 deletions

View File

@ -396,15 +396,15 @@ void PeriodicIdentification :: IdentifyFaces (class Mesh & mesh)
if (side == 1)
{
if (mesh.GetIdentifications().Get (seg1[0], seg2[0]) &&
mesh.GetIdentifications().Get (seg1[1], seg2[1]))
if (mesh.GetIdentifications().Used (seg1[0], seg2[0]) &&
mesh.GetIdentifications().Used (seg1[1], seg2[1]))
{
foundother = 1;
break;
}
if (mesh.GetIdentifications().Get (seg1[0], seg2[1]) &&
mesh.GetIdentifications().Get (seg1[1], seg2[0]))
if (mesh.GetIdentifications().Used (seg1[0], seg2[1]) &&
mesh.GetIdentifications().Used (seg1[1], seg2[0]))
{
foundother = 1;
break;
@ -412,15 +412,15 @@ void PeriodicIdentification :: IdentifyFaces (class Mesh & mesh)
}
else
{
if (mesh.GetIdentifications().Get (seg2[0], seg1[0]) &&
mesh.GetIdentifications().Get (seg2[1], seg1[1]))
if (mesh.GetIdentifications().Used (seg2[0], seg1[0]) &&
mesh.GetIdentifications().Used (seg2[1], seg1[1]))
{
foundother = 1;
break;
}
if (mesh.GetIdentifications().Get (seg2[0], seg1[1]) &&
mesh.GetIdentifications().Get (seg2[1], seg1[0]))
if (mesh.GetIdentifications().Used (seg2[0], seg1[1]) &&
mesh.GetIdentifications().Used (seg2[1], seg1[0]))
{
foundother = 1;
break;
@ -1168,15 +1168,15 @@ void CloseSurfaceIdentification :: IdentifyFaces (class Mesh & mesh)
if (side == 1)
{
if (mesh.GetIdentifications().Get (seg1[0], seg2[0]) &&
mesh.GetIdentifications().Get (seg1[1], seg2[1]))
if (mesh.GetIdentifications().Used (seg1[0], seg2[0]) &&
mesh.GetIdentifications().Used (seg1[1], seg2[1]))
{
foundother = 1;
break;
}
if (mesh.GetIdentifications().Get (seg1[0], seg2[1]) &&
mesh.GetIdentifications().Get (seg1[1], seg2[0]))
if (mesh.GetIdentifications().Used (seg1[0], seg2[1]) &&
mesh.GetIdentifications().Used (seg1[1], seg2[0]))
{
foundother = 1;
break;
@ -1184,15 +1184,15 @@ void CloseSurfaceIdentification :: IdentifyFaces (class Mesh & mesh)
}
else
{
if (mesh.GetIdentifications().Get (seg2[0], seg1[0]) &&
mesh.GetIdentifications().Get (seg2[1], seg1[1]))
if (mesh.GetIdentifications().Used (seg2[0], seg1[0]) &&
mesh.GetIdentifications().Used (seg2[1], seg1[1]))
{
foundother = 1;
break;
}
if (mesh.GetIdentifications().Get (seg2[0], seg1[1]) &&
mesh.GetIdentifications().Get (seg2[1], seg1[0]))
if (mesh.GetIdentifications().Used (seg2[0], seg1[1]) &&
mesh.GetIdentifications().Used (seg2[1], seg1[0]))
{
foundother = 1;
break;
@ -1650,8 +1650,8 @@ BuildSurfaceElements (NgArray<Segment> & segs,
{
const Segment & s1 = segs.Get(i1);
const Segment & s2 = segs.Get(i2);
if (mesh.GetIdentifications().Get (s1[0], s2[1]) &&
mesh.GetIdentifications().Get (s1[1], s2[0]))
if (mesh.GetIdentifications().Used (s1[0], s2[1]) &&
mesh.GetIdentifications().Used (s1[1], s2[0]))
{
Element2d el(QUAD);
el.PNum(1) = s1[0];

View File

@ -121,7 +121,7 @@ namespace netgen
{
INDEX_2 edge(el.PNum(j), el.PNum(k));
edge.Sort();
if (mesh.GetIdentifications().GetSymmetric (el.PNum(j), el.PNum(k)))
if (mesh.GetIdentifications().UsedSymmetric (el.PNum(j), el.PNum(k)))
{
int pi3 = 1, pi4 = 1;
while (pi3 == j || pi3 == k) pi3++;
@ -157,8 +157,8 @@ namespace netgen
INDEX_2 edge2(pi2, pi3);
edge1.Sort();
edge2.Sort();
if (mesh.GetIdentifications().GetSymmetric (pi1, pi4) &&
mesh.GetIdentifications().GetSymmetric (pi2, pi3))
if (mesh.GetIdentifications().UsedSymmetric (pi1, pi4) &&
mesh.GetIdentifications().UsedSymmetric (pi2, pi3))
{
//int p3 = el.PNum(pi3);
//int p4 = el.PNum(pi4);
@ -186,7 +186,7 @@ namespace netgen
INDEX_2 edge(el.PNum(j), el.PNum(k));
edge.Sort();
if (mesh.GetIdentifications().GetSymmetric (el.PNum(j), el.PNum(k)))
if (mesh.GetIdentifications().UsedSymmetric (el.PNum(j), el.PNum(k)))
{
int pi3 = 6-j-k;
int p3 = el.PNum(pi3);
@ -261,15 +261,16 @@ namespace netgen
// if (mesh.GetIdentifications().HasIdentifiedPoints())
{
INDEX_2_HASHTABLE<int> & identpts =
auto & identpts =
mesh.GetIdentifications().GetIdentifiedPoints ();
for (i = 1; i <= identpts.GetNBags(); i++)
for (j = 1; j <= identpts.GetBagSize(i); j++)
{
INDEX_2 pair;
int idnr;
identpts.GetData(i, j, pair, idnr);
INDEX_3 pair;
int dummy;
identpts.GetData(i, j, pair, dummy);
auto idnr = pair[2];
const CloseSurfaceIdentification * csid =
dynamic_cast<const CloseSurfaceIdentification*>
(geom->identifications.Get(idnr));

View File

@ -414,9 +414,14 @@ public:
int BagNr() const { return bagnr; }
int Pos() const { return pos; }
void operator++ (int)
Iterator operator++ (int)
{
Iterator it(ht, bagnr, pos);
++(*this);
return it;
}
Iterator& operator++()
{
// cout << "begin Operator ++: bagnr = " << bagnr << " - pos = " << pos << endl;
pos++;
while (bagnr < ht.GetNBags() &&
pos == ht.GetBagSize(bagnr+1))
@ -424,7 +429,12 @@ public:
pos = 0;
bagnr++;
}
// cout << "end Operator ++: bagnr = " << bagnr << " - pos = " << pos << endl;
return *this;
}
std::pair<INDEX_3, T> operator*()
{
return std::make_pair(ht.hash[bagnr][pos], ht.cont[bagnr][pos]);
}
bool operator != (int i) const
@ -446,6 +456,18 @@ public:
return GetNBags();
}
Iterator begin () const
{
Iterator it(*this, 0, -1);
it++;
return it;
}
int end() const
{
return GetNBags();
}
void GetData (const Iterator & it,
INDEX_3 & ahash, T & acont) const
{

View File

@ -6406,9 +6406,9 @@ namespace netgen
mapped_points = false;
// Add new points
for(auto [p1p2, idnr] : identpts)
for(auto [p1p2, dummy] : identpts)
{
if(idnr != nr)
if(p1p2[2] != nr)
continue;
auto& ipts = inserted_points[{p1p2.I1(), p1p2.I2()}];
auto p1 = Point(p1p2.I1());

View File

@ -561,8 +561,8 @@ namespace netgen
el.SetIndex(m_.domain);
mesh.AddVolumeElement(el);
}
for(const auto& [p1p2, idnr] : m.GetIdentifications().GetIdentifiedPoints())
mesh.GetIdentifications().Add(pmap[p1p2[0]], pmap[p1p2[1]], idnr);
for(const auto& [p1p2, dummy] : m.GetIdentifications().GetIdentifiedPoints())
mesh.GetIdentifications().Add(pmap[p1p2[0]], pmap[p1p2[1]], p1p2[2]);
for(auto i : Range(m.GetIdentifications().GetMaxNr()))
{
mesh.GetIdentifications().SetType(i+1, m.GetIdentifications().GetType(i+1));

View File

@ -2825,14 +2825,8 @@ namespace netgen
Array<INDEX_3> Identifications :: GetPairs () const
{
Array<INDEX_3> pairs;
for (auto i : IntRange(1, identifiedpoints.GetNBags()+1))
for (auto j : IntRange(1, identifiedpoints.GetBagSize(i)+1))
{
INDEX_2 i2;
int nr;
identifiedpoints.GetData (i, j, i2, nr);
pairs.Append ({i2.I1(), i2.I2(), nr});
}
for(auto [i3, dummy] : identifiedpoints_nr)
pairs.Append(i3);
return pairs;
}

View File

@ -1617,9 +1617,9 @@ namespace netgen
// bool HasIdentifiedPoints() const { return identifiedpoints != nullptr; }
///
INDEX_2_HASHTABLE<int> & GetIdentifiedPoints ()
INDEX_3_HASHTABLE<int> & GetIdentifiedPoints ()
{
return identifiedpoints;
return identifiedpoints_nr;
}
bool Used (PointIndex pi1, PointIndex pi2)

View File

@ -484,7 +484,6 @@ namespace netgen
maxhdom = mparam.maxh;
int maxlayer = 1;
int dom = 0;
for(auto dom : Range(geom.GetNSolids()))
{
auto & props = geom.GetSolid(dom).properties;

View File

@ -858,16 +858,17 @@ namespace netgen
{
// if (mesh->GetIdentifications().HasIdentifiedPoints())
{
INDEX_2_HASHTABLE<int> & idpts =
auto & idpts =
mesh->GetIdentifications().GetIdentifiedPoints();
for (int i = 1; i <= idpts.GetNBags(); i++)
for (int j = 1; j <= idpts.GetBagSize(i); j++)
{
INDEX_2 pts;
int val;
INDEX_3 pts;
int dummy, val;
idpts.GetData (i, j, pts, val);
idpts.GetData (i, j, pts, dummy);
val = pts[2];
const Point3d & p1 = mesh->Point(pts.I1());
const Point3d & p2 = mesh->Point(pts.I2());