mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
swapimprove2 with core tables
This commit is contained in:
parent
eeb63f659f
commit
47641c9b2c
@ -3432,7 +3432,7 @@ void MeshOptimize3d :: SwapImproveSurface (Mesh & mesh, OPTIMIZEGOAL goal,
|
||||
*/
|
||||
|
||||
bool MeshOptimize3d :: SwapImprove2 ( Mesh & mesh, OPTIMIZEGOAL goal, ElementIndex eli1, int face,
|
||||
TABLE<ElementIndex, PointIndex::BASE> & elementsonnode,
|
||||
Table<ElementIndex, PointIndex> & elementsonnode,
|
||||
TABLE<SurfaceElementIndex, PointIndex::BASE> & belementsonnode, bool check_only )
|
||||
{
|
||||
PointIndex pi1, pi2, pi3, pi4, pi5;
|
||||
@ -3490,7 +3490,7 @@ bool MeshOptimize3d :: SwapImprove2 ( Mesh & mesh, OPTIMIZEGOAL goal, ElementInd
|
||||
if (bface) return false;
|
||||
|
||||
|
||||
NgFlatArray<ElementIndex> row = elementsonnode[pi1];
|
||||
FlatArray<ElementIndex> row = elementsonnode[pi1];
|
||||
for (int k = 0; k < row.Size(); k++)
|
||||
{
|
||||
ElementIndex eli2 = row[k];
|
||||
@ -3576,12 +3576,15 @@ bool MeshOptimize3d :: SwapImprove2 ( Mesh & mesh, OPTIMIZEGOAL goal, ElementInd
|
||||
ElementIndex neli =
|
||||
mesh.AddVolumeElement (el33);
|
||||
|
||||
/*
|
||||
// do we need this ?
|
||||
for (int l = 0; l < 4; l++)
|
||||
{
|
||||
elementsonnode.Add (el31[l], eli1);
|
||||
elementsonnode.Add (el32[l], eli2);
|
||||
elementsonnode.Add (el33[l], neli);
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
return do_swap;
|
||||
@ -3613,7 +3616,7 @@ void MeshOptimize3d :: SwapImprove2Sequential (Mesh & mesh, OPTIMIZEGOAL goal)
|
||||
if (goal == OPT_CONFORM) return;
|
||||
|
||||
// contains at least all elements at node
|
||||
TABLE<ElementIndex, PointIndex::BASE> elementsonnode(np);
|
||||
// TABLE<ElementIndex, PointIndex::BASE> elementsonnode(np);
|
||||
TABLE<SurfaceElementIndex, PointIndex::BASE> belementsonnode(np);
|
||||
|
||||
PrintMessage (3, "SwapImprove2 ");
|
||||
@ -3639,7 +3642,6 @@ 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++)
|
||||
@ -3651,20 +3653,20 @@ void MeshOptimize3d :: SwapImprove2Sequential (Mesh & mesh, OPTIMIZEGOAL goal)
|
||||
creator.Add (pi, ei);
|
||||
});
|
||||
|
||||
auto __elementsonnode = creator.MoveTable();
|
||||
auto elementsonnode = creator.MoveTable();
|
||||
ngcore::ParallelForRange
|
||||
(__elementsonnode.Range(), [&] (auto myrange)
|
||||
(elementsonnode.Range(), [&] (auto myrange)
|
||||
{
|
||||
for (PointIndex pi : myrange)
|
||||
QuickSort(__elementsonnode[pi]);
|
||||
QuickSort(elementsonnode[pi]);
|
||||
});
|
||||
cout << "new elonnode " << __elementsonnode << endl;
|
||||
*/
|
||||
|
||||
// cout << "new elonnode " << __elementsonnode << endl;
|
||||
|
||||
/*
|
||||
for (ElementIndex ei = 0; ei < ne; ei++)
|
||||
for (PointIndex pi : mesh[ei].PNums())
|
||||
elementsonnode.Add (pi, ei);
|
||||
|
||||
*/
|
||||
// cout << "old elonnode " << elementsonnode << endl;
|
||||
|
||||
for (SurfaceElementIndex sei = 0; sei < nse; sei++)
|
||||
@ -3740,7 +3742,7 @@ void MeshOptimize3d :: SwapImprove2 (Mesh & mesh, OPTIMIZEGOAL goal)
|
||||
if (goal == OPT_CONFORM) return;
|
||||
|
||||
// contains at least all elements at node
|
||||
TABLE<ElementIndex, PointIndex::BASE> elementsonnode(np);
|
||||
// TABLE<ElementIndex, PointIndex::BASE> elementsonnode(np);
|
||||
TABLE<SurfaceElementIndex, PointIndex::BASE> belementsonnode(np);
|
||||
|
||||
PrintMessage (3, "SwapImprove2 ");
|
||||
@ -3751,10 +3753,30 @@ 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]);
|
||||
});
|
||||
|
||||
/*
|
||||
for (ElementIndex ei = 0; ei < ne; ei++)
|
||||
for (int j = 0; j < mesh[ei].GetNP(); j++)
|
||||
elementsonnode.Add (mesh[ei][j], ei);
|
||||
|
||||
*/
|
||||
for (SurfaceElementIndex sei = 0; sei < nse; sei++)
|
||||
for (int j = 0; j < 3; j++)
|
||||
belementsonnode.Add (mesh[sei][j], sei);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
const NgArray< NgArray<int,PointIndex::BASE>* > * idmaps = NULL);
|
||||
void SwapImprove2Sequential (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY);
|
||||
void SwapImprove2 (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY);
|
||||
bool SwapImprove2 ( Mesh & mesh, OPTIMIZEGOAL goal, ElementIndex eli1, int face, TABLE<ElementIndex, PointIndex::BASE> & elementsonnode, TABLE<SurfaceElementIndex, PointIndex::BASE> & belementsonnode, bool check_only=false );
|
||||
bool SwapImprove2 ( Mesh & mesh, OPTIMIZEGOAL goal, ElementIndex eli1, int face, Table<ElementIndex, PointIndex> & elementsonnode, TABLE<SurfaceElementIndex, PointIndex::BASE> & belementsonnode, bool check_only=false );
|
||||
|
||||
double
|
||||
CalcBad (const Mesh::T_POINTS & points, const Element & elem, double h)
|
||||
|
Loading…
Reference in New Issue
Block a user