From ebf1478048a537d13685ba2591e839e95a4617bd Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Mon, 21 Jun 2021 13:57:57 +0200 Subject: [PATCH] copy ctor for MatrixFixWidth --- libsrc/linalg/densemat.cpp | 2 +- libsrc/linalg/densemat.hpp | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libsrc/linalg/densemat.cpp b/libsrc/linalg/densemat.cpp index ef896616..f2cc2fa5 100644 --- a/libsrc/linalg/densemat.cpp +++ b/libsrc/linalg/densemat.cpp @@ -1380,6 +1380,6 @@ namespace netgen return ost; } - + } diff --git a/libsrc/linalg/densemat.hpp b/libsrc/linalg/densemat.hpp index 9b007202..5b3bb6a5 100644 --- a/libsrc/linalg/densemat.hpp +++ b/libsrc/linalg/densemat.hpp @@ -171,8 +171,14 @@ public: { height = h; data = adata; ownmem = false; } /// MatrixFixWidth (const MatrixFixWidth & m2) - : height(m2.height), data(m2.data), ownmem(false) - { ; } + : height(m2.height), ownmem(true) + { + data = new T[height*WIDTH]; + for (int i = 0; i < WIDTH*height; i++) + data[i] = m2.data[i]; + } + // : height(m2.height), data(m2.data), ownmem(false) + //{ ; } /// ~MatrixFixWidth () { if (ownmem) delete [] data; } @@ -277,6 +283,15 @@ public: /// MatrixFixWidth (int h) { height = h; data = new double[WIDTH*height]; ownmem = true; } + + MatrixFixWidth (const MatrixFixWidth & m2) + : height(m2.height), ownmem(true) + { + data = new double[height*WIDTH]; + for (int i = 0; i < WIDTH*height; i++) + data[i] = m2.data[i]; + } + /// MatrixFixWidth (int h, double * adata) { height = h; data = adata; ownmem = false; }