From: wolf Date: Sat, 31 May 2003 20:43:24 +0000 (+0000) Subject: Deprecate VECTOR::scale. Introduce VECTOR::operator/= X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40b77225ec81efee811159190ae52c1521c029cb;p=dealii-svn.git Deprecate VECTOR::scale. Introduce VECTOR::operator/= git-svn-id: https://svn.dealii.org/trunk@7703 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/block_vector.h b/deal.II/lac/include/lac/block_vector.h index 4d162d5839..2b5cdf9fad 100644 --- a/deal.II/lac/include/lac/block_vector.h +++ b/deal.II/lac/include/lac/block_vector.h @@ -1090,24 +1090,31 @@ class BlockVector const Number c, const BlockVector& X); /** - * Scale each element of the vector by the - * given factor. This function was - * previously called @p{equ(Number)}, which - * in my eyes is an extremely unintuitive - * naming and was thus replaced. + * Scale each element of the + * vector by the given factor. + * + * This function is deprecated + * and will be removed in a + * future version. Use + * @p{operator *=} and + * @p{operator /=} instead. */ void scale (const Number factor); /** * Scale each element of the * vector by a constant - * value. This operator is an - * alias to the @ref{scale} - * function, except that it - * returns a reference to itself. + * value. */ BlockVector & operator *= (const Number factor); + /** + * Scale each element of the + * vector by the inverse of the + * given value. + */ + BlockVector & operator /= (const Number factor); + /** * Multiply each element of this * vector by the corresponding @@ -1298,7 +1305,8 @@ Number& BlockVector::operator() (const unsigned int i) template inline -BlockVector & BlockVector::operator *= (const Number factor) +BlockVector & +BlockVector::operator *= (const Number factor) { scale (factor); return *this; @@ -1306,6 +1314,17 @@ BlockVector & BlockVector::operator *= (const Number factor) +template +inline +BlockVector & +BlockVector::operator /= (const Number factor) +{ + scale (1./factor); + return *this; +} + + + template inline Vector & diff --git a/deal.II/lac/include/lac/vector.h b/deal.II/lac/include/lac/vector.h index 0b2f55df25..057e390dd7 100644 --- a/deal.II/lac/include/lac/vector.h +++ b/deal.II/lac/include/lac/vector.h @@ -399,18 +399,29 @@ class Vector /** * Scale each element of the * vector by the given factor. + * + * This function is deprecated + * and will be removed in a + * future version. Use + * @p{operator *=} and + * @p{operator /=} instead. */ void scale (const Number factor); + /** * Scale each element of the * vector by a constant - * value. This operator is an - * alias to the @ref{scale} - * function, except that it - * returns a reference to itself. + * value. */ Vector & operator *= (const Number factor); + + /** + * Scale each element of the + * vector by the inverse of the + * given value. + */ + Vector & operator /= (const Number factor); /** * Scale each element of this @@ -739,6 +750,16 @@ Vector & Vector::operator *= (const Number factor) +template +inline +Vector & Vector::operator /= (const Number factor) +{ + scale (1./factor); + return *this; +} + + + template inline