]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Use a std::vector instead of a plain pointer to store data in TableBase.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 29 Oct 2010 23:04:43 +0000 (23:04 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 29 Oct 2010 23:04:43 +0000 (23:04 +0000)
git-svn-id: https://svn.dealii.org/trunk@22552 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/table.h
deal.II/include/deal.II/lac/full_matrix.h
deal.II/source/lac/lapack_full_matrix.cc
tests/base/table.cc

index 3daf142709ea078700c718e1af3d4b0651939a13..3809abbb7911ee3c262c0736d94ecc1d99f528b8 100644 (file)
@@ -17,6 +17,7 @@
 #include <base/exceptions.h>
 #include <base/subscriptor.h>
 #include <base/table_indices.h>
+#include <base/memory_consumption.h>
 
 #include <cstddef>
 #include <algorithm>
@@ -76,10 +77,16 @@ namespace internal
  * template parameters. Specialization for accessors to constant
  * objects.
  */
-    template <int N, typename T> struct Types<N,T,true> 
+    template <int N, typename T> struct Types<N,T,true>
     {
         typedef const T value_type;
         typedef const TableBase<N,T> TableType;
+
+        typedef typename std::vector<T>::const_iterator iterator;
+        typedef typename std::vector<T>::const_iterator const_iterator;
+
+        typedef typename std::vector<T>::const_reference reference;
+        typedef typename std::vector<T>::const_reference const_reference;
     };
 
 /**
@@ -88,12 +95,18 @@ namespace internal
  * template parameters. Specialization for accessors to non-constant
  * objects.
  */
-    template <int N, typename T> struct Types<N,T,false> 
+    template <int N, typename T> struct Types<N,T,false>
     {
         typedef T value_type;
         typedef TableBase<N,T> TableType;
+
+        typedef typename std::vector<T>::iterator iterator;
+        typedef typename std::vector<T>::const_iterator const_iterator;
+
+        typedef typename std::vector<T>::reference reference;
+        typedef typename std::vector<T>::const_reference const_reference;
     };
-  
+
 
 /**
  * @internal
@@ -131,19 +144,17 @@ namespace internal
  * generate objects of this class, as they are only thought as
  * temporaries for access to elements of the table class, not for
  * passing them around as arguments of functions, etc.
- * 
+ *
  * @author Wolfgang Bangerth, 2002
  */
     template <int N, typename T, bool C, unsigned int P>
     class Accessor
     {
       public:
-                                         /**
-                                          * Import two typedefs from the
-                                          * switch class above.
-                                          */
-        typedef typename Types<N,T,C>::value_type * pointer;      
-        typedef typename Types<N,T,C>::TableType    TableType;
+        typedef typename Types<N,T,C>::TableType TableType;
+
+        typedef typename Types<N,T,C>::iterator iterator;
+        typedef typename Types<N,T,C>::const_iterator const_iterator;
 
       private:
                                          /**
@@ -155,7 +166,7 @@ namespace internal
                                           * data we may access.
                                           */
         Accessor (const TableType &table,
-                  const pointer    data);
+                  const iterator    data);
 
                                          /**
                                           * Default constructor. Not
@@ -163,9 +174,9 @@ namespace internal
                                           * private.
                                           */
         Accessor ();
-        
+
       public:
-      
+
                                          /**
                                           * Copy constructor. This constructor
                                           * is public so that one can pass
@@ -207,13 +218,13 @@ namespace internal
                                           * elements constant.
                                           */
         const TableType &table;
-        const pointer   data;
+        const iterator   data;
 
                                          // declare some other classes
                                          // as friends. make sure to
                                          // work around bugs in some
                                          // compilers
-#ifndef DEAL_II_NAMESP_TEMPL_FRIEND_BUG      
+#ifndef DEAL_II_NAMESP_TEMPL_FRIEND_BUG
         template <int N1, typename T1> friend class dealii::Table;
         template <int N1, typename T1, bool C1, unsigned int P1>
         friend class Accessor;
@@ -228,7 +239,7 @@ namespace internal
     };
 
 
-  
+
 /**
  * @internal
  * Accessor class for tables. This is the specialization for the last
@@ -253,12 +264,13 @@ namespace internal
                                           * library algorithms.
                                           */
         typedef typename Types<N,T,C>::value_type value_type;
-        typedef value_type* pointer;
-        typedef const value_type* const_pointer;
-        typedef value_type* iterator;
-        typedef const value_type* const_iterator;
-        typedef value_type& reference;
-        typedef const value_type& const_reference;
+
+        typedef typename Types<N,T,C>::iterator iterator;
+        typedef typename Types<N,T,C>::const_iterator const_iterator;
+
+        typedef typename Types<N,T,C>::reference reference;
+        typedef typename Types<N,T,C>::const_reference const_reference;
+
         typedef size_t size_type;
         typedef ptrdiff_t difference_type;
 
@@ -269,13 +281,13 @@ namespace internal
         typedef typename Types<N,T,C>::TableType    TableType;
 
       private:
-      
+
                                          /**
-                                          * Constructor. Take a pointer
+                                          * Constructor. Take an iterator
                                           * to the table object to know
                                           * about the sizes of the
                                           * various dimensions, and a
-                                          * pointer to the subset of
+                                          * iterator to the subset of
                                           * data we may access (which in
                                           * this particular case is only
                                           * one row).
@@ -295,7 +307,7 @@ namespace internal
                                           * data consistency.
                                           */
         Accessor (const TableType &table,
-                  const pointer    data);
+                  const iterator    data);
 
                                          /**
                                           * Default constructor. Not needed,
@@ -303,7 +315,7 @@ namespace internal
                                           */
         Accessor ();
 
-      public:  
+      public:
                                          /**
                                           * Copy constructor. This constructor
                                           * is public so that one can pass
@@ -318,13 +330,13 @@ namespace internal
                                           */
         Accessor (const Accessor &a);
 
-      
+
                                          /**
                                           * Index operator. Performs a
                                           * range check.
                                           */
         reference operator [] (const unsigned int) const;
-      
+
                                          /**
                                           * Return the length of one row,
                                           * i.e. the number of elements
@@ -332,21 +344,21 @@ namespace internal
                                           * index of the table object.
                                           */
         unsigned int size () const;
-        
+
                                          /**
                                           * Return an iterator to the
                                           * first element of this
                                           * row.
                                           */
         iterator begin () const;
-      
+
                                          /**
                                           * Return an interator to the
                                           * element past the end of
                                           * this row.
                                           */
         iterator end () const;
-      
+
       private:
                                          /**
                                           * Store the data given to the
@@ -357,7 +369,7 @@ namespace internal
                                           * elements constant.
                                           */
         const TableType &table;
-        const pointer   data;
+        const iterator   data;
 
                                          // declare some other classes
                                          // as friends. make sure to
@@ -377,7 +389,7 @@ namespace internal
 #endif
     };
   }
-  
+
 } // namespace internal
 
 
@@ -466,7 +478,7 @@ class TableBase : public Subscriptor
                                       * dimensions to zero.
                                       */
     TableBase ();
-    
+
                                      /**
                                       * Constructor. Initialize the
                                       * array with the given
@@ -488,12 +500,12 @@ class TableBase : public Subscriptor
                                       */
     template <typename T2>
     TableBase (const TableBase<N,T2> &src);
-    
+
                                      /**
                                       * Destructor. Free allocated memory.
                                       */
     ~TableBase ();
-    
+
                                      /**
                                       * Assignment operator.
                                       * Copy all elements of <tt>src</tt>
@@ -507,7 +519,7 @@ class TableBase : public Subscriptor
                                       * operator which is not what we want.
                                       */
     TableBase<N,T>& operator = (const TableBase<N,T>& src);
-    
+
                                      /**
                                       * Copy operator.
                                       * Copy all elements of <tt>src</tt>
@@ -520,7 +532,7 @@ class TableBase : public Subscriptor
                                       */
     template<typename T2>
     TableBase<N,T>& operator = (const TableBase<N,T2> &src);
-    
+
                                      /**
                                       * Set all entries to their
                                       * default value (i.e. copy them
@@ -529,7 +541,7 @@ class TableBase : public Subscriptor
                                       * size of the table, though.
                                       */
     void reset_values ();
-    
+
                                      /**
                                       * Set the dimensions of this object to
                                       * the sizes given in the argument, and
@@ -547,13 +559,13 @@ class TableBase : public Subscriptor
                                      * <tt>i</tt>.
                                      */
     unsigned int size (const unsigned int i) const;
-    
+
                                      /**
                                       * Return the sizes of this
                                       * object in each direction.
                                       */
     const TableIndices<N> & size () const;
-    
+
                                      /**
                                       * Return the number of elements
                                       * stored in this object, which
@@ -570,7 +582,7 @@ class TableBase : public Subscriptor
                                       * <tt>n_elements()==0</tt>.
                                       */
     bool empty () const;
-    
+
                                      /**
                                       * Fill array with an array of
                                       * elements. The input array must
@@ -603,13 +615,14 @@ class TableBase : public Subscriptor
                                      * the same value.
                                      */
     void fill (const T& value);
-    
+
                                      /**
                                       * Return a read-write reference
                                       * to the indicated element.
                                       */
-    T & operator() (const TableIndices<N> &indices);
-  
+    typename std::vector<T>::reference
+    operator () (const TableIndices<N> &indices);
+
                                      /**
                                       * Return the value of the
                                       * indicated element as a
@@ -623,7 +636,8 @@ class TableBase : public Subscriptor
                                       * don't know here whether
                                       * copying is expensive or not.
                                       */
-    const T & operator() (const TableIndices<N> &indices) const;
+    typename std::vector<T>::const_reference
+    operator () (const TableIndices<N> &indices) const;
 
                                      /**
                                       * Determine an estimate for the
@@ -641,7 +655,7 @@ class TableBase : public Subscriptor
                                       * does no index checking.
                                       */
     unsigned int position (const TableIndices<N> &indices) const;
-    
+
                                      /**
                                       * Return a read-write reference
                                       * to the indicated element.
@@ -651,8 +665,8 @@ class TableBase : public Subscriptor
                                       * used internally and in
                                       * functions already checked.
                                       */
-    T & el (const TableIndices<N> &indices);
-  
+    typename std::vector<T>::reference el (const TableIndices<N> &indices);
+
                                      /**
                                       * Return the value of the
                                       * indicated element as a
@@ -671,8 +685,8 @@ class TableBase : public Subscriptor
                                       * don't know here whether
                                       * copying is expensive or not.
                                       */
