parallel trig-marking for bisection

This commit is contained in:
Joachim Schöberl 2017-04-11 10:45:31 +02:00
parent 0074d8b407
commit e464fe9771

View File

@ -1724,15 +1724,22 @@ namespace netgen
bool MarkHangingTris (T_MTRIS & mtris, bool MarkHangingTris (T_MTRIS & mtris,
const INDEX_2_CLOSED_HASHTABLE<PointIndex> & cutedges) const INDEX_2_CLOSED_HASHTABLE<PointIndex> & cutedges,
TaskManager tm)
{ {
bool hanging = false; bool hanging = false;
// for (int i = 1; i <= mtris.Size(); i++) // for (int i = 1; i <= mtris.Size(); i++)
for (auto & tri : mtris) // for (auto & tri : mtris)
ParallelForRange
(tm, mtris.Size(), [&] (size_t begin, size_t end)
{ {
bool my_hanging = false;
for (size_t i = begin; i < end; i++)
{
auto & tri = mtris[i];
if (tri.marked) if (tri.marked)
{ {
hanging = true; my_hanging = true;
continue; continue;
} }
for (int j = 0; j < 2; j++) for (int j = 0; j < 2; j++)
@ -1744,10 +1751,12 @@ namespace netgen
if (cutedges.Used (edge)) if (cutedges.Used (edge))
{ {
tri.marked = 1; tri.marked = 1;
hanging = true; my_hanging = true;
} }
} }
} }
if (my_hanging) hanging = true;
});
return hanging; return hanging;
} }
@ -3476,7 +3485,7 @@ namespace netgen
NgProfiler::StartTimer (timer1b); NgProfiler::StartTimer (timer1b);
hangingsurf = hangingsurf =
MarkHangingTris (mtris, cutedges) + MarkHangingTris (mtris, cutedges, opt.task_manager) +
MarkHangingQuads (mquads, cutedges); MarkHangingQuads (mquads, cutedges);
hangingedge = 0; hangingedge = 0;