fix smoothing

This commit is contained in:
Matthias Hochsteger 2023-02-07 16:06:39 +01:00
parent ae6bb81069
commit ca88e90a31

View File

@ -334,22 +334,18 @@ namespace netgen
: points(mesh.Points()), elements(mesh.VolumeElements()), elementsonpoint(* new Table<ElementIndex,PointIndex>()), own_elementsonpoint(true), mp(amp) : points(mesh.Points()), elements(mesh.VolumeElements()), elementsonpoint(* new Table<ElementIndex,PointIndex>()), own_elementsonpoint(true), mp(amp)
{ {
static Timer tim("PointFunction - build elementsonpoint table"); RegionTimer reg(tim); static Timer tim("PointFunction - build elementsonpoint table"); RegionTimer reg(tim);
BitArray free_points(points.Size()+PointIndex::BASE);
free_points.Clear();
ParallelForRange(elements.Range(), [&] (auto myrange) elementsonpoint = ngcore::CreateSortedTable<ElementIndex, PointIndex>( elements.Range(),
{ [&](auto & table, ElementIndex ei)
for (ElementIndex eli : myrange) {
{ const auto & el = elements[ei];
const auto & el = elements[eli];
if(el.Flags().fixed || el.NP()!=4 || (mp.only3D_domain_nr && mp.only3D_domain_nr != el.GetIndex()) ) if(el.Flags().fixed || el.NP()!=4 || (mp.only3D_domain_nr && mp.only3D_domain_nr != el.GetIndex()) )
for (auto pi : el.PNums()) return;
if(free_points[pi])
free_points.SetBitAtomic(pi); for (PointIndex pi : el.PNums())
} table.Add (pi, ei);
}); }, points.Size());
free_points.Invert();
elementsonpoint = mesh.CreatePoint2ElementTable(free_points, mp.only3D_domain_nr);
} }
void PointFunction :: SetPointIndex (PointIndex aactpind) void PointFunction :: SetPointIndex (PointIndex aactpind)
@ -1351,8 +1347,7 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal)
const auto & getDofs = [&] (int i) const auto & getDofs = [&] (int i)
{ {
i += PointIndex::BASE; return elementsonpoint[i += PointIndex::BASE];
return FlatArray<ElementIndex>(elementsonpoint[i].Size(), elementsonpoint[i].Data());
}; };
Array<int> colors(points.Size()); Array<int> colors(points.Size());