From 6cdfefcc82a34831e98d2b26ffd4c448d1ab33e3 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Thu, 10 Jun 2021 09:51:56 +0200 Subject: [PATCH] Use CreateTable for coloring table --- libsrc/meshing/smoothing3.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/libsrc/meshing/smoothing3.cpp b/libsrc/meshing/smoothing3.cpp index 60773d9d..79530dbf 100644 --- a/libsrc/meshing/smoothing3.cpp +++ b/libsrc/meshing/smoothing3.cpp @@ -1483,17 +1483,13 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal) tcoloring.Start(); int ncolors = ngcore::ComputeColoring( colors, ne, getDofs ); - TableCreator creator(ncolors); - for ( ; !creator.Done(); creator++) - { - ParallelForRange( Range(colors), [&](auto myrange) + auto color_table = CreateTable( points.Size(), + [&] ( auto & table, int i ) { - for(auto i : myrange) - creator.Add(colors[i], i); - }); - } + PointIndex pi = i+static_cast(PointIndex::BASE); + table.Add(colors[i], pi); + }, ncolors); - auto color_table = creator.MoveTable(); tcoloring.Stop(); if (goal == OPT_QUALITY) @@ -1530,12 +1526,12 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal) topt.Start(); int counter = 0; - for (int color : Range(color_table.Size())) + for (auto icolor : Range(ncolors)) { if (multithread.terminate) throw NgException ("Meshing stopped"); - ParallelForRange( Range(color_table[color].Size()), [&](auto myrange) + ParallelForRange( color_table[icolor].Range(), [&](auto myrange) { RegionTracer reg(ngcore::TaskManager::GetThreadId(), trange, myrange.Size()); Vector x(3); @@ -1550,7 +1546,7 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal) for (auto i : myrange) { - PointIndex pi(color_table[color][i]+PointIndex::BASE); + PointIndex pi = color_table[icolor][i]; if ( (*this)[pi].Type() == INNERPOINT ) { counter++;