mirror of
https://github.com/NGSolve/netgen.git
synced 2025-02-09 11:53:07 +05:00
enable periodic + closesurface identification on same boundaries
This commit is contained in:
parent
db9aaef220
commit
b981d45069
@ -396,15 +396,15 @@ void PeriodicIdentification :: IdentifyFaces (class Mesh & mesh)
|
|||||||
|
|
||||||
if (side == 1)
|
if (side == 1)
|
||||||
{
|
{
|
||||||
if (mesh.GetIdentifications().Get (seg1[0], seg2[0]) &&
|
if (mesh.GetIdentifications().Used (seg1[0], seg2[0]) &&
|
||||||
mesh.GetIdentifications().Get (seg1[1], seg2[1]))
|
mesh.GetIdentifications().Used (seg1[1], seg2[1]))
|
||||||
{
|
{
|
||||||
foundother = 1;
|
foundother = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mesh.GetIdentifications().Get (seg1[0], seg2[1]) &&
|
if (mesh.GetIdentifications().Used (seg1[0], seg2[1]) &&
|
||||||
mesh.GetIdentifications().Get (seg1[1], seg2[0]))
|
mesh.GetIdentifications().Used (seg1[1], seg2[0]))
|
||||||
{
|
{
|
||||||
foundother = 1;
|
foundother = 1;
|
||||||
break;
|
break;
|
||||||
@ -412,15 +412,15 @@ void PeriodicIdentification :: IdentifyFaces (class Mesh & mesh)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mesh.GetIdentifications().Get (seg2[0], seg1[0]) &&
|
if (mesh.GetIdentifications().Used (seg2[0], seg1[0]) &&
|
||||||
mesh.GetIdentifications().Get (seg2[1], seg1[1]))
|
mesh.GetIdentifications().Used (seg2[1], seg1[1]))
|
||||||
{
|
{
|
||||||
foundother = 1;
|
foundother = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mesh.GetIdentifications().Get (seg2[0], seg1[1]) &&
|
if (mesh.GetIdentifications().Used (seg2[0], seg1[1]) &&
|
||||||
mesh.GetIdentifications().Get (seg2[1], seg1[0]))
|
mesh.GetIdentifications().Used (seg2[1], seg1[0]))
|
||||||
{
|
{
|
||||||
foundother = 1;
|
foundother = 1;
|
||||||
break;
|
break;
|
||||||
@ -1168,15 +1168,15 @@ void CloseSurfaceIdentification :: IdentifyFaces (class Mesh & mesh)
|
|||||||
|
|
||||||
if (side == 1)
|
if (side == 1)
|
||||||
{
|
{
|
||||||
if (mesh.GetIdentifications().Get (seg1[0], seg2[0]) &&
|
if (mesh.GetIdentifications().Used (seg1[0], seg2[0]) &&
|
||||||
mesh.GetIdentifications().Get (seg1[1], seg2[1]))
|
mesh.GetIdentifications().Used (seg1[1], seg2[1]))
|
||||||
{
|
{
|
||||||
foundother = 1;
|
foundother = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mesh.GetIdentifications().Get (seg1[0], seg2[1]) &&
|
if (mesh.GetIdentifications().Used (seg1[0], seg2[1]) &&
|
||||||
mesh.GetIdentifications().Get (seg1[1], seg2[0]))
|
mesh.GetIdentifications().Used (seg1[1], seg2[0]))
|
||||||
{
|
{
|
||||||
foundother = 1;
|
foundother = 1;
|
||||||
break;
|
break;
|
||||||
@ -1184,15 +1184,15 @@ void CloseSurfaceIdentification :: IdentifyFaces (class Mesh & mesh)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mesh.GetIdentifications().Get (seg2[0], seg1[0]) &&
|
if (mesh.GetIdentifications().Used (seg2[0], seg1[0]) &&
|
||||||
mesh.GetIdentifications().Get (seg2[1], seg1[1]))
|
mesh.GetIdentifications().Used (seg2[1], seg1[1]))
|
||||||
{
|
{
|
||||||
foundother = 1;
|
foundother = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mesh.GetIdentifications().Get (seg2[0], seg1[1]) &&
|
if (mesh.GetIdentifications().Used (seg2[0], seg1[1]) &&
|
||||||
mesh.GetIdentifications().Get (seg2[1], seg1[0]))
|
mesh.GetIdentifications().Used (seg2[1], seg1[0]))
|
||||||
{
|
{
|
||||||
foundother = 1;
|
foundother = 1;
|
||||||
break;
|
break;
|
||||||
@ -1650,8 +1650,8 @@ BuildSurfaceElements (NgArray<Segment> & segs,
|
|||||||
{
|
{
|
||||||
const Segment & s1 = segs.Get(i1);
|
const Segment & s1 = segs.Get(i1);
|
||||||
const Segment & s2 = segs.Get(i2);
|
const Segment & s2 = segs.Get(i2);
|
||||||
if (mesh.GetIdentifications().Get (s1[0], s2[1]) &&
|
if (mesh.GetIdentifications().Used (s1[0], s2[1]) &&
|
||||||
mesh.GetIdentifications().Get (s1[1], s2[0]))
|
mesh.GetIdentifications().Used (s1[1], s2[0]))
|
||||||
{
|
{
|
||||||
Element2d el(QUAD);
|
Element2d el(QUAD);
|
||||||
el.PNum(1) = s1[0];
|
el.PNum(1) = s1[0];
|
||||||
|
@ -121,7 +121,7 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
INDEX_2 edge(el.PNum(j), el.PNum(k));
|
INDEX_2 edge(el.PNum(j), el.PNum(k));
|
||||||
edge.Sort();
|
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;
|
int pi3 = 1, pi4 = 1;
|
||||||
while (pi3 == j || pi3 == k) pi3++;
|
while (pi3 == j || pi3 == k) pi3++;
|
||||||
@ -157,8 +157,8 @@ namespace netgen
|
|||||||
INDEX_2 edge2(pi2, pi3);
|
INDEX_2 edge2(pi2, pi3);
|
||||||
edge1.Sort();
|
edge1.Sort();
|
||||||
edge2.Sort();
|
edge2.Sort();
|
||||||
if (mesh.GetIdentifications().GetSymmetric (pi1, pi4) &&
|
if (mesh.GetIdentifications().UsedSymmetric (pi1, pi4) &&
|
||||||
mesh.GetIdentifications().GetSymmetric (pi2, pi3))
|
mesh.GetIdentifications().UsedSymmetric (pi2, pi3))
|
||||||
{
|
{
|
||||||
//int p3 = el.PNum(pi3);
|
//int p3 = el.PNum(pi3);
|
||||||
//int p4 = el.PNum(pi4);
|
//int p4 = el.PNum(pi4);
|
||||||
@ -186,7 +186,7 @@ namespace netgen
|
|||||||
INDEX_2 edge(el.PNum(j), el.PNum(k));
|
INDEX_2 edge(el.PNum(j), el.PNum(k));
|
||||||
edge.Sort();
|
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 pi3 = 6-j-k;
|
||||||
int p3 = el.PNum(pi3);
|
int p3 = el.PNum(pi3);
|
||||||
@ -261,15 +261,16 @@ namespace netgen
|
|||||||
|
|
||||||
// if (mesh.GetIdentifications().HasIdentifiedPoints())
|
// if (mesh.GetIdentifications().HasIdentifiedPoints())
|
||||||
{
|
{
|
||||||
INDEX_2_HASHTABLE<int> & identpts =
|
auto & identpts =
|
||||||
mesh.GetIdentifications().GetIdentifiedPoints ();
|
mesh.GetIdentifications().GetIdentifiedPoints ();
|
||||||
|
|
||||||
for (i = 1; i <= identpts.GetNBags(); i++)
|
for (i = 1; i <= identpts.GetNBags(); i++)
|
||||||
for (j = 1; j <= identpts.GetBagSize(i); j++)
|
for (j = 1; j <= identpts.GetBagSize(i); j++)
|
||||||
{
|
{
|
||||||
INDEX_2 pair;
|
INDEX_3 pair;
|
||||||
int idnr;
|
int dummy;
|
||||||
identpts.GetData(i, j, pair, idnr);
|
identpts.GetData(i, j, pair, dummy);
|
||||||
|
auto idnr = pair[2];
|
||||||
const CloseSurfaceIdentification * csid =
|
const CloseSurfaceIdentification * csid =
|
||||||
dynamic_cast<const CloseSurfaceIdentification*>
|
dynamic_cast<const CloseSurfaceIdentification*>
|
||||||
(geom->identifications.Get(idnr));
|
(geom->identifications.Get(idnr));
|
||||||
|
@ -414,9 +414,14 @@ public:
|
|||||||
int BagNr() const { return bagnr; }
|
int BagNr() const { return bagnr; }
|
||||||
int Pos() const { return pos; }
|
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++;
|
pos++;
|
||||||
while (bagnr < ht.GetNBags() &&
|
while (bagnr < ht.GetNBags() &&
|
||||||
pos == ht.GetBagSize(bagnr+1))
|
pos == ht.GetBagSize(bagnr+1))
|
||||||
@ -424,7 +429,12 @@ public:
|
|||||||
pos = 0;
|
pos = 0;
|
||||||
bagnr++;
|
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
|
bool operator != (int i) const
|
||||||
@ -446,6 +456,18 @@ public:
|
|||||||
return GetNBags();
|
return GetNBags();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Iterator begin () const
|
||||||
|
{
|
||||||
|
Iterator it(*this, 0, -1);
|
||||||
|
it++;
|
||||||
|
return it;
|
||||||
|
}
|
||||||
|
|
||||||
|
int end() const
|
||||||
|
{
|
||||||
|
return GetNBags();
|
||||||
|
}
|
||||||
|
|
||||||
void GetData (const Iterator & it,
|
void GetData (const Iterator & it,
|
||||||
INDEX_3 & ahash, T & acont) const
|
INDEX_3 & ahash, T & acont) const
|
||||||
{
|
{
|
||||||
|
@ -6406,9 +6406,9 @@ namespace netgen
|
|||||||
mapped_points = false;
|
mapped_points = false;
|
||||||
|
|
||||||
// Add new points
|
// Add new points
|
||||||
for(auto [p1p2, idnr] : identpts)
|
for(auto [p1p2, dummy] : identpts)
|
||||||
{
|
{
|
||||||
if(idnr != nr)
|
if(p1p2[2] != nr)
|
||||||
continue;
|
continue;
|
||||||
auto& ipts = inserted_points[{p1p2.I1(), p1p2.I2()}];
|
auto& ipts = inserted_points[{p1p2.I1(), p1p2.I2()}];
|
||||||
auto p1 = Point(p1p2.I1());
|
auto p1 = Point(p1p2.I1());
|
||||||
|
@ -560,8 +560,8 @@ namespace netgen
|
|||||||
el.SetIndex(m_.domain);
|
el.SetIndex(m_.domain);
|
||||||
mesh.AddVolumeElement(el);
|
mesh.AddVolumeElement(el);
|
||||||
}
|
}
|
||||||
for(const auto& [p1p2, idnr] : m.GetIdentifications().GetIdentifiedPoints())
|
for(const auto& [p1p2, dummy] : m.GetIdentifications().GetIdentifiedPoints())
|
||||||
mesh.GetIdentifications().Add(pmap[p1p2[0]], pmap[p1p2[1]], idnr);
|
mesh.GetIdentifications().Add(pmap[p1p2[0]], pmap[p1p2[1]], p1p2[2]);
|
||||||
for(auto i : Range(m.GetIdentifications().GetMaxNr()))
|
for(auto i : Range(m.GetIdentifications().GetMaxNr()))
|
||||||
{
|
{
|
||||||
mesh.GetIdentifications().SetType(i+1, m.GetIdentifications().GetType(i+1));
|
mesh.GetIdentifications().SetType(i+1, m.GetIdentifications().GetType(i+1));
|
||||||
|
@ -2825,14 +2825,8 @@ namespace netgen
|
|||||||
Array<INDEX_3> Identifications :: GetPairs () const
|
Array<INDEX_3> Identifications :: GetPairs () const
|
||||||
{
|
{
|
||||||
Array<INDEX_3> pairs;
|
Array<INDEX_3> pairs;
|
||||||
for (auto i : IntRange(1, identifiedpoints.GetNBags()+1))
|
for(auto [i3, dummy] : identifiedpoints_nr)
|
||||||
for (auto j : IntRange(1, identifiedpoints.GetBagSize(i)+1))
|
pairs.Append(i3);
|
||||||
{
|
|
||||||
INDEX_2 i2;
|
|
||||||
int nr;
|
|
||||||
identifiedpoints.GetData (i, j, i2, nr);
|
|
||||||
pairs.Append ({i2.I1(), i2.I2(), nr});
|
|
||||||
}
|
|
||||||
return pairs;
|
return pairs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1619,9 +1619,9 @@ namespace netgen
|
|||||||
|
|
||||||
// bool HasIdentifiedPoints() const { return identifiedpoints != nullptr; }
|
// 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)
|
bool Used (PointIndex pi1, PointIndex pi2)
|
||||||
|
@ -858,16 +858,17 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
// if (mesh->GetIdentifications().HasIdentifiedPoints())
|
// if (mesh->GetIdentifications().HasIdentifiedPoints())
|
||||||
{
|
{
|
||||||
INDEX_2_HASHTABLE<int> & idpts =
|
auto & idpts =
|
||||||
mesh->GetIdentifications().GetIdentifiedPoints();
|
mesh->GetIdentifications().GetIdentifiedPoints();
|
||||||
|
|
||||||
for (int i = 1; i <= idpts.GetNBags(); i++)
|
for (int i = 1; i <= idpts.GetNBags(); i++)
|
||||||
for (int j = 1; j <= idpts.GetBagSize(i); j++)
|
for (int j = 1; j <= idpts.GetBagSize(i); j++)
|
||||||
{
|
{
|
||||||
INDEX_2 pts;
|
INDEX_3 pts;
|
||||||
int val;
|
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 & p1 = mesh->Point(pts.I1());
|
||||||
const Point3d & p2 = mesh->Point(pts.I2());
|
const Point3d & p2 = mesh->Point(pts.I2());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user