ParallelFor loops in setup of CombineImprove()

This commit is contained in:
Matthias Hochsteger 2019-10-14 13:51:25 +02:00
parent 19c86a9f3d
commit 9fd4970614

View File

@ -409,61 +409,48 @@ namespace netgen
auto elementsonnode = mesh.CreatePoint2SurfaceElementTable(faceindex); auto elementsonnode = mesh.CreatePoint2SurfaceElementTable(faceindex);
Array<SurfaceElementIndex> hasonepi, hasbothpi; Array<SurfaceElementIndex> hasonepi, hasbothpi;
int ntasks = ngcore::TaskManager::GetMaxThreads();
Array<std::tuple<PointIndex, PointIndex>> edges;
BuildEdgeList( mesh, elementsonnode, edges );
Array<bool,PointIndex> fixed(np); Array<bool,PointIndex> fixed(np);
ParallelFor( fixed.Range(), [&fixed] (auto i) NETGEN_LAMBDA_INLINE ParallelFor( fixed.Range(), [&fixed] (auto i) NETGEN_LAMBDA_INLINE
{ fixed[i] = false; }); { fixed[i] = false; });
ParallelFor( edges.Range(), [&] (auto i) NETGEN_LAMBDA_INLINE
{
auto [pi0, pi1] = edges[i];
if (mesh.IsSegment (pi0, pi1))
{
fixed[pi0] = true;
fixed[pi1] = true;
}
});
timerstart1.Stop(); timerstart1.Stop();
/* ParallelFor( mesh.LockedPoints().Range(), [&] (auto i) NETGEN_LAMBDA_INLINE
for (SegmentIndex si = 0; si < mesh.GetNSeg(); si++) {
{ fixed[mesh.LockedPoints()[i]] = true;
INDEX_2 i2(mesh[si][0], mesh[si][1]); });
fixed[i2.I1()] = true;
fixed[i2.I2()] = true;
}
*/
for (SurfaceElementIndex sei : seia)
{
Element2d & sel = mesh[sei];
for (int j = 0; j < sel.GetNP(); j++)
{
PointIndex pi1 = sel.PNumMod(j+2);
PointIndex pi2 = sel.PNumMod(j+3);
if (mesh.IsSegment (pi1, pi2))
{
fixed[pi1] = true;
fixed[pi2] = true;
}
}
}
/*
for(int i = 0; i < mesh.LockedPoints().Size(); i++)
fixed[mesh.LockedPoints()[i]] = true;
*/
for (PointIndex pi : mesh.LockedPoints())
fixed[pi] = true;
Array<Vec<3>,PointIndex> normals(np); Array<Vec<3>,PointIndex> normals(np);
// for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End(); pi++) ParallelFor( mesh.Points().Range(), [&] (auto pi) NETGEN_LAMBDA_INLINE
for (PointIndex pi : mesh.Points().Range()) {
{ if (elementsonnode[pi].Size())
if (elementsonnode[pi].Size()) {
{ Element2d & hel = mesh[elementsonnode[pi][0]];
Element2d & hel = mesh[elementsonnode[pi][0]]; for (int k = 0; k < 3; k++)
for (int k = 0; k < 3; k++) if (hel[k] == pi)
if (hel[k] == pi) {
{ GetNormalVector (surfnr, mesh[pi], hel.GeomInfoPi(k+1), normals[pi]);
GetNormalVector (surfnr, mesh[pi], hel.GeomInfoPi(k+1), normals[pi]); break;
break; }
} }
} });
}
timerstart.Stop(); timerstart.Stop();