build identifications, set geometry

This commit is contained in:
Matthias Hochsteger 2021-07-16 11:30:11 +02:00
parent d997ac0bbe
commit 8e2cd17436

View File

@ -21,7 +21,7 @@ namespace netgen
// maps from local (domain) mesh to global mesh // maps from local (domain) mesh to global mesh
Array<PointIndex, PointIndex> pmap; Array<PointIndex, PointIndex> pmap;
Array<INDEX_2> connected_pairs; // Array<INDEX_2> connected_pairs;
MeshingParameters mp; MeshingParameters mp;
@ -73,6 +73,7 @@ namespace netgen
ipmap[i].SetSize(num_points); ipmap[i].SetSize(num_points);
ipmap[i] = PointIndex::INVALID; ipmap[i] = PointIndex::INVALID;
m.SetDimension( mesh.GetDimension() ); m.SetDimension( mesh.GetDimension() );
m.SetGeometry( mesh.GetGeometry() );
for(auto i : Range(1, num_facedescriptors+1)) for(auto i : Range(1, num_facedescriptors+1))
m.AddFaceDescriptor( mesh.GetFaceDescriptor(i) ); m.AddFaceDescriptor( mesh.GetFaceDescriptor(i) );
@ -117,29 +118,56 @@ namespace netgen
} }
} }
NgArray<INDEX_2> connectednodes;
for(auto i : Range(ret)) for(auto i : Range(ret))
{ {
auto & imap = ipmap[i];
auto & m = *ret[i].mesh; auto & m = *ret[i].mesh;
auto & imap = ipmap[i];
auto nmax = identifications.GetMaxNr ();
auto & m_ident = m.GetIdentifications();
for (auto & sel : m.SurfaceElements()) for (auto & sel : m.SurfaceElements())
for(auto & pi : sel.PNums()) for(auto & pi : sel.PNums())
pi = imap[pi]; pi = imap[pi];
for (int nr = 1; nr <= identifications.GetMaxNr(); nr++) for(auto n : Range(1,nmax+1))
if (identifications.GetType(nr) != Identifications::PERIODIC)
{ {
identifications.GetPairs (nr, connectednodes); NgArray<INDEX_2> pairs;
for (auto pair : connectednodes) identifications.GetPairs(n, pairs);
for(auto pair : pairs)
{ {
auto pi0 = pair[0]; auto pi0 = pair[0];
auto pi1 = pair[1]; auto pi1 = pair[1];
if(imap[pi0].IsValid() && imap[pi1].IsValid()) if(imap[pi0].IsValid() && imap[pi1].IsValid())
ret[i].connected_pairs.Append({imap[pi0], imap[pi1]}); m_ident.Add(n, imap[pi0], imap[pi1]);
} }
} }
m.Save("part_"+ToString(i)+".vol.gz");
} }
// NgArray<INDEX_2> connectednodes;
// for(auto i : Range(ret))
// {
// auto & imap = ipmap[i];
// auto & m = *ret[i].mesh;
//
// for (auto & sel : m.SurfaceElements())
// for(auto & pi : sel.PNums())
// pi = imap[pi];
//
// for (int nr = 1; nr <= identifications.GetMaxNr(); nr++)
// if (identifications.GetType(nr) != Identifications::PERIODIC)
// {
// identifications.GetPairs (nr, connectednodes);
// for (auto pair : connectednodes)
// {
// auto pi0 = pair[0];
// auto pi1 = pair[1];
// if(imap[pi0].IsValid() && imap[pi1].IsValid())
// ret[i].connected_pairs.Append({imap[pi0], imap[pi1]});
// }
// }
// }
return ret; return ret;
} }
@ -197,8 +225,16 @@ namespace netgen
for (PointIndex pi : mesh.Points().Range()) for (PointIndex pi : mesh.Points().Range())
meshing.AddPoint (mesh[pi], pi); meshing.AddPoint (mesh[pi], pi);
for (auto pair : md.connected_pairs) NgArray<INDEX_2> connectednodes;
for (int nr = 1; nr <= mesh.GetIdentifications().GetMaxNr(); nr++)
if (mesh.GetIdentifications().GetType(nr) != Identifications::PERIODIC)
{
mesh.GetIdentifications().GetPairs (nr, connectednodes);
for (auto pair : connectednodes)
meshing.AddConnectedPair (pair); meshing.AddConnectedPair (pair);
}
// for (auto pair : md.connected_pairs)
// meshing.AddConnectedPair (pair);
for (int i = 1; i <= mesh.GetNOpenElements(); i++) for (int i = 1; i <= mesh.GetNOpenElements(); i++)
{ {