From: ESeNonFossiIo Date: Tue, 12 Apr 2016 20:07:38 +0000 (+0200) Subject: add m() and n() methods X-Git-Tag: v8.5.0-rc1~1104^2~6 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1abd0da0c15c0bdedf512c6aa5e33181de7ff5f4;p=dealii.git add m() and n() methods --- diff --git a/include/deal.II/lac/petsc_sparse_matrix.h b/include/deal.II/lac/petsc_sparse_matrix.h index 655379cf6c..4c6dbc037c 100644 --- a/include/deal.II/lac/petsc_sparse_matrix.h +++ b/include/deal.II/lac/petsc_sparse_matrix.h @@ -225,6 +225,16 @@ namespace PETScWrappers PetscScalar matrix_scalar_product (const VectorBase &u, const VectorBase &v) const; + /** + * Return the number of rows of this matrix. + */ + size_t m() const; + + /** + * Return the number of coloumns of this matrix. + */ + size_t n() const; + private: /** diff --git a/source/lac/petsc_sparse_matrix.cc b/source/lac/petsc_sparse_matrix.cc index 22c577252f..d0b4297824 100644 --- a/source/lac/petsc_sparse_matrix.cc +++ b/source/lac/petsc_sparse_matrix.cc @@ -308,7 +308,24 @@ namespace PETScWrappers } } + size_t + SparseMatrix::m () const + { + PetscInt m,n; + PetscErrorCode ierr = MatGetSize(matrix, &m, &n); + + return m; + } + size_t + SparseMatrix::n () const + { + PetscInt m,n; + PetscErrorCode ierr = MatGetSize(matrix, &m, &n); + + return n; + } + // Explicit instantiations // template