-    const T & el (const TableIndices<N> &indices) const;
-  
+    typename std::vector<T>::const_reference el (const TableIndices<N> &indices) const;
+
                                      /**
                                      * @deprecated This function
                                      * accesses data directly and
@@ -685,23 +699,13 @@ class TableBase : public Subscriptor
                                       * cast from const), otherwise,
                                       * keep away!
                                       */
-    const T* data () const;
-    
+    typename std::vector<T>::const_pointer data () const;
+
   protected:
                                      /**
                                       * Component-array.
                                       */
-    T* val;
-    
-                                     /**
-                                      * Size of array. This may be
-                                      * larger than the number of
-                                      * actually used elements, since
-                                      * we don't shrink the array upon
-                                      * calls to <tt>reinit</tt> unless the
-                                      * new size is zero.
-                                      */
-    unsigned int val_size;    
+    std::vector<T> values;
 
                                      /**
                                       * Size in each direction of the
@@ -727,7 +731,7 @@ class TableBase : public Subscriptor
  * in partial specializations of this class, with fixed numbers of
  * dimensions. See there, and in the documentation of the base class
  * for more information.
- * 
+ *
  * @ingroup data
  * @author Wolfgang Bangerth, 2002
  */
@@ -746,7 +750,7 @@ class Table : public TableBase<N,T>
  *
  * For the rationale of this class, and a description of the
  * interface, see the base class.
- * 
+ *
  * @ingroup data
  * @author Wolfgang Bangerth, 2002
  */
@@ -759,7 +763,7 @@ class Table<1,T> : public TableBase<1,T>
                                       * dimensions to zero.
                                       */
     Table ();
-    
+
                                      /**
                                       * Constructor. Pass down the
                                       * given dimension to the base
@@ -774,7 +778,7 @@ class Table<1,T> : public TableBase<1,T>
                                       * data element. Returns a
                                       * read-only reference.
                                       */
-    const T &
+    typename std::vector<T>::const_reference
     operator [] (const unsigned int i) const;
 
                                      /**
@@ -784,7 +788,7 @@ class Table<1,T> : public TableBase<1,T>
                                       * data element. Returns a
                                       * read-write reference.
                                       */
-    T &
+    typename std::vector<T>::reference
     operator [] (const unsigned int i);
 
                                      /**
@@ -794,7 +798,7 @@ class Table<1,T> : public TableBase<1,T>
                                       * data element. Returns a
                                       * read-only reference.
                                       */
-    const T &
+    typename std::vector<T>::const_reference
     operator () (const unsigned int i) const;
 
                                      /**
@@ -804,26 +808,26 @@ class Table<1,T> : public TableBase<1,T>
                                       * data element. Returns a
                                       * read-write reference.
                                       */
-    T &
+    typename std::vector<T>::reference
     operator () (const unsigned int i);
 
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    T &
-    operator() (const TableIndices<1> &indices);
-  
+    typename std::vector<T>::reference
+    operator () (const TableIndices<1> &indices);
+
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    const T &
-    operator() (const TableIndices<1> &indices) const;
+    typename std::vector<T>::const_reference
+    operator () (const TableIndices<1> &indices) const;
 };
 
 
@@ -837,7 +841,7 @@ class Table<1,T> : public TableBase<1,T>
  * of the full matrix classes in this library, and to keep a minimal
  * compatibility with a predecessor class (<tt>vector2d</tt>), some
  * additional functions are provided.
- * 
+ *
  * @ingroup data
  * @author Wolfgang Bangerth, 2002
  */
@@ -908,9 +912,9 @@ class Table<2,T> : public TableBase<2,T>
                                       * This version of the function
                                       * only allows read access.
                                       */
