From 64a685c2eae47ffdd5eae56d7ac62fb5e59d1ee5 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Fri, 4 Oct 2019 17:07:10 +0200 Subject: [PATCH] CreateSurface2ElementTable for individual faces --- libsrc/meshing/meshclass.cpp | 39 +++++++++++++++++++++++++++--------- libsrc/meshing/meshclass.hpp | 2 +- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index 25b60e88..e6067a5f 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -6205,22 +6205,41 @@ namespace netgen { for (PointIndex pi : myrange) QuickSort(elementsonnode[pi]); - }); + }, ngcore::TasksPerThread(4)); return move(elementsonnode); } - Table Mesh :: CreatePoint2SurfaceElementTable() const + Table Mesh :: CreatePoint2SurfaceElementTable( int faceindex ) const { + static Timer timer("Mesh::CreatePoint2SurfaceElementTable"); RegionTimer rt(timer); + TableCreator creator(GetNP()); - for ( ; !creator.Done(); creator++) - ngcore::ParallelForRange - (Range(surfelements), [&] (auto myrange) - { - for (SurfaceElementIndex ei : myrange) - for (PointIndex pi : (*this)[ei].PNums()) - creator.Add (pi, ei); - }); + + if(faceindex==0) + { + for ( ; !creator.Done(); creator++) + ngcore::ParallelForRange + (Range(surfelements), [&] (auto myrange) + { + for (SurfaceElementIndex ei : myrange) + for (PointIndex pi : (*this)[ei].PNums()) + creator.Add (pi, ei); + }, ngcore::TasksPerThread(4)); + } + else + { + Array face_els; + GetSurfaceElementsOfFace(faceindex, face_els); + for ( ; !creator.Done(); creator++) + ngcore::ParallelForRange + (Range(face_els), [&] (auto myrange) + { + for (auto i : myrange) + for (PointIndex pi : (*this)[face_els[i]].PNums()) + creator.Add (pi, face_els[i]); + }, ngcore::TasksPerThread(4)); + } auto elementsonnode = creator.MoveTable(); ngcore::ParallelForRange diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index 372430ee..6431afad 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -762,7 +762,7 @@ namespace netgen Table CreatePoint2ElementTable() const; - Table CreatePoint2SurfaceElementTable() const; + Table CreatePoint2SurfaceElementTable( int faceindex=0 ) const; DLL_HEADER bool PureTrigMesh (int faceindex = 0) const; DLL_HEADER bool PureTetMesh () const;