#include <base/exceptions.h>
#include <base/subscriptor.h>
#include <base/table_indices.h>
+#include <base/memory_consumption.h>
#include <cstddef>
#include <algorithm>
* 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;
};
/**
* 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
* 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:
/**
* data we may access.
*/
Accessor (const TableType &table,
- const pointer data);
+ const iterator data);
/**
* Default constructor. Not
* private.
*/
Accessor ();
-
+
public:
-
+
/**
* Copy constructor. This constructor
* is public so that one can pass
* 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;
};
-
+
/**
* @internal
* Accessor class for tables. This is the specialization for the last
* 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;
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).
* data consistency.
*/
Accessor (const TableType &table,
- const pointer data);
+ const iterator data);
/**
* Default constructor. Not needed,
*/
Accessor ();
- public:
+ public:
/**
* Copy constructor. This constructor
* is public so that one can pass
*/
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
* 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
* elements constant.
*/
const TableType &table;
- const pointer data;
+ const iterator data;
// declare some other classes
// as friends. make sure to
#endif
};
}
-
+
} // namespace internal
* dimensions to zero.
*/
TableBase ();
-
+
/**
* Constructor. Initialize the
* array with the given
*/
template <typename T2>
TableBase (const TableBase<N,T2> &src);
-
+
/**
* Destructor. Free allocated memory.
*/
~TableBase ();
-
+
/**
* Assignment operator.
* Copy all elements of <tt>src</tt>
* 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>
*/
template<typename T2>
TableBase<N,T>& operator = (const TableBase<N,T2> &src);
-
+
/**
* Set all entries to their
* default value (i.e. copy them
* size of the table, though.
*/
void reset_values ();
-
+
/**
* Set the dimensions of this object to
* the sizes given in the argument, and
* <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
* <tt>n_elements()==0</tt>.
*/
bool empty () const;
-
+
/**
* Fill array with an array of
* elements. The input array must
* 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
* 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
* does no index checking.
*/
unsigned int position (const TableIndices<N> &indices) const;
-
+
/**
* Return a read-write reference
* to the indicated element.
* 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
* 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
* 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
* 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
*/
*
* For the rationale of this class, and a description of the
* interface, see the base class.
- *
+ *
* @ingroup data
* @author Wolfgang Bangerth, 2002
*/
* dimensions to zero.
*/
Table ();
-
+
/**
* Constructor. Pass down the
* given dimension to the base
* data element. Returns a
* read-only reference.
*/
- const T &
+ typename std::vector<T>::const_reference
operator [] (const unsigned int i) const;
/**
* data element. Returns a
* read-write reference.
*/
- T &
+ typename std::vector<T>::reference
operator [] (const unsigned int i);
/**
* data element. Returns a
* read-only reference.
*/
- const T &
+ typename std::vector<T>::const_reference
operator () (const unsigned int i) const;
/**
* 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;
};
* 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
*/
* 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
* 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
* object here.
*/
unsigned int n_rows () const;
-
+
/**
* Number of columns. This function
* really makes only sense since
* 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
* 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;
};
*
* For the rationale of this class, and a description of the
* interface, see the base class.
- *
+ *
* @ingroup data
* @author Wolfgang Bangerth, 2002
*/
* 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
* 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;
};
*
* For the rationale of this class, and a description of the
* interface, see the base class.
- *
+ *
* @ingroup data
* @author Wolfgang Bangerth, Ralf Hartmann 2002
*/
const unsigned int size2,
const unsigned int size3,
const unsigned int size4);
-
+
/**
* Access operator. Generate an
* object that accesses the
* 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
* 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;
};
*
* For the rationale of this class, and a description of the
* interface, see the base class.
- *
+ *
* @ingroup data
* @author Wolfgang Bangerth, Ralf Hartmann 2002
*/
* 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
* 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<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;
};
*
* For the rationale of this class, and a description of the
* interface, see the base class.
- *
+ *
* @ingroup data
* @author Wolfgang Bangerth, Ralf Hartmann 2002
*/
* 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
* 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<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;
};
*
* 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
*/
* 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
* 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<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;
};
* 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;
/**
* 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
* object here.
*/
unsigned int n_rows () const;
-
+
/**
* Number of columns. This function
* really makes only sense since
* 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
* 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;
};
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);
}
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());
}
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)
table (a.table),
data (a.data)
{}
-
-
+
+
template <int N, typename T, bool C, unsigned int P>
inline
Accessor<N,T,C,P>::Accessor ()
// 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>
// 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
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);
}
}
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)
// not need to be copied around
Assert (false, ExcInternalError());
}
-
+
template <int N, typename T, bool C>
{}
-
+
template <int N, typename T, bool C>
inline
typename Accessor<N,T,C,1>::reference
}
-
+
template <int N, typename T, bool C>
inline
unsigned int
template <int N, typename T>
inline
TableBase<N,T>::~TableBase ()
-{
- if (val != 0)
- delete[] val;
-}
+{}
{
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;
}
{
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;
}
TableBase<N,T>::reset_values ()
{
if (n_elements() != 0)
- std::fill_n (val, n_elements(), T());
+ std::fill (values.begin(), values.end(), T());
}
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());
}
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
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
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());
}
unsigned int
TableBase<N,T>::memory_consumption () const
{
- return sizeof(*this) + val_size*sizeof(T);
+ return sizeof(*this) + MemoryConsumption::memory_consumption(values);
}
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],
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],
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];
}
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);
}
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());
}
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
{
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)
{
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];
}
template <typename T>
inline
-const T &
+typename std::vector<T>::const_reference
TransposeTable<T>::operator () (const unsigned int i,
const unsigned int j) const
{
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)
{
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];
}
this->table_size[2];
return (internal::TableBaseAccessors::Accessor<3,T,true,2>
(*this,
- this->val+i*subobject_size));
+ this->values.begin() + i*subobject_size));
}
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
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];
}
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)
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];
}
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);
}
this->table_size[3];
return (internal::TableBaseAccessors::Accessor<4,T,true,3>
(*this,
- this->val+i*subobject_size));
+ this->values.begin() + i*subobject_size));
}
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,
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];
}
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,
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];
}
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);
}
this->table_size[4];
return (internal::TableBaseAccessors::Accessor<5,T,true,4>
(*this,
- this->val+i*subobject_size));
+ this->values.begin() + i*subobject_size));
}
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,
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];
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,
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];
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);
}
this->table_size[5];
return (internal::TableBaseAccessors::Accessor<6,T,true,5>
(*this,
- this->val+i*subobject_size));
+ this->values.begin() + i*subobject_size));
}
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,
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)
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,
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)
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);
}
this->table_size[6];
return (internal::TableBaseAccessors::Accessor<7,T,true,6>
(*this,
- this->val+i*subobject_size));
+ this->values.begin() + i*subobject_size));
}
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,
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)
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,
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)
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);
}