-    const T & operator () (const unsigned int i,
+    typename std::vector<T>::const_reference operator () (const unsigned int i,
                            const unsigned int j) const;
-    
+
 
                                      /**
                                       * Direct access to one element
@@ -921,28 +925,28 @@ class Table<2,T> : public TableBase<2,T>
                                       * This version of the function
                                       * allows read-write access.
                                       */
-    T & operator () (const unsigned int i,
+    typename std::vector<T>::reference operator () (const unsigned int i,
                      const unsigned int j);
 
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    T &
-    operator() (const TableIndices<2> &indices);
-  
+    typename std::vector<T>::reference
+    operator () (const TableIndices<2> &indices);
+
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    const T &
-    operator() (const TableIndices<2> &indices) const;
+    typename std::vector<T>::const_reference
+    operator () (const TableIndices<2> &indices) const;
+
 
-    
                                      /**
                                       * Number of rows. This function
                                       * really makes only sense since
@@ -950,7 +954,7 @@ class Table<2,T> : public TableBase<2,T>
                                       * object here.
                                       */
     unsigned int n_rows () const;
-    
+
                                      /**
                                       * Number of columns. This function
                                       * really makes only sense since
@@ -975,9 +979,9 @@ class Table<2,T> : public TableBase<2,T>
                                       * table classes for 2d arrays,
                                       * then called <tt>vector2d</tt>.
                                       */
-    T & el (const unsigned int i,
+    typename std::vector<T>::reference el (const unsigned int i,
             const unsigned int j);
-  
+
                                      /**
                                       * Return the value of the
                                       * element <tt>(i,j)</tt> as a
@@ -1002,7 +1006,7 @@ class Table<2,T> : public TableBase<2,T>
                                       * table classes for 2d arrays,
                                       * then called <tt>vector2d</tt>.
                                       */
-    const T & el (const unsigned int i,
+    typename std::vector<T>::const_reference el (const unsigned int i,
                   const unsigned int j) const;
 };
 
@@ -1014,7 +1018,7 @@ class Table<2,T> : public TableBase<2,T>
  *
  * For the rationale of this class, and a description of the
  * interface, see the base class.
- * 
+ *
  * @ingroup data
  * @author Wolfgang Bangerth, 2002
  */
@@ -1074,10 +1078,10 @@ class Table<3,T> : public TableBase<3,T>
                                       * This version of the function
                                       * only allows read access.
                                       */
-    const T & operator () (const unsigned int i,
+    typename std::vector<T>::const_reference operator () (const unsigned int i,
                            const unsigned int j,
                            const unsigned int k) const;
-    
+
 
                                      /**
                                       * Direct access to one element
@@ -1088,25 +1092,25 @@ class Table<3,T> : public TableBase<3,T>
                                       * This version of the function
                                       * allows read-write access.
                                       */
-    T & operator () (const unsigned int i,
+    typename std::vector<T>::reference operator () (const unsigned int i,
                      const unsigned int j,
                      const unsigned int k);
 
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    T & operator() (const TableIndices<3> &indices);
-  
+    typename std::vector<T>::reference operator () (const TableIndices<3> &indices);
+
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    const T & operator() (const TableIndices<3> &indices) const;
+    typename std::vector<T>::const_reference operator () (const TableIndices<3> &indices) const;
 };
 
 
@@ -1117,7 +1121,7 @@ class Table<3,T> : public TableBase<3,T>
  *
  * For the rationale of this class, and a description of the
  * interface, see the base class.
- * 
+ *
  * @ingroup data
  * @author Wolfgang Bangerth, Ralf Hartmann 2002
  */
@@ -1140,7 +1144,7 @@ class Table<4,T> : public TableBase<4,T>
            const unsigned int size2,
            const unsigned int size3,
           const unsigned int size4);
-    
+
                                      /**
                                       * Access operator. Generate an
                                       * object that accesses the
@@ -1178,11 +1182,11 @@ class Table<4,T> : public TableBase<4,T>
                                       * This version of the function
                                       * only allows read access.
                                       */
-    const T & operator () (const unsigned int i,
+    typename std::vector<T>::const_reference operator () (const unsigned int i,
                            const unsigned int j,
                            const unsigned int k,
                           const unsigned int l) const;
-    
+
 
                                      /**
                                       * Direct access to one element
@@ -1193,28 +1197,28 @@ class Table<4,T> : public TableBase<4,T>
                                       * This version of the function
                                       * allows read-write access.
                                       */
-    T & operator () (const unsigned int i,
+    typename std::vector<T>::reference operator () (const unsigned int i,
                      const unsigned int j,
                      const unsigned int k,
                     const unsigned int l);
 
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    T &
-    operator() (const TableIndices<4> &indices);
-  
+    typename std::vector<T>::reference
+    operator () (const TableIndices<4> &indices);
+
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    const T &
-    operator() (const TableIndices<4> &indices) const;
+    typename std::vector<T>::const_reference
+    operator () (const TableIndices<4> &indices) const;
 };
 
 
@@ -1225,7 +1229,7 @@ class Table<4,T> : public TableBase<4,T>
  *
  * For the rationale of this class, and a description of the
  * interface, see the base class.
- * 
+ *
  * @ingroup data
  * @author Wolfgang Bangerth, Ralf Hartmann 2002
  */
@@ -1287,12 +1291,12 @@ class Table<5,T> : public TableBase<5,T>
                                       * This version of the function
                                       * only allows read access.
                                       */
-    const T & operator () (const unsigned int i,
+    typename std::vector<T>::const_reference operator () (const unsigned int i,
                            const unsigned int j,
                            const unsigned int k,
                           const unsigned int l,
                           const unsigned int m) const;
-    
+
                                      /**
                                       * Direct access to one element
                                       * of the table by specifying all
@@ -1302,7 +1306,7 @@ class Table<5,T> : public TableBase<5,T>
                                       * This version of the function
                                       * allows read-write access.
                                       */
-    T & operator () (const unsigned int i,
+    typename std::vector<T>::reference operator () (const unsigned int i,
                      const unsigned int j,
                      const unsigned int k,
                     const unsigned int l,
@@ -1310,21 +1314,21 @@ class Table<5,T> : public TableBase<5,T>
 
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    T &
-    operator() (const TableIndices<5> &indices);
-  
+    typename std::vector<T>::reference
+    operator () (const TableIndices<5> &indices);
+
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    const T &
-    operator() (const TableIndices<5> &indices) const;
+    typename std::vector<T>::const_reference
+    operator () (const TableIndices<5> &indices) const;
 };
 
 
@@ -1335,7 +1339,7 @@ class Table<5,T> : public TableBase<5,T>
  *
  * For the rationale of this class, and a description of the
  * interface, see the base class.
- * 
+ *
  * @ingroup data
  * @author Wolfgang Bangerth, Ralf Hartmann 2002
  */
@@ -1398,12 +1402,12 @@ class Table<6,T> : public TableBase<6,T>
                                       * This version of the function
                                       * only allows read access.
                                       */
-    const T & operator () (const unsigned int i,
+    typename std::vector<T>::const_reference operator () (const unsigned int i,
                            const unsigned int j,
                            const unsigned int k,
                           const unsigned int l,
                           const unsigned int m,
-                          const unsigned int n) const;    
+                          const unsigned int n) const;
 
                                      /**
                                       * Direct access to one element
@@ -1414,7 +1418,7 @@ class Table<6,T> : public TableBase<6,T>
                                       * This version of the function
                                       * allows read-write access.
                                       */
-    T & operator () (const unsigned int i,
+    typename std::vector<T>::reference operator () (const unsigned int i,
                      const unsigned int j,
                      const unsigned int k,
                     const unsigned int l,
@@ -1423,21 +1427,21 @@ class Table<6,T> : public TableBase<6,T>
 
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    T &
-    operator() (const TableIndices<6> &indices);
-  
+    typename std::vector<T>::reference
+    operator () (const TableIndices<6> &indices);
+
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    const T &
-    operator() (const TableIndices<6> &indices) const;
+    typename std::vector<T>::const_reference
+    operator () (const TableIndices<6> &indices) const;
 };
 
 
@@ -1447,7 +1451,7 @@ class Table<6,T> : public TableBase<6,T>
  *
  * For the rationale of this class, and a description of the
  * interface, see the base class.
- * 
+ *
  * @ingroup data
  * @author Wolfgang Bangerth, 2002, Ralf Hartmann 2004
  */
@@ -1511,13 +1515,13 @@ class Table<7,T> : public TableBase<7,T>
                                       * This version of the function
                                       * only allows read access.
                                       */
-    const T & operator () (const unsigned int i,
+    typename std::vector<T>::const_reference operator () (const unsigned int i,
                            const unsigned int j,
                            const unsigned int k,
                           const unsigned int l,
                           const unsigned int m,
                           const unsigned int n,
-                          const unsigned int o) const;    
+                          const unsigned int o) const;
 
                                      /**
                                       * Direct access to one element
@@ -1528,7 +1532,7 @@ class Table<7,T> : public TableBase<7,T>
                                       * This version of the function
                                       * allows read-write access.
                                       */
-    T & operator () (const unsigned int i,
+    typename std::vector<T>::reference operator () (const unsigned int i,
                      const unsigned int j,
                      const unsigned int k,
                     const unsigned int l,
@@ -1538,21 +1542,21 @@ class Table<7,T> : public TableBase<7,T>
 
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    T &
-    operator() (const TableIndices<7> &indices);
-  
+    typename std::vector<T>::reference
+    operator () (const TableIndices<7> &indices);
+
                                      /**
                                       * Make the corresponding
-                                      * operator() from the TableBase
+                                      * operator () from the TableBase
                                       * base class available also in
                                       * this class.
                                       */
-    const T &
-    operator() (const TableIndices<7> &indices) const;
+    typename std::vector<T>::const_reference
+    operator () (const TableIndices<7> &indices) const;
 };
 
 
@@ -1611,7 +1615,7 @@ class TransposeTable : public TableBase<2,T>
                                       * This version of the function
                                       * only allows read access.
                                       */
-    const T & operator () (const unsigned int i,
+    typename std::vector<T>::const_reference operator () (const unsigned int i,
                            const unsigned int j) const;
 
                                      /**
@@ -1623,9 +1627,9 @@ class TransposeTable : public TableBase<2,T>
                                       * This version of the function
                                       * allows read-write access.
                                       */
-    T & operator () (const unsigned int i,
+    typename std::vector<T>::reference operator () (const unsigned int i,
                      const unsigned int j);
-    
+
                                      /**
                                       * Number of rows. This function
                                       * really makes only sense since
@@ -1633,7 +1637,7 @@ class TransposeTable : public TableBase<2,T>
                                       * object here.
                                       */
     unsigned int n_rows () const;
-    
+
                                      /**
                                       * Number of columns. This function
                                       * really makes only sense since
@@ -1658,9 +1662,9 @@ class TransposeTable : public TableBase<2,T>
                                       * table classes for 2d arrays,
                                       * then called <tt>vector2d</tt>.
                                       */
-    T & el (const unsigned int i,
+    typename std::vector<T>::reference el (const unsigned int i,
             const unsigned int j);
-  
+
                                      /**
                                       * Return the value of the
                                       * element <tt>(i,j)</tt> as a
@@ -1685,7 +1689,7 @@ class TransposeTable : public TableBase<2,T>
                                       * table classes for 2d arrays,
                                       * then called <tt>vector2d</tt>.
                                       */
-    const T & el (const unsigned int i,
+    typename std::vector<T>::const_reference el (const unsigned int i,
                   const unsigned int j) const;
 };
 
@@ -1698,18 +1702,12 @@ class TransposeTable : public TableBase<2,T>
 
 template <int N, typename T>
 TableBase<N,T>::TableBase ()
-                :
-                val (0),
-                val_size (0)
 {}
 
 
 
 template <int N, typename T>
 TableBase<N,T>::TableBase (const TableIndices<N> &sizes)
-                :
-                val (0),
-                val_size (0)
 {
   reinit (sizes);
 }
@@ -1719,13 +1717,11 @@ TableBase<N,T>::TableBase (const TableIndices<N> &sizes)
 template <int N, typename T>
 TableBase<N,T>::TableBase (const TableBase<N,T> &src)
                 :
-                Subscriptor (),
-                val (0),
-                val_size (0)
+                Subscriptor ()
 {
   reinit (src.table_size);
   if (src.n_elements() != 0)
-    fill (src.data());
+    std::copy (src.values.begin(), src.values.end(), values.begin());
 }
 
 
@@ -1733,25 +1729,22 @@ TableBase<N,T>::TableBase (const TableBase<N,T> &src)
 template <int N, typename T>
 template <typename T2>
 TableBase<N,T>::TableBase (const TableBase<N,T2> &src)
-                :
-                val (0),
-                val_size (0)
 {
   reinit (src.table_size);
   if (src.n_elements() != 0)
-    fill (src.data());
+    std::copy (src.values.begin(), src.values.end(), values.begin());
 }
 
 
 
 namespace internal
 {
-  namespace TableBaseAccessors 
+  namespace TableBaseAccessors
   {
     template <int N, typename T, bool C, unsigned int P>
     inline
     Accessor<N,T,C,P>::Accessor (const TableType &table,
-                                 const pointer    data)
+                                 const iterator    data)
                     :
                     table (table),
                     data (data)
@@ -1766,9 +1759,9 @@ namespace internal
                     table (a.table),
                     data (a.data)
     {}
-  
 
-  
+
+
     template <int N, typename T, bool C, unsigned int P>
     inline
     Accessor<N,T,C,P>::Accessor ()
@@ -1781,9 +1774,9 @@ namespace internal
                                        // not need to be copied around
       Assert (false, ExcInternalError());
     }
-  
 
-  
+
+
     template <int N, typename T, bool C, unsigned int P>
     inline
     Accessor<N,T,C,P-1>
@@ -1797,7 +1790,7 @@ namespace internal
                                        // case i==0
       if (i==0)
         return Accessor<N,T,C,P-1> (table, data);
-      else 
+      else
         {
                                            // note: P>1, otherwise the
                                            // specialization would have
@@ -1805,7 +1798,7 @@ namespace internal
           unsigned int subobject_size = table.size()[N-1];
           for (int p=P-1; p>1; --p)
             subobject_size *= table.size()[N-p];
-          const pointer new_data = data + i*subobject_size;
+          const iterator new_data = data + i*subobject_size;
           return Accessor<N,T,C,P-1> (table, new_data);
         }
     }
@@ -1815,7 +1808,7 @@ namespace internal
     template <int N, typename T, bool C>
     inline
     Accessor<N,T,C,1>::Accessor (const TableType &table,
-                                 const pointer    data)
+                                 const iterator    data)
                     :
                     table (table),
                     data (data)
@@ -1835,7 +1828,7 @@ namespace internal
                                        // not need to be copied around
       Assert (false, ExcInternalError());
     }
-  
+
 
 
     template <int N, typename T, bool C>
@@ -1847,7 +1840,7 @@ namespace internal
     {}
 
 
-  
+
     template <int N, typename T, bool C>
     inline
     typename Accessor<N,T,C,1>::reference
@@ -1859,7 +1852,7 @@ namespace internal
     }
 
 
-  
+
     template <int N, typename T, bool C>
     inline
     unsigned int
@@ -1895,10 +1888,7 @@ namespace internal
 template <int N, typename T>
 inline
 TableBase<N,T>::~TableBase ()
-{
-  if (val != 0)
-    delete[] val;
-}
+{}
 
 
 
@@ -1909,8 +1899,8 @@ TableBase<N,T>::operator = (const TableBase<N,T>& m)
 {
   reinit (m.size());
   if (!empty())
-    std::copy (&m.val[0], &m.val[n_elements()], &val[0]);
-  
+    std::copy (&m.values[0], &m.values[n_elements()], &values[0]);
+
   return *this;
 }
 
@@ -1924,8 +1914,8 @@ TableBase<N,T>::operator = (const TableBase<N,T2>& m)
 {
   reinit (m.size());
   if (!empty())
-    std::copy (&m.val[0], &m.val[n_elements()], &val[0]);
-  
+    std::copy (&m.values[0], &m.values[n_elements()], &values[0]);
+
   return *this;
 }
 
@@ -1937,7 +1927,7 @@ void
 TableBase<N,T>::reset_values ()
 {
   if (n_elements() != 0)
-    std::fill_n (val, n_elements(), T());
+    std::fill (values.begin(), values.end(), T());
 }
 
 
@@ -1948,7 +1938,7 @@ void
 TableBase<N,T>::fill (const T& value)
 {
   if (n_elements() != 0)
-    std::fill_n (val, n_elements(), value);
+    std::fill (values.begin(), values.end(), T());
 }
 
 
@@ -1961,19 +1951,14 @@ TableBase<N,T>::reinit (const TableIndices<N> &new_sizes,
                        const bool             fast)
 {
   table_size = new_sizes;
-  
+
   const unsigned int new_size = n_elements();
-  
+
                                    // if zero size was given: free all
                                    // memory
   if (new_size == 0)
     {
-      if (val != 0)
-        delete[] val;
-
-      val      = 0;
-      val_size = 0;
-
+      values.resize (0);
                                        // set all sizes to zero, even
                                        // if one was previously
                                        // nonzero. This simplifies
@@ -1982,18 +1967,11 @@ TableBase<N,T>::reinit (const TableIndices<N> &new_sizes,
 
       return;
     }
-  
+
                                    // if new size is nonzero:
                                    // if necessary allocate
                                    // additional memory
-  if (val_size<new_size)
-    {
-      if (val != 0)
-        delete[] val;
-
-      val_size = new_size;
-      val      = new T[val_size];
-    }
+  values.resize (new_size);
 
                                    // reinitialize contents of old or
                                    // new memory. note that we
@@ -2068,7 +2046,7 @@ TableBase<N,T>::fill (const T2* entries)
   Assert (n_elements() != 0,
           ExcMessage("Trying to fill an empty matrix."));
 
-  std::copy (entries, entries+n_elements(), val);
+  std::copy (entries, entries+n_elements(), values.begin());
 }
 
 
@@ -2078,7 +2056,7 @@ inline
 unsigned int
 TableBase<N,T>::memory_consumption () const
 {
-  return sizeof(*this) + val_size*sizeof(T);
+  return sizeof(*this) + MemoryConsumption::memory_consumption(values);
 }
 
 
@@ -2116,8 +2094,8 @@ TableBase<N,T>::position (const TableIndices<N> &indices) const
 
 template <int N, typename T>
 inline
-const T &
-TableBase<N,T>::operator() (const TableIndices<N> &indices) const
+typename std::vector<T>::const_reference
+TableBase<N,T>::operator () (const TableIndices<N> &indices) const
 {
   for (unsigned int n=0; n<N; ++n)
     Assert (indices[n] < table_size[n],
@@ -2129,8 +2107,8 @@ TableBase<N,T>::operator() (const TableIndices<N> &indices) const
 
 template <int N, typename T>
 inline
-T &
-TableBase<N,T>::operator() (const TableIndices<N> &indices)
+typename std::vector<T>::reference
+TableBase<N,T>::operator () (const TableIndices<N> &indices)
 {
   for (unsigned int n=0; n<N; ++n)
     Assert (indices[n] < table_size[n],
@@ -2142,30 +2120,30 @@ TableBase<N,T>::operator() (const TableIndices<N> &indices)
 
 template <int N, typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 TableBase<N,T>::el (const TableIndices<N> &indices) const
-{  
-  return val[position(indices)];
+{
+  return values[position(indices)];
 }
 
 
 
 template <int N, typename T>
 inline
-T &
+typename std::vector<T>::reference
 TableBase<N,T>::el (const TableIndices<N> &indices)
 {
-  return val[position(indices)];
+  return values[position(indices)];
 }
 
 
 
 template <int N, typename T>
 inline
-const T *
+typename std::vector<T>::const_pointer
 TableBase<N,T>::data () const
 {
-  return val;
+  return &values[0];
 }
 
 
@@ -2189,68 +2167,68 @@ Table<1,T>::Table (const unsigned int size)
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<1,T>::operator [] (const unsigned int i) const
 {
   Assert (i < this->table_size[0],
           ExcIndexRange (i, 0, this->table_size[0]));
-  return this->val[i];
+  return this->values[i];
 }
 
 
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<1,T>::operator [] (const unsigned int i)
 {
   Assert (i < this->table_size[0],
           ExcIndexRange (i, 0, this->table_size[0]));
-  return this->val[i];
+  return this->values[i];
 }
 
 
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<1,T>::operator () (const unsigned int i) const
 {
   Assert (i < this->table_size[0],
           ExcIndexRange (i, 0, this->table_size[0]));
-  return this->val[i];
+  return this->values[i];
 }
 
 
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<1,T>::operator () (const unsigned int i)
 {
   Assert (i < this->table_size[0],
           ExcIndexRange (i, 0, this->table_size[0]));
-  return this->val[i];
+  return this->values[i];
 }
 
 
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<1,T>::operator () (const TableIndices<1> &indices) const
 {
-  return TableBase<1,T>::operator() (indices);
+  return TableBase<1,T>::operator () (indices);
 }
 
 
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<1,T>::operator () (const TableIndices<1> &indices)
 {
-  return TableBase<1,T>::operator() (indices);
+  return TableBase<1,T>::operator () (indices);
 }
 
 
@@ -2293,7 +2271,7 @@ Table<2,T>::operator [] (const unsigned int i) const
   Assert (i < this->table_size[0],
           ExcIndexRange (i, 0, this->table_size[0]));
   return internal::TableBaseAccessors::Accessor<2,T,true,1>(*this,
-                                                            this->val+i*n_cols());
+                                                            this->values.begin()+i*n_cols());
 }
 
 
@@ -2306,14 +2284,14 @@ Table<2,T>::operator [] (const unsigned int i)
   Assert (i < this->table_size[0],
           ExcIndexRange (i, 0, this->table_size[0]));
   return internal::TableBaseAccessors::Accessor<2,T,false,1>(*this,
-                                                             this->val+i*n_cols());
+                                                             this->values.begin()+i*n_cols());
 }
 
 
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<2,T>::operator () (const unsigned int i,
                          const unsigned int j) const
 {
@@ -2321,14 +2299,14 @@ Table<2,T>::operator () (const unsigned int i,
           ExcIndexRange (i, 0, this->table_size[0]));
   Assert (j < this->table_size[1],
           ExcIndexRange (j, 0, this->table_size[1]));
-  return this->val[i*this->table_size[1]+j];
+  return this->values[i*this->table_size[1]+j];
 }
 
 
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<2,T>::operator () (const unsigned int i,
                          const unsigned int j)
 {
@@ -2336,49 +2314,49 @@ Table<2,T>::operator () (const unsigned int i,
           ExcIndexRange (i, 0, this->table_size[0]));
   Assert (j < this->table_size[1],
           ExcIndexRange (j, 0, this->table_size[1]));
-  return this->val[i*this->table_size[1]+j];
+  return this->values[i*this->table_size[1]+j];
 }
 
 
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<2,T>::operator () (const TableIndices<2> &indices) const
 {
-  return TableBase<2,T>::operator() (indices);
+  return TableBase<2,T>::operator () (indices);
 }
 
 
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<2,T>::operator () (const TableIndices<2> &indices)
 {
-  return TableBase<2,T>::operator() (indices);
+  return TableBase<2,T>::operator () (indices);
 }
 
 
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<2,T>::el (const unsigned int i,
                 const unsigned int j) const
 {
-  return this->val[i*this->table_size[1]+j];
+  return this->values[i*this->table_size[1]+j];
 }
 
 
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<2,T>::el (const unsigned int i,
                 const unsigned int j)
 {
-  return this->val[i*this->table_size[1]+j];
+  return this->values[i*this->table_size[1]+j];
 }
 
 
@@ -2436,7 +2414,7 @@ TransposeTable<T>::reinit (const unsigned int size1,
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 TransposeTable<T>::operator () (const unsigned int i,
                                const unsigned int j) const
 {
@@ -2444,14 +2422,14 @@ TransposeTable<T>::operator () (const unsigned int i,
           ExcIndexRange (i, 0, this->table_size[1]));
   Assert (j < this->table_size[0],
           ExcIndexRange (j, 0, this->table_size[0]));
-  return this->val[j*this->table_size[1]+i];
+  return this->values[j*this->table_size[1]+i];
 }
 
 
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 TransposeTable<T>::operator () (const unsigned int i,
                                const unsigned int j)
 {
@@ -2459,29 +2437,29 @@ TransposeTable<T>::operator () (const unsigned int i,
           ExcIndexRange (i, 0, this->table_size[1]));
   Assert (j < this->table_size[0],
           ExcIndexRange (j, 0, this->table_size[0]));
-  return this->val[j*this->table_size[1]+i];
+  return this->values[j*this->table_size[1]+i];
 }
 
 
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 TransposeTable<T>::el (const unsigned int i,
                       const unsigned int j) const
 {
-  return this->val[j*this->table_size[1]+i];
+  return this->values[j*this->table_size[1]+i];
 }
 
 
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 TransposeTable<T>::el (const unsigned int i,
                       const unsigned int j)
 {
-  return this->val[j*this->table_size[1]+i];
+  return this->values[j*this->table_size[1]+i];
 }
 
 
@@ -2538,7 +2516,7 @@ Table<3,T>::operator [] (const unsigned int i) const
                                       this->table_size[2];
   return (internal::TableBaseAccessors::Accessor<3,T,true,2>
           (*this,
-           this->val+i*subobject_size));
+           this->values.begin() + i*subobject_size));
 }
 
 
@@ -2554,14 +2532,14 @@ Table<3,T>::operator [] (const unsigned int i)
                                       this->table_size[2];
   return (internal::TableBaseAccessors::Accessor<3,T,false,2>
           (*this,
-           this->val+i*subobject_size));
+           this->values.begin() + i*subobject_size));
 }
 
 
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<3,T>::operator () (const unsigned int i,
                          const unsigned int j,
                          const unsigned int k) const
@@ -2572,7 +2550,7 @@ Table<3,T>::operator () (const unsigned int i,
           ExcIndexRange (j, 0, this->table_size[1]));
   Assert (k < this->table_size[2],
           ExcIndexRange (k, 0, this->table_size[2]));
-  return this->val[(i*this->table_size[1]+j)
+  return this->values[(i*this->table_size[1]+j)
                    *this->table_size[2] + k];
 }
 
@@ -2580,7 +2558,7 @@ Table<3,T>::operator () (const unsigned int i,
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<3,T>::operator () (const unsigned int i,
                          const unsigned int j,
                          const unsigned int k)
@@ -2591,7 +2569,7 @@ Table<3,T>::operator () (const unsigned int i,
           ExcIndexRange (j, 0, this->table_size[1]));
   Assert (k < this->table_size[2],
           ExcIndexRange (k, 0, this->table_size[2]));
-  return this->val[(i*this->table_size[1]+j)
+  return this->values[(i*this->table_size[1]+j)
                    *this->table_size[2] + k];
 }
 
@@ -2599,20 +2577,20 @@ Table<3,T>::operator () (const unsigned int i,
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<3,T>::operator () (const TableIndices<3> &indices) const
 {
-  return TableBase<3,T>::operator() (indices);
+  return TableBase<3,T>::operator () (indices);
 }
 
 
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<3,T>::operator () (const TableIndices<3> &indices)
 {
-  return TableBase<3,T>::operator() (indices);
+  return TableBase<3,T>::operator () (indices);
 }
 
 
@@ -2648,7 +2626,7 @@ Table<4,T>::operator [] (const unsigned int i) const
                                      this->table_size[3];
   return (internal::TableBaseAccessors::Accessor<4,T,true,3>
           (*this,
-           this->val+i*subobject_size));
+           this->values.begin() + i*subobject_size));
 }
 
 
@@ -2665,14 +2643,14 @@ Table<4,T>::operator [] (const unsigned int i)
                                      this->table_size[3];
   return (internal::TableBaseAccessors::Accessor<4,T,false,3>
           (*this,
-           this->val+i*subobject_size));
+           this->values.begin() + i*subobject_size));
 }
 
 
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<4,T>::operator () (const unsigned int i,
                          const unsigned int j,
                          const unsigned int k,
@@ -2686,7 +2664,7 @@ Table<4,T>::operator () (const unsigned int i,
           ExcIndexRange (k, 0, this->table_size[2]));
   Assert (l < this->table_size[3],
           ExcIndexRange (l, 0, this->table_size[3]));
-  return this->val[((i*this->table_size[1]+j)
+  return this->values[((i*this->table_size[1]+j)
                    *this->table_size[2] + k)
                    *this->table_size[3] + l];
 }
@@ -2695,7 +2673,7 @@ Table<4,T>::operator () (const unsigned int i,
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<4,T>::operator () (const unsigned int i,
                          const unsigned int j,
                          const unsigned int k,
@@ -2709,7 +2687,7 @@ Table<4,T>::operator () (const unsigned int i,
           ExcIndexRange (k, 0, this->table_size[2]));
   Assert (l < this->table_size[3],
           ExcIndexRange (l, 0, this->table_size[3]));
-  return this->val[((i*this->table_size[1]+j)
+  return this->values[((i*this->table_size[1]+j)
                    *this->table_size[2] + k)
                    *this->table_size[3] + l];
 }
@@ -2718,20 +2696,20 @@ Table<4,T>::operator () (const unsigned int i,
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<4,T>::operator () (const TableIndices<4> &indices) const
 {
-  return TableBase<4,T>::operator() (indices);
+  return TableBase<4,T>::operator () (indices);
 }
 
 
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<4,T>::operator () (const TableIndices<4> &indices)
 {
-  return TableBase<4,T>::operator() (indices);
+  return TableBase<4,T>::operator () (indices);
 }
 
 
@@ -2770,7 +2748,7 @@ Table<5,T>::operator [] (const unsigned int i) const
                                      this->table_size[4];
   return (internal::TableBaseAccessors::Accessor<5,T,true,4>
           (*this,
-           this->val+i*subobject_size));
+           this->values.begin() + i*subobject_size));
 }
 
 
@@ -2788,14 +2766,14 @@ Table<5,T>::operator [] (const unsigned int i)
                                      this->table_size[4];
   return (internal::TableBaseAccessors::Accessor<5,T,false,4>
           (*this,
-           this->val+i*subobject_size));
+           this->values.begin() + i*subobject_size));
 }
 
 
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<5,T>::operator () (const unsigned int i,
                          const unsigned int j,
                          const unsigned int k,
@@ -2812,7 +2790,7 @@ Table<5,T>::operator () (const unsigned int i,
           ExcIndexRange (l, 0, this->table_size[3]));
   Assert (m < this->table_size[4],
           ExcIndexRange (m, 0, this->table_size[4]));
-  return this->val[(((i*this->table_size[1]+j)
+  return this->values[(((i*this->table_size[1]+j)
                     *this->table_size[2] + k)
                    *this->table_size[3] + l)
                    *this->table_size[4] + m];
@@ -2822,7 +2800,7 @@ Table<5,T>::operator () (const unsigned int i,
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<5,T>::operator () (const unsigned int i,
                          const unsigned int j,
                          const unsigned int k,
@@ -2839,7 +2817,7 @@ Table<5,T>::operator () (const unsigned int i,
           ExcIndexRange (l, 0, this->table_size[3]));
   Assert (m < this->table_size[4],
           ExcIndexRange (m, 0, this->table_size[4]));
-  return this->val[(((i*this->table_size[1]+j)
+  return this->values[(((i*this->table_size[1]+j)
                     *this->table_size[2] + k)
                    *this->table_size[3] + l)
                    *this->table_size[4] + m];
@@ -2849,20 +2827,20 @@ Table<5,T>::operator () (const unsigned int i,
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<5,T>::operator () (const TableIndices<5> &indices) const
 {
-  return TableBase<5,T>::operator() (indices);
+  return TableBase<5,T>::operator () (indices);
 }
 
 
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<5,T>::operator () (const TableIndices<5> &indices)
 {
-  return TableBase<5,T>::operator() (indices);
+  return TableBase<5,T>::operator () (indices);
 }
 
 
@@ -2902,7 +2880,7 @@ Table<6,T>::operator [] (const unsigned int i) const
                                      this->table_size[5];
   return (internal::TableBaseAccessors::Accessor<6,T,true,5>
           (*this,
-           this->val+i*subobject_size));
+           this->values.begin() + i*subobject_size));
 }
 
 
@@ -2921,14 +2899,14 @@ Table<6,T>::operator [] (const unsigned int i)
                                      this->table_size[5];
   return (internal::TableBaseAccessors::Accessor<6,T,false,5>
           (*this,
-           this->val+i*subobject_size));
+           this->values.begin() + i*subobject_size));
 }
 
 
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<6,T>::operator () (const unsigned int i,
                          const unsigned int j,
                          const unsigned int k,
@@ -2948,7 +2926,7 @@ Table<6,T>::operator () (const unsigned int i,
           ExcIndexRange (m, 0, this->table_size[4]));
   Assert (n < this->table_size[5],
           ExcIndexRange (n, 0, this->table_size[5]));
-  return this->val[((((i*this->table_size[1]+j)
+  return this->values[((((i*this->table_size[1]+j)
                      *this->table_size[2] + k)
                     *this->table_size[3] + l)
                    *this->table_size[4] + m)
@@ -2959,7 +2937,7 @@ Table<6,T>::operator () (const unsigned int i,
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<6,T>::operator () (const unsigned int i,
                          const unsigned int j,
                          const unsigned int k,
@@ -2979,7 +2957,7 @@ Table<6,T>::operator () (const unsigned int i,
           ExcIndexRange (m, 0, this->table_size[4]));
   Assert (n < this->table_size[5],
           ExcIndexRange (n, 0, this->table_size[5]));
-  return this->val[((((i*this->table_size[1]+j)
+  return this->values[((((i*this->table_size[1]+j)
                      *this->table_size[2] + k)
                     *this->table_size[3] + l)
                    *this->table_size[4] + m)
@@ -2990,20 +2968,20 @@ Table<6,T>::operator () (const unsigned int i,
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<6,T>::operator () (const TableIndices<6> &indices) const
 {
-  return TableBase<6,T>::operator() (indices);
+  return TableBase<6,T>::operator () (indices);
 }
 
 
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<6,T>::operator () (const TableIndices<6> &indices)
 {
-  return TableBase<6,T>::operator() (indices);
+  return TableBase<6,T>::operator () (indices);
 }
 
 
@@ -3045,7 +3023,7 @@ Table<7,T>::operator [] (const unsigned int i) const
                                      this->table_size[6];
   return (internal::TableBaseAccessors::Accessor<7,T,true,6>
           (*this,
-           this->val+i*subobject_size));
+           this->values.begin() + i*subobject_size));
 }
 
 
@@ -3065,14 +3043,14 @@ Table<7,T>::operator [] (const unsigned int i)
                                      this->table_size[6];
   return (internal::TableBaseAccessors::Accessor<7,T,false,6>
           (*this,
-           this->val+i*subobject_size));
+           this->values.begin() + i*subobject_size));
 }
 
 
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<7,T>::operator () (const unsigned int i,
                          const unsigned int j,
                          const unsigned int k,
@@ -3095,7 +3073,7 @@ Table<7,T>::operator () (const unsigned int i,
           ExcIndexRange (n, 0, this->table_size[5]));
   Assert (o < this->table_size[6],
           ExcIndexRange (o, 0, this->table_size[6]));
-  return this->val[(((((i*this->table_size[1]+j)
+  return this->values[(((((i*this->table_size[1]+j)
                       *this->table_size[2] + k)
                      *this->table_size[3] + l)
                     *this->table_size[4] + m)
@@ -3107,7 +3085,7 @@ Table<7,T>::operator () (const unsigned int i,
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<7,T>::operator () (const unsigned int i,
                          const unsigned int j,
                          const unsigned int k,
@@ -3130,7 +3108,7 @@ Table<7,T>::operator () (const unsigned int i,
           ExcIndexRange (n, 0, this->table_size[5]));
   Assert (o < this->table_size[5],
           ExcIndexRange (o, 0, this->table_size[6]));
-  return this->val[(((((i*this->table_size[1]+j)
+  return this->values[(((((i*this->table_size[1]+j)
                       *this->table_size[2] + k)
                      *this->table_size[3] + l)
                     *this->table_size[4] + m)
@@ -3142,20 +3120,20 @@ Table<7,T>::operator () (const unsigned int i,
 
 template <typename T>
 inline
-const T &
+typename std::vector<T>::const_reference
 Table<7,T>::operator () (const TableIndices<7> &indices) const
 {
-  return TableBase<7,T>::operator() (indices);
+  return TableBase<7,T>::operator () (indices);
 }
 
 
 
 template <typename T>
 inline
-T &
+typename std::vector<T>::reference
 Table<7,T>::operator () (const TableIndices<7> &indices)
 {
-  return TableBase<7,T>::operator() (indices);
+  return TableBase<7,T>::operator () (indices);
 }
 
 
index 42bcbe880b94ff7515d1cf2f04e32cdc336781a4..a62e83af8562159909728d11a29185b8086cc2cb 100644 (file)
@@ -90,9 +90,9 @@ class FullMatrix : public Table<2,number>
                                      */
     typedef typename numbers::NumberTraits<number>::real_type real_type;
 
-    
+
     class const_iterator;
-    
+
                                     /**
                                      * Accessor class for iterators
                                      */
@@ -127,7 +127,7 @@ class FullMatrix : public Table<2,number>
                                          * Value of this matrix entry.
                                          */
        number value() const;
-       
+
       protected:
                                         /**
                                          * The matrix accessed.
@@ -159,11 +159,11 @@ class FullMatrix : public Table<2,number>
       public:
                                          /**
                                           * Constructor.
-                                          */ 
+                                          */
        const_iterator(const FullMatrix<number> *matrix,
                       const unsigned int row,
                       const unsigned int col);
-         
+
                                          /**
                                           * Prefix increment.
                                           */
@@ -211,7 +211,7 @@ class FullMatrix : public Table<2,number>
                                           * operator above.
                                           */
        bool operator > (const const_iterator&) const;
-        
+
       private:
                                          /**
                                           * Store an object of the
@@ -224,7 +224,7 @@ class FullMatrix : public Table<2,number>
  * See also the base class Table.
  */
 //@{
-    
+
                                     /**
                                      * Constructor. Initialize the
                                      * matrix as a square matrix with
@@ -240,7 +240,7 @@ class FullMatrix : public Table<2,number>
                                      * allocated.
                                      */
     explicit FullMatrix (const unsigned int n = 0);
-    
+
                                     /**
                                      * Constructor. Initialize the
                                      * matrix as a rectangular
@@ -248,8 +248,8 @@ class FullMatrix : public Table<2,number>
                                      */
     FullMatrix (const unsigned int rows,
                 const unsigned int cols);
-    
-                                    /** 
+
+                                    /**
                                      * Copy constructor. This
                                      * constructor does a deep copy
                                      * of the matrix. Therefore, it
@@ -293,14 +293,14 @@ class FullMatrix : public Table<2,number>
                                      * @endverbatim
                                      */
     explicit FullMatrix (const IdentityMatrix &id);
-    
+
 
                                     /**
                                      * Assignment operator.
                                      */
     FullMatrix<number> &
     operator = (const FullMatrix<number>&);
-    
+
                                     /**
                                      * Variable assignment operator.
                                      */
@@ -334,7 +334,7 @@ class FullMatrix : public Table<2,number>
                                      */
     FullMatrix<number> &
     operator = (const IdentityMatrix &id);
-    
+
                                     /**
                                      * Assignment operator for a
                                      * LapackFullMatrix. The calling matrix
@@ -344,7 +344,7 @@ class FullMatrix : public Table<2,number>
     template <typename number2>
     FullMatrix<number> &
     operator = (const LAPACKFullMatrix<number2>&);
-    
+
                                      /**
                                      * Assignment from different
                                      * matrix classes. This
@@ -355,7 +355,7 @@ class FullMatrix : public Table<2,number>
                                      */
     template <class MATRIX>
     void copy_from (const MATRIX&);
-    
+
                                     /**
                                      * Fill rectangular block.
                                      *
@@ -380,7 +380,7 @@ class FullMatrix : public Table<2,number>
               const unsigned int dst_offset_j = 0,
               const unsigned int src_offset_i = 0,
               const unsigned int src_offset_j = 0);
-    
+
 
                                     /**
                                      * Make function of base class
@@ -388,7 +388,7 @@ class FullMatrix : public Table<2,number>
                                      */
     template<typename number2>
     void fill (const number2*);
-    
+
                                     /**
                                      * Fill with permutation of
                                      * another matrix.
@@ -415,7 +415,7 @@ class FullMatrix : public Table<2,number>
 //@}
 ///@name Non-modifying operators
 //@{
-    
+
                                     /**
                                      * Comparison operator. Be
                                      * careful with this thing, it
@@ -433,7 +433,7 @@ class FullMatrix : public Table<2,number>
                                      * <i>m x n</i>-matrix.
                                      */
     unsigned int m () const;
-    
+
                                     /**
                                      * Number of columns of this matrix.
                                      * To remember: this matrix is an
@@ -520,7 +520,7 @@ class FullMatrix : public Table<2,number>
                                      * over rows).
                                      */
     real_type linfty_norm () const;
-    
+
                                     /**
                                      * Compute the Frobenius norm of
                                      * the matrix.  Return value is
@@ -534,7 +534,7 @@ class FullMatrix : public Table<2,number>
                                      * the vector space.
                                      */
     real_type frobenius_norm () const;
-    
+
                                     /**
                                      * Compute the relative norm of
                                      * the skew-symmetric part. The
@@ -549,7 +549,7 @@ class FullMatrix : public Table<2,number>
                                      * accuracy, or not.
                                      */
     real_type relative_symmetry_norm2 () const;
-    
+
                                     /**
                                       * Computes the determinant of a
                                       * matrix.  This is only
@@ -571,7 +571,7 @@ class FullMatrix : public Table<2,number>
                                       * be quadratic for this function.
                                       */
     number trace () const;
-    
+
                                     /**
                                      * Output of the matrix in
                                      * user-defined format.
@@ -629,7 +629,7 @@ class FullMatrix : public Table<2,number>
                          const char         *zero_string = " ",
                          const double        denominator = 1.,
                          const double        threshold   = 0.) const;
-    
+
                                     /**
                                      * Determine an estimate for the
                                      * memory consumption (in bytes)
@@ -640,7 +640,7 @@ class FullMatrix : public Table<2,number>
 //@}
 ///@name Iterator functions
 //@{
-    
+
                                     /**
                                      * STL-like iterator with the
                                      * first entry.
@@ -651,7 +651,7 @@ class FullMatrix : public Table<2,number>
                                      * Final iterator.
                                      */
     const_iterator end () const;
-    
+
                                     /**
                                      * STL-like iterator with the
                                      * first entry of row <tt>r</tt>.
@@ -666,7 +666,7 @@ class FullMatrix : public Table<2,number>
 //@}
 ///@name Modifying operators
 //@{
-    
+
                                     /**
                                      * Scale the entire matrix by a
                                      * fixed factor.
@@ -888,7 +888,7 @@ class FullMatrix : public Table<2,number>
              const number               b,
              const FullMatrix<number2> &B,
              const number               c,
-             const FullMatrix<number2> &C);    
+             const FullMatrix<number2> &C);
 
                                     /**
                                      * Symmetrize the matrix by
@@ -903,15 +903,15 @@ class FullMatrix : public Table<2,number>
     void symmetrize ();
 
                                     /**
-                                     * A=Inverse(A). A must be a square matrix. 
-                                      * Inversion of 
+                                     * A=Inverse(A). A must be a square matrix.
+                                      * Inversion of
                                      * this matrix by Gauss-Jordan
                                      * algorithm with partial
                                      * pivoting.  This process is
                                      * well-behaved for positive
                                      * definite matrices, but be
                                      * aware of round-off errors in
-                                     * the indefinite case. 
+                                     * the indefinite case.
                                      *
                                      * In case deal.II was configured with
                                      * LAPACK, the functions Xgetrf and
@@ -942,7 +942,7 @@ class FullMatrix : public Table<2,number>
 
                                     /**
                                      * Assign the Cholesky decomposition
-                                     * of the given matrix to <tt>*this</tt>. 
+                                     * of the given matrix to <tt>*this</tt>.
                                      * The given matrix must be symmetric
                                      * positive definite.
                                      *
@@ -954,33 +954,33 @@ class FullMatrix : public Table<2,number>
     void cholesky (const FullMatrix<number2> &A);
 
                                     /**
-                                     * <tt>*this(i,j)</tt> = $V(i) W(j)$ 
+                                     * <tt>*this(i,j)</tt> = $V(i) W(j)$
                                      * where $V,W$
                                      * are vectors of the same length.
                                      */
     template <typename number2>
     void outer_product (const Vector<number2> &V,
                        const Vector<number2> &W);
-    
+
                                     /**
                                      * Assign the left_inverse of the given matrix
-                                     * to <tt>*this</tt>. The calculation being 
+                                     * to <tt>*this</tt>. The calculation being
                                      * performed is <i>(A<sup>T</sup>*A)<sup>-1</sup>
                                      * *A<sup>T</sup></i>.
-                                     */   
+                                     */
     template <typename number2>
     void left_invert (const FullMatrix<number2> &M);
 
                                     /**
                                      * Assign the right_inverse of the given matrix
-                                     * to <tt>*this</tt>. The calculation being 
+                                     * to <tt>*this</tt>. The calculation being
                                      * performed is <i>A<sup>T</sup>*(A*A<sup>T</sup>)
                                      * <sup>-1</sup></i>.
                                      */
     template <typename number2>
     void right_invert (const FullMatrix<number2> &M);
 
-                                     /** 
+                                     /**
                                      * Fill matrix with elements
                                      * extracted from a tensor,
                                      * taking rows included between
@@ -1017,7 +1017,7 @@ class FullMatrix : public Table<2,number>
                                      * that of the matrix coincide.
                                       */
     template <int dim>
-    void 
+    void
     copy_to(Tensor<2,dim> &T,
            const unsigned int src_r_i=0,
            const unsigned int src_r_j=dim-1,
@@ -1061,7 +1061,7 @@ class FullMatrix : public Table<2,number>
     void mmult (FullMatrix<number2>       &C,
                const FullMatrix<number2> &B,
                const bool                 adding=false) const;
-    
+
                                     /**
                                      * Matrix-matrix-multiplication using
                                      * transpose of <tt>this</tt>.
@@ -1125,7 +1125,7 @@ class FullMatrix : public Table<2,number>
     void mTmult (FullMatrix<number2>       &C,
                 const FullMatrix<number2> &B,
                 const bool                 adding=false) const;
-    
+
                                     /**
                                      * Matrix-matrix-multiplication using
                                      * transpose of <tt>this</tt> and
@@ -1158,7 +1158,7 @@ class FullMatrix : public Table<2,number>
     void TmTmult (FullMatrix<number2>       &C,
                  const FullMatrix<number2> &B,
                  const bool                 adding=false) const;
-    
+
                                     /**
                                      * Matrix-vector-multiplication.
                                      *
@@ -1180,7 +1180,7 @@ class FullMatrix : public Table<2,number>
     void vmult (Vector<number2>       &w,
                const Vector<number2> &v,
                const bool             adding=false) const;
-    
+
                                     /**
                                      * Adding Matrix-vector-multiplication.
                                      *  <i>w += A*v</i>
@@ -1191,7 +1191,7 @@ class FullMatrix : public Table<2,number>
     template<typename number2>
     void vmult_add (Vector<number2>       &w,
                    const Vector<number2> &v) const;
-    
+
                                     /**
                                      * Transpose
                                      * matrix-vector-multiplication.
@@ -1242,7 +1242,7 @@ class FullMatrix : public Table<2,number>
     void precondition_Jacobi (Vector<somenumber>       &dst,
                              const Vector<somenumber> &src,
                              const number              omega = 1.) const;
-    
+
                                     /**
                                      * <i>dst=b-A*x</i>. Residual calculation,
                                      * returns the <i>l<sub>2</sub></i>-norm
@@ -1326,7 +1326,7 @@ class FullMatrix : public Table<2,number>
                                      */
     DeclException0 (ExcMatrixNotPositiveDefinite);
                                     //@}
-    
+
     friend class Accessor;
 };
 
@@ -1365,7 +1365,7 @@ FullMatrix<number>::operator = (const number d)
   Assert (d==number(0), ExcScalarAssignmentOnlyForZeroValue());
 
   if (this->n_elements() != 0)
-    memset (this->val, 0, this->n_elements()*sizeof(number));
+    memset (&this->values[0], 0, this->n_elements()*sizeof(number));
 
   return *this;
 }
@@ -1476,7 +1476,7 @@ typename FullMatrix<number>::const_iterator &
 FullMatrix<number>::const_iterator::operator++ ()
 {
   Assert (accessor.a_row < accessor.matrix->m(), ExcIteratorPastEnd());
-  
+
   ++accessor.a_col;
   if (accessor.a_col >= accessor.matrix->n())
     {
@@ -1597,7 +1597,7 @@ FullMatrix<number>::print (STREAM             &s,
                           const unsigned int  p) const
 {
   Assert (!this->empty(), ExcEmptyMatrix());
-  
+
   for (unsigned int i=0; i<this->m(); ++i)
     {
       for (unsigned int j=0; j<this->n(); ++j)
index 74bede304ec22a02d2f2d401a9fe16da99070568..f051a053740e6a09cf39ad9b53db1e8699a009d1 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2005, 2006, 2008 by the deal.II authors
+//    Copyright (C) 2005, 2006, 2008, 2010 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -71,7 +71,7 @@ LAPACKFullMatrix<number>::operator = (const FullMatrix<number2>& M)
   for (unsigned int i=0;i<this->n_rows();++i)
     for (unsigned int j=0;j<this->n_cols();++j)
       (*this)(i,j) = M(i,j);
-  
+
   state = LAPACKSupport::matrix;
   return *this;
 }
@@ -82,10 +82,10 @@ LAPACKFullMatrix<number> &
 LAPACKFullMatrix<number>::operator = (const double d)
 {
   Assert (d==0, ExcScalarAssignmentOnlyForZeroValue());
-  
+
   if (this->n_elements() != 0)
-    std::fill_n (this->val, this->n_elements(), number());  
-  
+    std::fill (this->values.begin(), this->values.end(), number());
+
   state = LAPACKSupport::matrix;
   return *this;
 }
@@ -101,12 +101,12 @@ LAPACKFullMatrix<number>::vmult (
 {
   Assert ((state == matrix) || (state == inverse_matrix),
           ExcState(state));
-  
+
   const int mm = this->n_rows();
   const int nn = this->n_cols();
   const number alpha = 1.;
   const number beta = (adding ? 1. : 0.);
-  
+
   gemv("N", &mm, &nn, &alpha, this->data(), &mm, v.val, &one, &beta, w.val, &one);
 }
 
@@ -119,12 +119,12 @@ LAPACKFullMatrix<number>::Tvmult (
   const bool            adding) const
 {
   Assert (state == matrix, ExcState(state));
-  
+
   const int mm = this->n_rows();
   const int nn = this->n_cols();
   const number alpha = 1.;
   const number beta = (adding ? 1. : 0.);
-  
+
   gemv("T", &mm, &nn, &alpha, this->data(), &mm, v.val, &one, &beta, w.val, &one);
 }
 
@@ -171,7 +171,7 @@ LAPACKFullMatrix<number>::compute_lu_factorization()
 
   Assert(info >= 0, ExcInternalError());
   Assert(info == 0, LACExceptions::ExcSingular());
-  
+
   state = lu;
 }
 
@@ -180,7 +180,7 @@ template <typename number>
 void
 LAPACKFullMatrix<number>::invert()
 {
-  Assert(state == matrix || state == lu, 
+  Assert(state == matrix || state == lu,
         ExcState(state));
   const int mm = this->n_rows();
   const int nn = this->n_cols();
@@ -203,7 +203,7 @@ LAPACKFullMatrix<number>::invert()
 
   Assert(info >= 0, ExcInternalError());
   Assert(info == 0, LACExceptions::ExcSingular());
-  
+
   state = inverse_matrix;
 }
 
@@ -216,7 +216,7 @@ LAPACKFullMatrix<number>::apply_lu_factorization(Vector<number>& v,
   Assert(state == lu, ExcState(state));
   Assert(this->n_rows() == this->n_cols(),
         LACExceptions::ExcNotQuadratic());
-  
+
   const char* trans = transposed ? &T : &N;
   const int nn = this->n_cols();
   const number* values = this->data();
@@ -241,14 +241,14 @@ LAPACKFullMatrix<number>::compute_eigenvalues(
   wi.resize(nn);
   if (right) vr.resize(nn*nn);
   if (left)  vl.resize(nn*nn);
-  
+
   number* values = const_cast<number*> (this->data());
-  
+
   int info  = 0;
   int lwork = 1;
   const char * const jobvr = (right) ? (&V) : (&N);
   const char * const jobvl = (left)  ? (&V) : (&N);
-  
+
                                   // Optimal workspace query:
 
                                   // The LAPACK routine DGEEV requires
@@ -257,7 +257,7 @@ LAPACKFullMatrix<number>::compute_eigenvalues(
                                   //    work.size>=4*nn.
                                   // However, to improve performance, a
                                   // somewhat larger workspace may be needed.
-  
+
                                   // SOME implementations of the LAPACK routine
                                   // provide a workspace query call,
                                   //   info:=0, lwork:=-1
@@ -271,7 +271,7 @@ LAPACKFullMatrix<number>::compute_eigenvalues(
 #ifndef DEAL_II_LIBLAPACK_NOQUERYMODE
   lwork = -1;
   work.resize(1);
-      
+
   geev(jobvl, jobvr, &nn, values, &nn,
        &wr[0], &wi[0],
        &vl[0], &nn, &vr[0], &nn,
@@ -320,23 +320,23 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric (
   const int nn = this->n_cols();
   Assert(static_cast<unsigned int>(nn) == this->n_rows(), ExcNotQuadratic());
   Assert(B.n_rows() == B.n_cols(), ExcNotQuadratic());
-  Assert(static_cast<unsigned int>(nn) == B.n_cols(), 
+  Assert(static_cast<unsigned int>(nn) == B.n_cols(),
         ExcDimensionMismatch (nn, B.n_cols()));
-  Assert(eigenvectors.size() <= static_cast<unsigned int>(nn), 
+  Assert(eigenvectors.size() <= static_cast<unsigned int>(nn),
         ExcMessage ("eigenvectors.size() > matrix.n_cols()"));
-  
+
   wr.resize(nn);
-  wi.resize(nn); //This is set purley for consistency reasons with the 
+  wi.resize(nn); //This is set purley for consistency reasons with the
                  //eigenvalues() function.
-  
+
   number* values_A = const_cast<number*> (this->data());
   number* values_B = const_cast<number*> (B.data());
-  
+
   int info  = 0;
   int lwork = 1;
   const char * const jobz = (eigenvectors.size() > 0) ? (&V) : (&N);
   const char * const uplo = (&U);
-  
+
                                   // Optimal workspace query:
 
                                   // The LAPACK routine DSYGV requires
@@ -345,7 +345,7 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric (
                                   //    work.size>=3*nn-1.
                                   // However, to improve performance, a
                                   // somewhat larger workspace may be needed.
-  
+
                                   // SOME implementations of the LAPACK routine
                                   // provide a workspace query call,
                                   //   info:=0, lwork:=-1
@@ -359,7 +359,7 @@ LAPACKFullMatrix<number>::compute_generalized_eigenvalues_symmetric (
 #ifndef DEAL_II_LIBLAPACK_NOQUERYMODE
   lwork = -1;
   work.resize(1);
-  
+
   sygv (&itype, jobz, uplo, &nn, values_A, &nn,
         values_B, &nn,
         &wr[0], &work[0], &lwork, &info);
@@ -410,7 +410,7 @@ void
 LAPACKFullMatrix<number>::compute_lu_factorization()
 {
 Assert(false, ExcNeedsLAPACK());
-  
+
 }
 
 
@@ -475,10 +475,10 @@ LAPACKFullMatrix<number>::print_formatted (
   const double        threshold) const
 {
   unsigned int width = width_;
-  
+
   Assert ((!this->empty()) || (this->n_cols()+this->n_rows()==0),
          ExcInternalError());
-  
+
                                   // set output format, but store old
                                   // state
   std::ios::fmtflags old_flags = out.flags();
@@ -494,8 +494,8 @@ LAPACKFullMatrix<number>::print_formatted (
       if (!width)
        width = precision+2;
     }
-  
-  for (unsigned int i=0; i<this->n_rows(); ++i) 
+
+  for (unsigned int i=0; i<this->n_rows(); ++i)
     {
       for (unsigned int j=0; j<this->n_cols(); ++j)
        if (std::fabs(this->el(i,j)) > threshold)
index 49b07d2ea8ab0a114cc5705ac501859dc224585b..7b0eb945c481a39666e6fff095089fc6be60c85e 100644 (file)
@@ -1,8 +1,8 @@
 //----------------------------  table.cc,v  ---------------------------
 //    $Id$
-//    Version: $Name$ 
+//    Version: $Name$
 //
-//    Copyright (C) 1998 - 2005, 2008 by the deal.II authors
+//    Copyright (C) 1998 - 2005, 2008, 2010 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -45,57 +45,57 @@ main ()
     {
       Table<2,double> Td(3,3);
       Table<2,int> Ti(3,3);
-  
+
       for (unsigned int i=0; i<9; ++i)
         {
           Td[i/3][i%3] = entries[i];
           Ti[i/3][i%3] = entries[i];
         };
-      
+
       for (unsigned int i=0; i<3; ++i)
         for (unsigned int j=0; j<3; ++j)
           {
             Assert (Td[i][j] == Td(i,j), ExcInternalError());
             Assert (Ti[i][j] == Ti(i,j), ExcInternalError());
             Assert (Ti[i][j] == Td(i,j), ExcInternalError());
-            
+
             Assert (*(Td[i].begin()+j) == Td(i,j), ExcInternalError());
             Assert (*(Ti[i].begin()+j) == Ti(i,j), ExcInternalError());
             Assert (*(Ti[i].begin()+j) == Td(i,j), ExcInternalError());
-            
-            Assert (Td[i].begin()+j == &Td(i,j), ExcInternalError());
-            Assert (Ti[i].begin()+j == &Ti(i,j), ExcInternalError());
-            
+
+            Assert (&*(Td[i].begin()+j) == &Td(i,j), ExcInternalError());
+            Assert (&*(Ti[i].begin()+j) == &Ti(i,j), ExcInternalError());
+
             deallog << i << " " << j << " " << Td[i][j] << " ok" << std::endl;
           };
     };
-  
+
                                    // a rectangular table
   if (true)
     {
       Table<2,double> Td(4,3);
       Table<2,int> Ti(4,3);
-  
+
       for (unsigned int i=0; i<12; ++i)
         {
           Td(i/3,i%3) = entries[i];
           Ti(i/3,i%3) = entries[i];
         };
-      
+
       for (unsigned int i=0; i<4; ++i)
         for (unsigned int j=0; j<3; ++j)
           {
             Assert (Td[i][j] == Td(i,j), ExcInternalError());
             Assert (Ti[i][j] == Ti(i,j), ExcInternalError());
             Assert (Ti[i][j] == Td(i,j), ExcInternalError());
-            
+
             Assert (*(Td[i].begin()+j) == Td(i,j), ExcInternalError());
             Assert (*(Ti[i].begin()+j) == Ti(i,j), ExcInternalError());
             Assert (*(Ti[i].begin()+j) == Td(i,j), ExcInternalError());
-            
-            Assert (Td[i].begin()+j == &Td(i,j), ExcInternalError());
-            Assert (Ti[i].begin()+j == &Ti(i,j), ExcInternalError());
-            
+
+            Assert (&*(Td[i].begin()+j) == &Td(i,j), ExcInternalError());
+            Assert (&*(Ti[i].begin()+j) == &Ti(i,j), ExcInternalError());
+
             deallog << i << " " << j << " " << Td[i][j] << " ok" << std::endl;
           };
 
@@ -133,7 +133,7 @@ main ()
          deallog << std::endl;
        }
     }
-  
+
 
                                    // a 1d-table
   if (true)
@@ -141,23 +141,23 @@ main ()
       const unsigned int N=10;
       Table<1,double> Td(N);
       Table<1,int> Ti(N);
-  
+
       for (unsigned int i=0; i<N; ++i)
         {
           Td(i) = entries[i];
           Ti(i) = entries[i];
         };
-      
+
       for (unsigned int i=0; i<N; ++i)
         {
           Assert (Td[i] == Td(i), ExcInternalError());
           Assert (Ti[i] == Ti(i), ExcInternalError());
           Assert (Ti[i] == Td(i), ExcInternalError());
-          
+
           deallog << i << " " << Td[i] << " ok" << std::endl;
         };
     };
-  
+
                                    // a 3d-table
   if (true)
     {
@@ -173,7 +173,7 @@ main ()
               Td(i,j,k) = entries[index];
               Ti(i,j,k) = entries[index];
             };
-      
+
       for (unsigned int i=0; i<I; ++i)
         for (unsigned int j=0; j<J; ++j)
           for (unsigned int k=0; k<K; ++k)
@@ -181,14 +181,14 @@ main ()
             Assert (Td[i][j][k] == Td(i,j,k), ExcInternalError());
             Assert (Ti[i][j][k] == Ti(i,j,k), ExcInternalError());
             Assert (Ti[i][j][k] == Td(i,j,k), ExcInternalError());
-            
+
             Assert (*(Td[i][j].begin()+k) == Td(i,j,k), ExcInternalError());
             Assert (*(Ti[i][j].begin()+k) == Ti(i,j,k), ExcInternalError());
             Assert (*(Ti[i][j].begin()+k) == Td(i,j,k), ExcInternalError());
-            
-            Assert (Td[i][j].begin()+k == &Td(i,j,k), ExcInternalError());
-            Assert (Ti[i][j].begin()+k == &Ti(i,j,k), ExcInternalError());
-            
+
+            Assert (&*(Td[i][j].begin()+k) == &Td(i,j,k), ExcInternalError());
+           Assert (&*(Ti[i][j].begin()+k) == &Ti(i,j,k), ExcInternalError());
+
             deallog << i << " " << j << " " << k << " "
                     << Td[i][j][k] << " ok" << std::endl;
           };
@@ -223,7 +223,7 @@ main ()
                Td(i,j,k,l) = 2*index+1;
                Ti(i,j,k,l) = 2*index+1;
              };
-      
+
       for (unsigned int i=0; i<I; ++i)
         for (unsigned int j=0; j<J; ++j)
           for (unsigned int k=0; k<K; ++k)
@@ -232,18 +232,18 @@ main ()
                Assert (Td[i][j][k][l] == Td(i,j,k,l), ExcInternalError());
                Assert (Ti[i][j][k][l] == Ti(i,j,k,l), ExcInternalError());
                Assert (Ti[i][j][k][l] == Td(i,j,k,l), ExcInternalError());
-               
+
                Assert (*(Td[i][j][k].begin()+l) == Td(i,j,k,l), ExcInternalError());
                Assert (*(Ti[i][j][k].begin()+l) == Ti(i,j,k,l), ExcInternalError());
                Assert (*(Ti[i][j][k].begin()+l) == Td(i,j,k,l), ExcInternalError());
-               
-               Assert (Td[i][j][k].begin()+l == &Td(i,j,k,l), ExcInternalError());
-               Assert (Ti[i][j][k].begin()+l == &Ti(i,j,k,l), ExcInternalError());
-               
+
+               Assert (&*(Td[i][j][k].begin()+l) == &Td(i,j,k,l), ExcInternalError());
+               Assert (&*(Ti[i][j][k].begin()+l) == &Ti(i,j,k,l), ExcInternalError());
+
                deallog << i << " " << j << " " << k << " " << l << " "
                        << Td[i][j][k][l] << " ok" << std::endl;
              };
-      
+
       for (unsigned int i=0; i<I; ++i)
         for (unsigned int j=0; j<J; ++j)
          for (unsigned int k=0; k<K; ++k)
@@ -259,7 +259,7 @@ main ()
       const unsigned int I=6, J=2, K=3, L=4, M=5;
       Table<5,double> Td(I,J,K,L,M);
       Table<5,int> Ti(I,J,K,L,M);
-      
+
       unsigned int index=0;
       for (unsigned int i=0; i<I; ++i)
         for (unsigned int j=0; j<J; ++j)
@@ -270,7 +270,7 @@ main ()
                  Td(i,j,k,l,m) = 2*index+1;
                  Ti(i,j,k,l,m) = 2*index+1;
                };
-      
+
       for (unsigned int i=0; i<I; ++i)
         for (unsigned int j=0; j<J; ++j)
           for (unsigned int k=0; k<K; ++k)
@@ -280,18 +280,18 @@ main ()
                  Assert (Td[i][j][k][l][m] == Td(i,j,k,l,m), ExcInternalError());
                  Assert (Ti[i][j][k][l][m] == Ti(i,j,k,l,m), ExcInternalError());
                  Assert (Ti[i][j][k][l][m] == Td(i,j,k,l,m), ExcInternalError());
-                 
+
                  Assert (*(Td[i][j][k][l].begin()+m) == Td(i,j,k,l,m), ExcInternalError());
                  Assert (*(Ti[i][j][k][l].begin()+m) == Ti(i,j,k,l,m), ExcInternalError());
                  Assert (*(Ti[i][j][k][l].begin()+m) == Td(i,j,k,l,m), ExcInternalError());
-                 
-                 Assert (Td[i][j][k][l].begin()+m == &Td(i,j,k,l,m), ExcInternalError());
-                 Assert (Ti[i][j][k][l].begin()+m == &Ti(i,j,k,l,m), ExcInternalError());
-            
+
+                 Assert (&*(Td[i][j][k][l].begin()+m) == &Td(i,j,k,l,m), ExcInternalError());
+                 Assert (&*(Ti[i][j][k][l].begin()+m) == &Ti(i,j,k,l,m), ExcInternalError());
+
                  deallog << i << " " << j << " " << k << " " << l << " " << m << " "
                          << Td[i][j][k][l][m] << " ok" << std::endl;
                };
-      
+
       for (unsigned int i=0; i<I; ++i)
         for (unsigned int j=0; j<J; ++j)
          for (unsigned int k=0; k<K; ++k)
@@ -301,7 +301,7 @@ main ()
                      ExcDimensionMismatch(Td[i][j][k][l].end() - Td[i][j][k][l].begin(),
                                           static_cast<signed int>(M)));
     };
-  
+
                                    // a 6d-table
   if (true)
     {
@@ -320,7 +320,7 @@ main ()
                    Td(i,j,k,l,m,n) = 2*index+1;
                    Ti(i,j,k,l,m,n) = 2*index+1;
                  };
-      
+
       for (unsigned int i=0; i<I; ++i)
         for (unsigned int j=0; j<J; ++j)
           for (unsigned int k=0; k<K; ++k)
@@ -331,18 +331,18 @@ main ()
                    Assert (Td[i][j][k][l][m][n] == Td(i,j,k,l,m,n), ExcInternalError());
                    Assert (Ti[i][j][k][l][m][n] == Ti(i,j,k,l,m,n), ExcInternalError());
                    Assert (Ti[i][j][k][l][m][n] == Td(i,j,k,l,m,n), ExcInternalError());
-                   
+
                    Assert (*(Td[i][j][k][l][m].begin()+n) == Td(i,j,k,l,m,n), ExcInternalError());
                    Assert (*(Ti[i][j][k][l][m].begin()+n) == Ti(i,j,k,l,m,n), ExcInternalError());
                    Assert (*(Ti[i][j][k][l][m].begin()+n) == Td(i,j,k,l,m,n), ExcInternalError());
-                   
-                   Assert (Td[i][j][k][l][m].begin()+n == &Td(i,j,k,l,m,n), ExcInternalError());
-                   Assert (Ti[i][j][k][l][m].begin()+n == &Ti(i,j,k,l,m,n), ExcInternalError());
-                   
+
+                   Assert (&*(Td[i][j][k][l][m].begin()+n) == &Td(i,j,k,l,m,n), ExcInternalError());
+                   Assert (&*(Ti[i][j][k][l][m].begin()+n) == &Ti(i,j,k,l,m,n), ExcInternalError());
+
                    deallog << i << " " << j << " " << k << " " << l << " " << m << " " << n << " "
                            << Td[i][j][k][l][m][n] << " ok" << std::endl;
                  };
-      
+
       for (unsigned int i=0; i<I; ++i)
         for (unsigned int j=0; j<J; ++j)
          for (unsigned int k=0; k<K; ++k)
@@ -356,4 +356,4 @@ main ()
 }
 
 
-      
+

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.