From acb0850361f28172441d92e726b27858b5b371bc Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 5 Jul 2016 17:31:37 +0200 Subject: [PATCH] Use consistent order of arguments for PETScMatrix::add --- include/deal.II/lac/petsc_matrix_base.h | 12 +++++++++++- source/lac/petsc_matrix_base.cc | 13 +++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/include/deal.II/lac/petsc_matrix_base.h b/include/deal.II/lac/petsc_matrix_base.h index 51bcad37d0..acca524ec2 100644 --- a/include/deal.II/lac/petsc_matrix_base.h +++ b/include/deal.II/lac/petsc_matrix_base.h @@ -701,12 +701,22 @@ namespace PETScWrappers */ MatrixBase &operator /= (const PetscScalar factor); + + /** + * Add the matrix @p other scaled by the factor @p factor to the current + * matrix. + */ + MatrixBase &add (const PetscScalar factor, + const MatrixBase &other); + + /** * Add the matrix @p other scaled by the factor @p factor to the current * matrix. + * @deprecated Use the function with order of arguments reversed instead. */ MatrixBase &add (const MatrixBase &other, - const PetscScalar factor); + const PetscScalar factor) DEAL_II_DEPRECATED; /** * Matrix-vector multiplication: let dst = M*src with M diff --git a/source/lac/petsc_matrix_base.cc b/source/lac/petsc_matrix_base.cc index cea675dfb9..941370e3bc 100644 --- a/source/lac/petsc_matrix_base.cc +++ b/source/lac/petsc_matrix_base.cc @@ -470,8 +470,8 @@ namespace PETScWrappers MatrixBase & - MatrixBase::add (const MatrixBase &other, - const PetscScalar factor) + MatrixBase::add (const PetscScalar factor, + const MatrixBase &other) { const int ierr = MatAXPY (matrix, factor, other, DIFFERENT_NONZERO_PATTERN); @@ -483,6 +483,15 @@ namespace PETScWrappers } + + MatrixBase & + MatrixBase::add (const MatrixBase &other, + const PetscScalar factor) + { + return add(factor, other); + } + + void MatrixBase::vmult (VectorBase &dst, const VectorBase &src) const -- 2.39.5