From 2faeaf3abda7ab0c45a7d471b17d17339c41a58a Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 20 Apr 1998 14:48:38 +0000 Subject: [PATCH] Add two new operators. git-svn-id: https://svn.dealii.org/trunk@181 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/dvector.h | 10 ++++++++++ deal.II/lac/source/dvector.cc | 21 +++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/deal.II/lac/include/lac/dvector.h b/deal.II/lac/include/lac/dvector.h index 2824cee393..2d954ce251 100644 --- a/deal.II/lac/include/lac/dvector.h +++ b/deal.II/lac/include/lac/dvector.h @@ -177,6 +177,16 @@ class dVector : public VectorBase * @name 3: Modification of vectors */ //@{ + /** + * Fast equivalent to #U.add(1, V)#. + */ + dVector & operator += (const dVector &V); + + /** + * Fast equivalent to #U.add(-1, V)#. + */ + dVector & operator -= (const dVector &V); + /** * U(0-DIM)+=s . Addition of S to all components */ diff --git a/deal.II/lac/source/dvector.cc b/deal.II/lac/source/dvector.cc index 555c069a5f..c65fb20e2b 100644 --- a/deal.II/lac/source/dvector.cc +++ b/deal.II/lac/source/dvector.cc @@ -252,6 +252,27 @@ double dVector::linfty_norm () const { +dVector& dVector::operator += (const dVector& v) +{ + if (v.dim != dim) reinit(v,1); + + for (unsigned int i=0; i