]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Two PETSc functions. (i) A variation of mult () piecwise multiplication of two vector...
authoryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 15 Oct 2010 08:34:56 +0000 (08:34 +0000)
committeryoung <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 15 Oct 2010 08:34:56 +0000 (08:34 +0000)
git-svn-id: https://svn.dealii.org/trunk@22347 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/petsc_matrix_base.h
deal.II/lac/include/lac/petsc_vector_base.h
deal.II/lac/source/petsc_matrix_base.cc
deal.II/lac/source/petsc_vector_base.cc

index 8de24c42cc4526d6d932584eb5a97346b5e61c4c..6d5677afa1b7a3f74786981b2a07f0d13ed6e838 100644 (file)
@@ -837,6 +837,16 @@ namespace PETScWrappers
                                         */
       PetscReal frobenius_norm () const;
 
+#if DEAL_II_PETSC_VERSION_GTE(3,1,0)
+                                       /**
+                                        * Return the trace of the
+                                        * matrix, i.e. the sum of all
+                                        * diagonal entries in the
+                                        * matrix.
+                                        */
+      PetscReal trace () const;
+#endif
+
                                        /**
                                         * Multiply the entire matrix by a
                                         * fixed factor.
index c74409c916362f3c614ba9426d95bac02a0db26a..0b93a1533074bb3e6132172144733420a03b7f5d 100644 (file)
@@ -509,6 +509,13 @@ namespace PETScWrappers
                                         */
       VectorBase & mult ();
 
+                                      /**
+                                        * A collective piecewise
+                                       * multiply operation of two
+                                       * vectors.
+                                        */
+      VectorBase & mult (const VectorBase &v);
+
                                        /**
                                         * Return whether the vector contains
                                         * only elements with value zero. This
index a58b7a5fe9c362bef3e10c9685c5ffcc9c005ec0..62ceb30887f02aa5d461dca72ceaa2e0a65aa13f 100644 (file)
@@ -415,6 +415,22 @@ namespace PETScWrappers
 
 
 
+#if DEAL_II_PETSC_VERSION_GTE(3,1,0)
+  PetscReal
+  MatrixBase::trace () const
+  {
+    PetscReal result;
+
+    const int ierr
+      = MatGetTrace (matrix, &result);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+
+    return result;
+  }
+#endif
+
+
+
   MatrixBase &
   MatrixBase::operator *= (const PetscScalar a)
   {
index c958951b514e6364a0c680ea0161818fc7980f5a..336483ccbd61c7d4b0b07c31efd0b84210ff09f7 100644 (file)
@@ -592,6 +592,15 @@ namespace PETScWrappers
     return *this;
   }
 
+  VectorBase &
+  VectorBase::mult (const VectorBase &v)
+  {
+    const int ierr = VecPointwiseMult (vector,vector,v);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+
+    return *this;
+  }
+
 
 
   bool

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.