From 9968037361e99eb879423b3a0b07ec33b7ac7f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Sch=C3=B6berl?= Date: Fri, 28 Aug 2020 08:47:33 +0200 Subject: [PATCH] move semantics to table, PNums to LineSegments --- libsrc/core/table.hpp | 7 +++++++ libsrc/general/table.hpp | 11 +++++++++++ libsrc/meshing/meshtype.hpp | 4 ++++ 3 files changed, 22 insertions(+) diff --git a/libsrc/core/table.hpp b/libsrc/core/table.hpp index 537ea2a4..8a565a44 100644 --- a/libsrc/core/table.hpp +++ b/libsrc/core/table.hpp @@ -405,6 +405,13 @@ public: /// Creates table with a priori fixed entry sizes. DynamicTable (const Array & entrysizes) : BaseDynamicTable (entrysizes, sizeof(T)) { ; } + + DynamicTable & operator= (DynamicTable && tab2) + { + Swap (data, tab2.data); + Swap (oneblock, tab2.oneblock); + return *this; + } /// Inserts element acont into row i. Does not test if already used. void Add (int i, const T & acont) diff --git a/libsrc/general/table.hpp b/libsrc/general/table.hpp index 7d2f6999..832fc751 100644 --- a/libsrc/general/table.hpp +++ b/libsrc/general/table.hpp @@ -114,11 +114,22 @@ public: /// Creates table of size size inline TABLE (int size) : BASE_TABLE (size) { ; } + TABLE (TABLE && tab2) + : BASE_TABLE(move(tab2)) + { } + /// Creates fixed maximal element size table inline TABLE (const NgFlatArray & entrysizes) : BASE_TABLE (NgFlatArray (entrysizes.Size(), const_cast(&entrysizes[BASE])), sizeof(T)) { ; } + + TABLE & operator= (TABLE && tab2) + { + BASE_TABLE::operator=(move(tab2)); + return *this; + } + /// Changes Size of table to size, deletes data inline void SetSize (int size) diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index 4071df4b..30c269e6 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -1062,6 +1062,10 @@ namespace netgen return pnums[2].IsValid() ? 3 : 2; } + auto PNums() const { return FlatArray (GetNP(), &pnums[0]); } + auto PNums() { return FlatArray (GetNP(), &pnums[0]); } + + ELEMENT_TYPE GetType() const { return pnums[2].IsValid() ? SEGMENT3 : SEGMENT;