From: Wolfgang Bangerth Date: Mon, 20 Apr 1998 14:48:38 +0000 (+0000) Subject: Add two new operators. X-Git-Tag: v8.0.0~23073 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2faeaf3abda7ab0c45a7d471b17d17339c41a58a;p=dealii.git Add two new operators. git-svn-id: https://svn.dealii.org/trunk@181 0785d39b-7218-0410-832d-ea1e28bc413d --- 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