]> https://gitweb.dealii.org/ - dealii.git/commitdiff
allow to set empty vectors to zero
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Tue, 25 May 2004 08:22:01 +0000 (08:22 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Tue, 25 May 2004 08:22:01 +0000 (08:22 +0000)
git-svn-id: https://svn.dealii.org/trunk@9310 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/vector.h
deal.II/lac/include/lac/vector.templates.h

index 680127f737e463a883829a9d1cf60bed00abb861..63b2ba2b2ff7ca7fdc1e7c19247037353c9ae117 100644 (file)
@@ -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<Number> & Vector<Number>::operator /= (const Number factor)
 
 
 
-template <typename Number>
-inline
-Vector<Number> & Vector<Number>::operator = (const Number s)
-{
-  Assert (dim!=0, ExcEmptyVector());
-  std::fill (begin(), end(), s);
-  return *this;
-}
-
-
-
 template <typename Number>
 template <typename Number2>
 inline
index 07ea7fd246731ef392ea11aa144d2059ebda9a39..737c7114e8dd8078eb76d204872d0842737ab98f 100644 (file)
@@ -630,6 +630,18 @@ Vector<Number>::operator = (const Vector<Number2>& v)
 
 
 
+template <typename Number>
+Vector<Number> & Vector<Number>::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 <typename Number>

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.