From: Guido Kanschat Date: Tue, 25 May 2004 08:22:01 +0000 (+0000) Subject: allow to set empty vectors to zero X-Git-Tag: v8.0.0~15135 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddbe2006088a06cd515345ae0ca2732a422bebc5;p=dealii.git allow to set empty vectors to zero git-svn-id: https://svn.dealii.org/trunk@9310 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/vector.h b/deal.II/lac/include/lac/vector.h index 680127f737..63b2ba2b2f 100644 --- a/deal.II/lac/include/lac/vector.h +++ b/deal.II/lac/include/lac/vector.h @@ -279,7 +279,6 @@ class Vector * given in the discussion about making * the constructor explicit work. * - * * Since the semantics of assigning a * scalar to a vector are not * immediately clear, this operator @@ -919,17 +918,6 @@ Vector & Vector::operator /= (const Number factor) -template -inline -Vector & Vector::operator = (const Number s) -{ - Assert (dim!=0, ExcEmptyVector()); - std::fill (begin(), end(), s); - return *this; -} - - - template template inline diff --git a/deal.II/lac/include/lac/vector.templates.h b/deal.II/lac/include/lac/vector.templates.h index 07ea7fd246..737c7114e8 100644 --- a/deal.II/lac/include/lac/vector.templates.h +++ b/deal.II/lac/include/lac/vector.templates.h @@ -630,6 +630,18 @@ Vector::operator = (const Vector& v) +template +Vector & Vector::operator = (const Number s) +{ + if (s != 0.) + Assert (dim!=0, ExcEmptyVector()); + if (dim!=0) + std::fill (begin(), end(), s); + return *this; +} + + + #ifdef DEAL_II_USE_PETSC template