mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
Merge branch 'fix_identified_point_handling' into 'master'
Fix handling identified points in Compress and MeshVolume See merge request ngsolve/netgen!676
This commit is contained in:
commit
592221ee19
@ -4214,6 +4214,8 @@ namespace netgen
|
||||
|
||||
for (int i = 0; i < lockedpoints.Size(); i++)
|
||||
lockedpoints[i] = op2np[lockedpoints[i]];
|
||||
|
||||
GetIdentifications().MapPoints(op2np);
|
||||
/*
|
||||
for (int i = 0; i < facedecoding.Size(); i++)
|
||||
facedecoding[i].firstelement = -1;
|
||||
|
@ -539,6 +539,8 @@ namespace netgen
|
||||
}
|
||||
|
||||
mesh.VolumeElements().DeleteAll();
|
||||
mesh.GetIdentifications().GetIdentifiedPoints().DeleteData();
|
||||
|
||||
for(auto & m_ : md)
|
||||
{
|
||||
auto first_new_pi = m_.pmap.Range().Next();
|
||||
|
@ -2694,6 +2694,7 @@ namespace netgen
|
||||
{
|
||||
identifiedpoints.DeleteData();
|
||||
identifiedpoints_nr.DeleteData();
|
||||
idpoints_table.SetSize(0);
|
||||
|
||||
/*
|
||||
delete identifiedpoints;
|
||||
@ -2821,6 +2822,20 @@ 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});
|
||||
}
|
||||
return pairs;
|
||||
}
|
||||
|
||||
void Identifications :: GetPairs (int identnr,
|
||||
NgArray<INDEX_2> & identpairs) const
|
||||
{
|
||||
@ -2866,6 +2881,21 @@ namespace netgen
|
||||
}
|
||||
}
|
||||
|
||||
// Map points in the identifications to new point numbers
|
||||
// deletes identifications with invalid (mapped) points
|
||||
void Identifications :: MapPoints(FlatArray<PointIndex, PointIndex> op2np)
|
||||
{
|
||||
auto pairs = GetPairs();
|
||||
Delete();
|
||||
|
||||
for(auto pair : pairs)
|
||||
{
|
||||
auto p1 = op2np[pair.I1()];
|
||||
auto p2 = op2np[pair.I2()];
|
||||
if(p1.IsValid() && p2.IsValid())
|
||||
Add(p1, p2, pair.I3());
|
||||
}
|
||||
}
|
||||
|
||||
void Identifications :: Print (ostream & ost) const
|
||||
{
|
||||
|
@ -1633,6 +1633,7 @@ namespace netgen
|
||||
|
||||
///
|
||||
DLL_HEADER void GetPairs (int identnr, NgArray<INDEX_2> & identpairs) const;
|
||||
DLL_HEADER Array<INDEX_3> GetPairs () const;
|
||||
///
|
||||
int GetMaxNr () const { return maxidentnr; }
|
||||
|
||||
@ -1659,6 +1660,8 @@ namespace netgen
|
||||
/// remove secondorder
|
||||
void SetMaxPointNr (int maxpnum);
|
||||
|
||||
void MapPoints(FlatArray<PointIndex, PointIndex> op2np);
|
||||
|
||||
DLL_HEADER void Print (ostream & ost) const;
|
||||
|
||||
void DoArchive (Archive & ar);
|
||||
|
Loading…
Reference in New Issue
Block a user