Reference documentation for deal.II version 9.1.1
\(\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 template <int N, typename T>
35 class TableBase;
36 template <int N, typename T>
37 class Table;
38 template <typename T>
40 template <typename T>
41 class Table<1, T>;
42 template <typename T>
43 class Table<2, T>;
44 template <typename T>
45 class Table<3, T>;
46 template <typename T>
47 class Table<4, T>;
48 template <typename T>
49 class Table<5, T>;
50 template <typename T>
51 class Table<6, T>;
52 
53 
54 
55 namespace internal
56 {
73  namespace TableBaseAccessors
74  {
82  template <int N, typename T, bool Constness>
83  struct Types
84  {};
85 
91  template <int N, typename T>
92  struct Types<N, T, true>
93  {
94  using value_type = const T;
95  using TableType = const TableBase<N, T>;
96 
97  using iterator = typename AlignedVector<T>::const_iterator;
98  using const_iterator = typename AlignedVector<T>::const_iterator;
99 
100  using reference = typename AlignedVector<T>::const_reference;
101  using const_reference = typename AlignedVector<T>::const_reference;
102  };
103 
109  template <int N, typename T>
110  struct Types<N, T, false>
111  {
112  using value_type = T;
113  using TableType = TableBase<N, T>;
114 
115  using iterator = typename AlignedVector<T>::iterator;
116  using const_iterator = typename AlignedVector<T>::const_iterator;
117 
118  using reference = typename AlignedVector<T>::reference;
119  using const_reference = typename AlignedVector<T>::const_reference;
120  };
121 
122 
161  template <int N, typename T, bool C, unsigned int P>
162  class Accessor
163  {
164  public:
165  using TableType = typename Types<N, T, C>::TableType;
166 
167  using iterator = typename Types<N, T, C>::iterator;
168  using const_iterator = typename Types<N, T, C>::const_iterator;
169 
170  using size_type = size_t;
171  using difference_type = ptrdiff_t;
172 
173  private:
179  Accessor(const TableType &table, const iterator data);
180 
181  public:
189  Accessor(const Accessor &a);
190 
194  Accessor<N, T, C, P - 1> operator[](const size_type i) const;
195 
201  size_type,
202  size_type,
203  size_type,
204  << "Index " << N - P + 1 << "has a value of " << arg1
205  << " but needs to be in the range [" << arg2 << "," << arg3
206  << "[.");
207 
208  private:
214  const TableType &table;
215  const iterator data;
216 
217  // declare some other classes
218  // as friends. make sure to
219  // work around bugs in some
220  // compilers
221  template <int N1, typename T1>
222  friend class ::Table;
223  template <int N1, typename T1, bool C1, unsigned int P1>
224  friend class Accessor;
225 #ifndef DEAL_II_TEMPL_SPEC_FRIEND_BUG
226  friend class ::Table<N, T>;
227  friend class Accessor<N, T, C, P + 1>;
228 #endif
229  };
230 
231 
232 
242  template <int N, typename T, bool C>
243  class Accessor<N, T, C, 1>
244  {
245  public:
251  using value_type = typename Types<N, T, C>::value_type;
252 
253  using iterator = typename Types<N, T, C>::iterator;
254  using const_iterator = typename Types<N, T, C>::const_iterator;
255 
256  using reference = typename Types<N, T, C>::reference;
257  using const_reference = typename Types<N, T, C>::const_reference;
258 
259  using size_type = size_t;
260  using difference_type = ptrdiff_t;
261 
265  using TableType = typename Types<N, T, C>::TableType;
266 
267  private:
279  Accessor(const TableType &table, const iterator data);
280 
281  public:
289  Accessor(const Accessor &a);
290 
294  reference operator[](const size_type) const;
295 
300  size_type
301  size() const;
302 
306  iterator
307  begin() const;
308 
312  iterator
313  end() const;
314 
315  private:
321  const TableType &table;
322  const iterator data;
323 
324  // declare some other classes
325  // as friends. make sure to
326  // work around bugs in some
327  // compilers
328  template <int N1, typename T1>
329  friend class ::Table;
330  template <int N1, typename T1, bool C1, unsigned int P1>
331  friend class Accessor;
332 #ifndef DEAL_II_TEMPL_SPEC_FRIEND_BUG
333  friend class ::Table<2, T>;
334  friend class Accessor<N, T, C, 2>;
335 #endif
336  };
337  } // namespace TableBaseAccessors
338 
339 } // namespace internal
340 
341 
342 
409 template <int N, typename T>
410 class TableBase : public Subscriptor
411 {
412 public:
413  using value_type = T;
414 
418  using size_type = typename AlignedVector<T>::size_type;
419 
420 
424  TableBase() = default;
425 
430  TableBase(const TableIndices<N> &sizes);
431 
437  template <typename InputIterator>
438  TableBase(const TableIndices<N> &sizes,
439  InputIterator entries,
440  const bool C_style_indexing = true);
441 
445  TableBase(const TableBase<N, T> &src);
446 
451  template <typename T2>
452  TableBase(const TableBase<N, T2> &src);
453 
457  TableBase(TableBase<N, T> &&src) noexcept;
458 
462  ~TableBase() override = default;
463 
473  operator=(const TableBase<N, T> &src);
474 
482  template <typename T2>
484  operator=(const TableBase<N, T2> &src);
485 
491  operator=(TableBase<N, T> &&src) noexcept;
492 
496  bool
497  operator==(const TableBase<N, T> &T2) const;
498 
503  void
504  reset_values();
505 
514  void
515  reinit(const TableIndices<N> &new_size,
516  const bool omit_default_initialization = false);
517 
521  size_type
522  size(const unsigned int i) const;
523 
527  const TableIndices<N> &
528  size() const;
529 
534  size_type
535  n_elements() const;
536 
541  bool
542  empty() const;
543 
580  template <typename InputIterator>
581  void
582  fill(InputIterator entries, const bool C_style_indexing = true);
583 
587  void
588  fill(const T &value);
589 
593  typename AlignedVector<T>::reference
594  operator()(const TableIndices<N> &indices);
595 
603  typename AlignedVector<T>::const_reference
604  operator()(const TableIndices<N> &indices) const;
605 
618  void
619  swap(TableBase<N, T> &v);
620 
625  std::size_t
626  memory_consumption() const;
627 
632  template <class Archive>
633  void
634  serialize(Archive &ar, const unsigned int version);
635 
636 protected:
641  size_type
642  position(const TableIndices<N> &indices) const;
643 
650  typename AlignedVector<T>::reference
651  el(const TableIndices<N> &indices);
652 
663  typename AlignedVector<T>::const_reference
664  el(const TableIndices<N> &indices) const;
665 
666 protected:
671 
676 
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  size_type
925  row() const;
926 
930  size_type
931  column() const;
932 
933  protected:
938 
942  std::ptrdiff_t linear_index;
943 
950  void
952 
956  friend class AccessorBase<TableType, true, storage_order>;
957 
961  friend class LinearIndexIterator<
962  Iterator<TableType, Constness, storage_order>,
963  Accessor<TableType, Constness, storage_order>>;
964  };
965 
970  template <typename TableType, Storage storage_order>
971  class Accessor<TableType, true, storage_order>
972  : public AccessorBase<TableType, true, storage_order>
973  {
974  public:
978  using value_type =
980 
984  using size_type =
986 
991  };
992 
997  template <typename TableType, Storage storage_order>
998  class Accessor<TableType, false, storage_order>
999  : public AccessorBase<TableType, false, storage_order>
1000  {
1001  public:
1005  using value_type =
1007 
1011  using size_type =
1013 
1018 
1024  operator=(const value_type &) const;
1025 
1031  operator=(value_type &&) const;
1032 
1038 
1043  value_type &
1044  value() const;
1045  };
1046 
1059  template <typename TableType, bool Constness, Storage storage_order>
1060  class Iterator
1061  : public LinearIndexIterator<Iterator<TableType, Constness, storage_order>,
1062  Accessor<TableType, Constness, storage_order>>
1063  {
1064  public:
1068  using size_type = typename TableType::size_type;
1069 
1073  using container_pointer_type = typename std::
1074  conditional<Constness, const TableType *, TableType *>::type;
1075 
1080 
1084  Iterator(const container_pointer_type object);
1085 
1089  Iterator(const container_pointer_type object,
1090  const size_type row,
1091  const size_type column);
1092 
1097 
1101  Iterator(const container_pointer_type container,
1102  const std::ptrdiff_t linear_index);
1103  };
1104 } // namespace MatrixTableIterators
1105 
1106 
1107 
1121 template <typename T>
1122 class Table<2, T> : public TableBase<2, T>
1123 {
1124 public:
1129 
1134 
1138  using reference = typename AlignedVector<T>::reference;
1139 
1143  using const_reference = typename AlignedVector<T>::const_reference;
1144 
1149  using const_iterator = MatrixTableIterators::
1150  Iterator<Table<2, T>, true, MatrixTableIterators::Storage::row_major>;
1151 
1155  using iterator = MatrixTableIterators::
1156  Iterator<Table<2, T>, false, MatrixTableIterators::Storage::row_major>;
1157 
1161  Table() = default;
1162 
1166  Table(const size_type size1, const size_type size2);
1167 
1206  template <typename InputIterator>
1207  Table(const size_type size1,
1208  const size_type size2,
1209  InputIterator entries,
1210  const bool C_style_indexing = true);
1211 
1217  void
1218  reinit(const size_type size1,
1219  const size_type size2,
1220  const bool omit_default_initialization = false);
1221 
1223 
1230  ::internal::TableBaseAccessors::Accessor<2, T, true, 1>
1231  operator[](const size_type i) const;
1232 
1239  ::internal::TableBaseAccessors::Accessor<2, T, false, 1>
1240  operator[](const size_type i);
1241 
1248  typename AlignedVector<T>::const_reference
1249  operator()(const size_type i, const size_type j) const;
1250 
1251 
1258  typename AlignedVector<T>::reference
1259  operator()(const size_type i, const size_type j);
1260 
1265  typename AlignedVector<T>::reference
1266  operator()(const TableIndices<2> &indices);
1267 
1272  typename AlignedVector<T>::const_reference
1273  operator()(const TableIndices<2> &indices) const;
1274 
1275 
1280  size_type
1281  n_rows() const;
1282 
1287  size_type
1288  n_cols() const;
1289 
1293  iterator
1294  begin();
1295 
1300  begin() const;
1301 
1305  iterator
1306  end();
1307 
1312  end() const;
1313 
1314 protected:
1325  typename AlignedVector<T>::reference
1326  el(const size_type i, const size_type j);
1327 
1342  typename AlignedVector<T>::const_reference
1343  el(const size_type i, const size_type j) const;
1344 
1349  friend class MatrixTableIterators::
1350  AccessorBase<Table<2, T>, true, MatrixTableIterators::Storage::row_major>;
1351  friend class MatrixTableIterators::
1352  AccessorBase<Table<2, T>, false, MatrixTableIterators::Storage::row_major>;
1353 
1358  friend class MatrixTableIterators::
1359  Accessor<Table<2, T>, false, MatrixTableIterators::Storage::row_major>;
1360 };
1361 
1362 
1363 
1374 template <typename T>
1375 class Table<3, T> : public TableBase<3, T>
1376 {
1377 public:
1382 
1386  Table() = default;
1387 
1391  Table(const size_type size1, const size_type size2, const size_type size3);
1392 
1433  template <typename InputIterator>
1434  Table(const size_type size1,
1435  const size_type size2,
1436  const size_type size3,
1437  InputIterator entries,
1438  const bool C_style_indexing = true);
1439 
1447  ::internal::TableBaseAccessors::Accessor<3, T, true, 2>
1448  operator[](const size_type i) const;
1449 
1457  ::internal::TableBaseAccessors::Accessor<3, T, false, 2>
1458  operator[](const size_type i);
1459 
1466  typename AlignedVector<T>::const_reference
1467  operator()(const size_type i, const size_type j, const size_type k) const;
1468 
1469 
1476  typename AlignedVector<T>::reference
1477  operator()(const size_type i, const size_type j, const size_type k);
1478 
1483  typename AlignedVector<T>::reference
1484  operator()(const TableIndices<3> &indices);
1485 
1490  typename AlignedVector<T>::const_reference
1491  operator()(const TableIndices<3> &indices) const;
1492 };
1493 
1494 
1495 
1506 template <typename T>
1507 class Table<4, T> : public TableBase<4, T>
1508 {
1509 public:
1514 
1518  Table() = default;
1519 
1523  Table(const size_type size1,
1524  const size_type size2,
1525  const size_type size3,
1526  const size_type size4);
1527 
1535  ::internal::TableBaseAccessors::Accessor<4, T, true, 3>
1536  operator[](const size_type i) const;
1537 
1545  ::internal::TableBaseAccessors::Accessor<4, T, false, 3>
1546  operator[](const size_type i);
1547 
1554  typename AlignedVector<T>::const_reference
1555  operator()(const size_type i,
1556  const size_type j,
1557  const size_type k,
1558  const size_type l) const;
1559 
1560 
1567  typename AlignedVector<T>::reference
1568  operator()(const size_type i,
1569  const size_type j,
1570  const size_type k,
1571  const size_type l);
1572 
1577  typename AlignedVector<T>::reference
1578  operator()(const TableIndices<4> &indices);
1579 
1584  typename AlignedVector<T>::const_reference
1585  operator()(const TableIndices<4> &indices) const;
1586 };
1587 
1588 
1589 
1600 template <typename T>
1601 class Table<5, T> : public TableBase<5, T>
1602 {
1603 public:
1608 
1609 
1613  Table() = default;
1614 
1618  Table(const size_type size1,
1619  const size_type size2,
1620  const size_type size3,
1621  const size_type size4,
1622  const size_type size5);
1623 
1631  ::internal::TableBaseAccessors::Accessor<5, T, true, 4>
1632  operator[](const size_type i) const;
1633 
1641  ::internal::TableBaseAccessors::Accessor<5, T, false, 4>
1642  operator[](const size_type i);
1643 
1650  typename AlignedVector<T>::const_reference
1651  operator()(const size_type i,
1652  const size_type j,
1653  const size_type k,
1654  const size_type l,
1655  const size_type m) const;
1656 
1663  typename AlignedVector<T>::reference
1664  operator()(const size_type i,
1665  const size_type j,
1666  const size_type k,
1667  const size_type l,
1668  const size_type m);
1669 
1674  typename AlignedVector<T>::reference
1675  operator()(const TableIndices<5> &indices);
1676 
1681  typename AlignedVector<T>::const_reference
1682  operator()(const TableIndices<5> &indices) const;
1683 };
1684 
1685 
1686 
1697 template <typename T>
1698 class Table<6, T> : public TableBase<6, T>
1699 {
1700 public:
1705 
1709  Table() = default;
1710 
1714  Table(const size_type size1,
1715  const size_type size2,
1716  const size_type size3,
1717  const size_type size4,
1718  const size_type size5,
1719  const size_type size6);
1720 
1728  ::internal::TableBaseAccessors::Accessor<6, T, true, 5>
1729  operator[](const size_type i) const;
1730 
1738  ::internal::TableBaseAccessors::Accessor<6, T, false, 5>
1739  operator[](const size_type i);
1740 
1747  typename AlignedVector<T>::const_reference
1748  operator()(const size_type i,
1749  const size_type j,
1750  const size_type k,
1751  const size_type l,
1752  const size_type m,
1753  const size_type n) const;
1754 
1761  typename AlignedVector<T>::reference
1762  operator()(const size_type i,
1763  const size_type j,
1764  const size_type k,
1765  const size_type l,
1766  const size_type m,
1767  const size_type n);
1768 
1773  typename AlignedVector<T>::reference
1774  operator()(const TableIndices<6> &indices);
1775 
1780  typename AlignedVector<T>::const_reference
1781  operator()(const TableIndices<6> &indices) const;
1782 };
1783 
1784 
1795 template <typename T>
1796 class Table<7, T> : public TableBase<7, T>
1797 {
1798 public:
1803 
1807  Table() = default;
1808 
1812  Table(const size_type size1,
1813  const size_type size2,
1814  const size_type size3,
1815  const size_type size4,
1816  const size_type size5,
1817  const size_type size6,
1818  const size_type size7);
1819 
1827  ::internal::TableBaseAccessors::Accessor<7, T, true, 6>
1828  operator[](const size_type i) const;
1829 
1837  ::internal::TableBaseAccessors::Accessor<7, T, false, 6>
1838  operator[](const size_type i);
1839 
1846  typename AlignedVector<T>::const_reference
1847  operator()(const size_type i,
1848  const size_type j,
1849  const size_type k,
1850  const size_type l,
1851  const size_type m,
1852  const size_type n,
1853  const size_type o) const;
1854 
1861  typename AlignedVector<T>::reference
1862  operator()(const size_type i,
1863  const size_type j,
1864  const size_type k,
1865  const size_type l,
1866  const size_type m,
1867  const size_type n,
1868  const size_type o);
1869 
1874  typename AlignedVector<T>::reference
1875  operator()(const TableIndices<7> &indices);
1876 
1881  typename AlignedVector<T>::const_reference
1882  operator()(const TableIndices<7> &indices) const;
1883 };
1884 
1885 
1895 {
1896  template <typename T, bool Constness>
1897  using AccessorBase DEAL_II_DEPRECATED = MatrixTableIterators::AccessorBase<
1899  Constness,
1901 
1902  template <typename T, bool Constness>
1903  using Accessor DEAL_II_DEPRECATED =
1905  Constness,
1907 
1908  template <typename T, bool Constness>
1909  using Iterator DEAL_II_DEPRECATED =
1911  Constness,
1913 } // namespace TransposeTableIterators
1914 
1915 
1929 template <typename T>
1930 class TransposeTable : public TableBase<2, T>
1931 {
1932 public:
1937 
1941  using value_type = typename AlignedVector<T>::value_type;
1942 
1946  using reference = typename AlignedVector<T>::reference;
1947 
1951  using const_reference = typename AlignedVector<T>::const_reference;
1952 
1957  using const_iterator =
1959  true,
1961 
1965  using iterator =
1967  false,
1969 
1973  TransposeTable() = default;
1974 
1978  TransposeTable(const size_type size1, const size_type size2);
1979 
1985  void
1986  reinit(const size_type size1,
1987  const size_type size2,
1988  const bool omit_default_initialization = false);
1989 
1997  operator()(const size_type i, const size_type j) const;
1998 
2005  reference
2006  operator()(const size_type i, const size_type j);
2007 
2012  size_type
2013  n_rows() const;
2014 
2019  size_type
2020  n_cols() const;
2021 
2025  iterator
2026  begin();
2027 
2032  begin() const;
2033 
2037  iterator
2038  end();
2039 
2044  end() const;
2045 
2046 protected:
2057  reference
2058  el(const size_type i, const size_type j);
2059 
2075  el(const size_type i, const size_type j) const;
2076 
2082  TransposeTable<T>,
2083  true,
2086  TransposeTable<T>,
2087  false,
2088  MatrixTableIterators::Storage::column_major>;
2089 
2094  friend class MatrixTableIterators::Accessor<
2095  TransposeTable<T>,
2096  false,
2097  MatrixTableIterators::Storage::column_major>;
2098 };
2099 
2100 
2101 
2102 /* --------------------- Template and inline functions ---------------- */
2103 
2104 #ifndef DOXYGEN
2105 
2106 template <int N, typename T>
2107 TableBase<N, T>::TableBase(const TableIndices<N> &sizes)
2108 {
2109  reinit(sizes);
2110 }
2111 
2112 
2113 
2114 template <int N, typename T>
2115 template <typename InputIterator>
2117  InputIterator entries,
2118  const bool C_style_indexing)
2119 {
2120  reinit(sizes);
2121  fill(entries, C_style_indexing);
2122 }
2123 
2124 
2125 
2126 template <int N, typename T>
2128  : Subscriptor()
2129 {
2130  reinit(src.table_size, true);
2131  values = src.values;
2132 }
2133 
2134 
2135 
2136 template <int N, typename T>
2137 template <typename T2>
2139 {
2140  reinit(src.table_size);
2141  if (src.n_elements() != 0)
2142  std::copy(src.values.begin(), src.values.end(), values.begin());
2143 }
2144 
2145 
2146 
2147 template <int N, typename T>
2149  : Subscriptor(std::move(src))
2150  , values(std::move(src.values))
2151  , table_size(src.table_size)
2152 {
2153  src.table_size = TableIndices<N>();
2154 }
2155 
2156 
2157 
2158 template <int N, typename T>
2159 template <class Archive>
2160 inline void
2161 TableBase<N, T>::serialize(Archive &ar, const unsigned int)
2162 {
2163  ar &static_cast<Subscriptor &>(*this);
2164 
2165  ar &values &table_size;
2166 }
2167 
2168 
2169 
2170 namespace internal
2171 {
2172  namespace TableBaseAccessors
2173  {
2174  template <int N, typename T, bool C, unsigned int P>
2175  inline Accessor<N, T, C, P>::Accessor(const TableType &table,
2176  const iterator data)
2177  : table(table)
2178  , data(data)
2179  {}
2180 
2181 
2182 
2183  template <int N, typename T, bool C, unsigned int P>
2184  inline Accessor<N, T, C, P>::Accessor(const Accessor &a)
2185  : table(a.table)
2186  , data(a.data)
2187  {}
2188 
2189 
2190 
2191  template <int N, typename T, bool C, unsigned int P>
2192  inline Accessor<N, T, C, P - 1> Accessor<N, T, C, P>::
2193  operator[](const size_type i) const
2194  {
2195  Assert(i < table.size()[N - P], ExcIndexRange(i, 0, table.size()[N - P]));
2196 
2197  // access i-th
2198  // subobject. optimize on the
2199  // case i==0
2200  if (i == 0)
2201  return Accessor<N, T, C, P - 1>(table, data);
2202  else
2203  {
2204  // note: P>1, otherwise the
2205  // specialization would have
2206  // been taken!
2207  size_type subobject_size = table.size()[N - 1];
2208  for (int p = P - 1; p > 1; --p)
2209  subobject_size *= table.size()[N - p];
2210  const iterator new_data = data + i * subobject_size;
2211  return Accessor<N, T, C, P - 1>(table, new_data);
2212  }
2213  }
2214 
2215 
2216 
2217  template <int N, typename T, bool C>
2218  inline Accessor<N, T, C, 1>::Accessor(const TableType &table,
2219  const iterator data)
2220  : table(table)
2221  , data(data)
2222  {}
2223 
2224 
2225 
2226  template <int N, typename T, bool C>
2227  inline Accessor<N, T, C, 1>::Accessor(const Accessor &a)
2228  : table(a.table)
2229  , data(a.data)
2230  {}
2231 
2232 
2233 
2234  template <int N, typename T, bool C>
2235  inline typename Accessor<N, T, C, 1>::reference Accessor<N, T, C, 1>::
2236  operator[](const size_type i) const
2237  {
2238  AssertIndexRange(i, table.size()[N - 1]);
2239  return *(data + i);
2240  }
2241 
2242 
2243 
2244  template <int N, typename T, bool C>
2245  inline typename Accessor<N, T, C, 1>::size_type
2246  Accessor<N, T, C, 1>::size() const
2247  {
2248  return table.size()[N - 1];
2249  }
2250 
2251 
2252 
2253  template <int N, typename T, bool C>
2254  inline typename Accessor<N, T, C, 1>::iterator
2255  Accessor<N, T, C, 1>::begin() const
2256  {
2257  return data;
2258  }
2259 
2260 
2261 
2262  template <int N, typename T, bool C>
2263  inline typename Accessor<N, T, C, 1>::iterator
2264  Accessor<N, T, C, 1>::end() const
2265  {
2266  return data + table.size()[N - 1];
2267  }
2268  } // namespace TableBaseAccessors
2269 } // namespace internal
2270 
2271 
2272 
2273 template <int N, typename T>
2274 inline TableBase<N, T> &
2276 {
2277  if (!m.empty())
2278  values = m.values;
2279  reinit(m.size(), true);
2280 
2281  return *this;
2282 }
2283 
2284 
2285 
2286 template <int N, typename T>
2287 template <typename T2>
2288 inline TableBase<N, T> &
2290 {
2291  reinit(m.size(), true);
2292  if (!empty())
2293  std::copy(m.values.begin(),
2294  m.values.begin() + n_elements(),
2295  values.begin());
2296 
2297  return *this;
2298 }
2299 
2300 
2301 
2302 template <int N, typename T>
2303 inline TableBase<N, T> &
2305 {
2306  static_cast<Subscriptor &>(*this) = std::move(m);
2307  values = std::move(m.values);
2308  table_size = m.table_size;
2310 
2311  return *this;
2312 }
2313 
2314 
2315 
2316 template <int N, typename T>
2317 inline bool
2319 {
2320  return (values == T2.values);
2321 }
2322 
2323 
2324 
2325 template <int N, typename T>
2326 inline void
2328 {
2329  // use parallel set operation
2330  if (n_elements() != 0)
2331  values.fill(T());
2332 }
2333 
2334 
2335 
2336 template <int N, typename T>
2337 inline void
2338 TableBase<N, T>::fill(const T &value)
2339 {
2340  if (n_elements() != 0)
2341  values.fill(value);
2342 }
2343 
2344 
2345 
2346 template <int N, typename T>
2347 inline void
2348 TableBase<N, T>::reinit(const TableIndices<N> &new_sizes,
2349  const bool omit_default_initialization)
2350 {
2351  table_size = new_sizes;
2352 
2353  const size_type new_size = n_elements();
2354 
2355  // if zero size was given: free all memory
2356  if (new_size == 0)
2357  {
2358  values.resize(0);
2359  // set all sizes to zero, even
2360  // if one was previously
2361  // nonzero. This simplifies
2362  // some assertions.
2363  table_size = TableIndices<N>();
2364 
2365  return;
2366  }
2367 
2368  // adjust values field. If it was empty before, we can simply call resize(),
2369  // which can set all the data fields. Otherwise, select the fast resize and
2370  // manually fill in all the elements as required by the design of this
2371  // class. (Selecting another code for the empty case ensures that we touch
2372  // the memory only once for non-trivial classes that need to initialize the
2373  // memory also in resize_fast.)
2374  if (!omit_default_initialization)
2375  {
2376  if (values.empty())
2377  values.resize(new_size);
2378  else
2379  {
2380  values.resize_fast(new_size);
2381  values.fill();
2382  }
2383  }
2384  else
2385  values.resize_fast(new_size);
2386 }
2387 
2388 
2389 
2390 template <int N, typename T>
2391 inline const TableIndices<N> &
2392 TableBase<N, T>::size() const
2393 {
2394  return table_size;
2395 }
2396 
2397 
2398 
2399 template <int N, typename T>
2400 inline typename TableBase<N, T>::size_type
2401 TableBase<N, T>::size(const unsigned int i) const
2402 {
2403  Assert(i < N, ExcIndexRange(i, 0, N));
2404  return table_size[i];
2405 }
2406 
2407 
2408 
2409 template <int N, typename T>
2410 inline typename TableBase<N, T>::size_type
2412 {
2413  size_type s = 1;
2414  for (unsigned int n = 0; n < N; ++n)
2415  s *= table_size[n];
2416  return s;
2417 }
2418 
2419 
2420 
2421 template <int N, typename T>
2422 inline bool
2423 TableBase<N, T>::empty() const
2424 {
2425  return (n_elements() == 0);
2426 }
2427 
2428 
2429 
2430 namespace internal
2431 {
2432  namespace TableImplementation
2433  {
2434  template <typename InputIterator, typename T>
2435  void
2436  fill_Fortran_style(InputIterator entries, TableBase<1, T> &table)
2437  {
2438  using size_type = typename TableBase<1, T>::size_type;
2439  for (size_type i = 0; i < table.size()[0]; ++i)
2440  table(TableIndices<1>(i)) = *entries++;
2441  }
2442 
2443 
2444  template <typename InputIterator, typename T>
2445  void
2446  fill_Fortran_style(InputIterator entries, TableBase<2, T> &table)
2447  {
2448  using size_type = typename TableBase<2, T>::size_type;
2449  for (size_type j = 0; j < table.size()[1]; ++j)
2450  for (size_type i = 0; i < table.size()[0]; ++i)
2451  table(TableIndices<2>(i, j)) = *entries++;
2452  }
2453 
2454 
2455  template <typename InputIterator, typename T>
2456  void
2457  fill_Fortran_style(InputIterator entries, TableBase<3, T> &table)
2458  {
2459  using size_type = typename TableBase<3, T>::size_type;
2460  for (size_type k = 0; k < table.size()[2]; ++k)
2461  for (size_type j = 0; j < table.size()[1]; ++j)
2462  for (size_type i = 0; i < table.size()[0]; ++i)
2463  table(TableIndices<3>(i, j, k)) = *entries++;
2464  }
2465 
2466 
2467  template <typename InputIterator, typename T, int N>
2468  void
2469  fill_Fortran_style(InputIterator, TableBase<N, T> &)
2470  {
2471  Assert(false, ExcNotImplemented());
2472  }
2473  } // namespace TableImplementation
2474 } // namespace internal
2475 
2476 
2477 template <int N, typename T>
2478 template <typename InputIterator>
2479 inline void
2480 TableBase<N, T>::fill(InputIterator entries, const bool C_style_indexing)
2481 {
2482  Assert(n_elements() != 0, ExcMessage("Trying to fill an empty matrix."));
2483 
2484  if (C_style_indexing)
2485  for (typename AlignedVector<T>::iterator p = values.begin();
2486  p != values.end();
2487  ++p)
2488  *p = *entries++;
2489  else
2490  internal::TableImplementation::fill_Fortran_style(entries, *this);
2491 }
2492 
2493 
2494 
2495 template <int N, typename T>
2496 inline void
2498 {
2499  values.swap(v.values);
2500  std::swap(table_size, v.table_size);
2501 }
2502 
2503 
2504 
2505 template <int N, typename T>
2506 inline std::size_t
2508 {
2509  return sizeof(*this) + MemoryConsumption::memory_consumption(values);
2510 }
2511 
2512 
2513 
2514 template <int N, typename T>
2515 inline typename TableBase<N, T>::size_type
2516 TableBase<N, T>::position(const TableIndices<N> &indices) const
2517 {
2518  // specialize this for the
2519  // different numbers of dimensions,
2520  // to make the job somewhat easier
2521  // for the compiler. have the
2522  // general formula nevertheless:
2523  switch (N)
2524  {
2525  case 1:
2526  return indices[0];
2527  case 2:
2528  return size_type(indices[0]) * table_size[1] + indices[1];
2529  case 3:
2530  return ((size_type(indices[0]) * table_size[1] + indices[1]) *
2531  table_size[2] +
2532  indices[2]);
2533  default:
2534  {
2535  unsigned int s = indices[0];
2536  for (unsigned int n = 1; n < N; ++n)
2537  s = s * table_size[n] + indices[n];
2538  return s;
2539  }
2540  }
2541 }
2542 
2543 
2544 
2545 template <int N, typename T>
2546 inline typename AlignedVector<T>::const_reference
2547 TableBase<N, T>::operator()(const TableIndices<N> &indices) const
2548 {
2549  for (unsigned int n = 0; n < N; ++n)
2550  AssertIndexRange(indices[n], table_size[n]);
2551  return el(indices);
2552 }
2553 
2554 
2555 
2556 template <int N, typename T>
2557 inline typename AlignedVector<T>::reference
2559 {
2560  for (unsigned int n = 0; n < N; ++n)
2561  AssertIndexRange(indices[n], table_size[n]);
2562  return el(indices);
2563 }
2564 
2565 
2566 
2567 template <int N, typename T>
2568 inline typename AlignedVector<T>::const_reference
2569 TableBase<N, T>::el(const TableIndices<N> &indices) const
2570 {
2571  return values[position(indices)];
2572 }
2573 
2574 
2575 
2576 template <int N, typename T>
2577 inline typename AlignedVector<T>::reference
2578 TableBase<N, T>::el(const TableIndices<N> &indices)
2579 {
2580  AssertIndexRange(position(indices), values.size());
2581  return values[position(indices)];
2582 }
2583 
2584 
2585 
2586 template <typename T>
2587 inline Table<1, T>::Table(const size_type size)
2588  : TableBase<1, T>(TableIndices<1>(size))
2589 {}
2590 
2591 
2592 
2593 template <typename T>
2594 template <typename InputIterator>
2595 inline Table<1, T>::Table(const size_type size,
2596  InputIterator entries,
2597  const bool C_style_indexing)
2598  : TableBase<1, T>(TableIndices<1>(size), entries, C_style_indexing)
2599 {}
2600 
2601 
2602 
2603 template <typename T>
2604 inline typename AlignedVector<T>::const_reference Table<1, T>::
2605  operator[](const size_type i) const
2606 {
2607  AssertIndexRange(i, this->table_size[0]);
2608  return this->values[i];
2609 }
2610 
2611 
2612 
2613 template <typename T>
2614 inline typename AlignedVector<T>::reference Table<1, T>::
2615  operator[](const size_type i)
2616 {
2617  AssertIndexRange(i, this->table_size[0]);
2618  return this->values[i];
2619 }
2620 
2621 
2622 
2623 template <typename T>
2624 inline typename AlignedVector<T>::const_reference
2625 Table<1, T>::operator()(const size_type i) const
2626 {
2627  AssertIndexRange(i, this->table_size[0]);
2628  return this->values[i];
2629 }
2630 
2631 
2632 
2633 template <typename T>
2634 inline typename AlignedVector<T>::reference
2635 Table<1, T>::operator()(const size_type i)
2636 {
2637  AssertIndexRange(i, this->table_size[0]);
2638  return this->values[i];
2639 }
2640 
2641 
2642 
2643 template <typename T>
2644 inline typename AlignedVector<T>::const_reference
2645 Table<1, T>::operator()(const TableIndices<1> &indices) const
2646 {
2647  return TableBase<1, T>::operator()(indices);
2648 }
2649 
2650 
2651 
2652 template <typename T>
2653 inline typename AlignedVector<T>::reference
2655 {
2656  return TableBase<1, T>::operator()(indices);
2657 }
2658 
2659 
2660 //---------------------------------------------------------------------------
2661 
2662 
2663 
2664 template <typename T>
2665 inline Table<2, T>::Table(const size_type size1, const size_type size2)
2666  : TableBase<2, T>(TableIndices<2>(size1, size2))
2667 {}
2668 
2669 
2670 
2671 template <typename T>
2672 template <typename InputIterator>
2673 inline Table<2, T>::Table(const size_type size1,
2674  const size_type size2,
2675  InputIterator entries,
2676  const bool C_style_indexing)
2677  : TableBase<2, T>(TableIndices<2>(size1, size2), entries, C_style_indexing)
2678 {}
2679 
2680 
2681 
2682 template <typename T>
2683 inline void
2684 Table<2, T>::reinit(const size_type size1,
2685  const size_type size2,
2686  const bool omit_default_initialization)
2687 {
2688  this->TableBase<2, T>::reinit(TableIndices<2>(size1, size2),
2689  omit_default_initialization);
2690 }
2691 
2692 
2693 
2694 template <typename T>
2695 inline ::internal::TableBaseAccessors::Accessor<2, T, true, 1>
2696  Table<2, T>::operator[](const size_type i) const
2697 {
2698  AssertIndexRange(i, this->table_size[0]);
2699  return ::internal::TableBaseAccessors::Accessor<2, T, true, 1>(
2700  *this, this->values.begin() + size_type(i) * n_cols());
2701 }
2702 
2703 
2704 
2705 template <typename T>
2706 inline ::internal::TableBaseAccessors::Accessor<2, T, false, 1>
2707  Table<2, T>::operator[](const size_type i)
2708 {
2709  AssertIndexRange(i, this->table_size[0]);
2710  return ::internal::TableBaseAccessors::Accessor<2, T, false, 1>(
2711  *this, this->values.begin() + size_type(i) * n_cols());
2712 }
2713 
2714 
2715 
2716 template <typename T>
2717 inline typename AlignedVector<T>::const_reference
2718 Table<2, T>::operator()(const size_type i, const size_type j) const
2719 {
2720  AssertIndexRange(i, this->table_size[0]);
2721  AssertIndexRange(j, this->table_size[1]);
2722  return this->values[size_type(i) * this->table_size[1] + j];
2723 }
2724 
2725 
2726 
2727 template <typename T>
2728 inline typename AlignedVector<T>::reference
2729 Table<2, T>::operator()(const size_type i, const size_type j)
2730 {
2731  AssertIndexRange(i, this->table_size[0]);
2732  AssertIndexRange(j, this->table_size[1]);
2733  return this->values[size_type(i) * this->table_size[1] + j];
2734 }
2735 
2736 
2737 
2738 template <typename T>
2739 inline typename AlignedVector<T>::const_reference
2740 Table<2, T>::operator()(const TableIndices<2> &indices) const
2741 {
2742  return TableBase<2, T>::operator()(indices);
2743 }
2744 
2745 
2746 
2747 template <typename T>
2748 inline typename AlignedVector<T>::reference
2750 {
2751  return TableBase<2, T>::operator()(indices);
2752 }
2753 
2754 
2755 
2756 template <typename T>
2757 inline typename AlignedVector<T>::const_reference
2758 Table<2, T>::el(const size_type i, const size_type j) const
2759 {
2760  return this->values[size_type(i) * this->table_size[1] + j];
2761 }
2762 
2763 
2764 
2765 template <typename T>
2766 inline typename AlignedVector<T>::reference
2767 Table<2, T>::el(const size_type i, const size_type j)
2768 {
2769  return this->values[size_type(i) * this->table_size[1] + j];
2770 }
2771 
2772 
2773 
2774 template <typename T>
2775 inline typename Table<2, T>::size_type
2776 Table<2, T>::n_rows() const
2777 {
2778  return this->table_size[0];
2779 }
2780 
2781 
2782 
2783 template <typename T>
2784 inline typename Table<2, T>::size_type
2785 Table<2, T>::n_cols() const
2786 {
2787  return this->table_size[1];
2788 }
2789 
2790 
2791 
2792 template <typename T>
2793 inline typename Table<2, T>::iterator
2795 {
2796  return typename Table<2, T>::iterator(this, 0, 0);
2797 }
2798 
2799 
2800 
2801 template <typename T>
2802 inline typename Table<2, T>::const_iterator
2803 Table<2, T>::begin() const
2804 {
2805  return typename Table<2, T>::const_iterator(this, 0, 0);
2806 }
2807 
2808 
2809 
2810 template <typename T>
2811 inline typename Table<2, T>::iterator
2813 {
2814  return typename Table<2, T>::iterator(this);
2815 }
2816 
2817 
2818 
2819 template <typename T>
2820 inline typename Table<2, T>::const_iterator
2821 Table<2, T>::end() const
2822 {
2823  return typename Table<2, T>::const_iterator(this);
2824 }
2825 
2826 
2827 
2828 //---------------------------------------------------------------------------
2829 namespace MatrixTableIterators
2830 {
2831  namespace internal
2832  {
2833  // Internal calculation routines for AccessorBase. These do not do any
2834  // checking whatsoever.
2835  template <typename TableType, Storage storage_order>
2836  inline std::ptrdiff_t
2837  get_row_index(const std::ptrdiff_t linear_index,
2838  const TableType *const container)
2839  {
2840  switch (storage_order)
2841  {
2842  case Storage::row_major:
2843  return linear_index / container->n_cols();
2844  case Storage::column_major:
2845  return linear_index % container->n_rows();
2846  default:
2847  Assert(false, ExcInternalError());
2848  }
2849  return {};
2850  }
2851 
2852 
2853 
2854  template <typename TableType, Storage storage_order>
2855  inline std::ptrdiff_t
2856  get_column_index(const std::ptrdiff_t linear_index,
2857  const TableType *const container)
2858  {
2859  switch (storage_order)
2860  {
2861  case Storage::row_major:
2862  return linear_index % container->n_cols();
2863  case Storage::column_major:
2864  return linear_index / container->n_rows();
2865  default:
2866  Assert(false, ExcInternalError());
2867  }
2868  return {};
2869  }
2870  } // namespace internal
2871 
2872 
2873 
2874  template <typename TableType, bool Constness, Storage storage_order>
2876  : container(nullptr)
2877  , linear_index(std::numeric_limits<decltype(linear_index)>::max())
2878  {}
2879 
2880 
2881 
2882  template <typename TableType, bool Constness, Storage storage_order>
2883  inline AccessorBase<TableType, Constness, storage_order>::AccessorBase(
2884  const container_pointer_type table)
2885  : container(table)
2886  , linear_index(container->values.size())
2887  {}
2888 
2889 
2890 
2891  template <typename TableType, bool Constness, Storage storage_order>
2892  inline AccessorBase<TableType, Constness, storage_order>::AccessorBase(
2893  const AccessorBase<TableType, false, storage_order> &a)
2894  : container(a.container)
2895  , linear_index(a.linear_index)
2896  {}
2897 
2898 
2899 
2900  template <typename TableType, bool Constness, Storage storage_order>
2901  inline AccessorBase<TableType, Constness, storage_order>::AccessorBase(
2902  const container_pointer_type table,
2903  const std::ptrdiff_t index)
2904  : container(table)
2905  , linear_index(index)
2906  {
2907  Assert(0 <= linear_index &&
2908  std::size_t(linear_index) < container->values.size() + 1,
2909  ExcMessage("The current iterator points outside of the table and is "
2910  "not the end iterator."));
2911  }
2912 
2913 
2914 
2915  template <typename TableType, bool Constness, Storage storage_order>
2916  inline const typename AccessorBase<TableType, Constness, storage_order>::
2917  value_type &
2918  AccessorBase<TableType, Constness, storage_order>::value() const
2919  {
2920  assert_valid_linear_index();
2921  return this->container->values[linear_index];
2922  }
2923 
2924 
2925 
2926  template <typename TableType, bool Constness, Storage storage_order>
2927  inline typename AccessorBase<TableType, Constness, storage_order>::size_type
2928  AccessorBase<TableType, Constness, storage_order>::row() const
2929  {
2930  assert_valid_linear_index();
2931  return static_cast<std::size_t>(
2932  internal::get_row_index<TableType, storage_order>(linear_index,
2933  container));
2934  }
2935 
2936 
2937 
2938  template <typename TableType, bool Constness, Storage storage_order>
2939  inline typename AccessorBase<TableType, Constness, storage_order>::size_type
2940  AccessorBase<TableType, Constness, storage_order>::column() const
2941  {
2942  assert_valid_linear_index();
2943  return static_cast<std::size_t>(
2944  internal::get_column_index<TableType, storage_order>(linear_index,
2945  container));
2946  }
2947 
2948 
2949 
2950  template <typename TableType, bool Constness, Storage storage_order>
2951  inline void
2952  AccessorBase<TableType, Constness, storage_order>::assert_valid_linear_index()
2953  const
2954  {
2955 # ifdef DEBUG // avoid unused variable warnings by guarding everything
2956  Assert(container != nullptr,
2957  ExcMessage("This accessor has been default-constructed and does not "
2958  "have a corresponding table."));
2959  Assert(!container->empty(),
2960  ExcMessage("An empty table has no rows or columns."));
2961  Assert(0 <= linear_index &&
2962  std::size_t(linear_index) < container->values.size(),
2963  ExcMessage("The current iterator points outside of the table."));
2964  const std::ptrdiff_t row_n =
2965  internal::get_row_index<TableType, storage_order>(linear_index,
2966  container);
2967  const std::ptrdiff_t column_n =
2968  internal::get_column_index<TableType, storage_order>(linear_index,
2969  container);
2970  Assert(0 <= column_n && std::size_t(column_n) < container->n_cols(),
2971  ExcMessage("The current iterator points outside the table."));
2972  Assert(0 <= row_n && std::size_t(row_n) < container->n_rows(),
2973  ExcMessage("The current iterator points outside the table."));
2974 # endif
2975  }
2976 
2977 
2978 
2979  template <typename TableType, Storage storage_order>
2980  inline const Accessor<TableType, false, storage_order> &
2981  Accessor<TableType, false, storage_order>::operator=(
2982  const typename Accessor<TableType, false, storage_order>::value_type &t)
2983  const
2984  {
2985  this->assert_valid_linear_index();
2986  this->container->values[this->linear_index] = t;
2987  return *this;
2988  }
2989 
2990 
2991 
2992  template <typename TableType, Storage storage_order>
2993  inline const Accessor<TableType, false, storage_order> &
2994  Accessor<TableType, false, storage_order>::operator=(
2995  typename Accessor<TableType, false, storage_order>::value_type &&t) const
2996  {
2997  this->assert_valid_linear_index();
2998  this->container->values[this->linear_index] = t;
2999  return *this;
3000  }
3001 
3002 
3003 
3004  template <typename TableType, Storage storage_order>
3005  inline typename Accessor<TableType, false, storage_order>::value_type &
3006  Accessor<TableType, false, storage_order>::value() const
3007  {
3008  this->assert_valid_linear_index();
3009  return this->container->values[this->linear_index];
3010  }
3011 
3012 
3013 
3014  template <typename TableType, bool Constness, Storage storage_order>
3015  inline Iterator<TableType, Constness, storage_order>::Iterator(
3016  const Accessor<TableType, Constness, storage_order> &a)
3017  : LinearIndexIterator<Iterator<TableType, Constness, storage_order>,
3018  Accessor<TableType, Constness, storage_order>>(a)
3019  {}
3020 
3021 
3022 
3023  template <typename TableType, bool Constness, Storage storage_order>
3024  inline Iterator<TableType, Constness, storage_order>::Iterator(
3025  const container_pointer_type table)
3026  : LinearIndexIterator<Iterator<TableType, Constness, storage_order>,
3027  Accessor<TableType, Constness, storage_order>>(
3028  Accessor<TableType, Constness, storage_order>(table))
3029  {}
3030 
3031 
3032 
3033  template <typename TableType, bool Constness, Storage storage_order>
3034  inline Iterator<TableType, Constness, storage_order>::Iterator(
3035  const Iterator<TableType, false, storage_order> &i)
3036  : LinearIndexIterator<Iterator<TableType, Constness, storage_order>,
3037  Accessor<TableType, Constness, storage_order>>(*i)
3038  {}
3039 
3040 
3041 
3042  template <typename TableType, bool Constness, Storage storage_order>
3043  inline Iterator<TableType, Constness, storage_order>::Iterator(
3044  const container_pointer_type table,
3045  const size_type row_n,
3046  const size_type col_n)
3047  : Iterator(table,
3048  storage_order == Storage::row_major ?
3049  table->n_cols() * row_n + col_n :
3050  table->n_rows() * col_n + row_n)
3051  {}
3052 
3053 
3054 
3055  template <typename TableType, bool Constness, Storage storage_order>
3056  inline Iterator<TableType, Constness, storage_order>::Iterator(
3057  const container_pointer_type table,
3058  const std::ptrdiff_t linear_index)
3059  : LinearIndexIterator<Iterator<TableType, Constness, storage_order>,
3060  Accessor<TableType, Constness, storage_order>>(
3061  Accessor<TableType, Constness, storage_order>(table, linear_index))
3062  {}
3063 } // namespace MatrixTableIterators
3064 
3065 
3066 
3067 //---------------------------------------------------------------------------
3068 template <typename T>
3069 inline TransposeTable<T>::TransposeTable(const size_type size1,
3070  const size_type size2)
3071  : TableBase<2, T>(TableIndices<2>(size2, size1))
3072 {}
3073 
3074 
3075 
3076 template <typename T>
3077 inline void
3078 TransposeTable<T>::reinit(const size_type size1,
3079  const size_type size2,
3080  const bool omit_default_initialization)
3081 {
3082  this->TableBase<2, T>::reinit(TableIndices<2>(size2, size1),
3083  omit_default_initialization);
3084 }
3085 
3086 
3087 
3088 template <typename T>
3089 inline typename TransposeTable<T>::const_reference
3090 TransposeTable<T>::operator()(const size_type i, const size_type j) const
3091 {
3092  AssertIndexRange(i, this->table_size[1]);
3093  AssertIndexRange(j, this->table_size[0]);
3094  return this->values[size_type(j) * this->table_size[1] + i];
3095 }
3096 
3097 
3098 
3099 template <typename T>
3100 inline typename TransposeTable<T>::reference
3101 TransposeTable<T>::operator()(const size_type i, const size_type j)
3102 {
3103  AssertIndexRange(i, this->table_size[1]);
3104  AssertIndexRange(j, this->table_size[0]);
3105  return this->values[size_type(j) * this->table_size[1] + i];
3106 }
3107 
3108 
3109 
3110 template <typename T>
3111 inline typename TransposeTable<T>::const_reference
3112 TransposeTable<T>::el(const size_type i, const size_type j) const
3113 {
3114  return this->values[size_type(j) * this->table_size[1] + i];
3115 }
3116 
3117 
3118 
3119 template <typename T>
3120 inline typename TransposeTable<T>::reference
3121 TransposeTable<T>::el(const size_type i, const size_type j)
3122 {
3123  return this->values[size_type(j) * this->table_size[1] + i];
3124 }
3125 
3126 
3127 
3128 template <typename T>
3129 inline typename TransposeTable<T>::size_type
3131 {
3132  return this->table_size[1];
3133 }
3134 
3135 
3136 
3137 template <typename T>
3138 inline typename TransposeTable<T>::size_type
3140 {
3141  return this->table_size[0];
3142 }
3143 
3144 
3145 
3146 template <typename T>
3147 inline typename TransposeTable<T>::iterator
3149 {
3150  return typename TransposeTable<T>::iterator(this, 0, 0);
3151 }
3152 
3153 
3154 
3155 template <typename T>
3156 inline typename TransposeTable<T>::const_iterator
3158 {
3159  return typename TransposeTable<T>::const_iterator(this, 0, 0);
3160 }
3161 
3162 
3163 
3164 template <typename T>
3165 inline typename TransposeTable<T>::iterator
3167 {
3168  return typename TransposeTable<T>::iterator(this);
3169 }
3170 
3171 
3172 
3173 template <typename T>
3174 inline typename TransposeTable<T>::const_iterator
3175 TransposeTable<T>::end() const
3176 {
3177  return typename TransposeTable<T>::const_iterator(this);
3178 }
3179 //---------------------------------------------------------------------------
3180 
3181 
3182 
3183 template <typename T>
3184 inline Table<3, T>::Table(const size_type size1,
3185  const size_type size2,
3186  const size_type size3)
3187  : TableBase<3, T>(TableIndices<3>(size1, size2, size3))
3188 {}
3189 
3190 
3191 
3192 template <typename T>
3193 template <typename InputIterator>
3194 inline Table<3, T>::Table(const size_type size1,
3195  const size_type size2,
3196  const size_type size3,
3197  InputIterator entries,
3198  const bool C_style_indexing)
3199  : TableBase<3, T>(TableIndices<3>(size1, size2, size3),
3200  entries,
3201  C_style_indexing)
3202 {}
3203 
3204 
3205 
3206 template <typename T>
3207 inline ::internal::TableBaseAccessors::Accessor<3, T, true, 2>
3208  Table<3, T>::operator[](const size_type i) const
3209 {
3210  AssertIndexRange(i, this->table_size[0]);
3211  const size_type subobject_size =
3212  size_type(this->table_size[1]) * this->table_size[2];
3213  return (::internal::TableBaseAccessors::Accessor<3, T, true, 2>(
3214  *this, this->values.begin() + i * subobject_size));
3215 }
3216 
3217 
3218 
3219 template <typename T>
3220 inline ::internal::TableBaseAccessors::Accessor<3, T, false, 2>
3221  Table<3, T>::operator[](const size_type i)
3222 {
3223  AssertIndexRange(i, this->table_size[0]);
3224  const size_type subobject_size =
3225  size_type(this->table_size[1]) * this->table_size[2];
3226  return (::internal::TableBaseAccessors::Accessor<3, T, false, 2>(
3227  *this, this->values.begin() + i * subobject_size));
3228 }
3229 
3230 
3231 
3232 template <typename T>
3233 inline typename AlignedVector<T>::const_reference
3235 operator()(const size_type i, const size_type j, const size_type k) const
3236 {
3237  AssertIndexRange(i, this->table_size[0]);
3238  AssertIndexRange(j, this->table_size[1]);
3239  AssertIndexRange(k, this->table_size[2]);
3240  return this
3241  ->values[(size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3242  k];
3243 }
3244 
3245 
3246 
3247 template <typename T>
3248 inline typename AlignedVector<T>::reference
3249 Table<3, T>::operator()(const size_type i, const size_type j, const size_type k)
3250 {
3251  AssertIndexRange(i, this->table_size[0]);
3252  AssertIndexRange(j, this->table_size[1]);
3253  AssertIndexRange(k, this->table_size[2]);
3254  return this
3255  ->values[(size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3256  k];
3257 }
3258 
3259 
3260 
3261 template <typename T>
3262 inline typename AlignedVector<T>::const_reference
3263 Table<3, T>::operator()(const TableIndices<3> &indices) const
3264 {
3265  return TableBase<3, T>::operator()(indices);
3266 }
3267 
3268 
3269 
3270 template <typename T>
3271 inline typename AlignedVector<T>::reference
3273 {
3274  return TableBase<3, T>::operator()(indices);
3275 }
3276 
3277 
3278 
3279 template <typename T>
3280 inline Table<4, T>::Table(const size_type size1,
3281  const size_type size2,
3282  const size_type size3,
3283  const size_type size4)
3284  : TableBase<4, T>(TableIndices<4>(size1, size2, size3, size4))
3285 {}
3286 
3287 
3288 
3289 template <typename T>
3290 inline ::internal::TableBaseAccessors::Accessor<4, T, true, 3>
3291  Table<4, T>::operator[](const size_type i) const
3292 {
3293  AssertIndexRange(i, this->table_size[0]);
3294  const size_type subobject_size =
3295  size_type(this->table_size[1]) * this->table_size[2] * this->table_size[3];
3296  return (::internal::TableBaseAccessors::Accessor<4, T, true, 3>(
3297  *this, this->values.begin() + i * subobject_size));
3298 }
3299 
3300 
3301 
3302 template <typename T>
3303 inline ::internal::TableBaseAccessors::Accessor<4, T, false, 3>
3304  Table<4, T>::operator[](const size_type i)
3305 {
3306  AssertIndexRange(i, this->table_size[0]);
3307  const size_type subobject_size =
3308  size_type(this->table_size[1]) * this->table_size[2] * this->table_size[3];
3309  return (::internal::TableBaseAccessors::Accessor<4, T, false, 3>(
3310  *this, this->values.begin() + i * subobject_size));
3311 }
3312 
3313 
3314 
3315 template <typename T>
3316 inline typename AlignedVector<T>::const_reference
3317 Table<4, T>::operator()(const size_type i,
3318  const size_type j,
3319  const size_type k,
3320  const size_type l) const
3321 {
3322  AssertIndexRange(i, this->table_size[0]);
3323  AssertIndexRange(j, this->table_size[1]);
3324  AssertIndexRange(k, this->table_size[2]);
3325  AssertIndexRange(l, this->table_size[3]);
3326  return this
3327  ->values[((size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3328  k) *
3329  this->table_size[3] +
3330  l];
3331 }
3332 
3333 
3334 
3335 template <typename T>
3336 inline typename AlignedVector<T>::reference
3337 Table<4, T>::operator()(const size_type i,
3338  const size_type j,
3339  const size_type k,
3340  const size_type l)
3341 {
3342  AssertIndexRange(i, this->table_size[0]);
3343  AssertIndexRange(j, this->table_size[1]);
3344  AssertIndexRange(k, this->table_size[2]);
3345  AssertIndexRange(l, this->table_size[3]);
3346  return this
3347  ->values[((size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3348  k) *
3349  this->table_size[3] +
3350  l];
3351 }
3352 
3353 
3354 
3355 template <typename T>
3356 inline typename AlignedVector<T>::const_reference
3357 Table<4, T>::operator()(const TableIndices<4> &indices) const
3358 {
3359  return TableBase<4, T>::operator()(indices);
3360 }
3361 
3362 
3363 
3364 template <typename T>
3365 inline typename AlignedVector<T>::reference
3367 {
3368  return TableBase<4, T>::operator()(indices);
3369 }
3370 
3371 
3372 
3373 template <typename T>
3374 inline Table<5, T>::Table(const size_type size1,
3375  const size_type size2,
3376  const size_type size3,
3377  const size_type size4,
3378  const size_type size5)
3379  : TableBase<5, T>(TableIndices<5>(size1, size2, size3, size4, size5))
3380 {}
3381 
3382 
3383 
3384 template <typename T>
3385 inline ::internal::TableBaseAccessors::Accessor<5, T, true, 4>
3386  Table<5, T>::operator[](const size_type i) const
3387 {
3388  AssertIndexRange(i, this->table_size[0]);
3389  const size_type subobject_size = size_type(this->table_size[1]) *
3390  this->table_size[2] * this->table_size[3] *
3391  this->table_size[4];
3392  return (::internal::TableBaseAccessors::Accessor<5, T, true, 4>(
3393  *this, this->values.begin() + i * subobject_size));
3394 }
3395 
3396 
3397 
3398 template <typename T>
3399 inline ::internal::TableBaseAccessors::Accessor<5, T, false, 4>
3400  Table<5, T>::operator[](const size_type i)
3401 {
3402  AssertIndexRange(i, this->table_size[0]);
3403  const size_type subobject_size = size_type(this->table_size[1]) *
3404  this->table_size[2] * this->table_size[3] *
3405  this->table_size[4];
3406  return (::internal::TableBaseAccessors::Accessor<5, T, false, 4>(
3407  *this, this->values.begin() + i * subobject_size));
3408 }
3409 
3410 
3411 
3412 template <typename T>
3413 inline typename AlignedVector<T>::const_reference
3414 Table<5, T>::operator()(const size_type i,
3415  const size_type j,
3416  const size_type k,
3417  const size_type l,
3418  const size_type m) const
3419 {
3420  AssertIndexRange(i, this->table_size[0]);
3421  AssertIndexRange(j, this->table_size[1]);
3422  AssertIndexRange(k, this->table_size[2]);
3423  AssertIndexRange(l, this->table_size[3]);
3424  AssertIndexRange(m, this->table_size[4]);
3425  return this
3426  ->values[(((size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3427  k) *
3428  this->table_size[3] +
3429  l) *
3430  this->table_size[4] +
3431  m];
3432 }
3433 
3434 
3435 
3436 template <typename T>
3437 inline typename AlignedVector<T>::reference
3438 Table<5, T>::operator()(const size_type i,
3439  const size_type j,
3440  const size_type k,
3441  const size_type l,
3442  const size_type m)
3443 {
3444  AssertIndexRange(i, this->table_size[0]);
3445  AssertIndexRange(j, this->table_size[1]);
3446  AssertIndexRange(k, this->table_size[2]);
3447  AssertIndexRange(l, this->table_size[3]);
3448  AssertIndexRange(m, this->table_size[4]);
3449  return this
3450  ->values[(((size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3451  k) *
3452  this->table_size[3] +
3453  l) *
3454  this->table_size[4] +
3455  m];
3456 }
3457 
3458 
3459 
3460 template <typename T>
3461 inline typename AlignedVector<T>::const_reference
3462 Table<5, T>::operator()(const TableIndices<5> &indices) const
3463 {
3464  return TableBase<5, T>::operator()(indices);
3465 }
3466 
3467 
3468 
3469 template <typename T>
3470 inline typename AlignedVector<T>::reference
3472 {
3473  return TableBase<5, T>::operator()(indices);
3474 }
3475 
3476 
3477 
3478 template <typename T>
3479 inline Table<6, T>::Table(const size_type size1,
3480  const size_type size2,
3481  const size_type size3,
3482  const size_type size4,
3483  const size_type size5,
3484  const size_type size6)
3485  : TableBase<6, T>()
3486 {
3487  TableIndices<6> table_indices;
3488  table_indices[0] = size1;
3489  table_indices[1] = size2;
3490  table_indices[2] = size3;
3491  table_indices[3] = size4;
3492  table_indices[4] = size5;
3493  table_indices[5] = size6;
3494 
3495  TableBase<6, T>::reinit(table_indices);
3496 }
3497 
3498 
3499 
3500 template <typename T>
3501 inline ::internal::TableBaseAccessors::Accessor<6, T, true, 5>
3502  Table<6, T>::operator[](const size_type i) const
3503 {
3504  AssertIndexRange(i, this->table_size[0]);
3505  const size_type subobject_size = size_type(this->table_size[1]) *
3506  this->table_size[2] * this->table_size[3] *
3507  this->table_size[4] * this->table_size[5];
3508  return (::internal::TableBaseAccessors::Accessor<6, T, true, 5>(
3509  *this, this->values.begin() + i * subobject_size));
3510 }
3511 
3512 
3513 
3514 template <typename T>
3515 inline ::internal::TableBaseAccessors::Accessor<6, T, false, 5>
3516  Table<6, T>::operator[](const size_type i)
3517 {
3518  AssertIndexRange(i, this->table_size[0]);
3519  const size_type subobject_size = size_type(this->table_size[1]) *
3520  this->table_size[2] * this->table_size[3] *
3521  this->table_size[4] * this->table_size[5];
3522  return (::internal::TableBaseAccessors::Accessor<6, T, false, 5>(
3523  *this, this->values.begin() + i * subobject_size));
3524 }
3525 
3526 
3527 
3528 template <typename T>
3529 inline typename AlignedVector<T>::const_reference
3530 Table<6, T>::operator()(const size_type i,
3531  const size_type j,
3532  const size_type k,
3533  const size_type l,
3534  const size_type m,
3535  const size_type n) const
3536 {
3537  AssertIndexRange(i, this->table_size[0]);
3538  AssertIndexRange(j, this->table_size[1]);
3539  AssertIndexRange(k, this->table_size[2]);
3540  AssertIndexRange(l, this->table_size[3]);
3541  AssertIndexRange(m, this->table_size[4]);
3542  AssertIndexRange(n, this->table_size[5]);
3543  return this
3544  ->values[((((size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3545  k) *
3546  this->table_size[3] +
3547  l) *
3548  this->table_size[4] +
3549  m) *
3550  this->table_size[5] +
3551  n];
3552 }
3553 
3554 
3555 
3556 template <typename T>
3557 inline typename AlignedVector<T>::reference
3558 Table<6, T>::operator()(const size_type i,
3559  const size_type j,
3560  const size_type k,
3561  const size_type l,
3562  const size_type m,
3563  const size_type n)
3564 {
3565  AssertIndexRange(i, this->table_size[0]);
3566  AssertIndexRange(j, this->table_size[1]);
3567  AssertIndexRange(k, this->table_size[2]);
3568  AssertIndexRange(l, this->table_size[3]);
3569  AssertIndexRange(m, this->table_size[4]);
3570  AssertIndexRange(n, this->table_size[5]);
3571  return this
3572  ->values[((((size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3573  k) *
3574  this->table_size[3] +
3575  l) *
3576  this->table_size[4] +
3577  m) *
3578  this->table_size[5] +
3579  n];
3580 }
3581 
3582 
3583 
3584 template <typename T>
3585 inline typename AlignedVector<T>::const_reference
3586 Table<6, T>::operator()(const TableIndices<6> &indices) const
3587 {
3588  return TableBase<6, T>::operator()(indices);
3589 }
3590 
3591 
3592 
3593 template <typename T>
3594 inline typename AlignedVector<T>::reference
3596 {
3597  return TableBase<6, T>::operator()(indices);
3598 }
3599 
3600 
3601 
3602 template <typename T>
3603 inline Table<7, T>::Table(const size_type size1,
3604  const size_type size2,
3605  const size_type size3,
3606  const size_type size4,
3607  const size_type size5,
3608  const size_type size6,
3609  const size_type size7)
3610  : TableBase<7, T>()
3611 {
3612  TableIndices<7> table_indices;
3613  table_indices[0] = size1;
3614  table_indices[1] = size2;
3615  table_indices[2] = size3;
3616  table_indices[3] = size4;
3617  table_indices[4] = size5;
3618  table_indices[5] = size6;
3619  table_indices[6] = size7;
3620 
3621  TableBase<7, T>::reinit(table_indices);
3622 }
3623 
3624 
3625 
3626 template <typename T>
3627 inline ::internal::TableBaseAccessors::Accessor<7, T, true, 6>
3628  Table<7, T>::operator[](const size_type i) const
3629 {
3630  AssertIndexRange(i, this->table_size[0]);
3631  const size_type subobject_size =
3632  size_type(this->table_size[1]) * this->table_size[2] * this->table_size[3] *
3633  this->table_size[4] * this->table_size[5] * this->table_size[6];
3634  return (::internal::TableBaseAccessors::Accessor<7, T, true, 6>(
3635  *this, this->values.begin() + i * subobject_size));
3636 }
3637 
3638 
3639 
3640 template <typename T>
3641 inline ::internal::TableBaseAccessors::Accessor<7, T, false, 6>
3642  Table<7, T>::operator[](const size_type i)
3643 {
3644  AssertIndexRange(i, this->table_size[0]);
3645  const size_type subobject_size =
3646  size_type(this->table_size[1]) * this->table_size[2] * this->table_size[3] *
3647  this->table_size[4] * this->table_size[5] * this->table_size[6];
3648  return (::internal::TableBaseAccessors::Accessor<7, T, false, 6>(
3649  *this, this->values.begin() + i * subobject_size));
3650 }
3651 
3652 
3653 
3654 template <typename T>
3655 inline typename AlignedVector<T>::const_reference
3656 Table<7, T>::operator()(const size_type i,
3657  const size_type j,
3658  const size_type k,
3659  const size_type l,
3660  const size_type m,
3661  const size_type n,
3662  const size_type o) const
3663 {
3664  AssertIndexRange(i, this->table_size[0]);
3665  AssertIndexRange(j, this->table_size[1]);
3666  AssertIndexRange(k, this->table_size[2]);
3667  AssertIndexRange(l, this->table_size[3]);
3668  AssertIndexRange(m, this->table_size[4]);
3669  AssertIndexRange(n, this->table_size[5]);
3670  AssertIndexRange(o, this->table_size[6]);
3671  return this->values
3672  [(((((size_type(i) * this->table_size[1] + j) * this->table_size[2] + k) *
3673  this->table_size[3] +
3674  l) *
3675  this->table_size[4] +
3676  m) *
3677  this->table_size[5] +
3678  n) *
3679  this->table_size[6] +
3680  o];
3681 }
3682 
3683 
3684 
3685 template <typename T>
3686 inline typename AlignedVector<T>::reference
3687 Table<7, T>::operator()(const size_type i,
3688  const size_type j,
3689  const size_type k,
3690  const size_type l,
3691  const size_type m,
3692  const size_type n,
3693  const size_type o)
3694 {
3695  AssertIndexRange(i, this->table_size[0]);
3696  AssertIndexRange(j, this->table_size[1]);
3697  AssertIndexRange(k, this->table_size[2]);
3698  AssertIndexRange(l, this->table_size[3]);
3699  AssertIndexRange(m, this->table_size[4]);
3700  AssertIndexRange(n, this->table_size[5]);
3701  AssertIndexRange(o, this->table_size[6]);
3702  return this->values
3703  [(((((size_type(i) * this->table_size[1] + j) * this->table_size[2] + k) *
3704  this->table_size[3] +
3705  l) *
3706  this->table_size[4] +
3707  m) *
3708  this->table_size[5] +
3709  n) *
3710  this->table_size[6] +
3711  o];
3712 }
3713 
3714 
3715 
3716 template <typename T>
3717 inline typename AlignedVector<T>::const_reference
3718 Table<7, T>::operator()(const TableIndices<7> &indices) const
3719 {
3720  return TableBase<7, T>::operator()(indices);
3721 }
3722 
3723 
3724 
3725 template <typename T>
3726 inline typename AlignedVector<T>::reference
3728 {
3729  return TableBase<7, T>::operator()(indices);
3730 }
3731 
3732 
3733 #endif // DOXYGEN
3734 
3735 
3736 
3744 template <int N, typename T>
3745 inline void
3747 {
3748  u.swap(v);
3749 }
3750 
3751 DEAL_II_NAMESPACE_CLOSE
3752 
3753 #endif
bool operator==(const TableBase< N, T > &T2) const
typename TableBase< 3, T >::size_type size_type
Definition: table.h:1381
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:1936
MatrixTableIterators::Iterator< TransposeTable< T >, true, MatrixTableIterators::Storage::column_major > const_iterator
Definition: table.h:1960
const TableIndices< N > & size() const
typename TableBase< 6, T >::size_type size_type
Definition: table.h:1704
const value_type & value() const
typename AccessorBase< TableType, true, storage_order >::value_type value_type
Definition: table.h:1006
size_type n_cols() const
typename AlignedVector< number >::reference reference
Definition: table.h:1946
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:1128
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
Iterator(const Accessor< TableType, Constness, storage_order > &accessor)
SymmetricTensor< 2, dim, Number > C(const Tensor< 2, dim, Number > &F)
typename AlignedVector< T >::const_reference const_reference
Definition: table.h:1143
typename TableBase< 4, T >::size_type size_type
Definition: table.h:1513
MatrixTableIterators::Iterator< TransposeTable< T >, false, MatrixTableIterators::Storage::column_major > iterator
Definition: table.h:1968
typename AccessorBase< TableType, true, storage_order >::size_type size_type
Definition: table.h:1012
static ::ExceptionBase & ExcMessage(std::string arg1)
iterator end()
void swap(BlockIndices &u, BlockIndices &v)
iterator begin()
void reinit(const TableIndices< N > &new_size, const bool omit_default_initialization=false)
~TableBase() override=default
typename AccessorBase< TableType, true, storage_order >::value_type value_type
Definition: table.h:979
#define Assert(cond, exc)
Definition: exceptions.h:1407
typename AccessorBase< TableType, true, storage_order >::size_type size_type
Definition: table.h:985
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:937
typename TableType::size_type size_type
Definition: table.h:1068
TableBase()=default
Accessor class offering read and write access to the elements of a table.
Definition: table.h:998
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
MatrixTableIterators::Iterator< TransposeTable< T >, Constness, MatrixTableIterators::Storage::column_major > Iterator
Definition: table.h:1912
size_type size(const unsigned int i) const
TableBase< N, T > & operator=(const TableBase< N, T > &src)
typename AlignedVector< T >::size_type size_type
Definition: table.h:418
std::size_t memory_consumption() const
typename TableBase< 5, T >::size_type size_type
Definition: table.h:1607
void reset_values()
typename AlignedVector< T >::reference reference
Definition: table.h:1138
TransposeTable()=default
typename AlignedVector< T >::value_type value_type
Definition: table.h:1133
reference el(const size_type i, const size_type j)
static ::ExceptionBase & ExcNotImplemented()
Definition: table.h:37
bool empty() const
TableIndices< N > table_size
Definition: table.h:675
#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:670
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:1802
void fill(InputIterator entries, const bool C_style_indexing=true)
T max(const T &t, const MPI_Comm &mpi_communicator)
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:1951
typename std::conditional< Constness, const TableType *, TableType * >::type container_pointer_type
Definition: table.h:1074
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
static ::ExceptionBase & ExcInternalError()