Reference documentation for deal.II version Git 7026f387cc 2019-10-15 14:19:01 -0400
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
table.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2002 - 2019 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_table_h
17 #define dealii_table_h
18 
19 #include <deal.II/base/config.h>
20 
21 #include <deal.II/base/aligned_vector.h>
22 #include <deal.II/base/exceptions.h>
23 #include <deal.II/base/linear_index_iterator.h>
24 #include <deal.II/base/memory_consumption.h>
25 #include <deal.II/base/subscriptor.h>
26 #include <deal.II/base/table_indices.h>
27 
28 #include <algorithm>
29 #include <cstddef>
30 
31 DEAL_II_NAMESPACE_OPEN
32 
33 // forward declaration
34 #ifndef DOXYGEN
35 template <int N, typename T>
36 class TableBase;
37 template <int N, typename T>
38 class Table;
39 template <typename T>
40 class TransposeTable;
41 template <typename T>
42 class Table<1, T>;
43 template <typename T>
44 class Table<2, T>;
45 template <typename T>
46 class Table<3, T>;
47 template <typename T>
48 class Table<4, T>;
49 template <typename T>
50 class Table<5, T>;
51 template <typename T>
52 class Table<6, T>;
53 #endif
54 
55 
56 
57 namespace internal
58 {
75  namespace TableBaseAccessors
76  {
84  template <int N, typename T, bool Constness>
85  struct Types
86  {};
87 
93  template <int N, typename T>
94  struct Types<N, T, true>
95  {
96  using value_type = const T;
97  using TableType = const TableBase<N, T>;
98 
99  using iterator = typename AlignedVector<T>::const_iterator;
100  using const_iterator = typename AlignedVector<T>::const_iterator;
101 
102  using reference = typename AlignedVector<T>::const_reference;
103  using const_reference = typename AlignedVector<T>::const_reference;
104  };
105 
111  template <int N, typename T>
112  struct Types<N, T, false>
113  {
114  using value_type = T;
115  using TableType = TableBase<N, T>;
116 
117  using iterator = typename AlignedVector<T>::iterator;
118  using const_iterator = typename AlignedVector<T>::const_iterator;
119 
120  using reference = typename AlignedVector<T>::reference;
121  using const_reference = typename AlignedVector<T>::const_reference;
122  };
123 
124 
163  template <int N, typename T, bool C, unsigned int P>
164  class Accessor
165  {
166  public:
167  using TableType = typename Types<N, T, C>::TableType;
168 
169  using iterator = typename Types<N, T, C>::iterator;
170  using const_iterator = typename Types<N, T, C>::const_iterator;
171 
172  using size_type = size_t;
173  using difference_type = ptrdiff_t;
174 
175  private:
181  Accessor(const TableType &table, const iterator data);
182 
183  public:
191  Accessor(const Accessor &a);
192 
196  Accessor<N, T, C, P - 1> operator[](const size_type i) const;
197 
203  size_type,
204  size_type,
205  size_type,
206  << "Index " << N - P + 1 << "has a value of " << arg1
207  << " but needs to be in the range [" << arg2 << "," << arg3
208  << "[.");
209 
210  private:
216  const TableType &table;
217  const iterator data;
218 
219  // declare some other classes
220  // as friends. make sure to
221  // work around bugs in some
222  // compilers
223  template <int N1, typename T1>
224  friend class ::Table;
225  template <int N1, typename T1, bool C1, unsigned int P1>
226  friend class Accessor;
227 #ifndef DEAL_II_TEMPL_SPEC_FRIEND_BUG
228  friend class ::Table<N, T>;
229  friend class Accessor<N, T, C, P + 1>;
230 #endif
231  };
232 
233 
234 
244  template <int N, typename T, bool C>
245  class Accessor<N, T, C, 1>
246  {
247  public:
253  using value_type = typename Types<N, T, C>::value_type;
254 
255  using iterator = typename Types<N, T, C>::iterator;
256  using const_iterator = typename Types<N, T, C>::const_iterator;
257 
258  using reference = typename Types<N, T, C>::reference;
259  using const_reference = typename Types<N, T, C>::const_reference;
260 
261  using size_type = size_t;
262  using difference_type = ptrdiff_t;
263 
267  using TableType = typename Types<N, T, C>::TableType;
268 
269  private:
281  Accessor(const TableType &table, const iterator data);
282 
283  public:
291  Accessor(const Accessor &a);
292 
296  reference operator[](const size_type) const;
297 
302  size_type
303  size() const;
304 
308  iterator
309  begin() const;
310 
314  iterator
315  end() const;
316 
317  private:
323  const TableType &table;
324  const iterator data;
325 
326  // declare some other classes
327  // as friends. make sure to
328  // work around bugs in some
329  // compilers
330  template <int N1, typename T1>
331  friend class ::Table;
332  template <int N1, typename T1, bool C1, unsigned int P1>
333  friend class Accessor;
334 #ifndef DEAL_II_TEMPL_SPEC_FRIEND_BUG
335  friend class ::Table<2, T>;
336  friend class Accessor<N, T, C, 2>;
337 #endif
338  };
339  } // namespace TableBaseAccessors
340 
341 } // namespace internal
342 
343 
344 
411 template <int N, typename T>
412 class TableBase : public Subscriptor
413 {
414 public:
415  using value_type = T;
416 
420  using size_type = typename AlignedVector<T>::size_type;
421 
422 
426  TableBase() = default;
427 
432  TableBase(const TableIndices<N> &sizes);
433 
439  template <typename InputIterator>
440  TableBase(const TableIndices<N> &sizes,
441  InputIterator entries,
442  const bool C_style_indexing = true);
443 
447  TableBase(const TableBase<N, T> &src);
448 
453  template <typename T2>
454  TableBase(const TableBase<N, T2> &src);
455 
459  TableBase(TableBase<N, T> &&src) noexcept;
460 
464  ~TableBase() override = default;
465 
475  operator=(const TableBase<N, T> &src);
476 
484  template <typename T2>
486  operator=(const TableBase<N, T2> &src);
487 
493  operator=(TableBase<N, T> &&src) noexcept;
494 
498  bool
499  operator==(const TableBase<N, T> &T2) const;
500 
505  void
506  reset_values();
507 
516  void
517  reinit(const TableIndices<N> &new_size,
518  const bool omit_default_initialization = false);
519 
523  size_type
524  size(const unsigned int i) const;
525 
529  const TableIndices<N> &
530  size() const;
531 
536  size_type
537  n_elements() const;
538 
543  bool
544  empty() const;
545 
582  template <typename InputIterator>
583  void
584  fill(InputIterator entries, const bool C_style_indexing = true);
585 
589  void
590  fill(const T &value);
591 
595  typename AlignedVector<T>::reference
596  operator()(const TableIndices<N> &indices);
597 
605  typename AlignedVector<T>::const_reference
606  operator()(const TableIndices<N> &indices) const;
607 
620  void
621  swap(TableBase<N, T> &v);
622 
627  std::size_t
628  memory_consumption() const;
629 
634  template <class Archive>
635  void
636  serialize(Archive &ar, const unsigned int version);
637 
638 protected:
643  size_type
644  position(const TableIndices<N> &indices) const;
645 
652  typename AlignedVector<T>::reference
653  el(const TableIndices<N> &indices);
654 
665  typename AlignedVector<T>::const_reference
666  el(const TableIndices<N> &indices) const;
667 
668 protected:
673 
678 
679  // Make all other table classes friends.
680  template <int, typename>
681  friend class TableBase;
682 };
683 
684 
698 template <int N, typename T>
699 class Table : public TableBase<N, T>
700 {};
701 
702 
715 template <typename T>
716 class Table<1, T> : public TableBase<1, T>
717 {
718 public:
723 
727  Table() = default;
728 
732  Table(const size_type size);
733 
771  template <typename InputIterator>
772  Table(const size_type size,
773  InputIterator entries,
774  const bool C_style_indexing = true);
775 
780  typename AlignedVector<T>::const_reference
781  operator[](const size_type i) const;
782 
787  typename AlignedVector<T>::reference operator[](const size_type i);
788 
793  typename AlignedVector<T>::const_reference
794  operator()(const size_type i) const;
795 
800  typename AlignedVector<T>::reference
801  operator()(const size_type i);
802 
807  typename AlignedVector<T>::reference
808  operator()(const TableIndices<1> &indices);
809 
814  typename AlignedVector<T>::const_reference
815  operator()(const TableIndices<1> &indices) const;
816 };
817 
818 
819 
828 {
833  enum class Storage
834  {
838  row_major,
839 
844  };
845 
846  // Forward declaration of the iterator class.
847  template <typename TableType, bool Constness, Storage storage_order>
848  class Iterator;
849 
854  template <typename TableType, bool Constness, Storage storage_order>
855  class Accessor;
856 
873  template <typename TableType, bool Constness, Storage storage_order>
875  {
876  public:
880  using container_pointer_type = typename std::
881  conditional<Constness, const TableType *, TableType *>::type;
882 
886  using value_type = typename TableType::value_type;
887 
891  using size_type = typename TableType::size_type;
892 
896  AccessorBase();
897 
902 
907 
912  const std::ptrdiff_t linear_index);
913 
918  const value_type &
919  value() const;
920 
924  operator const value_type &() const;
925 
929  size_type
930  row() const;
931 
935  size_type
936  column() const;
937 
938  protected:
943 
947  std::ptrdiff_t linear_index;
948 
955  void
956  assert_valid_linear_index() const;
957 
958  // Make the const version a friend for copying.
959  friend class AccessorBase<TableType, true, storage_order>;
960 
961  // Make the underlying iterator class a friend.
962  friend class LinearIndexIterator<
963  Iterator<TableType, Constness, storage_order>,
964  Accessor<TableType, Constness, storage_order>>;
965  };
966 
971  template <typename TableType, Storage storage_order>
972  class Accessor<TableType, true, storage_order>
973  : public AccessorBase<TableType, true, storage_order>
974  {
975  public:
979  using value_type =
981 
985  using size_type =
987 
992  };
993 
998  template <typename TableType, Storage storage_order>
999  class Accessor<TableType, false, storage_order>
1000  : public AccessorBase<TableType, false, storage_order>
1001  {
1002  public:
1006  using value_type =
1008 
1012  using size_type =
1014 
1019 
1025  operator=(const value_type &) const;
1026 
1032  operator=(value_type &&) const;
1033 
1039 
1044  value_type &
1045  value() const;
1046 
1050  operator value_type &();
1051  };
1052 
1065  template <typename TableType, bool Constness, Storage storage_order>
1066  class Iterator
1067  : public LinearIndexIterator<Iterator<TableType, Constness, storage_order>,
1068  Accessor<TableType, Constness, storage_order>>
1069  {
1070  public:
1074  using size_type = typename TableType::size_type;
1075 
1079  using container_pointer_type = typename std::
1080  conditional<Constness, const TableType *, TableType *>::type;
1081 
1086 
1090  Iterator(const container_pointer_type object);
1091 
1095  Iterator(const container_pointer_type object,
1096  const size_type row,
1097  const size_type column);
1098 
1103 
1107  Iterator(const container_pointer_type container,
1108  const std::ptrdiff_t linear_index);
1109  };
1110 } // namespace MatrixTableIterators
1111 
1112 
1113 
1127 template <typename T>
1128 class Table<2, T> : public TableBase<2, T>
1129 {
1130 public:
1135 
1140 
1144  using reference = typename AlignedVector<T>::reference;
1145 
1149  using const_reference = typename AlignedVector<T>::const_reference;
1150 
1155  using const_iterator = MatrixTableIterators::
1156  Iterator<Table<2, T>, true, MatrixTableIterators::Storage::row_major>;
1157 
1161  using iterator = MatrixTableIterators::
1162  Iterator<Table<2, T>, false, MatrixTableIterators::Storage::row_major>;
1163 
1167  Table() = default;
1168 
1172  Table(const size_type size1, const size_type size2);
1173 
1212  template <typename InputIterator>
1213  Table(const size_type size1,
1214  const size_type size2,
1215  InputIterator entries,
1216  const bool C_style_indexing = true);
1217 
1223  void
1224  reinit(const size_type size1,
1225  const size_type size2,
1226  const bool omit_default_initialization = false);
1227 
1229 
1236  ::internal::TableBaseAccessors::Accessor<2, T, true, 1>
1237  operator[](const size_type i) const;
1238 
1245  ::internal::TableBaseAccessors::Accessor<2, T, false, 1>
1246  operator[](const size_type i);
1247 
1254  typename AlignedVector<T>::const_reference
1255  operator()(const size_type i, const size_type j) const;
1256 
1263  typename AlignedVector<T>::reference
1264  operator()(const size_type i, const size_type j);
1265 
1270  typename AlignedVector<T>::reference
1271  operator()(const TableIndices<2> &indices);
1272 
1277  typename AlignedVector<T>::const_reference
1278  operator()(const TableIndices<2> &indices) const;
1279 
1280 
1285  size_type
1286  n_rows() const;
1287 
1292  size_type
1293  n_cols() const;
1294 
1298  iterator
1299  begin();
1300 
1305  begin() const;
1306 
1310  iterator
1311  end();
1312 
1317  end() const;
1318 
1319 protected:
1330  typename AlignedVector<T>::reference
1331  el(const size_type i, const size_type j);
1332 
1347  typename AlignedVector<T>::const_reference
1348  el(const size_type i, const size_type j) const;
1349 
1350  // Make the AccessorBase class a friend so that it may directly index into
1351  // the array.
1352  friend class MatrixTableIterators::
1353  AccessorBase<Table<2, T>, true, MatrixTableIterators::Storage::row_major>;
1354  friend class MatrixTableIterators::
1355  AccessorBase<Table<2, T>, false, MatrixTableIterators::Storage::row_major>;
1356 
1357  // Make the mutable accessor class a friend so that we can write to array
1358  // entries with iterators.
1359  friend class MatrixTableIterators::
1360  Accessor<Table<2, T>, false, MatrixTableIterators::Storage::row_major>;
1361 };
1362 
1363 
1364 
1375 template <typename T>
1376 class Table<3, T> : public TableBase<3, T>
1377 {
1378 public:
1383 
1387  Table() = default;
1388 
1392  Table(const size_type size1, const size_type size2, const size_type size3);
1393 
1434  template <typename InputIterator>
1435  Table(const size_type size1,
1436  const size_type size2,
1437  const size_type size3,
1438  InputIterator entries,
1439  const bool C_style_indexing = true);
1440 
1448  ::internal::TableBaseAccessors::Accessor<3, T, true, 2>
1449  operator[](const size_type i) const;
1450 
1458  ::internal::TableBaseAccessors::Accessor<3, T, false, 2>
1459  operator[](const size_type i);
1460 
1467  typename AlignedVector<T>::const_reference
1468  operator()(const size_type i, const size_type j, const size_type k) const;
1469 
1470 
1477  typename AlignedVector<T>::reference
1478  operator()(const size_type i, const size_type j, const size_type k);
1479 
1484  typename AlignedVector<T>::reference
1485  operator()(const TableIndices<3> &indices);
1486 
1491  typename AlignedVector<T>::const_reference
1492  operator()(const TableIndices<3> &indices) const;
1493 };
1494 
1495 
1496 
1507 template <typename T>
1508 class Table<4, T> : public TableBase<4, T>
1509 {
1510 public:
1515 
1519  Table() = default;
1520 
1524  Table(const size_type size1,
1525  const size_type size2,
1526  const size_type size3,
1527  const size_type size4);
1528 
1536  ::internal::TableBaseAccessors::Accessor<4, T, true, 3>
1537  operator[](const size_type i) const;
1538 
1546  ::internal::TableBaseAccessors::Accessor<4, T, false, 3>
1547  operator[](const size_type i);
1548 
1555  typename AlignedVector<T>::const_reference
1556  operator()(const size_type i,
1557  const size_type j,
1558  const size_type k,
1559  const size_type l) const;
1560 
1561 
1568  typename AlignedVector<T>::reference
1569  operator()(const size_type i,
1570  const size_type j,
1571  const size_type k,
1572  const size_type l);
1573 
1578  typename AlignedVector<T>::reference
1579  operator()(const TableIndices<4> &indices);
1580 
1585  typename AlignedVector<T>::const_reference
1586  operator()(const TableIndices<4> &indices) const;
1587 };
1588 
1589 
1590 
1601 template <typename T>
1602 class Table<5, T> : public TableBase<5, T>
1603 {
1604 public:
1609 
1610 
1614  Table() = default;
1615 
1619  Table(const size_type size1,
1620  const size_type size2,
1621  const size_type size3,
1622  const size_type size4,
1623  const size_type size5);
1624 
1632  ::internal::TableBaseAccessors::Accessor<5, T, true, 4>
1633  operator[](const size_type i) const;
1634 
1642  ::internal::TableBaseAccessors::Accessor<5, T, false, 4>
1643  operator[](const size_type i);
1644 
1651  typename AlignedVector<T>::const_reference
1652  operator()(const size_type i,
1653  const size_type j,
1654  const size_type k,
1655  const size_type l,
1656  const size_type m) const;
1657 
1664  typename AlignedVector<T>::reference
1665  operator()(const size_type i,
1666  const size_type j,
1667  const size_type k,
1668  const size_type l,
1669  const size_type m);
1670 
1675  typename AlignedVector<T>::reference
1676  operator()(const TableIndices<5> &indices);
1677 
1682  typename AlignedVector<T>::const_reference
1683  operator()(const TableIndices<5> &indices) const;
1684 };
1685 
1686 
1687 
1698 template <typename T>
1699 class Table<6, T> : public TableBase<6, T>
1700 {
1701 public:
1706 
1710  Table() = default;
1711 
1715  Table(const size_type size1,
1716  const size_type size2,
1717  const size_type size3,
1718  const size_type size4,
1719  const size_type size5,
1720  const size_type size6);
1721 
1729  ::internal::TableBaseAccessors::Accessor<6, T, true, 5>
1730  operator[](const size_type i) const;
1731 
1739  ::internal::TableBaseAccessors::Accessor<6, T, false, 5>
1740  operator[](const size_type i);
1741 
1748  typename AlignedVector<T>::const_reference
1749  operator()(const size_type i,
1750  const size_type j,
1751  const size_type k,
1752  const size_type l,
1753  const size_type m,
1754  const size_type n) const;
1755 
1762  typename AlignedVector<T>::reference
1763  operator()(const size_type i,
1764  const size_type j,
1765  const size_type k,
1766  const size_type l,
1767  const size_type m,
1768  const size_type n);
1769 
1774  typename AlignedVector<T>::reference
1775  operator()(const TableIndices<6> &indices);
1776 
1781  typename AlignedVector<T>::const_reference
1782  operator()(const TableIndices<6> &indices) const;
1783 };
1784 
1785 
1796 template <typename T>
1797 class Table<7, T> : public TableBase<7, T>
1798 {
1799 public:
1804 
1808  Table() = default;
1809 
1813  Table(const size_type size1,
1814  const size_type size2,
1815  const size_type size3,
1816  const size_type size4,
1817  const size_type size5,
1818  const size_type size6,
1819  const size_type size7);
1820 
1828  ::internal::TableBaseAccessors::Accessor<7, T, true, 6>
1829  operator[](const size_type i) const;
1830 
1838  ::internal::TableBaseAccessors::Accessor<7, T, false, 6>
1839  operator[](const size_type i);
1840 
1847  typename AlignedVector<T>::const_reference
1848  operator()(const size_type i,
1849  const size_type j,
1850  const size_type k,
1851  const size_type l,
1852  const size_type m,
1853  const size_type n,
1854  const size_type o) const;
1855 
1862  typename AlignedVector<T>::reference
1863  operator()(const size_type i,
1864  const size_type j,
1865  const size_type k,
1866  const size_type l,
1867  const size_type m,
1868  const size_type n,
1869  const size_type o);
1870 
1875  typename AlignedVector<T>::reference
1876  operator()(const TableIndices<7> &indices);
1877 
1882  typename AlignedVector<T>::const_reference
1883  operator()(const TableIndices<7> &indices) const;
1884 };
1885 
1886 
1896 {
1897  template <typename T, bool Constness>
1898  using AccessorBase DEAL_II_DEPRECATED = MatrixTableIterators::AccessorBase<
1900  Constness,
1902 
1903  template <typename T, bool Constness>
1904  using Accessor DEAL_II_DEPRECATED =
1906  Constness,
1907  MatrixTableIterators::Storage::column_major>;
1908 
1909  template <typename T, bool Constness>
1910  using Iterator DEAL_II_DEPRECATED =
1912  Constness,
1913  MatrixTableIterators::Storage::column_major>;
1914 } // namespace TransposeTableIterators
1915 
1916 
1930 template <typename T>
1931 class TransposeTable : public TableBase<2, T>
1932 {
1933 public:
1938 
1942  using value_type = typename AlignedVector<T>::value_type;
1943 
1947  using reference = typename AlignedVector<T>::reference;
1948 
1952  using const_reference = typename AlignedVector<T>::const_reference;
1953 
1958  using const_iterator =
1960  true,
1962 
1966  using iterator =
1968  false,
1970 
1974  TransposeTable() = default;
1975 
1979  TransposeTable(const size_type size1, const size_type size2);
1980 
1986  void
1987  reinit(const size_type size1,
1988  const size_type size2,
1989  const bool omit_default_initialization = false);
1990 
1998  operator()(const size_type i, const size_type j) const;
1999 
2006  reference
2007  operator()(const size_type i, const size_type j);
2008 
2013  size_type
2014  n_rows() const;
2015 
2020  size_type
2021  n_cols() const;
2022 
2026  iterator
2027  begin();
2028 
2033  begin() const;
2034 
2038  iterator
2039  end();
2040 
2045  end() const;
2046 
2047 protected:
2058  reference
2059  el(const size_type i, const size_type j);
2060 
2076  el(const size_type i, const size_type j) const;
2077 
2078  // Make the AccessorBase class a friend so that it may directly index into
2079  // the array.
2081  TransposeTable<T>,
2082  true,
2085  TransposeTable<T>,
2086  false,
2087  MatrixTableIterators::Storage::column_major>;
2088 
2089  // Make the mutable accessor class a friend so that we can write to array
2090  // entries with iterators.
2091  friend class MatrixTableIterators::Accessor<
2092  TransposeTable<T>,
2093  false,
2094  MatrixTableIterators::Storage::column_major>;
2095 };
2096 
2097 
2098 
2099 /* --------------------- Template and inline functions ---------------- */
2100 
2101 #ifndef DOXYGEN
2102 
2103 template <int N, typename T>
2104 TableBase<N, T>::TableBase(const TableIndices<N> &sizes)
2105 {
2106  reinit(sizes);
2107 }
2108 
2109 
2110 
2111 template <int N, typename T>
2112 template <typename InputIterator>
2114  InputIterator entries,
2115  const bool C_style_indexing)
2116 {
2117  reinit(sizes);
2118  fill(entries, C_style_indexing);
2119 }
2120 
2121 
2122 
2123 template <int N, typename T>
2125  : Subscriptor()
2126 {
2127  reinit(src.table_size, true);
2128  values = src.values;
2129 }
2130 
2131 
2132 
2133 template <int N, typename T>
2134 template <typename T2>
2136 {
2137  reinit(src.table_size);
2138  if (src.n_elements() != 0)
2139  std::copy(src.values.begin(), src.values.end(), values.begin());
2140 }
2141 
2142 
2143 
2144 template <int N, typename T>
2146  : Subscriptor(std::move(src))
2147  , values(std::move(src.values))
2148  , table_size(src.table_size)
2149 {
2150  src.table_size = TableIndices<N>();
2151 }
2152 
2153 
2154 
2155 template <int N, typename T>
2156 template <class Archive>
2157 inline void
2158 TableBase<N, T>::serialize(Archive &ar, const unsigned int)
2159 {
2160  ar &static_cast<Subscriptor &>(*this);
2161 
2162  ar &values &table_size;
2163 }
2164 
2165 
2166 
2167 namespace internal
2168 {
2169  namespace TableBaseAccessors
2170  {
2171  template <int N, typename T, bool C, unsigned int P>
2172  inline Accessor<N, T, C, P>::Accessor(const TableType &table,
2173  const iterator data)
2174  : table(table)
2175  , data(data)
2176  {}
2177 
2178 
2179 
2180  template <int N, typename T, bool C, unsigned int P>
2181  inline Accessor<N, T, C, P>::Accessor(const Accessor &a)
2182  : table(a.table)
2183  , data(a.data)
2184  {}
2185 
2186 
2187 
2188  template <int N, typename T, bool C, unsigned int P>
2189  inline Accessor<N, T, C, P - 1> Accessor<N, T, C, P>::
2190  operator[](const size_type i) const
2191  {
2192  Assert(i < table.size()[N - P], ExcIndexRange(i, 0, table.size()[N - P]));
2193 
2194  // access i-th
2195  // subobject. optimize on the
2196  // case i==0
2197  if (i == 0)
2198  return Accessor<N, T, C, P - 1>(table, data);
2199  else
2200  {
2201  // note: P>1, otherwise the
2202  // specialization would have
2203  // been taken!
2204  size_type subobject_size = table.size()[N - 1];
2205  for (int p = P - 1; p > 1; --p)
2206  subobject_size *= table.size()[N - p];
2207  const iterator new_data = data + i * subobject_size;
2208  return Accessor<N, T, C, P - 1>(table, new_data);
2209  }
2210  }
2211 
2212 
2213 
2214  template <int N, typename T, bool C>
2215  inline Accessor<N, T, C, 1>::Accessor(const TableType &table,
2216  const iterator data)
2217  : table(table)
2218  , data(data)
2219  {}
2220 
2221 
2222 
2223  template <int N, typename T, bool C>
2224  inline Accessor<N, T, C, 1>::Accessor(const Accessor &a)
2225  : table(a.table)
2226  , data(a.data)
2227  {}
2228 
2229 
2230 
2231  template <int N, typename T, bool C>
2232  inline typename Accessor<N, T, C, 1>::reference Accessor<N, T, C, 1>::
2233  operator[](const size_type i) const
2234  {
2235  AssertIndexRange(i, table.size()[N - 1]);
2236  return *(data + i);
2237  }
2238 
2239 
2240 
2241  template <int N, typename T, bool C>
2242  inline typename Accessor<N, T, C, 1>::size_type
2243  Accessor<N, T, C, 1>::size() const
2244  {
2245  return table.size()[N - 1];
2246  }
2247 
2248 
2249 
2250  template <int N, typename T, bool C>
2251  inline typename Accessor<N, T, C, 1>::iterator
2252  Accessor<N, T, C, 1>::begin() const
2253  {
2254  return data;
2255  }
2256 
2257 
2258 
2259  template <int N, typename T, bool C>
2260  inline typename Accessor<N, T, C, 1>::iterator
2261  Accessor<N, T, C, 1>::end() const
2262  {
2263  return data + table.size()[N - 1];
2264  }
2265  } // namespace TableBaseAccessors
2266 } // namespace internal
2267 
2268 
2269 
2270 template <int N, typename T>
2271 inline TableBase<N, T> &
2273 {
2274  if (!m.empty())
2275  values = m.values;
2276  reinit(m.size(), true);
2277 
2278  return *this;
2279 }
2280 
2281 
2282 
2283 template <int N, typename T>
2284 template <typename T2>
2285 inline TableBase<N, T> &
2287 {
2288  reinit(m.size(), true);
2289  if (!empty())
2290  std::copy(m.values.begin(),
2291  m.values.begin() + n_elements(),
2292  values.begin());
2293 
2294  return *this;
2295 }
2296 
2297 
2298 
2299 template <int N, typename T>
2300 inline TableBase<N, T> &
2302 {
2303  static_cast<Subscriptor &>(*this) = std::move(m);
2304  values = std::move(m.values);
2305  table_size = m.table_size;
2307 
2308  return *this;
2309 }
2310 
2311 
2312 
2313 template <int N, typename T>
2314 inline bool
2316 {
2317  return (values == T2.values);
2318 }
2319 
2320 
2321 
2322 template <int N, typename T>
2323 inline void
2325 {
2326  // use parallel set operation
2327  if (n_elements() != 0)
2328  values.fill(T());
2329 }
2330 
2331 
2332 
2333 template <int N, typename T>
2334 inline void
2335 TableBase<N, T>::fill(const T &value)
2336 {
2337  if (n_elements() != 0)
2338  values.fill(value);
2339 }
2340 
2341 
2342 
2343 template <int N, typename T>
2344 inline void
2345 TableBase<N, T>::reinit(const TableIndices<N> &new_sizes,
2346  const bool omit_default_initialization)
2347 {
2348  table_size = new_sizes;
2349 
2350  const size_type new_size = n_elements();
2351 
2352  // if zero size was given: free all memory
2353  if (new_size == 0)
2354  {
2355  values.resize(0);
2356  // set all sizes to zero, even
2357  // if one was previously
2358  // nonzero. This simplifies
2359  // some assertions.
2361 
2362  return;
2363  }
2364 
2365  // adjust values field. If it was empty before, we can simply call resize(),
2366  // which can set all the data fields. Otherwise, select the fast resize and
2367  // manually fill in all the elements as required by the design of this
2368  // class. (Selecting another code for the empty case ensures that we touch
2369  // the memory only once for non-trivial classes that need to initialize the
2370  // memory also in resize_fast.)
2371  if (!omit_default_initialization)
2372  {
2373  if (values.empty())
2374  values.resize(new_size);
2375  else
2376  {
2377  values.resize_fast(new_size);
2378  values.fill();
2379  }
2380  }
2381  else
2382  values.resize_fast(new_size);
2383 }
2384 
2385 
2386 
2387 template <int N, typename T>
2388 inline const TableIndices<N> &
2389 TableBase<N, T>::size() const
2390 {
2391  return table_size;
2392 }
2393 
2394 
2395 
2396 template <int N, typename T>
2397 inline typename TableBase<N, T>::size_type
2398 TableBase<N, T>::size(const unsigned int i) const
2399 {
2400  Assert(i < N, ExcIndexRange(i, 0, N));
2401  return table_size[i];
2402 }
2403 
2404 
2405 
2406 template <int N, typename T>
2407 inline typename TableBase<N, T>::size_type
2409 {
2410  size_type s = 1;
2411  for (unsigned int n = 0; n < N; ++n)
2412  s *= table_size[n];
2413  return s;
2414 }
2415 
2416 
2417 
2418 template <int N, typename T>
2419 inline bool
2420 TableBase<N, T>::empty() const
2421 {
2422  return (n_elements() == 0);
2423 }
2424 
2425 
2426 
2427 namespace internal
2428 {
2429  namespace TableImplementation
2430  {
2431  template <typename InputIterator, typename T>
2432  void
2433  fill_Fortran_style(InputIterator entries, TableBase<1, T> &table)
2434  {
2435  using size_type = typename TableBase<1, T>::size_type;
2436  for (size_type i = 0; i < table.size()[0]; ++i)
2437  table(TableIndices<1>(i)) = *entries++;
2438  }
2439 
2440 
2441  template <typename InputIterator, typename T>
2442  void
2443  fill_Fortran_style(InputIterator entries, TableBase<2, T> &table)
2444  {
2445  using size_type = typename TableBase<2, T>::size_type;
2446  for (size_type j = 0; j < table.size()[1]; ++j)
2447  for (size_type i = 0; i < table.size()[0]; ++i)
2448  table(TableIndices<2>(i, j)) = *entries++;
2449  }
2450 
2451 
2452  template <typename InputIterator, typename T>
2453  void
2454  fill_Fortran_style(InputIterator entries, TableBase<3, T> &table)
2455  {
2456  using size_type = typename TableBase<3, T>::size_type;
2457  for (size_type k = 0; k < table.size()[2]; ++k)
2458  for (size_type j = 0; j < table.size()[1]; ++j)
2459  for (size_type i = 0; i < table.size()[0]; ++i)
2460  table(TableIndices<3>(i, j, k)) = *entries++;
2461  }
2462 
2463 
2464  template <typename InputIterator, typename T, int N>
2465  void
2466  fill_Fortran_style(InputIterator, TableBase<N, T> &)
2467  {
2468  Assert(false, ExcNotImplemented());
2469  }
2470  } // namespace TableImplementation
2471 } // namespace internal
2472 
2473 
2474 template <int N, typename T>
2475 template <typename InputIterator>
2476 inline void
2477 TableBase<N, T>::fill(InputIterator entries, const bool C_style_indexing)
2478 {
2479  Assert(n_elements() != 0, ExcMessage("Trying to fill an empty matrix."));
2480 
2481  if (C_style_indexing)
2482  for (typename AlignedVector<T>::iterator p = values.begin();
2483  p != values.end();
2484  ++p)
2485  *p = *entries++;
2486  else
2487  internal::TableImplementation::fill_Fortran_style(entries, *this);
2488 }
2489 
2490 
2491 
2492 template <int N, typename T>
2493 inline void
2495 {
2496  values.swap(v.values);
2498 }
2499 
2500 
2501 
2502 template <int N, typename T>
2503 inline std::size_t
2505 {
2506  return sizeof(*this) + MemoryConsumption::memory_consumption(values);
2507 }
2508 
2509 
2510 
2511 template <int N, typename T>
2512 inline typename TableBase<N, T>::size_type
2513 TableBase<N, T>::position(const TableIndices<N> &indices) const
2514 {
2515  // specialize this for the
2516  // different numbers of dimensions,
2517  // to make the job somewhat easier
2518  // for the compiler. have the
2519  // general formula nevertheless:
2520  switch (N)
2521  {
2522  case 1:
2523  return indices[0];
2524  case 2:
2525  return size_type(indices[0]) * table_size[1] + indices[1];
2526  case 3:
2527  return ((size_type(indices[0]) * table_size[1] + indices[1]) *
2528  table_size[2] +
2529  indices[2]);
2530  default:
2531  {
2532  unsigned int s = indices[0];
2533  for (unsigned int n = 1; n < N; ++n)
2534  s = s * table_size[n] + indices[n];
2535  return s;
2536  }
2537  }
2538 }
2539 
2540 
2541 
2542 template <int N, typename T>
2543 inline typename AlignedVector<T>::const_reference
2544 TableBase<N, T>::operator()(const TableIndices<N> &indices) const
2545 {
2546  for (unsigned int n = 0; n < N; ++n)
2547  AssertIndexRange(indices[n], table_size[n]);
2548  return el(indices);
2549 }
2550 
2551 
2552 
2553 template <int N, typename T>
2554 inline typename AlignedVector<T>::reference
2556 {
2557  for (unsigned int n = 0; n < N; ++n)
2558  AssertIndexRange(indices[n], table_size[n]);
2559  return el(indices);
2560 }
2561 
2562 
2563 
2564 template <int N, typename T>
2565 inline typename AlignedVector<T>::const_reference
2566 TableBase<N, T>::el(const TableIndices<N> &indices) const
2567 {
2568  return values[position(indices)];
2569 }
2570 
2571 
2572 
2573 template <int N, typename T>
2574 inline typename AlignedVector<T>::reference
2575 TableBase<N, T>::el(const TableIndices<N> &indices)
2576 {
2577  AssertIndexRange(position(indices), values.size());
2578  return values[position(indices)];
2579 }
2580 
2581 
2582 
2583 template <typename T>
2584 inline Table<1, T>::Table(const size_type size)
2585  : TableBase<1, T>(TableIndices<1>(size))
2586 {}
2587 
2588 
2589 
2590 template <typename T>
2591 template <typename InputIterator>
2592 inline Table<1, T>::Table(const size_type size,
2593  InputIterator entries,
2594  const bool C_style_indexing)
2595  : TableBase<1, T>(TableIndices<1>(size), entries, C_style_indexing)
2596 {}
2597 
2598 
2599 
2600 template <typename T>
2601 inline typename AlignedVector<T>::const_reference Table<1, T>::
2602  operator[](const size_type i) const
2603 {
2604  AssertIndexRange(i, this->table_size[0]);
2605  return this->values[i];
2606 }
2607 
2608 
2609 
2610 template <typename T>
2611 inline typename AlignedVector<T>::reference Table<1, T>::
2612  operator[](const size_type i)
2613 {
2614  AssertIndexRange(i, this->table_size[0]);
2615  return this->values[i];
2616 }
2617 
2618 
2619 
2620 template <typename T>
2621 inline typename AlignedVector<T>::const_reference
2622 Table<1, T>::operator()(const size_type i) const
2623 {
2624  AssertIndexRange(i, this->table_size[0]);
2625  return this->values[i];
2626 }
2627 
2628 
2629 
2630 template <typename T>
2631 inline typename AlignedVector<T>::reference
2633 {
2634  AssertIndexRange(i, this->table_size[0]);
2635  return this->values[i];
2636 }
2637 
2638 
2639 
2640 template <typename T>
2641 inline typename AlignedVector<T>::const_reference
2642 Table<1, T>::operator()(const TableIndices<1> &indices) const
2643 {
2644  return TableBase<1, T>::operator()(indices);
2645 }
2646 
2647 
2648 
2649 template <typename T>
2650 inline typename AlignedVector<T>::reference
2652 {
2653  return TableBase<1, T>::operator()(indices);
2654 }
2655 
2656 
2657 //---------------------------------------------------------------------------
2658 
2659 
2660 
2661 template <typename T>
2662 inline Table<2, T>::Table(const size_type size1, const size_type size2)
2663  : TableBase<2, T>(TableIndices<2>(size1, size2))
2664 {}
2665 
2666 
2667 
2668 template <typename T>
2669 template <typename InputIterator>
2670 inline Table<2, T>::Table(const size_type size1,
2671  const size_type size2,
2672  InputIterator entries,
2673  const bool C_style_indexing)
2674  : TableBase<2, T>(TableIndices<2>(size1, size2), entries, C_style_indexing)
2675 {}
2676 
2677 
2678 
2679 template <typename T>
2680 inline void
2681 Table<2, T>::reinit(const size_type size1,
2682  const size_type size2,
2683  const bool omit_default_initialization)
2684 {
2685  this->TableBase<2, T>::reinit(TableIndices<2>(size1, size2),
2686  omit_default_initialization);
2687 }
2688 
2689 
2690 
2691 template <typename T>
2692 inline ::internal::TableBaseAccessors::Accessor<2, T, true, 1>
2693  Table<2, T>::operator[](const size_type i) const
2694 {
2695  AssertIndexRange(i, this->table_size[0]);
2696  return ::internal::TableBaseAccessors::Accessor<2, T, true, 1>(
2697  *this, this->values.begin() + size_type(i) * n_cols());
2698 }
2699 
2700 
2701 
2702 template <typename T>
2703 inline ::internal::TableBaseAccessors::Accessor<2, T, false, 1>
2705 {
2706  AssertIndexRange(i, this->table_size[0]);
2707  return ::internal::TableBaseAccessors::Accessor<2, T, false, 1>(
2708  *this, this->values.begin() + size_type(i) * n_cols());
2709 }
2710 
2711 
2712 
2713 template <typename T>
2714 inline typename AlignedVector<T>::const_reference
2715 Table<2, T>::operator()(const size_type i, const size_type j) const
2716 {
2717  AssertIndexRange(i, this->table_size[0]);
2718  AssertIndexRange(j, this->table_size[1]);
2719  return this->values[size_type(i) * this->table_size[1] + j];
2720 }
2721 
2722 
2723 
2724 template <typename T>
2725 inline typename AlignedVector<T>::reference
2727 {
2728  AssertIndexRange(i, this->table_size[0]);
2729  AssertIndexRange(j, this->table_size[1]);
2730  return this->values[size_type(i) * this->table_size[1] + j];
2731 }
2732 
2733 
2734 
2735 template <typename T>
2736 inline typename AlignedVector<T>::const_reference
2737 Table<2, T>::operator()(const TableIndices<2> &indices) const
2738 {
2739  return TableBase<2, T>::operator()(indices);
2740 }
2741 
2742 
2743 
2744 template <typename T>
2745 inline typename AlignedVector<T>::reference
2747 {
2748  return TableBase<2, T>::operator()(indices);
2749 }
2750 
2751 
2752 
2753 template <typename T>
2754 inline typename AlignedVector<T>::const_reference
2755 Table<2, T>::el(const size_type i, const size_type j) const
2756 {
2757  return this->values[size_type(i) * this->table_size[1] + j];
2758 }
2759 
2760 
2761 
2762 template <typename T>
2763 inline typename AlignedVector<T>::reference
2764 Table<2, T>::el(const size_type i, const size_type j)
2765 {
2766  return this->values[size_type(i) * this->table_size[1] + j];
2767 }
2768 
2769 
2770 
2771 template <typename T>
2772 inline typename Table<2, T>::size_type
2773 Table<2, T>::n_rows() const
2774 {
2775  return this->table_size[0];
2776 }
2777 
2778 
2779 
2780 template <typename T>
2781 inline typename Table<2, T>::size_type
2782 Table<2, T>::n_cols() const
2783 {
2784  return this->table_size[1];
2785 }
2786 
2787 
2788 
2789 template <typename T>
2790 inline typename Table<2, T>::iterator
2792 {
2793  return typename Table<2, T>::iterator(this, 0, 0);
2794 }
2795 
2796 
2797 
2798 template <typename T>
2799 inline typename Table<2, T>::const_iterator
2800 Table<2, T>::begin() const
2801 {
2802  return typename Table<2, T>::const_iterator(this, 0, 0);
2803 }
2804 
2805 
2806 
2807 template <typename T>
2808 inline typename Table<2, T>::iterator
2810 {
2811  return typename Table<2, T>::iterator(this);
2812 }
2813 
2814 
2815 
2816 template <typename T>
2817 inline typename Table<2, T>::const_iterator
2818 Table<2, T>::end() const
2819 {
2820  return typename Table<2, T>::const_iterator(this);
2821 }
2822 
2823 
2824 
2825 //---------------------------------------------------------------------------
2826 namespace MatrixTableIterators
2827 {
2828  namespace internal
2829  {
2830  // Internal calculation routines for AccessorBase. These do not do any
2831  // checking whatsoever.
2832  template <typename TableType, Storage storage_order>
2833  inline std::ptrdiff_t
2834  get_row_index(const std::ptrdiff_t linear_index,
2835  const TableType *const container)
2836  {
2837  switch (storage_order)
2838  {
2839  case Storage::row_major:
2840  return linear_index / container->n_cols();
2841  case Storage::column_major:
2842  return linear_index % container->n_rows();
2843  default:
2844  Assert(false, ExcInternalError());
2845  }
2846  return {};
2847  }
2848 
2849 
2850 
2851  template <typename TableType, Storage storage_order>
2852  inline std::ptrdiff_t
2853  get_column_index(const std::ptrdiff_t linear_index,
2854  const TableType *const container)
2855  {
2856  switch (storage_order)
2857  {
2858  case Storage::row_major:
2859  return linear_index % container->n_cols();
2860  case Storage::column_major:
2861  return linear_index / container->n_rows();
2862  default:
2863  Assert(false, ExcInternalError());
2864  }
2865  return {};
2866  }
2867  } // namespace internal
2868 
2869 
2870 
2871  template <typename TableType, bool Constness, Storage storage_order>
2872  inline AccessorBase<TableType, Constness, storage_order>::AccessorBase()
2873  : container(nullptr)
2874  , linear_index(std::numeric_limits<decltype(linear_index)>::max())
2875  {}
2876 
2877 
2878 
2879  template <typename TableType, bool Constness, Storage storage_order>
2880  inline AccessorBase<TableType, Constness, storage_order>::AccessorBase(
2881  const container_pointer_type table)
2882  : container(table)
2883  , linear_index(container->values.size())
2884  {}
2885 
2886 
2887 
2888  template <typename TableType, bool Constness, Storage storage_order>
2889  inline AccessorBase<TableType, Constness, storage_order>::AccessorBase(
2890  const AccessorBase<TableType, false, storage_order> &a)
2891  : container(a.container)
2892  , linear_index(a.linear_index)
2893  {}
2894 
2895 
2896 
2897  template <typename TableType, bool Constness, Storage storage_order>
2898  inline AccessorBase<TableType, Constness, storage_order>::AccessorBase(
2899  const container_pointer_type table,
2900  const std::ptrdiff_t index)
2901  : container(table)
2902  , linear_index(index)
2903  {
2904  Assert(0 <= linear_index &&
2905  std::size_t(linear_index) < container->values.size() + 1,
2906  ExcMessage("The current iterator points outside of the table and is "
2907  "not the end iterator."));
2908  }
2909 
2910 
2911 
2912  template <typename TableType, bool Constness, Storage storage_order>
2913  inline const typename AccessorBase<TableType, Constness, storage_order>::
2914  value_type &
2915  AccessorBase<TableType, Constness, storage_order>::value() const
2916  {
2917  assert_valid_linear_index();
2918  return this->container->values[linear_index];
2919  }
2920 
2921 
2922 
2923  template <typename TableType, bool Constness, Storage storage_order>
2924  inline AccessorBase<TableType, Constness, storage_order>::
2925  operator const value_type &() const
2926  {
2927  assert_valid_linear_index();
2928  return this->container->values[linear_index];
2929  }
2930 
2931 
2932 
2933  template <typename TableType, bool Constness, Storage storage_order>
2934  inline typename AccessorBase<TableType, Constness, storage_order>::size_type
2935  AccessorBase<TableType, Constness, storage_order>::row() const
2936  {
2937  assert_valid_linear_index();
2938  return static_cast<std::size_t>(
2939  internal::get_row_index<TableType, storage_order>(linear_index,
2940  container));
2941  }
2942 
2943 
2944 
2945  template <typename TableType, bool Constness, Storage storage_order>
2946  inline typename AccessorBase<TableType, Constness, storage_order>::size_type
2947  AccessorBase<TableType, Constness, storage_order>::column() const
2948  {
2949  assert_valid_linear_index();
2950  return static_cast<std::size_t>(
2951  internal::get_column_index<TableType, storage_order>(linear_index,
2952  container));
2953  }
2954 
2955 
2956 
2957  template <typename TableType, bool Constness, Storage storage_order>
2958  inline void
2959  AccessorBase<TableType, Constness, storage_order>::assert_valid_linear_index()
2960  const
2961  {
2962 # ifdef DEBUG // avoid unused variable warnings by guarding everything
2963  Assert(container != nullptr,
2964  ExcMessage("This accessor has been default-constructed and does not "
2965  "have a corresponding table."));
2966  Assert(!container->empty(),
2967  ExcMessage("An empty table has no rows or columns."));
2968  Assert(0 <= linear_index &&
2969  std::size_t(linear_index) < container->values.size(),
2970  ExcMessage("The current iterator points outside of the table."));
2971  const std::ptrdiff_t row_n =
2972  internal::get_row_index<TableType, storage_order>(linear_index,
2973  container);
2974  const std::ptrdiff_t column_n =
2975  internal::get_column_index<TableType, storage_order>(linear_index,
2976  container);
2977  Assert(0 <= column_n && std::size_t(column_n) < container->n_cols(),
2978  ExcMessage("The current iterator points outside the table."));
2979  Assert(0 <= row_n && std::size_t(row_n) < container->n_rows(),
2980  ExcMessage("The current iterator points outside the table."));
2981 # endif
2982  }
2983 
2984 
2985 
2986  template <typename TableType, Storage storage_order>
2987  inline const Accessor<TableType, false, storage_order> &
2988  Accessor<TableType, false, storage_order>::operator=(
2989  const typename Accessor<TableType, false, storage_order>::value_type &t)
2990  const
2991  {
2992  this->assert_valid_linear_index();
2993  this->container->values[this->linear_index] = t;
2994  return *this;
2995  }
2996 
2997 
2998 
2999  template <typename TableType, Storage storage_order>
3000  inline const Accessor<TableType, false, storage_order> &
3001  Accessor<TableType, false, storage_order>::operator=(
3002  typename Accessor<TableType, false, storage_order>::value_type &&t) const
3003  {
3004  this->assert_valid_linear_index();
3005  this->container->values[this->linear_index] = t;
3006  return *this;
3007  }
3008 
3009 
3010 
3011  template <typename TableType, Storage storage_order>
3012  inline typename Accessor<TableType, false, storage_order>::value_type &
3013  Accessor<TableType, false, storage_order>::value() const
3014  {
3015  this->assert_valid_linear_index();
3016  return this->container->values[this->linear_index];
3017  }
3018 
3019 
3020 
3021  template <typename TableType, Storage storage_order>
3022  inline Accessor<TableType, false, storage_order>::operator value_type &()
3023  {
3024  this->assert_valid_linear_index();
3025  return this->container->values[this->linear_index];
3026  }
3027 
3028 
3029 
3030  template <typename TableType, bool Constness, Storage storage_order>
3031  inline Iterator<TableType, Constness, storage_order>::Iterator(
3032  const Accessor<TableType, Constness, storage_order> &a)
3033  : LinearIndexIterator<Iterator<TableType, Constness, storage_order>,
3034  Accessor<TableType, Constness, storage_order>>(a)
3035  {}
3036 
3037 
3038 
3039  template <typename TableType, bool Constness, Storage storage_order>
3040  inline Iterator<TableType, Constness, storage_order>::Iterator(
3041  const container_pointer_type table)
3042  : LinearIndexIterator<Iterator<TableType, Constness, storage_order>,
3043  Accessor<TableType, Constness, storage_order>>(
3044  Accessor<TableType, Constness, storage_order>(table))
3045  {}
3046 
3047 
3048 
3049  template <typename TableType, bool Constness, Storage storage_order>
3050  inline Iterator<TableType, Constness, storage_order>::Iterator(
3051  const Iterator<TableType, false, storage_order> &i)
3052  : LinearIndexIterator<Iterator<TableType, Constness, storage_order>,
3053  Accessor<TableType, Constness, storage_order>>(*i)
3054  {}
3055 
3056 
3057 
3058  template <typename TableType, bool Constness, Storage storage_order>
3059  inline Iterator<TableType, Constness, storage_order>::Iterator(
3060  const container_pointer_type table,
3061  const size_type row_n,
3062  const size_type col_n)
3063  : Iterator(table,
3064  storage_order == Storage::row_major ?
3065  table->n_cols() * row_n + col_n :
3066  table->n_rows() * col_n + row_n)
3067  {}
3068 
3069 
3070 
3071  template <typename TableType, bool Constness, Storage storage_order>
3072  inline Iterator<TableType, Constness, storage_order>::Iterator(
3073  const container_pointer_type table,
3074  const std::ptrdiff_t linear_index)
3075  : LinearIndexIterator<Iterator<TableType, Constness, storage_order>,
3076  Accessor<TableType, Constness, storage_order>>(
3077  Accessor<TableType, Constness, storage_order>(table, linear_index))
3078  {}
3079 } // namespace MatrixTableIterators
3080 
3081 
3082 
3083 //---------------------------------------------------------------------------
3084 template <typename T>
3085 inline TransposeTable<T>::TransposeTable(const size_type size1,
3086  const size_type size2)
3087  : TableBase<2, T>(TableIndices<2>(size2, size1))
3088 {}
3089 
3090 
3091 
3092 template <typename T>
3093 inline void
3095  const size_type size2,
3096  const bool omit_default_initialization)
3097 {
3098  this->TableBase<2, T>::reinit(TableIndices<2>(size2, size1),
3099  omit_default_initialization);
3100 }
3101 
3102 
3103 
3104 template <typename T>
3105 inline typename TransposeTable<T>::const_reference
3106 TransposeTable<T>::operator()(const size_type i, const size_type j) const
3107 {
3108  AssertIndexRange(i, this->table_size[1]);
3109  AssertIndexRange(j, this->table_size[0]);
3110  return this->values[size_type(j) * this->table_size[1] + i];
3111 }
3112 
3113 
3114 
3115 template <typename T>
3116 inline typename TransposeTable<T>::reference
3118 {
3119  AssertIndexRange(i, this->table_size[1]);
3120  AssertIndexRange(j, this->table_size[0]);
3121  return this->values[size_type(j) * this->table_size[1] + i];
3122 }
3123 
3124 
3125 
3126 template <typename T>
3127 inline typename TransposeTable<T>::const_reference
3128 TransposeTable<T>::el(const size_type i, const size_type j) const
3129 {
3130  return this->values[size_type(j) * this->table_size[1] + i];
3131 }
3132 
3133 
3134 
3135 template <typename T>
3136 inline typename TransposeTable<T>::reference
3137 TransposeTable<T>::el(const size_type i, const size_type j)
3138 {
3139  return this->values[size_type(j) * this->table_size[1] + i];
3140 }
3141 
3142 
3143 
3144 template <typename T>
3145 inline typename TransposeTable<T>::size_type
3147 {
3148  return this->table_size[1];
3149 }
3150 
3151 
3152 
3153 template <typename T>
3154 inline typename TransposeTable<T>::size_type
3156 {
3157  return this->table_size[0];
3158 }
3159 
3160 
3161 
3162 template <typename T>
3163 inline typename TransposeTable<T>::iterator
3165 {
3166  return typename TransposeTable<T>::iterator(this, 0, 0);
3167 }
3168 
3169 
3170 
3171 template <typename T>
3172 inline typename TransposeTable<T>::const_iterator
3174 {
3175  return typename TransposeTable<T>::const_iterator(this, 0, 0);
3176 }
3177 
3178 
3179 
3180 template <typename T>
3181 inline typename TransposeTable<T>::iterator
3183 {
3184  return typename TransposeTable<T>::iterator(this);
3185 }
3186 
3187 
3188 
3189 template <typename T>
3190 inline typename TransposeTable<T>::const_iterator
3191 TransposeTable<T>::end() const
3192 {
3193  return typename TransposeTable<T>::const_iterator(this);
3194 }
3195 //---------------------------------------------------------------------------
3196 
3197 
3198 
3199 template <typename T>
3200 inline Table<3, T>::Table(const size_type size1,
3201  const size_type size2,
3202  const size_type size3)
3203  : TableBase<3, T>(TableIndices<3>(size1, size2, size3))
3204 {}
3205 
3206 
3207 
3208 template <typename T>
3209 template <typename InputIterator>
3210 inline Table<3, T>::Table(const size_type size1,
3211  const size_type size2,
3212  const size_type size3,
3213  InputIterator entries,
3214  const bool C_style_indexing)
3215  : TableBase<3, T>(TableIndices<3>(size1, size2, size3),
3216  entries,
3217  C_style_indexing)
3218 {}
3219 
3220 
3221 
3222 template <typename T>
3223 inline ::internal::TableBaseAccessors::Accessor<3, T, true, 2>
3224  Table<3, T>::operator[](const size_type i) const
3225 {
3226  AssertIndexRange(i, this->table_size[0]);
3227  const size_type subobject_size =
3228  size_type(this->table_size[1]) * this->table_size[2];
3229  return (::internal::TableBaseAccessors::Accessor<3, T, true, 2>(
3230  *this, this->values.begin() + i * subobject_size));
3231 }
3232 
3233 
3234 
3235 template <typename T>
3236 inline ::internal::TableBaseAccessors::Accessor<3, T, false, 2>
3238 {
3239  AssertIndexRange(i, this->table_size[0]);
3240  const size_type subobject_size =
3241  size_type(this->table_size[1]) * this->table_size[2];
3242  return (::internal::TableBaseAccessors::Accessor<3, T, false, 2>(
3243  *this, this->values.begin() + i * subobject_size));
3244 }
3245 
3246 
3247 
3248 template <typename T>
3249 inline typename AlignedVector<T>::const_reference
3251 operator()(const size_type i, const size_type j, const size_type k) const
3252 {
3253  AssertIndexRange(i, this->table_size[0]);
3254  AssertIndexRange(j, this->table_size[1]);
3255  AssertIndexRange(k, this->table_size[2]);
3256  return this
3257  ->values[(size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3258  k];
3259 }
3260 
3261 
3262 
3263 template <typename T>
3264 inline typename AlignedVector<T>::reference
3265 Table<3, T>::operator()(const size_type i, const size_type j, const size_type k)
3266 {
3267  AssertIndexRange(i, this->table_size[0]);
3268  AssertIndexRange(j, this->table_size[1]);
3269  AssertIndexRange(k, this->table_size[2]);
3270  return this
3271  ->values[(size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3272  k];
3273 }
3274 
3275 
3276 
3277 template <typename T>
3278 inline typename AlignedVector<T>::const_reference
3279 Table<3, T>::operator()(const TableIndices<3> &indices) const
3280 {
3281  return TableBase<3, T>::operator()(indices);
3282 }
3283 
3284 
3285 
3286 template <typename T>
3287 inline typename AlignedVector<T>::reference
3289 {
3290  return TableBase<3, T>::operator()(indices);
3291 }
3292 
3293 
3294 
3295 template <typename T>
3296 inline Table<4, T>::Table(const size_type size1,
3297  const size_type size2,
3298  const size_type size3,
3299  const size_type size4)
3300  : TableBase<4, T>(TableIndices<4>(size1, size2, size3, size4))
3301 {}
3302 
3303 
3304 
3305 template <typename T>
3306 inline ::internal::TableBaseAccessors::Accessor<4, T, true, 3>
3307  Table<4, T>::operator[](const size_type i) const
3308 {
3309  AssertIndexRange(i, this->table_size[0]);
3310  const size_type subobject_size =
3311  size_type(this->table_size[1]) * this->table_size[2] * this->table_size[3];
3312  return (::internal::TableBaseAccessors::Accessor<4, T, true, 3>(
3313  *this, this->values.begin() + i * subobject_size));
3314 }
3315 
3316 
3317 
3318 template <typename T>
3319 inline ::internal::TableBaseAccessors::Accessor<4, T, false, 3>
3321 {
3322  AssertIndexRange(i, this->table_size[0]);
3323  const size_type subobject_size =
3324  size_type(this->table_size[1]) * this->table_size[2] * this->table_size[3];
3325  return (::internal::TableBaseAccessors::Accessor<4, T, false, 3>(
3326  *this, this->values.begin() + i * subobject_size));
3327 }
3328 
3329 
3330 
3331 template <typename T>
3332 inline typename AlignedVector<T>::const_reference
3334  const size_type j,
3335  const size_type k,
3336  const size_type l) const
3337 {
3338  AssertIndexRange(i, this->table_size[0]);
3339  AssertIndexRange(j, this->table_size[1]);
3340  AssertIndexRange(k, this->table_size[2]);
3341  AssertIndexRange(l, this->table_size[3]);
3342  return this
3343  ->values[((size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3344  k) *
3345  this->table_size[3] +
3346  l];
3347 }
3348 
3349 
3350 
3351 template <typename T>
3352 inline typename AlignedVector<T>::reference
3354  const size_type j,
3355  const size_type k,
3356  const size_type l)
3357 {
3358  AssertIndexRange(i, this->table_size[0]);
3359  AssertIndexRange(j, this->table_size[1]);
3360  AssertIndexRange(k, this->table_size[2]);
3361  AssertIndexRange(l, this->table_size[3]);
3362  return this
3363  ->values[((size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3364  k) *
3365  this->table_size[3] +
3366  l];
3367 }
3368 
3369 
3370 
3371 template <typename T>
3372 inline typename AlignedVector<T>::const_reference
3373 Table<4, T>::operator()(const TableIndices<4> &indices) const
3374 {
3375  return TableBase<4, T>::operator()(indices);
3376 }
3377 
3378 
3379 
3380 template <typename T>
3381 inline typename AlignedVector<T>::reference
3383 {
3384  return TableBase<4, T>::operator()(indices);
3385 }
3386 
3387 
3388 
3389 template <typename T>
3390 inline Table<5, T>::Table(const size_type size1,
3391  const size_type size2,
3392  const size_type size3,
3393  const size_type size4,
3394  const size_type size5)
3395  : TableBase<5, T>(TableIndices<5>(size1, size2, size3, size4, size5))
3396 {}
3397 
3398 
3399 
3400 template <typename T>
3401 inline ::internal::TableBaseAccessors::Accessor<5, T, true, 4>
3402  Table<5, T>::operator[](const size_type i) const
3403 {
3404  AssertIndexRange(i, this->table_size[0]);
3405  const size_type subobject_size = size_type(this->table_size[1]) *
3406  this->table_size[2] * this->table_size[3] *
3407  this->table_size[4];
3408  return (::internal::TableBaseAccessors::Accessor<5, T, true, 4>(
3409  *this, this->values.begin() + i * subobject_size));
3410 }
3411 
3412 
3413 
3414 template <typename T>
3415 inline ::internal::TableBaseAccessors::Accessor<5, T, false, 4>
3417 {
3418  AssertIndexRange(i, this->table_size[0]);
3419  const size_type subobject_size = size_type(this->table_size[1]) *
3420  this->table_size[2] * this->table_size[3] *
3421  this->table_size[4];
3422  return (::internal::TableBaseAccessors::Accessor<5, T, false, 4>(
3423  *this, this->values.begin() + i * subobject_size));
3424 }
3425 
3426 
3427 
3428 template <typename T>
3429 inline typename AlignedVector<T>::const_reference
3431  const size_type j,
3432  const size_type k,
3433  const size_type l,
3434  const size_type m) const
3435 {
3436  AssertIndexRange(i, this->table_size[0]);
3437  AssertIndexRange(j, this->table_size[1]);
3438  AssertIndexRange(k, this->table_size[2]);
3439  AssertIndexRange(l, this->table_size[3]);
3440  AssertIndexRange(m, this->table_size[4]);
3441  return this
3442  ->values[(((size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3443  k) *
3444  this->table_size[3] +
3445  l) *
3446  this->table_size[4] +
3447  m];
3448 }
3449 
3450 
3451 
3452 template <typename T>
3453 inline typename AlignedVector<T>::reference
3455  const size_type j,
3456  const size_type k,
3457  const size_type l,
3458  const size_type m)
3459 {
3460  AssertIndexRange(i, this->table_size[0]);
3461  AssertIndexRange(j, this->table_size[1]);
3462  AssertIndexRange(k, this->table_size[2]);
3463  AssertIndexRange(l, this->table_size[3]);
3464  AssertIndexRange(m, this->table_size[4]);
3465  return this
3466  ->values[(((size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3467  k) *
3468  this->table_size[3] +
3469  l) *
3470  this->table_size[4] +
3471  m];
3472 }
3473 
3474 
3475 
3476 template <typename T>
3477 inline typename AlignedVector<T>::const_reference
3478 Table<5, T>::operator()(const TableIndices<5> &indices) const
3479 {
3480  return TableBase<5, T>::operator()(indices);
3481 }
3482 
3483 
3484 
3485 template <typename T>
3486 inline typename AlignedVector<T>::reference
3488 {
3489  return TableBase<5, T>::operator()(indices);
3490 }
3491 
3492 
3493 
3494 template <typename T>
3495 inline Table<6, T>::Table(const size_type size1,
3496  const size_type size2,
3497  const size_type size3,
3498  const size_type size4,
3499  const size_type size5,
3500  const size_type size6)
3501  : TableBase<6, T>()
3502 {
3503  TableIndices<6> table_indices;
3504  table_indices[0] = size1;
3505  table_indices[1] = size2;
3506  table_indices[2] = size3;
3507  table_indices[3] = size4;
3508  table_indices[4] = size5;
3509  table_indices[5] = size6;
3510 
3511  TableBase<6, T>::reinit(table_indices);
3512 }
3513 
3514 
3515 
3516 template <typename T>
3517 inline ::internal::TableBaseAccessors::Accessor<6, T, true, 5>
3518  Table<6, T>::operator[](const size_type i) const
3519 {
3520  AssertIndexRange(i, this->table_size[0]);
3521  const size_type subobject_size = size_type(this->table_size[1]) *
3522  this->table_size[2] * this->table_size[3] *
3523  this->table_size[4] * this->table_size[5];
3524  return (::internal::TableBaseAccessors::Accessor<6, T, true, 5>(
3525  *this, this->values.begin() + i * subobject_size));
3526 }
3527 
3528 
3529 
3530 template <typename T>
3531 inline ::internal::TableBaseAccessors::Accessor<6, T, false, 5>
3533 {
3534  AssertIndexRange(i, this->table_size[0]);
3535  const size_type subobject_size = size_type(this->table_size[1]) *
3536  this->table_size[2] * this->table_size[3] *
3537  this->table_size[4] * this->table_size[5];
3538  return (::internal::TableBaseAccessors::Accessor<6, T, false, 5>(
3539  *this, this->values.begin() + i * subobject_size));
3540 }
3541 
3542 
3543 
3544 template <typename T>
3545 inline typename AlignedVector<T>::const_reference
3547  const size_type j,
3548  const size_type k,
3549  const size_type l,
3550  const size_type m,
3551  const size_type n) const
3552 {
3553  AssertIndexRange(i, this->table_size[0]);
3554  AssertIndexRange(j, this->table_size[1]);
3555  AssertIndexRange(k, this->table_size[2]);
3556  AssertIndexRange(l, this->table_size[3]);
3557  AssertIndexRange(m, this->table_size[4]);
3558  AssertIndexRange(n, this->table_size[5]);
3559  return this
3560  ->values[((((size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3561  k) *
3562  this->table_size[3] +
3563  l) *
3564  this->table_size[4] +
3565  m) *
3566  this->table_size[5] +
3567  n];
3568 }
3569 
3570 
3571 
3572 template <typename T>
3573 inline typename AlignedVector<T>::reference
3575  const size_type j,
3576  const size_type k,
3577  const size_type l,
3578  const size_type m,
3579  const size_type n)
3580 {
3581  AssertIndexRange(i, this->table_size[0]);
3582  AssertIndexRange(j, this->table_size[1]);
3583  AssertIndexRange(k, this->table_size[2]);
3584  AssertIndexRange(l, this->table_size[3]);
3585  AssertIndexRange(m, this->table_size[4]);
3586  AssertIndexRange(n, this->table_size[5]);
3587  return this
3588  ->values[((((size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3589  k) *
3590  this->table_size[3] +
3591  l) *
3592  this->table_size[4] +
3593  m) *
3594  this->table_size[5] +
3595  n];
3596 }
3597 
3598 
3599 
3600 template <typename T>
3601 inline typename AlignedVector<T>::const_reference
3602 Table<6, T>::operator()(const TableIndices<6> &indices) const
3603 {
3604  return TableBase<6, T>::operator()(indices);
3605 }
3606 
3607 
3608 
3609 template <typename T>
3610 inline typename AlignedVector<T>::reference
3612 {
3613  return TableBase<6, T>::operator()(indices);
3614 }
3615 
3616 
3617 
3618 template <typename T>
3619 inline Table<7, T>::Table(const size_type size1,
3620  const size_type size2,
3621  const size_type size3,
3622  const size_type size4,
3623  const size_type size5,
3624  const size_type size6,
3625  const size_type size7)
3626  : TableBase<7, T>()
3627 {
3628  TableIndices<7> table_indices;
3629  table_indices[0] = size1;
3630  table_indices[1] = size2;
3631  table_indices[2] = size3;
3632  table_indices[3] = size4;
3633  table_indices[4] = size5;
3634  table_indices[5] = size6;
3635  table_indices[6] = size7;
3636 
3637  TableBase<7, T>::reinit(table_indices);
3638 }
3639 
3640 
3641 
3642 template <typename T>
3643 inline ::internal::TableBaseAccessors::Accessor<7, T, true, 6>
3644  Table<7, T>::operator[](const size_type i) const
3645 {
3646  AssertIndexRange(i, this->table_size[0]);
3647  const size_type subobject_size =
3648  size_type(this->table_size[1]) * this->table_size[2] * this->table_size[3] *
3649  this->table_size[4] * this->table_size[5] * this->table_size[6];
3650  return (::internal::TableBaseAccessors::Accessor<7, T, true, 6>(
3651  *this, this->values.begin() + i * subobject_size));
3652 }
3653 
3654 
3655 
3656 template <typename T>
3657 inline ::internal::TableBaseAccessors::Accessor<7, T, false, 6>
3659 {
3660  AssertIndexRange(i, this->table_size[0]);
3661  const size_type subobject_size =
3662  size_type(this->table_size[1]) * this->table_size[2] * this->table_size[3] *
3663  this->table_size[4] * this->table_size[5] * this->table_size[6];
3664  return (::internal::TableBaseAccessors::Accessor<7, T, false, 6>(
3665  *this, this->values.begin() + i * subobject_size));
3666 }
3667 
3668 
3669 
3670 template <typename T>
3671 inline typename AlignedVector<T>::const_reference
3673  const size_type j,
3674  const size_type k,
3675  const size_type l,
3676  const size_type m,
3677  const size_type n,
3678  const size_type o) const
3679 {
3680  AssertIndexRange(i, this->table_size[0]);
3681  AssertIndexRange(j, this->table_size[1]);
3682  AssertIndexRange(k, this->table_size[2]);
3683  AssertIndexRange(l, this->table_size[3]);
3684  AssertIndexRange(m, this->table_size[4]);
3685  AssertIndexRange(n, this->table_size[5]);
3686  AssertIndexRange(o, this->table_size[6]);
3687  return this->values
3688  [(((((size_type(i) * this->table_size[1] + j) * this->table_size[2] + k) *
3689  this->table_size[3] +
3690  l) *
3691  this->table_size[4] +
3692  m) *
3693  this->table_size[5] +
3694  n) *
3695  this->table_size[6] +
3696  o];
3697 }
3698 
3699 
3700 
3701 template <typename T>
3702 inline typename AlignedVector<T>::reference
3704  const size_type j,
3705  const size_type k,
3706  const size_type l,
3707  const size_type m,
3708  const size_type n,
3709  const size_type o)
3710 {
3711  AssertIndexRange(i, this->table_size[0]);
3712  AssertIndexRange(j, this->table_size[1]);
3713  AssertIndexRange(k, this->table_size[2]);
3714  AssertIndexRange(l, this->table_size[3]);
3715  AssertIndexRange(m, this->table_size[4]);
3716  AssertIndexRange(n, this->table_size[5]);
3717  AssertIndexRange(o, this->table_size[6]);
3718  return this->values
3719  [(((((size_type(i) * this->table_size[1] + j) * this->table_size[2] + k) *
3720  this->table_size[3] +
3721  l) *
3722  this->table_size[4] +
3723  m) *
3724  this->table_size[5] +
3725  n) *
3726  this->table_size[6] +
3727  o];
3728 }
3729 
3730 
3731 
3732 template <typename T>
3733 inline typename AlignedVector<T>::const_reference
3734 Table<7, T>::operator()(const TableIndices<7> &indices) const
3735 {
3736  return TableBase<7, T>::operator()(indices);
3737 }
3738 
3739 
3740 
3741 template <typename T>
3742 inline typename AlignedVector<T>::reference
3744 {
3745  return TableBase<7, T>::operator()(indices);
3746 }
3747 
3748 
3749 #endif // DOXYGEN
3750 
3751 
3752 
3760 template <int N, typename T>
3761 inline void
3763 {
3764  u.swap(v);
3765 }
3766 
3767 DEAL_II_NAMESPACE_CLOSE
3768 
3769 #endif
bool operator==(const TableBase< N, T > &T2) const
typename TableBase< 3, T >::size_type size_type
Definition: table.h:1382
size_type position(const TableIndices< N > &indices) const
Storage
Enumeration describing the storage order (i.e., the in-memory layout) of a table class.
Definition: table.h:833
void serialize(Archive &ar, const unsigned int version)
void swap(TableBase< N, T > &v)
typename TableBase< 2, T >::size_type size_type
Definition: table.h:1937
MatrixTableIterators::Iterator< TransposeTable< T >, true, MatrixTableIterators::Storage::column_major > const_iterator
Definition: table.h:1961
const TableIndices< N > & size() const
typename TableBase< 6, T >::size_type size_type
Definition: table.h:1705
typename AccessorBase< TableType, true, storage_order >::value_type value_type
Definition: table.h:1007
size_type n_cols() const
typename AlignedVector< number >::reference reference
Definition: table.h:1947
typename std::conditional< Constness, const TableType *, TableType * >::type container_pointer_type
Definition: table.h:881
#define AssertIndexRange(index, range)
Definition: exceptions.h:1637
size_type n_rows() const
STL namespace.
typename TableBase< 2, T >::size_type size_type
Definition: table.h:1134
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
size_type n_elements() const
typename TableBase< 1, T >::size_type size_type
Definition: table.h:722
SymmetricTensor< 2, dim, Number > C(const Tensor< 2, dim, Number > &F)
typename AlignedVector< T >::const_reference const_reference
Definition: table.h:1149
typename TableBase< 4, T >::size_type size_type
Definition: table.h:1514
MatrixTableIterators::Iterator< TransposeTable< T >, false, MatrixTableIterators::Storage::column_major > iterator
Definition: table.h:1969
typename AccessorBase< TableType, true, storage_order >::size_type size_type
Definition: table.h:1013
static ::ExceptionBase & ExcMessage(std::string arg1)
iterator end()
iterator begin()
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
typename AccessorBase< TableType, true, storage_order >::value_type value_type
Definition: table.h:980
#define Assert(cond, exc)
Definition: exceptions.h:1407
typename AccessorBase< TableType, true, storage_order >::size_type size_type
Definition: table.h:986
Accessor base class for Table<2, T> and TransposeTable.
Definition: table.h:874
void reinit(const size_type size1, const size_type size2, const bool omit_default_initialization=false)
AlignedVector< T >::reference el(const TableIndices< N > &indices)
container_pointer_type container
Definition: table.h:942
typename TableType::size_type size_type
Definition: table.h:1074
TableBase()=default
Accessor class offering read and write access to the elements of a table.
Definition: table.h:999
void swap(Vector< Number > &u, Vector< Number > &v)
Definition: vector.h:1376
Iterator class for both matrix-like tables, i.e., Table<2, T> and TransposeTable. ...
Definition: table.h:848
size_type size(const unsigned int i) const
TableBase< N, T > & operator=(const TableBase< N, T > &src)
typename AlignedVector< Tensor< 1, dim > >::size_type size_type
Definition: table.h:420
std::size_t memory_consumption() const
typename TableBase< 5, T >::size_type size_type
Definition: table.h:1608
void reset_values()
typename AlignedVector< T >::reference reference
Definition: table.h:1144
TransposeTable()=default
typename AlignedVector< T >::value_type value_type
Definition: table.h:1139
reference el(const size_type i, const size_type j)
static ::ExceptionBase & ExcNotImplemented()
Definition: table.h:699
bool empty() const
TableIndices< N > table_size
Definition: table.h:677
#define DeclException3(Exception3, type1, type2, type3, outsequence)
Definition: exceptions.h:564
const_reference operator()(const size_type i, const size_type j) const
AlignedVector< T >::reference operator()(const TableIndices< N > &indices)
AlignedVector< T > values
Definition: table.h:672
Accessor class template. This class is partially specialized for both values of Constness.
Definition: table.h:855
typename TableBase< 7, T >::size_type size_type
Definition: table.h:1803
void fill(InputIterator entries, const bool C_style_indexing=true)
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
typename AlignedVector< number >::const_reference const_reference
Definition: table.h:1952
typename std::conditional< Constness, const TableType *, TableType * >::type container_pointer_type
Definition: table.h:1080
static ::ExceptionBase & ExcInternalError()