mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
Use CreateTable for coloring table
This commit is contained in:
parent
c734a27621
commit
6cdfefcc82
@ -1483,17 +1483,13 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal)
|
|||||||
|
|
||||||
tcoloring.Start();
|
tcoloring.Start();
|
||||||
int ncolors = ngcore::ComputeColoring( colors, ne, getDofs );
|
int ncolors = ngcore::ComputeColoring( colors, ne, getDofs );
|
||||||
TableCreator<int> creator(ncolors);
|
auto color_table = CreateTable<PointIndex, int>( points.Size(),
|
||||||
for ( ; !creator.Done(); creator++)
|
[&] ( auto & table, int i )
|
||||||
{
|
|
||||||
ParallelForRange( Range(colors), [&](auto myrange)
|
|
||||||
{
|
{
|
||||||
for(auto i : myrange)
|
PointIndex pi = i+static_cast<int>(PointIndex::BASE);
|
||||||
creator.Add(colors[i], i);
|
table.Add(colors[i], pi);
|
||||||
});
|
}, ncolors);
|
||||||
}
|
|
||||||
|
|
||||||
auto color_table = creator.MoveTable();
|
|
||||||
tcoloring.Stop();
|
tcoloring.Stop();
|
||||||
|
|
||||||
if (goal == OPT_QUALITY)
|
if (goal == OPT_QUALITY)
|
||||||
@ -1530,12 +1526,12 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal)
|
|||||||
|
|
||||||
topt.Start();
|
topt.Start();
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (int color : Range(color_table.Size()))
|
for (auto icolor : Range(ncolors))
|
||||||
{
|
{
|
||||||
if (multithread.terminate)
|
if (multithread.terminate)
|
||||||
throw NgException ("Meshing stopped");
|
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());
|
RegionTracer reg(ngcore::TaskManager::GetThreadId(), trange, myrange.Size());
|
||||||
Vector x(3);
|
Vector x(3);
|
||||||
@ -1550,7 +1546,7 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal)
|
|||||||
|
|
||||||
for (auto i : myrange)
|
for (auto i : myrange)
|
||||||
{
|
{
|
||||||
PointIndex pi(color_table[color][i]+PointIndex::BASE);
|
PointIndex pi = color_table[icolor][i];
|
||||||
if ( (*this)[pi].Type() == INNERPOINT )
|
if ( (*this)[pi].Type() == INNERPOINT )
|
||||||
{
|
{
|
||||||
counter++;
|
counter++;
|
||||||
|
Loading…
Reference in New Issue
Block a user