try to compress identifications

This commit is contained in:
Matthias Hochsteger 2024-01-19 17:51:46 +01:00
parent fd946dca7d
commit 3d46d7e439
4 changed files with 57 additions and 1 deletions

View File

@ -4140,6 +4140,13 @@ namespace netgen
for (int i = 0; i < lockedpoints.Size(); i++) for (int i = 0; i < lockedpoints.Size(); i++)
lockedpoints[i] = op2np[lockedpoints[i]]; lockedpoints[i] = op2np[lockedpoints[i]];
cout << "op2np " << endl;
for(auto i : Range(op2np)) {
if(i!=op2np[i])
cout << i << '\t' << op2np[i] << endl;
}
GetIdentifications().MapPoints(op2np);
/* /*
for (int i = 0; i < facedecoding.Size(); i++) for (int i = 0; i < facedecoding.Size(); i++)
facedecoding[i].firstelement = -1; facedecoding[i].firstelement = -1;

View File

@ -543,9 +543,16 @@ namespace netgen
md[0].mesh.release(); md[0].mesh.release();
return; return;
} }
cout << "divide mesh" << endl;
mesh.VolumeElements().DeleteAll(); mesh.VolumeElements().DeleteAll();
auto & ident_points = mesh.GetIdentifications().GetIdentifiedPoints();
ident_points.DeleteData();
for(auto & m_ : md) {
m_.mesh->GetIdentifications().Delete();
m_.mesh->Save("mesh_domain_"+ToString(m_.domain)+".vol.gz");
}
for(auto & m_ : md) for(auto & m_ : md)
{ {
auto first_new_pi = m_.pmap.Range().Next(); auto first_new_pi = m_.pmap.Range().Next();
@ -565,6 +572,18 @@ namespace netgen
el.SetIndex(m_.domain); el.SetIndex(m_.domain);
mesh.AddVolumeElement(el); mesh.AddVolumeElement(el);
} }
// auto & part_ident = m.GetIdentifications().GetIdentifiedPoints();
// for (auto i : IntRange(1, part_ident.GetNBags()+1))
// for (auto j : IntRange(1, part_ident.GetBagSize(i)+1))
// {
// INDEX_2 i2;
// int nr;
// part_ident.GetData (i, j, i2, nr);
// i2.I1() = pmap[i2.I1()];
// i2.I2() = pmap[i2.I2()];
// ident_points.Set(i2, nr);
// }
} }
} }

View File

@ -2661,6 +2661,7 @@ namespace netgen
{ {
identifiedpoints.DeleteData(); identifiedpoints.DeleteData();
identifiedpoints_nr.DeleteData(); identifiedpoints_nr.DeleteData();
idpoints_table.SetSize(0);
/* /*
delete identifiedpoints; delete identifiedpoints;
@ -2831,6 +2832,33 @@ namespace netgen
} }
} }
void Identifications :: MapPoints(FlatArray<PointIndex, PointIndex> op2np)
{
Array<NgArray<INDEX_2>> pairs;
pairs.SetSize(maxidentnr+1);
for(auto i : Range(maxidentnr+1))
GetPairs(i, pairs[i]);
Delete();
for (auto i : Range(maxidentnr+1))
for(auto pair : pairs[i]) {
pair.I1() = op2np[pair.I1()];
pair.I2() = op2np[pair.I2()];
auto invalid = PointIndex(PointIndex::INVALID);
if(pair.I1() != invalid && pair.I2() != invalid)
Add(pair.I1(), pair.I2(), i);
}
// 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);
// i2.I1() = op2np[i2.I1()];
// i2.I2() = op2np[i2.I2()];
// identifiedpoints.SetData (i, j, i2, nr);
// }
}
void Identifications :: Print (ostream & ost) const void Identifications :: Print (ostream & ost) const
{ {

View File

@ -1605,6 +1605,8 @@ namespace netgen
/// remove secondorder /// remove secondorder
void SetMaxPointNr (int maxpnum); void SetMaxPointNr (int maxpnum);
void MapPoints(FlatArray<PointIndex, PointIndex> op2np);
DLL_HEADER void Print (ostream & ost) const; DLL_HEADER void Print (ostream & ost) const;
void DoArchive (Archive & ar); void DoArchive (Archive & ar);