]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add two new operators.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 20 Apr 1998 14:48:38 +0000 (14:48 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 20 Apr 1998 14:48:38 +0000 (14:48 +0000)
git-svn-id: https://svn.dealii.org/trunk@181 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/dvector.h
deal.II/lac/source/dvector.cc

index 2824cee393d5503a045364583290854e29bb4364..2d954ce251fb59f554751aeb104c9a2fe6414021 100644 (file)
@@ -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
                                      */
index 555c069a5f454023e3cdd8017c02db63510e8c5f..c65fb20e2b67a43768c1f4b68917dd0b987cee15 100644 (file)
@@ -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<dim; ++i)
+    val[i] += v.val[i];
+  return *this;
+}
+
+
+
+dVector& dVector::operator -= (const dVector& v)
+{
+  if (v.dim != dim) reinit(v,1);
+
+  for (unsigned int i=0; i<dim; ++i)
+    val[i] -= v.val[i];
+  return *this;
+}
+
+
 
 void dVector::add (const double v)
 {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.