]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Replace unintuitive naming of function and small cleanups.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 20 Apr 1998 13:37:10 +0000 (13:37 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 20 Apr 1998 13:37:10 +0000 (13:37 +0000)
git-svn-id: https://svn.dealii.org/trunk@179 0785d39b-7218-0410-832d-ea1e28bc413d

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

index c593ca6e75a5c1b9218f7fcd2f2eeb2d316f9b5d..78bed615ba89b6569e3c1ecbe948f6706d22ea3e 100644 (file)
@@ -79,6 +79,7 @@ class dVector : public VectorBase
                                      * #v = 0#, but more obvious and faster.
                                      */
     void clear ();
+    
                                     /**
                                      *  U(0-N) = s       . Fill all components
                                      */
@@ -217,9 +218,13 @@ class dVector : public VectorBase
               const double c, const dVector& X);
     
                                     /**
-                                     *  U=s*U            . Scaling
+                                     * Scale each element of the vector by the
+                                     * given factor. This function was
+                                     * previously called #equ(double)#, which
+                                     * in my eyes is an extremely unintuitive
+                                     * naming and was thus replaced.
                                      */
-    void equ (const double s);
+    void scale (const double factor);
     
                                     /**
                                      *  U=a*V            . Replacing
index b387aa2aa30680b75594e2062aced9574396828d..2c56b9bf8ad30fba18420c16645d769a4ceff216 100644 (file)
@@ -414,7 +414,7 @@ dSMatrix::copy_from (const dSMatrix &matrix) {
   Assert (cols != 0, ExcMatrixNotInitialized());
   Assert (cols == matrix.cols, ExcDifferentSparsityPatterns());
 
-  for (unsigned int i = 0 ; i<cols->vec_len; i++)
+  for (unsigned int i = 0 ; i<cols->vec_len; ++i)
     val[i] = matrix.val[i];
 
   return *this;
@@ -427,7 +427,7 @@ dSMatrix::add_scaled (const double factor, const dSMatrix &matrix) {
   Assert (cols != 0, ExcMatrixNotInitialized());
   Assert (cols == matrix.cols, ExcDifferentSparsityPatterns());
 
-  for (unsigned int i = 0 ; i<cols->vec_len; i++)
+  for (unsigned int i = 0 ; i<cols->vec_len; ++i)
     val[i] += factor*matrix.val[i];
 };
 
@@ -440,14 +440,11 @@ dSMatrix::vmult (dVector& dst, const dVector& src) const
   Assert(m() == dst.n(), ExcDimensionsDontMatch(m(),dst.n()));
   Assert(n() == src.n(), ExcDimensionsDontMatch(n(),src.n()));
 
-  for (unsigned int i=0;i<m();i++)
+  for (unsigned int i=0; i<m(); ++i)
     {
       double s = 0.;
-      for (unsigned int j=cols->rowstart[i]; j < cols->rowstart[i+1] ;j++) 
-       {
-         int p = cols->colnums[j];
-         s += val[j] * src(p);
-       }
+      for (unsigned int j=cols->rowstart[i]; j<cols->rowstart[i+1]; ++j) 
+       s += val[j] * src(cols->colnums[j]);
       dst(i) = s;
     }
 }
index 57de9513011c85df52d3920330b3435cc659bb1e..1e4bf2d721fd1afab86c3e87b1d8cd4be4991dbd 100644 (file)
@@ -340,10 +340,10 @@ void dVector::equ (const double a, const dVector& u,
 
 
 
-void dVector::equ (const double a)
+void dVector::scale (const double factor)
 {
   for (unsigned int i=0; i<dim; i++)
-    val[i] *= a;
+    val[i] *= factor;
 }
 
 

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.