From: young <young@0785d39b-7218-0410-832d-ea1e28bc413d>
Date: Wed, 25 Jul 2012 11:35:08 +0000 (+0000)
Subject: Piesewise multiplication of PETSc vectors and redocument.
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40fb4a0aead451461fbbcbbbbb4163e45addd975;p=dealii-svn.git

Piesewise multiplication of PETSc vectors and redocument.

git-svn-id: https://svn.dealii.org/trunk@25727 0785d39b-7218-0410-832d-ea1e28bc413d
---

diff --git a/deal.II/include/deal.II/lac/petsc_vector_base.h b/deal.II/include/deal.II/lac/petsc_vector_base.h
index e62b926d17..a5df5e3d60 100644
--- a/deal.II/include/deal.II/lac/petsc_vector_base.h
+++ b/deal.II/include/deal.II/lac/petsc_vector_base.h
@@ -551,19 +551,32 @@ namespace PETScWrappers
 
                                        /**
                                         * A collective piecewise
-                                        * multiply operation. TODO:
-                                        * The model for this function
-                                        * should be similer to add ().
+                                        * multiply operation on
+                                        * <code>this</code> vector
+                                        * with itself. TODO: The model
+                                        * for this function should be
+                                        * similer to add ().
                                         */
       VectorBase & mult ();
 
                                        /**
-                                        * A collective piecewise
-                                        * multiply operation of two
-                                        * vectors.
+                                        * Same as above, but a
+                                        * collective piecewise
+                                        * multiply operation of
+                                        * <code>this</code> vector
+                                        * with \f$v\f$.
                                         */
       VectorBase & mult (const VectorBase &v);
 
+                                       /**
+                                        * Same as above, but a
+                                        * collective piecewise
+                                        * multiply operation of
+                                        * \f$u\f$ with \f$v\f$.
+                                        */
+      VectorBase & mult (const VectorBase &u,
+			 const VectorBase &v);
+
                                        /**
                                         * Return whether the vector contains
                                         * only elements with value zero. This
diff --git a/deal.II/source/lac/petsc_vector_base.cc b/deal.II/source/lac/petsc_vector_base.cc
index ba8fa63d23..20dcc6fd0e 100644
--- a/deal.II/source/lac/petsc_vector_base.cc
+++ b/deal.II/source/lac/petsc_vector_base.cc
@@ -646,6 +646,7 @@ namespace PETScWrappers
     return *this;
   }
 
+
   VectorBase &
   VectorBase::mult (const VectorBase &v)
   {
@@ -656,6 +657,15 @@ namespace PETScWrappers
   }
 
 
+  VectorBase &
+  VectorBase::mult (const VectorBase &u,
+		    const VectorBase &v)
+  {
+    const int ierr = VecPointwiseMult (vector,u,v);
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+
+    return *this;
+  }
 
   bool
   VectorBase::all_zero () const