parallel CreatePoint2ElementTable as method of Mesh

This commit is contained in:
Joachim Schöberl 2019-09-30 09:36:15 +02:00
parent 7019504265
commit 656b0e0539
3 changed files with 54 additions and 37 deletions

View File

@ -3631,25 +3631,8 @@ void MeshOptimize3d :: SwapImprove2Sequential (Mesh & mesh, OPTIMIZEGOAL goal)
(*testout) << "Total badness = " << bad1 << endl;
cout << "tot bad = " << bad1 << endl;
// find elements on node
TableCreator<ElementIndex, PointIndex> creator(np);
for ( ; !creator.Done(); creator++)
ngcore::ParallelForRange
(ElementIndex(ne), [&] (auto myrange)
{
for (ElementIndex ei : myrange)
for (PointIndex pi : mesh[ei].PNums())
creator.Add (pi, ei);
});
auto elementsonnode = creator.MoveTable();
ngcore::ParallelForRange
(elementsonnode.Range(), [&] (auto myrange)
{
for (PointIndex pi : myrange)
QuickSort(elementsonnode[pi]);
});
auto elementsonnode = mesh.CreatePoint2ElementTable();
for (SurfaceElementIndex sei = 0; sei < nse; sei++)
for (int j = 0; j < 3; j++)
belementsonnode.Add (mesh[sei][j], sei);
@ -3733,24 +3716,7 @@ void MeshOptimize3d :: SwapImprove2 (Mesh & mesh, OPTIMIZEGOAL goal)
// find elements on node
TableCreator<ElementIndex, PointIndex> creator(np);
for ( ; !creator.Done(); creator++)
ngcore::ParallelForRange
(ElementIndex(ne), [&] (auto myrange)
{
for (ElementIndex ei : myrange)
for (PointIndex pi : mesh[ei].PNums())
creator.Add (pi, ei);
});
auto elementsonnode = creator.MoveTable();
ngcore::ParallelForRange
(elementsonnode.Range(), [&] (auto myrange)
{
for (PointIndex pi : myrange)
QuickSort(elementsonnode[pi]);
});
auto elementsonnode = mesh.CreatePoint2ElementTable();
for (SurfaceElementIndex sei = 0; sei < nse; sei++)
for (int j = 0; j < 3; j++)

View File

@ -1751,6 +1751,7 @@ namespace netgen
if (dimension == 3)
{
static Timer t("Mesh::CalcSurfacesOfNode, pointloop"); RegionTimer reg (t);
/*
for (PointIndex pi = points.Begin(); pi < points.End(); pi++)
points[pi].SetType (INNERPOINT);
@ -5973,6 +5974,54 @@ namespace netgen
}
Table<ElementIndex, PointIndex> Mesh :: CreatePoint2ElementTable() const
{
TableCreator<ElementIndex, PointIndex> creator(GetNP());
for ( ; !creator.Done(); creator++)
ngcore::ParallelForRange
(Range(volelements), [&] (auto myrange)
{
for (ElementIndex ei : myrange)
for (PointIndex pi : (*this)[ei].PNums())
creator.Add (pi, ei);
});
auto elementsonnode = creator.MoveTable();
ngcore::ParallelForRange
(elementsonnode.Range(), [&] (auto myrange)
{
for (PointIndex pi : myrange)
QuickSort(elementsonnode[pi]);
});
return move(elementsonnode);
}
Table<SurfaceElementIndex, PointIndex> Mesh :: CreatePoint2SurfaceElementTable() const
{
TableCreator<SurfaceElementIndex, PointIndex> creator(GetNP());
for ( ; !creator.Done(); creator++)
ngcore::ParallelForRange
(Range(surfelements), [&] (auto myrange)
{
for (SurfaceElementIndex ei : myrange)
for (PointIndex pi : (*this)[ei].PNums())
creator.Add (pi, ei);
});
auto elementsonnode = creator.MoveTable();
ngcore::ParallelForRange
(elementsonnode.Range(), [&] (auto myrange)
{
for (PointIndex pi : myrange)
QuickSort(elementsonnode[pi]);
});
return move(elementsonnode);
}
/*
void Mesh :: BuildConnectedNodes ()
{

View File

@ -747,6 +747,8 @@ namespace netgen
Table<ElementIndex, PointIndex> CreatePoint2ElementTable() const;
Table<SurfaceElementIndex, PointIndex> CreatePoint2SurfaceElementTable() const;
DLL_HEADER bool PureTrigMesh (int faceindex = 0) const;
DLL_HEADER bool PureTetMesh () const;