mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
fix Mirror for second-order meshes
This commit is contained in:
parent
c20480c662
commit
0b7d8d5a9b
@ -7129,6 +7129,7 @@ namespace netgen
|
|||||||
return fabs(v*n_plane) < eps;
|
return fabs(v*n_plane) < eps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
auto mirror = [&] (PointIndex pi) -> PointIndex
|
auto mirror = [&] (PointIndex pi) -> PointIndex
|
||||||
{
|
{
|
||||||
auto & p = m[pi];
|
auto & p = m[pi];
|
||||||
@ -7151,14 +7152,51 @@ namespace netgen
|
|||||||
|
|
||||||
for(auto pi : Range(points))
|
for(auto pi : Range(points))
|
||||||
point_map[pi] = mirror(pi);
|
point_map[pi] = mirror(pi);
|
||||||
|
*/
|
||||||
|
|
||||||
for(auto & el : VolumeElements())
|
Array<PointIndex, PointIndex> point_map(GetNP());
|
||||||
{
|
Array<PointIndex, PointIndex> point_map1(GetNP());
|
||||||
auto nel = el;
|
|
||||||
|
nm.Points().SetSize(0);
|
||||||
|
|
||||||
|
for(auto pi : Range(points))
|
||||||
|
{
|
||||||
|
auto & p = m[pi];
|
||||||
|
|
||||||
|
auto v = p_plane-p;
|
||||||
|
auto l = v.Length();
|
||||||
|
|
||||||
|
if(l < eps || fabs(v*n_plane)/l < eps)
|
||||||
|
{
|
||||||
|
auto npi = nm.AddPoint(p, p.GetLayer(), p.Type());
|
||||||
|
point_map[pi] = npi;
|
||||||
|
point_map1[pi] = npi;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto new_point = p + 2*(v*n_plane)*n_plane;
|
||||||
|
point_map1[pi] = nm.AddPoint(p, p.GetLayer(), p.Type());
|
||||||
|
point_map[pi] = nm.AddPoint( new_point, p.GetLayer(), p.Type() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(auto & el : nm.VolumeElements())
|
||||||
for(auto i : Range(el.GetNP()))
|
for(auto i : Range(el.GetNP()))
|
||||||
nel[i] = point_map[el[i]];
|
el[i] = point_map1[el[i]];
|
||||||
nm.AddVolumeElement(nel);
|
for(auto & el : nm.SurfaceElements())
|
||||||
}
|
for(auto i : Range(el.GetNP()))
|
||||||
|
el[i] = point_map1[el[i]];
|
||||||
|
for(auto & el : nm.LineSegments())
|
||||||
|
for(auto i : Range(el.GetNP()))
|
||||||
|
el[i] = point_map1[el[i]];
|
||||||
|
|
||||||
|
for(auto & el : VolumeElements())
|
||||||
|
{
|
||||||
|
auto nel = el;
|
||||||
|
for(auto i : Range(el.GetNP()))
|
||||||
|
nel[i] = point_map[el[i]];
|
||||||
|
nm.AddVolumeElement(nel);
|
||||||
|
}
|
||||||
|
|
||||||
for (auto ei : Range(SurfaceElements()))
|
for (auto ei : Range(SurfaceElements()))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user