more tracing and parallelization

This commit is contained in:
Joachim Schöberl 2018-01-04 18:45:07 +01:00
parent dca5a01e04
commit 19ec4fc9ca
4 changed files with 37 additions and 2 deletions

View File

@ -1009,7 +1009,7 @@ namespace netgen
ref.Bisect (*mesh, biopt);
(*tracer)("call updatetop", false);
mesh -> UpdateTopology(task_manager);
mesh -> UpdateTopology(task_manager, tracer);
(*tracer)("call updatetop", true);
mesh -> GetCurvedElements().SetIsHighOrder (false);
}

View File

@ -3346,13 +3346,15 @@ namespace netgen
//IdentifyCutEdges(mesh, cutedges);
(*opt.tracer)("mark elements", false);
hangingvol =
MarkHangingTets (mtets, cutedges, opt.task_manager) +
MarkHangingPrisms (mprisms, cutedges) +
MarkHangingIdentifications (mids, cutedges);
(*opt.tracer)("mark elements", true);
size_t nsel = mtris.Size();
NgProfiler::StartTimer (timer_bisecttrig);
@ -3625,6 +3627,8 @@ namespace netgen
(*opt.tracer)("copy tets", false);
mesh.ClearVolumeElements();
mesh.VolumeElements().SetAllocSize (mtets.Size()+mprisms.Size());
mesh.VolumeElements().SetSize(mtets.Size());
/*
for (int i = 1; i <= mtets.Size(); i++)
{
Element el(TET);
@ -3634,6 +3638,22 @@ namespace netgen
el.SetOrder (mtets.Get(i).order);
mesh.AddVolumeElement (el);
}
*/
ParallelForRange
(opt.task_manager, mtets.Size(), [&] (size_t begin, size_t end)
{
for (size_t i = begin; i < end; i++)
{
Element el(TET);
auto & tet = mtets[i];
el.SetIndex (tet.matindex);
el.SetOrder (tet.order);
for (int j = 0; j < 4; j++)
el[j] = tet.pnums[j];
mesh.SetVolumeElement (ElementIndex(i), el);
}
});
(*opt.tracer)("copy tets", true);
for (int i = 1; i <= mprisms.Size(); i++)

View File

@ -402,6 +402,19 @@ namespace netgen
return ve;
}
void Mesh :: SetVolumeElement (ElementIndex ei, const Element & el)
{
/*
int maxn = el[0];
for (int i = 1; i < el.GetNP(); i++)
if (el[i] > maxn) maxn = el[i];
maxn += 1-PointIndex::BASE;
*/
volelements[ei] = el;
volelements.Last().flags.illegal_valid = 0;
}

View File

@ -307,6 +307,8 @@ namespace netgen
DLL_HEADER void GetSurfaceElementsOfFace (int facenr, Array<SurfaceElementIndex> & sei) const;
DLL_HEADER ElementIndex AddVolumeElement (const Element & el);
// write to pre-allocated container, thread-safe
DLL_HEADER void SetVolumeElement (ElementIndex sei, const Element & el);
int GetNE () const { return volelements.Size(); }