]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add dVector::clear
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 18 Mar 1998 10:01:33 +0000 (10:01 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 18 Mar 1998 10:01:33 +0000 (10:01 +0000)
git-svn-id: https://svn.dealii.org/trunk@74 0785d39b-7218-0410-832d-ea1e28bc413d

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

index ecf150f6b53aab346df89939dd2a38bfa13d0685..58a279fb8bda78c72ebcf34112183087fa914c68 100644 (file)
@@ -73,7 +73,12 @@ class dVector : public VectorBase
                                      *         Destructor. Clears memory
                                      */
     ~dVector();
-    
+
+                                    /**
+                                     * Set all entries to zero. Equivalent to
+                                     * #v = 0#, but more obvious and faster.
+                                     */
+    void clear ();
                                     /**
                                      *  U(0-N) = s       . Fill all components
                                      */
index 7b9c1ec54f345ef1126518b9f5c0aa365d20c77a..42b819f97a7a1af35dcecb9cd825aa00b24679c2 100644 (file)
@@ -54,7 +54,7 @@ clean:
 #rather for libbasic.a(tria.o)
 Makefile.dep: $(cc-files) $(h-files)
        @echo ============================ Remaking Makefile
-       perl ../Make_dep.pl ../lib/liblac $(INCLUDE) $(cc-files) \
+       @perl ../Make_dep.pl ../lib/liblac $(INCLUDE) $(cc-files) \
                > Makefile.dep
 
 
index f47e26257981bcbac39cba3228d924d5df2ccfa2..938391b1957ed67e28f290aea891d4544ef79e7a 100644 (file)
@@ -64,7 +64,8 @@ void dVector::reinit(const dVector& v, int fast)
     maxdim = n;
   }
   dim = n;
-  if (!fast) (*this) = 0.;
+  if (!fast)
+    clear ();
 }
 
 dVector::~dVector()
@@ -74,6 +75,12 @@ dVector::~dVector()
 
 
 
+void dVector::clear () {
+  for (int i=0; i<dim; ++i)
+    val[i] = 0.;
+}
+
+
 double dVector::operator * (const dVector& v) const
 {
   Assert (dim == v.dim, ExcDimensionsDontMatch(dim, v.dim));

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.