mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 22:20:35 +05:00
Parallel MeshOptimize2d::EdgeSwapping() (individual faces)
This commit is contained in:
parent
4d218fa042
commit
f24a749fb2
@ -375,26 +375,40 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Array<std::pair<SurfaceElementIndex,int>> improvement_candidates(3*seia.Size());
|
||||||
|
atomic<int> cnt(0);
|
||||||
|
|
||||||
int t = 4;
|
int t = 4;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
while (!done && t >= 2)
|
while (!done && t >= 2)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < seia.Size(); i++)
|
cnt = 0;
|
||||||
{
|
ParallelForRange( Range(seia), [&] (auto myrange)
|
||||||
SurfaceElementIndex t1 = seia[i];
|
{
|
||||||
|
for (auto i : myrange)
|
||||||
|
{
|
||||||
|
SurfaceElementIndex t1 = seia[i];
|
||||||
|
|
||||||
if (mesh[t1].IsDeleted())
|
if (mesh[t1].IsDeleted())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mesh[t1].GetIndex() != faceindex)
|
if (mesh[t1].GetIndex() != faceindex)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (multithread.terminate)
|
if (multithread.terminate)
|
||||||
throw NgException ("Meshing stopped");
|
throw NgException ("Meshing stopped");
|
||||||
|
|
||||||
for (int o1 = 0; o1 < 3; o1++)
|
for (int o1 = 0; o1 < 3; o1++)
|
||||||
done |= EdgeSwapping(mesh, usemetric, neighbors, swapped, t1, o1, surfnr, t, pdef, false);
|
if(EdgeSwapping(mesh, usemetric, neighbors, swapped, t1, o1, surfnr, t, pdef, true))
|
||||||
}
|
improvement_candidates[cnt++]= std::make_pair(t1,o1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
auto elements_with_improvement = improvement_candidates.Range(cnt.load());
|
||||||
|
QuickSort(elements_with_improvement);
|
||||||
|
|
||||||
|
for (auto [t1,o1] : elements_with_improvement)
|
||||||
|
done |= EdgeSwapping(mesh, usemetric, neighbors, swapped, t1, o1, surfnr, t, pdef, false);
|
||||||
t--;
|
t--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user