progress bars for find edges, mesh surface,...

This commit is contained in:
Christopher Lackner 2019-10-31 15:17:28 +01:00
parent fbf6d92895
commit 249d785084
4 changed files with 26 additions and 15 deletions

View File

@ -171,6 +171,7 @@ namespace netgen
auto boundary = face.GetBoundary(facebndnr); auto boundary = face.GetBoundary(facebndnr);
for(auto enr : Range(boundary)) for(auto enr : Range(boundary))
{ {
multithread.percent = 100. * ((double(enr)/boundary.Size() + facebndnr)/face.GetNBoundaries() + facenr)/faces.Size();
const auto& oriented_edge = *boundary[enr]; const auto& oriented_edge = *boundary[enr];
auto edgenr = GetEdgeIndex(oriented_edge); auto edgenr = GetEdgeIndex(oriented_edge);
const auto& edge = edges[edgenr]; const auto& edge = edges[edgenr];
@ -298,10 +299,13 @@ namespace netgen
const MeshingParameters& mparam) const const MeshingParameters& mparam) const
{ {
static Timer t1("Surface Meshing"); RegionTimer regt(t1); static Timer t1("Surface Meshing"); RegionTimer regt(t1);
const char* savetask = multithread.task;
multithread.task = "Mesh Surface";
Array<int, PointIndex> glob2loc(mesh.GetNP()); Array<int, PointIndex> glob2loc(mesh.GetNP());
for(auto k : Range(faces)) for(auto k : Range(faces))
{ {
multithread.percent = 100. * k/faces.Size();
const auto& face = *faces[k]; const auto& face = *faces[k];
auto bb = face.GetBoundingBox(); auto bb = face.GetBoundingBox();
bb.Increase(bb.Diam()/10); bb.Increase(bb.Diam()/10);
@ -354,6 +358,7 @@ namespace netgen
mesh.SurfaceElements()[i].SetIndex(k+1); mesh.SurfaceElements()[i].SetIndex(k+1);
} }
} }
multithread.task = savetask;
} }
void NetgenGeometry :: OptimizeSurface(Mesh& mesh, const MeshingParameters& mparam) const void NetgenGeometry :: OptimizeSurface(Mesh& mesh, const MeshingParameters& mparam) const
@ -366,9 +371,11 @@ namespace netgen
auto meshopt = MeshOptimize2d(mesh); auto meshopt = MeshOptimize2d(mesh);
for(auto i : Range(mparam.optsteps2d)) for(auto i : Range(mparam.optsteps2d))
{ {
PrintMessage(2, "Optimization step ", i); PrintMessage(3, "Optimization step ", i);
int innerstep = 0;
for(auto optstep : mparam.optimize2d) for(auto optstep : mparam.optimize2d)
{ {
multithread.percent = 100. * (double(innerstep++)/mparam.optimize2d.size() + i)/mparam.optsteps2d;
switch(optstep) switch(optstep)
{ {
case 's': case 's':

View File

@ -183,7 +183,7 @@ void MeshOptimize3d :: CombineImproveSequential (Mesh & mesh,
// mesh.CalcSurfacesOfNode (); // mesh.CalcSurfacesOfNode ();
const char * savetask = multithread.task; const char * savetask = multithread.task;
multithread.task = "Combine Improve"; multithread.task = "Optimize Volume: Combine Improve";
double totalbad = 0; double totalbad = 0;
@ -435,7 +435,7 @@ void MeshOptimize3d :: CombineImprove (Mesh & mesh,
// mesh.CalcSurfacesOfNode (); // mesh.CalcSurfacesOfNode ();
const char * savetask = multithread.task; const char * savetask = multithread.task;
multithread.task = "Combine Improve"; multithread.task = "Optimize Volume: Combine Improve";
tbad.Start(); tbad.Start();
@ -712,7 +712,7 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
Array<double> elerrs(ne); Array<double> elerrs(ne);
const char * savetask = multithread.task; const char * savetask = multithread.task;
multithread.task = "Split Improve"; multithread.task = "Optimize Volume: Split Improve";
PrintMessage (3, "SplitImprove"); PrintMessage (3, "SplitImprove");
(*testout) << "start SplitImprove" << "\n"; (*testout) << "start SplitImprove" << "\n";
@ -826,7 +826,7 @@ void MeshOptimize3d :: SplitImproveSequential (Mesh & mesh,
illegaltet.Clear(); illegaltet.Clear();
const char * savetask = multithread.task; const char * savetask = multithread.task;
multithread.task = "Split Improve"; multithread.task = "Optimize Volume: Split Improve";
PrintMessage (3, "SplitImprove"); PrintMessage (3, "SplitImprove");
(*testout) << "start SplitImprove" << "\n"; (*testout) << "start SplitImprove" << "\n";
@ -1121,7 +1121,7 @@ void MeshOptimize3d :: SwapImproveSequential (Mesh & mesh, OPTIMIZEGOAL goal,
(*testout) << "\n" << "Start SwapImprove" << endl; (*testout) << "\n" << "Start SwapImprove" << endl;
const char * savetask = multithread.task; const char * savetask = multithread.task;
multithread.task = "Swap Improve"; multithread.task = "Optimize Volume: Swap Improve";
// mesh.CalcSurfacesOfNode (); // mesh.CalcSurfacesOfNode ();
@ -2617,7 +2617,7 @@ void MeshOptimize3d :: SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal,
(*testout) << "\n" << "Start SwapImprove" << endl; (*testout) << "\n" << "Start SwapImprove" << endl;
const char * savetask = multithread.task; const char * savetask = multithread.task;
multithread.task = "Swap Improve"; multithread.task = "Optimize Volume: Swap Improve";
INDEX_3_HASHTABLE<int> faces(mesh.GetNOpenElements()/3 + 2); INDEX_3_HASHTABLE<int> faces(mesh.GetNOpenElements()/3 + 2);
if (goal == OPT_CONFORM) if (goal == OPT_CONFORM)

View File

@ -646,6 +646,8 @@ namespace netgen
{ {
static Timer t("OptimizeVolume"); RegionTimer reg(t); static Timer t("OptimizeVolume"); RegionTimer reg(t);
RegionTaskManager rtm(mp.parallel_meshing ? mp.nthreads : 0); RegionTaskManager rtm(mp.parallel_meshing ? mp.nthreads : 0);
const char* savetask = multithread.task;
multithread.task = "Optimize Volume";
int i; int i;
@ -663,7 +665,7 @@ namespace netgen
*/ */
mesh3d.CalcSurfacesOfNode(); mesh3d.CalcSurfacesOfNode();
for (i = 1; i <= mp.optsteps3d; i++) for (auto i : Range(mp.optsteps3d))
{ {
if (multithread.terminate) if (multithread.terminate)
break; break;
@ -672,12 +674,13 @@ namespace netgen
// teterrpow = mp.opterrpow; // teterrpow = mp.opterrpow;
// for (size_t j = 1; j <= strlen(mp.optimize3d); j++) // for (size_t j = 1; j <= strlen(mp.optimize3d); j++)
for (size_t j = 1; j <= mp.optimize3d.length(); j++) for (auto j : Range(mp.optimize3d.size()))
{ {
multithread.percent = 100.* (double(j)/mp.optimize3d.size() + i)/mp.optsteps3d;
if (multithread.terminate) if (multithread.terminate)
break; break;
switch (mp.optimize3d[j-1]) switch (mp.optimize3d[j])
{ {
case 'c': optmesh.CombineImprove(mesh3d, OPT_REST); break; case 'c': optmesh.CombineImprove(mesh3d, OPT_REST); break;
case 'd': optmesh.SplitImprove(mesh3d); break; case 'd': optmesh.SplitImprove(mesh3d); break;
@ -698,6 +701,7 @@ namespace netgen
MeshQuality3d (mesh3d); MeshQuality3d (mesh3d);
} }
multithread.task = savetask;
return MESHING3_OK; return MESHING3_OK;
} }

View File

@ -1164,7 +1164,7 @@ void Mesh :: ImproveMesh (const CSG eometry & geometry, OPTIMIZEGOAL goal)
} }
const char * savetask = multithread.task; const char * savetask = multithread.task;
multithread.task = "Smooth Mesh"; multithread.task = "Optimize Volume: Smooth Mesh";
TABLE<INDEX> surfelementsonpoint(points.Size()); TABLE<INDEX> surfelementsonpoint(points.Size());
@ -1398,7 +1398,7 @@ void Mesh :: ImproveMeshSequential (const MeshingParameters & mp, OPTIMIZEGOAL g
const char * savetask = multithread.task; const char * savetask = multithread.task;
multithread.task = "Smooth Mesh"; multithread.task = "Optimize Volume: Smooth Mesh";
for (PointIndex pi : points.Range()) for (PointIndex pi : points.Range())
if ( (*this)[pi].Type() == INNERPOINT ) if ( (*this)[pi].Type() == INNERPOINT )
@ -1524,7 +1524,7 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal)
} }
const char * savetask = multithread.task; const char * savetask = multithread.task;
multithread.task = "Smooth Mesh"; multithread.task = "Optimize Volume: Smooth Mesh";
topt.Start(); topt.Start();
int counter = 0; int counter = 0;
@ -1659,7 +1659,7 @@ void Mesh :: ImproveMeshJacobian (const MeshingParameters & mp,
const char * savetask = multithread.task; const char * savetask = multithread.task;
multithread.task = "Smooth Mesh Jacobian"; multithread.task = "Optimize Volume: Smooth Mesh Jacobian";
// for (PointIndex pi = points.Begin(); i < points.End(); pi++) // for (PointIndex pi = points.Begin(); i < points.End(); pi++)
for (PointIndex pi : points.Range()) for (PointIndex pi : points.Range())
@ -1815,7 +1815,7 @@ void Mesh :: ImproveMeshJacobianOnSurface (const MeshingParameters & mp,
const char * savetask = multithread.task; const char * savetask = multithread.task;
multithread.task = "Smooth Mesh Jacobian"; multithread.task = "Optimize Volume: Smooth Mesh Jacobian";
// for (PointIndex pi = points.Begin(); pi <= points.End(); pi++) // for (PointIndex pi = points.Begin(); pi <= points.End(); pi++)
for (PointIndex pi : points.Range()) for (PointIndex pi : points.Range())