mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-26 04:40:34 +05:00
parallel CreatePoint2ElementTable as method of Mesh
This commit is contained in:
parent
7019504265
commit
656b0e0539
@ -3631,25 +3631,8 @@ void MeshOptimize3d :: SwapImprove2Sequential (Mesh & mesh, OPTIMIZEGOAL goal)
|
|||||||
(*testout) << "Total badness = " << bad1 << endl;
|
(*testout) << "Total badness = " << bad1 << endl;
|
||||||
cout << "tot bad = " << bad1 << endl;
|
cout << "tot bad = " << bad1 << endl;
|
||||||
|
|
||||||
// find elements on node
|
auto elementsonnode = mesh.CreatePoint2ElementTable();
|
||||||
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]);
|
|
||||||
});
|
|
||||||
|
|
||||||
for (SurfaceElementIndex sei = 0; sei < nse; sei++)
|
for (SurfaceElementIndex sei = 0; sei < nse; sei++)
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
belementsonnode.Add (mesh[sei][j], sei);
|
belementsonnode.Add (mesh[sei][j], sei);
|
||||||
@ -3733,24 +3716,7 @@ void MeshOptimize3d :: SwapImprove2 (Mesh & mesh, OPTIMIZEGOAL goal)
|
|||||||
|
|
||||||
// find elements on node
|
// find elements on node
|
||||||
|
|
||||||
|
auto elementsonnode = mesh.CreatePoint2ElementTable();
|
||||||
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]);
|
|
||||||
});
|
|
||||||
|
|
||||||
for (SurfaceElementIndex sei = 0; sei < nse; sei++)
|
for (SurfaceElementIndex sei = 0; sei < nse; sei++)
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
|
@ -1751,6 +1751,7 @@ namespace netgen
|
|||||||
|
|
||||||
if (dimension == 3)
|
if (dimension == 3)
|
||||||
{
|
{
|
||||||
|
static Timer t("Mesh::CalcSurfacesOfNode, pointloop"); RegionTimer reg (t);
|
||||||
/*
|
/*
|
||||||
for (PointIndex pi = points.Begin(); pi < points.End(); pi++)
|
for (PointIndex pi = points.Begin(); pi < points.End(); pi++)
|
||||||
points[pi].SetType (INNERPOINT);
|
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 ()
|
void Mesh :: BuildConnectedNodes ()
|
||||||
{
|
{
|
||||||
|
@ -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 PureTrigMesh (int faceindex = 0) const;
|
||||||
DLL_HEADER bool PureTetMesh () const;
|
DLL_HEADER bool PureTetMesh () const;
|
||||||
|
Loading…
Reference in New Issue
Block a user