fix identifications, copy whole LocalH tree

This commit is contained in:
Matthias Hochsteger 2021-07-16 17:18:41 +02:00
parent 8e2cd17436
commit e5e8882d07
2 changed files with 31 additions and 36 deletions

View File

@ -36,9 +36,9 @@ namespace netgen
Array<MeshingData> ret; Array<MeshingData> ret;
auto num_domains = mesh.GetNDomains(); auto num_domains = mesh.GetNDomains();
ret.SetSize(num_domains);
if(num_domains==1 || mp.only3D_domain_nr) if(num_domains==1 || mp.only3D_domain_nr)
{ {
ret.SetSize(1);
// no need to divide mesh, just fill in meshing data // no need to divide mesh, just fill in meshing data
ret[0].domain = 1; ret[0].domain = 1;
if(mp.only3D_domain_nr) if(mp.only3D_domain_nr)
@ -48,6 +48,7 @@ namespace netgen
ret[0].mp = mp; ret[0].mp = mp;
return ret; return ret;
} }
ret.SetSize(num_domains);
Array<Array<PointIndex, PointIndex>> ipmap; Array<Array<PointIndex, PointIndex>> ipmap;
ipmap.SetSize(num_domains); ipmap.SetSize(num_domains);
@ -55,8 +56,6 @@ namespace netgen
auto num_points = mesh.GetNP(); auto num_points = mesh.GetNP();
auto num_facedescriptors = mesh.GetNFD(); auto num_facedescriptors = mesh.GetNFD();
auto & identifications = mesh.GetIdentifications();
for(auto i : Range(ret)) for(auto i : Range(ret))
{ {
auto & md = ret[i]; auto & md = ret[i];
@ -68,7 +67,7 @@ namespace netgen
ret[i].mesh = make_unique<Mesh>(); ret[i].mesh = make_unique<Mesh>();
auto & m = *ret[i].mesh; auto & m = *ret[i].mesh;
// m.SetLocalH(mesh.GetLocalH()->Copy()); m.SetLocalH(mesh.GetLocalH());
ipmap[i].SetSize(num_points); ipmap[i].SetSize(num_points);
ipmap[i] = PointIndex::INVALID; ipmap[i] = PointIndex::INVALID;
@ -118,6 +117,22 @@ namespace netgen
} }
} }
// add segmetns
for(auto i : Range(ret))
{
auto & imap = ipmap[i];
auto & m = *ret[i].mesh;
for(auto seg : mesh.LineSegments())
if(imap[seg[0]].IsValid() && imap[seg[1]].IsValid())
{
seg[0] = imap[seg[0]];
seg[1] = imap[seg[1]];
m.AddSegment(seg);
}
}
auto & identifications = mesh.GetIdentifications();
for(auto i : Range(ret)) for(auto i : Range(ret))
{ {
auto & m = *ret[i].mesh; auto & m = *ret[i].mesh;
@ -136,38 +151,18 @@ namespace netgen
for(auto pair : pairs) for(auto pair : pairs)
{ {
auto pi0 = pair[0]; auto pi0 = imap[pair[0]];
auto pi1 = pair[1]; auto pi1 = imap[pair[1]];
if(imap[pi0].IsValid() && imap[pi1].IsValid()) if(!pi0.IsValid() || !pi1.IsValid())
m_ident.Add(n, imap[pi0], imap[pi1]); continue;
}
}
m.Save("part_"+ToString(i)+".vol.gz");
}
// NgArray<INDEX_2> connectednodes; if(pi1<pi0)
// for(auto i : Range(ret)) Swap(pi0,pi1);
// { m_ident.Add(pi0, pi1, n);
// auto & imap = ipmap[i]; }
// auto & m = *ret[i].mesh; m_ident.SetType( n, identifications.GetType(n) );
// }
// 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;
} }

View File

@ -1128,7 +1128,7 @@ void Meshing3 :: PrepareBlockFillLocalH (Mesh & mesh,
if (mp.maxh < maxh) maxh = mp.maxh; if (mp.maxh < maxh) maxh = mp.maxh;
auto loch_ptr = mesh.LocalHFunction().Copy(bounding_box); auto loch_ptr = mesh.LocalHFunction().Copy(); //bounding_box);
auto & loch = *loch_ptr; auto & loch = *loch_ptr;
// auto & loch = mesh.LocalHFunction(); // auto & loch = mesh.LocalHFunction();