mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
Do edge swapping for faces individually with tensor product meshes
If the mesh contains quads, the edge swapping algorithm switches to generic improve, which introduces quads everywhere. This is not intended if one domain contains a tensor product mesh. Thus, call the optimizer for each face if mesh contains quads but mp.quad is not set.
This commit is contained in:
parent
d1c7a16d63
commit
d08e2daa06
@ -20,6 +20,19 @@ namespace netgen
|
||||
}
|
||||
mesh.Compress();
|
||||
|
||||
bool optimize_swap_separate_faces = false;
|
||||
if(!mp.quad)
|
||||
{
|
||||
bool mixed = false;
|
||||
ParallelFor( Range(mesh.GetNSE()), [&] (auto i) NETGEN_LAMBDA_INLINE
|
||||
{
|
||||
if (mesh[SurfaceElementIndex(i)].GetNP() != 3)
|
||||
mixed = true;
|
||||
});
|
||||
if(mixed)
|
||||
optimize_swap_separate_faces = true;
|
||||
}
|
||||
|
||||
const char * optstr = mp.optimize2d.c_str();
|
||||
int optsteps = mp.optsteps2d;
|
||||
|
||||
@ -33,14 +46,40 @@ namespace netgen
|
||||
{ // topological swap
|
||||
MeshOptimize2d meshopt(mesh);
|
||||
meshopt.SetMetricWeight (mp.elsizeweight);
|
||||
|
||||
if(optimize_swap_separate_faces)
|
||||
{
|
||||
for(auto i : Range(1, mesh.GetNFD()+1))
|
||||
{
|
||||
meshopt.SetFaceIndex(i);
|
||||
meshopt.EdgeSwapping (0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
meshopt.SetFaceIndex(0);
|
||||
meshopt.EdgeSwapping (0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'S':
|
||||
{ // metric swap
|
||||
MeshOptimize2d meshopt(mesh);
|
||||
meshopt.SetMetricWeight (mp.elsizeweight);
|
||||
|
||||
if(optimize_swap_separate_faces)
|
||||
{
|
||||
for(auto i : Range(1, mesh.GetNFD()+1))
|
||||
{
|
||||
meshopt.SetFaceIndex(i);
|
||||
meshopt.EdgeSwapping (1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
meshopt.SetFaceIndex(0);
|
||||
meshopt.EdgeSwapping (1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'm':
|
||||
|
Loading…
Reference in New Issue
Block a user