diff --git a/FunctionSpace/CMakeLists.txt b/FunctionSpace/CMakeLists.txt index 9b73fd520ec26848183e15cee588da099096ea5f..8f229bd95c544217899121d68ee3d6613d5b957e 100644 --- a/FunctionSpace/CMakeLists.txt +++ b/FunctionSpace/CMakeLists.txt @@ -4,7 +4,6 @@ # bugs and problems to <gmsh@geuz.org>. set(SRC - Matrix.cpp VectorDouble.cpp VectorPolynomial.cpp Polynomial.cpp @@ -23,5 +22,5 @@ set(SRC file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) append_gmsh_src(FunctionSpace "${SRC};${HDR}") -## Compatibility with SmallFEM (TO BE REMOVED !!!) +## Compatibility wicth SmallFEM (TO BE REMOVED !!!) add_sources_in_gmsh(FunctionSpace "${SRC}") \ No newline at end of file diff --git a/FunctionSpace/Matrix.cpp b/FunctionSpace/Matrix.cpp deleted file mode 100644 index 752345e14d506af4b8c32d5458caf692fe1304e0..0000000000000000000000000000000000000000 --- a/FunctionSpace/Matrix.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include <sstream> -#include "Matrix.h" -#include "Exception.h" - -extern "C"{ -#include <cblas.h> -} - -Matrix::Matrix(const int n, const int m){ - if(!(n || m)) - throw Exception("Matrix can't be of dimension (0, 0)"); - - nRow = n; - nCol = m; - nElem = nRow * nCol; - matrix = new double[nElem]; -} - -Matrix::~Matrix(void){ - if(matrix) - delete[] matrix; -} - -void Matrix::allToZero(void){ - for(int i = 0; i < nElem; i++) - matrix[i] = 0.0; -} - -Vector<double> Matrix::mult(const Vector<double>& v) const{ - Vector<double> s(v.N); - - cblas_dgemv(CblasRowMajor, CblasNoTrans, - nRow, nCol, - 1.0, matrix, nCol, - v.v, 1, - 0.0, s.v, 1); - - return s; -} - -std::string Matrix::toString(void) const{ - std::stringstream s; - - for(int i = 0; i < nRow; i++){ - for(int j = 0; j < nCol; j++){ - s << std::scientific << std::showpos << get(i, j) << "\t"; - } - s << std::endl; - } - - return s.str(); -} - -std::string Matrix::toStringMatlab(void) const{ - std::stringstream s; - - s << "["; - for(int i = 0; i < nRow; i++){ - for(int j = 0; j < nCol; j++){ - s << std::scientific << std::showpos << get(j, i) << " "; - } - s << ";"; - } - s << "]"; - - return s.str(); -} diff --git a/FunctionSpace/Matrix.h b/FunctionSpace/Matrix.h deleted file mode 100644 index fe8425ff90b16887556a7d61dea326d8fd307e8a..0000000000000000000000000000000000000000 --- a/FunctionSpace/Matrix.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef _MATRIX_H_ -#define _MATRIX_H_ - -#include <string> -#include "Vector.h" - -/** - @class Matrix - @brief Handles matrices - - This class represents a @c n by @c m matrix. - - @todo - Other than Matrix of double - */ - -class Solver; - -class Matrix{ - private: - int nRow; - int nCol; - int nElem; - double *matrix; - friend class Solver; - - public: - Matrix(const int n, const int m); - ~Matrix(void); - - int row(void) const; - int col(void) const; - - void set(const int i, const int j, const double v); - void allToZero(void); - double get(const int i, const int j) const; - - double& operator()(const int i, const int j); - double operator()(const int i, const int j) const; - - Vector<double> mult(const Vector<double>& v) const; - - std::string toString(void) const; - std::string toStringMatlab(void) const; -}; - -/** - @fn Matrix::Matrix - @param n The number of @em rows of the future Matrix - @param m The number of @em columns of the future Matrix - @return Returns a new @c n by @c m Matrix - - @fn Matrix::~Matrix - @return Deletes this Matrix - - @fn Matrix::row - @return Returns the number of @c rows of this Matrix - - @fn Matrix::col - @return Returns the number of @c columns of this Matrix - - @fn Matrix::set - @param i A @em row index - @param j A @em column index - @param v A value - @returns Sets the given value at the position (@c i, @c j) - in this Matrix - - @fn Matrix::allToZero - @returns Sets all the Matrix elements to @em @c 0 - - @fn Matrix::get - @param i A @em row index - @param j A @em column index - @returns Retuns the value at the position (@c i, @c j) - in this Matrix - - @fn double& Matrix::operator()(const int, const int) - @param i A @em row index - @param j A @em column index - @return Returns a @em reference to the element - at position (@c i, @c j) in this Matrix - - @fn double Matrix::operator()(const int, const int) const - @param i A @em row index - @param j A @em column index - @return Returns the @em value of the element - at position (@c i, @c j) in this Matrix - - @fn Matrix::mult - @param v A Vector of size @c m (for a @c n by @c m Matrix) - @return Returns the Vector (of size @c n) resulting - of the product of @em this Matrix with the @em given Vector - - @fn Matrix::toString - @return Retuns a string correspondig to this Matrix - - @fn Matrix::toStringMatlab - @return Same as Matrix::toString, but the string is in - Matlab / Octave format -*/ - -////////////////////// -// Inline Functions // -////////////////////// - -inline int Matrix::row(void) const{ - return nRow; -} - -inline int Matrix::col(void) const{ - return nCol; -} - -inline void Matrix::set(const int i, const int j, const double v){ - matrix[j + i * nCol] = v; -} - -inline double Matrix::get(const int i, const int j) const{ - return matrix[j + i * nCol]; -} - -inline double& Matrix::operator()(const int i, const int j){ - return matrix[j + i * nCol]; -} - -inline double Matrix::operator()(const int i, const int j) const{ - return matrix[j + i * nCol]; -} - -#endif