From 40fb4a0aead451461fbbcbbbbb4163e45addd975 Mon Sep 17 00:00:00 2001 From: young Date: Wed, 25 Jul 2012 11:35:08 +0000 Subject: [PATCH] Piesewise multiplication of PETSc vectors and redocument. git-svn-id: https://svn.dealii.org/trunk@25727 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/lac/petsc_vector_base.h | 25 ++++++++++++++----- deal.II/source/lac/petsc_vector_base.cc | 10 ++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) 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 + * this 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 + * this 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 -- 2.39.5