CreatePoint2ElementTable with optional points bitarray

This commit is contained in:
Matthias Hochsteger 2021-06-04 11:23:37 +02:00
parent 7623289c27
commit 6c37ce33b0
3 changed files with 35 additions and 15 deletions

View File

@ -1598,20 +1598,20 @@ namespace netgen
// tempmesh.Save ("tempmesh.vol");
{
MeshOptimize3d meshopt(mp);
tempmesh.Compress();
tempmesh.FindOpenElements ();
RegionTaskManager rtm(mp.parallel_meshing ? mp.nthreads : 0);
for (auto i : Range(10))
for (int i = 1; i <= 4; i++)
{
PrintMessage (5, "Num open: ", tempmesh.GetNOpenElements());
tempmesh.FindOpenElements ();
PrintMessage (5, "Num open: ", tempmesh.GetNOpenElements());
tempmesh.CalcSurfacesOfNode ();
if(i%5==0)
tempmesh.FreeOpenElementsEnvironment (1);
MeshOptimize3d meshopt(mp);
// tempmesh.CalcSurfacesOfNode();
meshopt.SwapImprove(tempmesh, OPT_CONFORM);
}
tempmesh.Compress();
}
MeshQuality3d (tempmesh);

View File

@ -6545,12 +6545,32 @@ namespace netgen
}
Table<ElementIndex, PointIndex> Mesh :: CreatePoint2ElementTable() const
Table<ElementIndex, PointIndex> Mesh :: CreatePoint2ElementTable(std::optional<BitArray> points) const
{
if(points)
{
const auto & free_points = *points;
return ngcore::CreateSortedTable<ElementIndex, PointIndex>( volelements.Range(),
[&](auto & table, ElementIndex ei)
{
for (PointIndex pi : (*this)[ei].PNums())
const auto & el = (*this)[ei];
if(el.IsDeleted())
return;
for (PointIndex pi : el.PNums())
if(free_points[pi])
table.Add (pi, ei);
}, GetNP());
}
else
return ngcore::CreateSortedTable<ElementIndex, PointIndex>( volelements.Range(),
[&](auto & table, ElementIndex ei)
{
const auto & el = (*this)[ei];
if(el.IsDeleted())
return;
for (PointIndex pi : el.PNums())
table.Add (pi, ei);
}, GetNP());
}

View File

@ -772,7 +772,7 @@ namespace netgen
Table<ElementIndex, PointIndex> CreatePoint2ElementTable() const;
Table<ElementIndex, PointIndex> CreatePoint2ElementTable(std::optional<BitArray> points = std::nullopt) const;
Table<SurfaceElementIndex, PointIndex> CreatePoint2SurfaceElementTable( int faceindex=0 ) const;
DLL_HEADER bool PureTrigMesh (int faceindex = 0) const;