mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
Rework on 3D SplitImprove
- Try (expensive) split operation only if badness > 100 (of any adjacent tet) and badness > 0.1 * badness_max - Use FindInnerPoint before BFGS to ensure valid starting point (similar as in ImproveMesh() ) - Skip valid tets if goal==OPT_LEGAL (as in sequential version)
This commit is contained in:
parent
bcd883a773
commit
3acadc023f
@ -118,10 +118,10 @@ inline int FindInnerPoint (POINTArray & points,
|
|||||||
{
|
{
|
||||||
// const Element2d & el = faces[i];
|
// const Element2d & el = faces[i];
|
||||||
// (*testout) << "el[" << i << "] = " << el << endl;
|
// (*testout) << "el[" << i << "] = " << el << endl;
|
||||||
for (int j = 1; j <= 3; j++)
|
for (int j : Range(3))
|
||||||
{
|
{
|
||||||
double hi = Dist (points[faces[i].PNumMod(j)],
|
double hi = Dist (points[faces[i][j%3]],
|
||||||
points[faces[i].PNumMod(j+1)]);
|
points[faces[i][(j+1)%3]]);
|
||||||
if (hi > hmax) hmax = hi;
|
if (hi > hmax) hmax = hi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -556,10 +556,27 @@ double MeshOptimize3d :: SplitImproveEdge (Mesh & mesh, OPTIMIZEGOAL goal, Table
|
|||||||
if(mp.only3D_domain_nr != mesh[ei].GetIndex())
|
if(mp.only3D_domain_nr != mesh[ei].GetIndex())
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
|
if (goal == OPT_LEGAL)
|
||||||
|
{
|
||||||
|
bool all_tets_legal = true;
|
||||||
|
for(auto ei : hasbothpoints)
|
||||||
|
if( !mesh.LegalTet (mesh[ei]) || elerrs[ei] > 1e3)
|
||||||
|
all_tets_legal = false;
|
||||||
|
if(all_tets_legal)
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
double bad1 = 0.0;
|
double bad1 = 0.0;
|
||||||
|
double bad1_max = 0.0;
|
||||||
for (ElementIndex ei : hasbothpoints)
|
for (ElementIndex ei : hasbothpoints)
|
||||||
bad1 += CalcBad (mesh.Points(), mesh[ei], 0);
|
{
|
||||||
|
double bad = elerrs[ei];
|
||||||
|
bad1 += bad;
|
||||||
|
bad1_max = max(bad1_max, bad);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bad1_max < 100.0)
|
||||||
|
return 0.0;
|
||||||
|
|
||||||
bool puretet = 1;
|
bool puretet = 1;
|
||||||
for (ElementIndex ei : hasbothpoints)
|
for (ElementIndex ei : hasbothpoints)
|
||||||
@ -598,14 +615,25 @@ double MeshOptimize3d :: SplitImproveEdge (Mesh & mesh, OPTIMIZEGOAL goal, Table
|
|||||||
px(1) = pnew.Y();
|
px(1) = pnew.Y();
|
||||||
px(2) = pnew.Z();
|
px(2) = pnew.Z();
|
||||||
|
|
||||||
if (bad1 > 0.1 * badmax)
|
if (bad1_max > 0.1 * badmax)
|
||||||
|
{
|
||||||
|
int pok = pf.Func (px) < 1e10;
|
||||||
|
if (!pok)
|
||||||
|
pok = FindInnerPoint (mesh.Points(), locfaces, pnew);
|
||||||
|
|
||||||
|
if(pok)
|
||||||
|
{
|
||||||
|
px(0) = pnew.X();
|
||||||
|
px(1) = pnew.Y();
|
||||||
|
px(2) = pnew.Z();
|
||||||
BFGS (px, pf, par);
|
BFGS (px, pf, par);
|
||||||
|
|
||||||
double bad2 = pf.Func (px);
|
|
||||||
|
|
||||||
pnew.X() = px(0);
|
pnew.X() = px(0);
|
||||||
pnew.Y() = px(1);
|
pnew.Y() = px(1);
|
||||||
pnew.Z() = px(2);
|
pnew.Z() = px(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double bad2 = pf.Func (px);
|
||||||
|
|
||||||
mesh[ptmp] = Point<3>(pnew);
|
mesh[ptmp] = Point<3>(pnew);
|
||||||
|
|
||||||
@ -688,6 +716,7 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
|
|||||||
|
|
||||||
PrintMessage (3, "SplitImprove");
|
PrintMessage (3, "SplitImprove");
|
||||||
(*testout) << "start SplitImprove" << "\n";
|
(*testout) << "start SplitImprove" << "\n";
|
||||||
|
mesh.BoundaryEdge (1,2); // ensure the boundary-elements table is built
|
||||||
|
|
||||||
ParallelFor( mesh.VolumeElements().Range(), [&] (ElementIndex ei) NETGEN_LAMBDA_INLINE
|
ParallelFor( mesh.VolumeElements().Range(), [&] (ElementIndex ei) NETGEN_LAMBDA_INLINE
|
||||||
{
|
{
|
||||||
@ -749,7 +778,7 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
|
|||||||
}
|
}
|
||||||
topt.Stop();
|
topt.Stop();
|
||||||
mesh.Compress();
|
mesh.Compress();
|
||||||
PrintMessage (5, cnt, " splits performed");
|
PrintMessage (1, cnt, " splits performed");
|
||||||
(*testout) << "Splitt - Improve done" << "\n";
|
(*testout) << "Splitt - Improve done" << "\n";
|
||||||
|
|
||||||
if (goal == OPT_QUALITY)
|
if (goal == OPT_QUALITY)
|
||||||
|
@ -42,13 +42,12 @@ namespace netgen
|
|||||||
|
|
||||||
#define _INCLUDE_MORE
|
#define _INCLUDE_MORE
|
||||||
|
|
||||||
|
#include "findip.hpp"
|
||||||
|
#include "findip2.hpp"
|
||||||
|
|
||||||
#include "meshing3.hpp"
|
#include "meshing3.hpp"
|
||||||
#include "improve3.hpp"
|
#include "improve3.hpp"
|
||||||
|
|
||||||
#include "findip.hpp"
|
|
||||||
#include "findip2.hpp"
|
|
||||||
|
|
||||||
#include "curvedelems.hpp"
|
#include "curvedelems.hpp"
|
||||||
#include "clusters.hpp"
|
#include "clusters.hpp"
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user