]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add a function setting a table to a constant value
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 26 Jan 2006 11:15:05 +0000 (11:15 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Thu, 26 Jan 2006 11:15:05 +0000 (11:15 +0000)
git-svn-id: https://svn.dealii.org/trunk@12177 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/table.h

index 8b000a7f795558c7a319ae5a6b3d25f5264d2cc1..f208761e3403e7664ad355d90fe5f207ed005c2f 100644 (file)
@@ -612,6 +612,15 @@ class TableBase : public Subscriptor
                                       */
     template<typename T2>
     void fill (const T2 *entries);
+
+                                    /**
+                                     * Fill all table entries with
+                                     * the same value. The type of
+                                     * value must be convertible to t
+                                     * he value type of the table.
+                                     */
+    template<typename T2>
+    void fill (const T2& value);
     
                                      /**
                                       * Return a read-write reference
@@ -1837,6 +1846,17 @@ TableBase<N,T>::reset_values ()
 }
 
 
+template <int N, typename T>
+template <typename T2>
+void
+TableBase<N,T>::fill (const T2& value)
+{
+  if (n_elements() != 0)
+    std::fill_n(val, n_elements(), value);
+}
+
+
+
 
 template <int N, typename T>
 void

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.