--- trunk/OOPSE-3.0/src/math/RectMatrix.hpp 2004/10/21 21:31:39 1630 +++ trunk/OOPSE-3.0/src/math/RectMatrix.hpp 2004/10/25 22:46:19 1644 @@ -63,6 +63,12 @@ namespace oopse { data_[i][j] = s; } + RectMatrix(Real* array) { + for (unsigned int i = 0; i < Row; i++) + for (unsigned int j = 0; j < Col; j++) + data_[i][j] = array[i * Row + j]; + } + /** copy constructor */ RectMatrix(const RectMatrix& m) { *this = m; @@ -104,6 +110,19 @@ namespace oopse { return data_[i][j]; } + /** + * Copy the internal data to an array + * @param array the pointer of destination array + */ + void getArray(Real* array) { + for (unsigned int i = 0; i < Row; i++) { + for (unsigned int j = 0; j < Col; j++) { + array[i * Row + j] = data_[i][j]; + } + } + } + + /** Returns the pointer of internal array */ Real* getArrayPointer() { return &data_[0][0];