]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add m() and n() methods
authorESeNonFossiIo <esenonfossiio@gmail.com>
Tue, 12 Apr 2016 20:07:38 +0000 (22:07 +0200)
committerESeNonFossiIo <esenonfossiio@gmail.com>
Thu, 14 Apr 2016 08:41:23 +0000 (10:41 +0200)
include/deal.II/lac/petsc_sparse_matrix.h
source/lac/petsc_sparse_matrix.cc

index 655379cf6c9d7ed9bfc6a305eb456c160de6cb36..4c6dbc037cf62459b43b2f285f98b61031044f82 100644 (file)
@@ -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:
 
     /**
index 22c577252fd30846fdcaf31384457b5710e473f2..d0b42978248c0370ba7157b570783cd9d1642ca2 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.