move semantics to table, PNums to LineSegments

This commit is contained in:
Joachim Schöberl 2020-08-28 08:47:33 +02:00
parent 78d0479993
commit 9968037361
3 changed files with 22 additions and 0 deletions

View File

@ -405,6 +405,13 @@ public:
/// Creates table with a priori fixed entry sizes.
DynamicTable (const Array<int> & 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)

View File

@ -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<int,BASE> & entrysizes)
: BASE_TABLE (NgFlatArray<int> (entrysizes.Size(), const_cast<int*>(&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)

View File

@ -1062,6 +1062,10 @@ namespace netgen
return pnums[2].IsValid() ? 3 : 2;
}
auto PNums() const { return FlatArray<const PointIndex> (GetNP(), &pnums[0]); }
auto PNums() { return FlatArray<PointIndex> (GetNP(), &pnums[0]); }
ELEMENT_TYPE GetType() const
{
return pnums[2].IsValid() ? SEGMENT3 : SEGMENT;