From 5d5b7c11c931de18a59328eb7613bbd7849023c5 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 20 Apr 1998 13:37:10 +0000 Subject: [PATCH] Replace unintuitive naming of function and small cleanups. git-svn-id: https://svn.dealii.org/trunk@179 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/dvector.h | 9 +++++++-- deal.II/lac/source/dsmatrix.cc | 13 +++++-------- deal.II/lac/source/dvector.cc | 4 ++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/deal.II/lac/include/lac/dvector.h b/deal.II/lac/include/lac/dvector.h index c593ca6e75..78bed615ba 100644 --- a/deal.II/lac/include/lac/dvector.h +++ b/deal.II/lac/include/lac/dvector.h @@ -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 diff --git a/deal.II/lac/source/dsmatrix.cc b/deal.II/lac/source/dsmatrix.cc index b387aa2aa3..2c56b9bf8a 100644 --- a/deal.II/lac/source/dsmatrix.cc +++ b/deal.II/lac/source/dsmatrix.cc @@ -414,7 +414,7 @@ dSMatrix::copy_from (const dSMatrix &matrix) { Assert (cols != 0, ExcMatrixNotInitialized()); Assert (cols == matrix.cols, ExcDifferentSparsityPatterns()); - for (unsigned int i = 0 ; ivec_len; i++) + for (unsigned int i = 0 ; ivec_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 ; ivec_len; i++) + for (unsigned int i = 0 ; ivec_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;irowstart[i]; j < cols->rowstart[i+1] ;j++) - { - int p = cols->colnums[j]; - s += val[j] * src(p); - } + for (unsigned int j=cols->rowstart[i]; jrowstart[i+1]; ++j) + s += val[j] * src(cols->colnums[j]); dst(i) = s; } } diff --git a/deal.II/lac/source/dvector.cc b/deal.II/lac/source/dvector.cc index 57de951301..1e4bf2d721 100644 --- a/deal.II/lac/source/dvector.cc +++ b/deal.II/lac/source/dvector.cc @@ -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