16 #ifndef dealii_table_h 17 #define dealii_table_h 19 #include <deal.II/base/config.h> 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> 31 DEAL_II_NAMESPACE_OPEN
34 template <
int N,
typename T>
36 template <
int N,
typename T>
73 namespace TableBaseAccessors
82 template <
int N,
typename T,
bool Constness>
91 template <
int N,
typename T>
92 struct Types<N, T, true>
94 using value_type =
const T;
97 using iterator =
typename AlignedVector<T>::const_iterator;
98 using const_iterator =
typename AlignedVector<T>::const_iterator;
100 using reference =
typename AlignedVector<T>::const_reference;
101 using const_reference =
typename AlignedVector<T>::const_reference;
109 template <
int N,
typename T>
110 struct Types<N, T, false>
112 using value_type = T;
115 using iterator =
typename AlignedVector<T>::iterator;
116 using const_iterator =
typename AlignedVector<T>::const_iterator;
118 using reference =
typename AlignedVector<T>::reference;
119 using const_reference =
typename AlignedVector<T>::const_reference;
161 template <
int N,
typename T,
bool C,
unsigned int P>
165 using TableType =
typename Types<N, T, C>::TableType;
167 using iterator =
typename Types<N, T, C>::iterator;
168 using const_iterator =
typename Types<N, T, C>::const_iterator;
170 using size_type = size_t;
171 using difference_type = ptrdiff_t;
179 Accessor(
const TableType &table,
const iterator data);
189 Accessor(
const Accessor &a);
194 Accessor<N, T,
C, P - 1> operator[](
const size_type i)
const;
204 <<
"Index " << N - P + 1 <<
"has a value of " << arg1
205 <<
" but needs to be in the range [" << arg2 <<
"," << arg3
214 const TableType &table;
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>;
242 template <
int N,
typename T,
bool C>
243 class Accessor<N, T,
C, 1>
251 using value_type =
typename Types<N, T, C>::value_type;
253 using iterator =
typename Types<N, T, C>::iterator;
254 using const_iterator =
typename Types<N, T, C>::const_iterator;
256 using reference =
typename Types<N, T, C>::reference;
257 using const_reference =
typename Types<N, T, C>::const_reference;
259 using size_type = size_t;
260 using difference_type = ptrdiff_t;
265 using TableType =
typename Types<N, T, C>::TableType;
279 Accessor(
const TableType &table,
const iterator data);
289 Accessor(
const Accessor &a);
294 reference operator[](
const size_type)
const;
321 const TableType &table;
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>;
409 template <
int N,
typename T>
413 using value_type = T;
437 template <
typename InputIterator>
439 InputIterator entries,
440 const bool C_style_indexing =
true);
451 template <
typename T2>
482 template <
typename T2>
516 const bool omit_default_initialization =
false);
522 size(
const unsigned int i)
const;
580 template <
typename InputIterator>
582 fill(InputIterator entries,
const bool C_style_indexing =
true);
588 fill(
const T &value);
593 typename AlignedVector<T>::reference
603 typename AlignedVector<T>::const_reference
632 template <
class Archive>
634 serialize(Archive &ar,
const unsigned int version);
650 typename AlignedVector<T>::reference
663 typename AlignedVector<T>::const_reference
680 template <
int,
typename>
698 template <
int N,
typename T>
715 template <
typename T>
771 template <
typename InputIterator>
773 InputIterator entries,
774 const bool C_style_indexing =
true);
780 typename AlignedVector<T>::const_reference
787 typename AlignedVector<T>::reference operator[](
const size_type i);
793 typename AlignedVector<T>::const_reference
800 typename AlignedVector<T>::reference
807 typename AlignedVector<T>::reference
814 typename AlignedVector<T>::const_reference
847 template <
typename TableType,
bool Constness, Storage storage_order>
854 template <
typename TableType,
bool Constness, Storage storage_order>
873 template <
typename TableType,
bool Constness, Storage storage_order>
881 conditional<Constness, const TableType *, TableType *>::type;
962 Iterator<TableType, Constness, storage_order>,
970 template <
typename TableType, Storage storage_order>
997 template <
typename TableType, Storage storage_order>
1059 template <
typename TableType,
bool Constness, Storage storage_order>
1062 Accessor<TableType, Constness, storage_order>>
1074 conditional<Constness, const TableType *, TableType *>::type;
1102 const std::ptrdiff_t linear_index);
1121 template <
typename T>
1155 using iterator = MatrixTableIterators::
1206 template <
typename InputIterator>
1209 InputIterator entries,
1210 const bool C_style_indexing =
true);
1220 const bool omit_default_initialization =
false);
1230 ::internal::TableBaseAccessors::Accessor<2, T, true, 1>
1239 ::internal::TableBaseAccessors::Accessor<2, T, false, 1>
1248 typename AlignedVector<T>::const_reference
1258 typename AlignedVector<T>::reference
1265 typename AlignedVector<T>::reference
1272 typename AlignedVector<T>::const_reference
1325 typename AlignedVector<T>::reference
1342 typename AlignedVector<T>::const_reference
1350 AccessorBase<Table<2, T>, true, MatrixTableIterators::Storage::row_major>;
1352 AccessorBase<Table<2, T>, false, MatrixTableIterators::Storage::row_major>;
1359 Accessor<Table<2, T>, false, MatrixTableIterators::Storage::row_major>;
1374 template <typename T>
1433 template <
typename InputIterator>
1437 InputIterator entries,
1438 const bool C_style_indexing =
true);
1447 ::internal::TableBaseAccessors::Accessor<3, T, true, 2>
1457 ::internal::TableBaseAccessors::Accessor<3, T, false, 2>
1466 typename AlignedVector<T>::const_reference
1476 typename AlignedVector<T>::reference
1483 typename AlignedVector<T>::reference
1490 typename AlignedVector<T>::const_reference
1506 template <
typename T>
1535 ::internal::TableBaseAccessors::Accessor<4, T, true, 3>
1545 ::internal::TableBaseAccessors::Accessor<4, T, false, 3>
1554 typename AlignedVector<T>::const_reference
1567 typename AlignedVector<T>::reference
1577 typename AlignedVector<T>::reference
1584 typename AlignedVector<T>::const_reference
1600 template <
typename T>
1631 ::internal::TableBaseAccessors::Accessor<5, T, true, 4>
1641 ::internal::TableBaseAccessors::Accessor<5, T, false, 4>
1650 typename AlignedVector<T>::const_reference
1663 typename AlignedVector<T>::reference
1674 typename AlignedVector<T>::reference
1681 typename AlignedVector<T>::const_reference
1697 template <
typename T>
1728 ::internal::TableBaseAccessors::Accessor<6, T, true, 5>
1738 ::internal::TableBaseAccessors::Accessor<6, T, false, 5>
1747 typename AlignedVector<T>::const_reference
1761 typename AlignedVector<T>::reference
1773 typename AlignedVector<T>::reference
1780 typename AlignedVector<T>::const_reference
1795 template <
typename T>
1827 ::internal::TableBaseAccessors::Accessor<7, T, true, 6>
1837 ::internal::TableBaseAccessors::Accessor<7, T, false, 6>
1846 typename AlignedVector<T>::const_reference
1861 typename AlignedVector<T>::reference
1874 typename AlignedVector<T>::reference
1881 typename AlignedVector<T>::const_reference
1896 template <
typename T,
bool Constness>
1902 template <
typename T,
bool Constness>
1903 using Accessor DEAL_II_DEPRECATED =
1908 template <
typename T,
bool Constness>
1909 using Iterator DEAL_II_DEPRECATED =
1929 template <
typename T>
1988 const bool omit_default_initialization =
false);
2088 MatrixTableIterators::Storage::column_major>;
2097 MatrixTableIterators::Storage::column_major>;
2106 template <int N, typename T>
2114 template <
int N,
typename T>
2115 template <
typename InputIterator>
2117 InputIterator entries,
2118 const bool C_style_indexing)
2121 fill(entries, C_style_indexing);
2126 template <
int N,
typename T>
2136 template <
int N,
typename T>
2137 template <
typename T2>
2142 std::copy(src.
values.begin(), src.
values.end(), values.begin());
2147 template <
int N,
typename T>
2150 , values(std::move(src.
values))
2158 template <
int N,
typename T>
2159 template <
class Archive>
2165 ar &values &table_size;
2172 namespace TableBaseAccessors
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)
2183 template <
int N,
typename T,
bool C,
unsigned int P>
2184 inline Accessor<N, T, C, P>::Accessor(
const Accessor &a)
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 2201 return Accessor<N, T,
C, P - 1>(table, data);
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);
2217 template <
int N,
typename T,
bool C>
2218 inline Accessor<N, T, C, 1>::Accessor(
const TableType &table,
2219 const iterator data)
2226 template <
int N,
typename T,
bool C>
2227 inline Accessor<N, T, C, 1>::Accessor(
const Accessor &a)
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 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 2248 return table.size()[N - 1];
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 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 2266 return data + table.size()[N - 1];
2273 template <
int N,
typename T>
2279 reinit(m.
size(),
true);
2286 template <
int N,
typename T>
2287 template <
typename T2>
2291 reinit(m.
size(),
true);
2293 std::copy(m.
values.begin(),
2294 m.
values.begin() + n_elements(),
2302 template <
int N,
typename T>
2307 values = std::move(m.
values);
2316 template <
int N,
typename T>
2320 return (values == T2.
values);
2325 template <
int N,
typename T>
2330 if (n_elements() != 0)
2336 template <
int N,
typename T>
2340 if (n_elements() != 0)
2346 template <
int N,
typename T>
2349 const bool omit_default_initialization)
2351 table_size = new_sizes;
2353 const size_type new_size = n_elements();
2374 if (!omit_default_initialization)
2377 values.resize(new_size);
2380 values.resize_fast(new_size);
2385 values.resize_fast(new_size);
2390 template <
int N,
typename T>
2399 template <
int N,
typename T>
2404 return table_size[i];
2409 template <
int N,
typename T>
2414 for (
unsigned int n = 0; n < N; ++n)
2421 template <
int N,
typename T>
2425 return (n_elements() == 0);
2432 namespace TableImplementation
2434 template <
typename InputIterator,
typename T>
2439 for (size_type i = 0; i < table.
size()[0]; ++i)
2444 template <
typename InputIterator,
typename T>
2449 for (size_type j = 0; j < table.
size()[1]; ++j)
2450 for (size_type i = 0; i < table.
size()[0]; ++i)
2455 template <
typename InputIterator,
typename T>
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)
2467 template <
typename InputIterator,
typename T,
int N>
2477 template <
int N,
typename T>
2478 template <
typename InputIterator>
2484 if (C_style_indexing)
2485 for (
typename AlignedVector<T>::iterator p = values.begin();
2490 internal::TableImplementation::fill_Fortran_style(entries, *
this);
2495 template <
int N,
typename T>
2505 template <
int N,
typename T>
2514 template <
int N,
typename T>
2528 return size_type(indices[0]) * table_size[1] + indices[1];
2530 return ((size_type(indices[0]) * table_size[1] + indices[1]) *
2535 unsigned int s = indices[0];
2536 for (
unsigned int n = 1; n < N; ++n)
2537 s = s * table_size[n] + indices[n];
2545 template <
int N,
typename T>
2546 inline typename AlignedVector<T>::const_reference
2549 for (
unsigned int n = 0; n < N; ++n)
2556 template <
int N,
typename T>
2557 inline typename AlignedVector<T>::reference
2560 for (
unsigned int n = 0; n < N; ++n)
2567 template <
int N,
typename T>
2568 inline typename AlignedVector<T>::const_reference
2571 return values[position(indices)];
2576 template <
int N,
typename T>
2577 inline typename AlignedVector<T>::reference
2581 return values[position(indices)];
2586 template <
typename T>
2593 template <
typename T>
2594 template <
typename InputIterator>
2596 InputIterator entries,
2597 const bool C_style_indexing)
2603 template <
typename T>
2604 inline typename AlignedVector<T>::const_reference
Table<1, T>:: 2613 template <
typename T>
2623 template <
typename T>
2624 inline typename AlignedVector<T>::const_reference
2633 template <
typename T>
2634 inline typename AlignedVector<T>::reference
2643 template <
typename T>
2644 inline typename AlignedVector<T>::const_reference
2652 template <
typename T>
2653 inline typename AlignedVector<T>::reference
2664 template <
typename T>
2671 template <
typename T>
2672 template <
typename InputIterator>
2674 const size_type size2,
2675 InputIterator entries,
2676 const bool C_style_indexing)
2682 template <
typename T>
2685 const size_type size2,
2686 const bool omit_default_initialization)
2689 omit_default_initialization);
2694 template <
typename T>
2695 inline ::internal::TableBaseAccessors::Accessor<2, T, true, 1>
2699 return ::internal::TableBaseAccessors::Accessor<2, T, true, 1>(
2705 template <
typename T>
2706 inline ::internal::TableBaseAccessors::Accessor<2, T, false, 1>
2710 return ::internal::TableBaseAccessors::Accessor<2, T, false, 1>(
2716 template <
typename T>
2717 inline typename AlignedVector<T>::const_reference
2727 template <
typename T>
2728 inline typename AlignedVector<T>::reference
2738 template <
typename T>
2739 inline typename AlignedVector<T>::const_reference
2747 template <
typename T>
2748 inline typename AlignedVector<T>::reference
2756 template <
typename T>
2757 inline typename AlignedVector<T>::const_reference
2765 template <
typename T>
2766 inline typename AlignedVector<T>::reference
2774 template <
typename T>
2783 template <
typename T>
2792 template <
typename T>
2801 template <
typename T>
2810 template <
typename T>
2819 template <
typename T>
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)
2840 switch (storage_order)
2843 return linear_index / container->n_cols();
2845 return linear_index % container->n_rows();
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)
2859 switch (storage_order)
2862 return linear_index % container->n_cols();
2864 return linear_index / container->n_rows();
2874 template <
typename TableType,
bool Constness, Storage storage_order>
2876 : container(nullptr)
2877 , linear_index(
std::numeric_limits<decltype(linear_index)>::
max())
2882 template <
typename TableType,
bool Constness, Storage storage_order>
2883 inline AccessorBase<TableType, Constness, storage_order>::AccessorBase(
2884 const container_pointer_type table)
2886 , linear_index(container->values.size())
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)
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)
2905 , linear_index(index)
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."));
2915 template <
typename TableType,
bool Constness, Storage storage_order>
2916 inline const typename AccessorBase<TableType, Constness, storage_order>::
2918 AccessorBase<TableType, Constness, storage_order>::value()
const 2920 assert_valid_linear_index();
2921 return this->container->values[linear_index];
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 2930 assert_valid_linear_index();
2931 return static_cast<std::size_t
>(
2932 internal::get_row_index<TableType, storage_order>(linear_index,
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 2942 assert_valid_linear_index();
2943 return static_cast<std::size_t
>(
2944 internal::get_column_index<TableType, storage_order>(linear_index,
2950 template <
typename TableType,
bool Constness, Storage storage_order>
2952 AccessorBase<TableType, Constness, storage_order>::assert_valid_linear_index()
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,
2967 const std::ptrdiff_t column_n =
2968 internal::get_column_index<TableType, storage_order>(linear_index,
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."));
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)
2985 this->assert_valid_linear_index();
2986 this->container->values[this->linear_index] = t;
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 2997 this->assert_valid_linear_index();
2998 this->container->values[this->linear_index] = t;
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 3008 this->assert_valid_linear_index();
3009 return this->container->values[this->linear_index];
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)
3018 Accessor<TableType, Constness, storage_order>>(a)
3023 template <
typename TableType,
bool Constness, Storage storage_order>
3024 inline Iterator<TableType, Constness, storage_order>::Iterator(
3025 const container_pointer_type table)
3027 Accessor<TableType, Constness, storage_order>>(
3028 Accessor<TableType, Constness, storage_order>(table))
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)
3037 Accessor<TableType, Constness, storage_order>>(*i)
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)
3049 table->n_cols() * row_n + col_n :
3050 table->n_rows() * col_n + row_n)
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)
3060 Accessor<TableType, Constness, storage_order>>(
3061 Accessor<TableType, Constness, storage_order>(table, linear_index))
3068 template <
typename T>
3070 const size_type size2)
3076 template <
typename T>
3079 const size_type size2,
3080 const bool omit_default_initialization)
3083 omit_default_initialization);
3088 template <
typename T>
3094 return this->values[size_type(j) * this->table_size[1] + i];
3099 template <
typename T>
3105 return this->values[size_type(j) * this->table_size[1] + i];
3110 template <
typename T>
3114 return this->values[size_type(j) * this->table_size[1] + i];
3119 template <
typename T>
3123 return this->values[size_type(j) * this->table_size[1] + i];
3128 template <
typename T>
3132 return this->table_size[1];
3137 template <
typename T>
3141 return this->table_size[0];
3146 template <
typename T>
3155 template <
typename T>
3164 template <
typename T>
3173 template <
typename T>
3183 template <
typename T>
3185 const size_type size2,
3186 const size_type size3)
3192 template <
typename T>
3193 template <
typename InputIterator>
3195 const size_type size2,
3196 const size_type size3,
3197 InputIterator entries,
3198 const bool C_style_indexing)
3206 template <
typename T>
3207 inline ::internal::TableBaseAccessors::Accessor<3, T, true, 2>
3213 return (::internal::TableBaseAccessors::Accessor<3, T, true, 2>(
3214 *
this, this->
values.begin() + i * subobject_size));
3219 template <
typename T>
3220 inline ::internal::TableBaseAccessors::Accessor<3, T, false, 2>
3226 return (::internal::TableBaseAccessors::Accessor<3, T, false, 2>(
3227 *
this, this->
values.begin() + i * subobject_size));
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 3247 template <
typename T>
3248 inline typename AlignedVector<T>::reference
3261 template <
typename T>
3262 inline typename AlignedVector<T>::const_reference
3270 template <
typename T>
3271 inline typename AlignedVector<T>::reference
3279 template <
typename T>
3281 const size_type size2,
3282 const size_type size3,
3283 const size_type size4)
3289 template <
typename T>
3290 inline ::internal::TableBaseAccessors::Accessor<4, T, true, 3>
3296 return (::internal::TableBaseAccessors::Accessor<4, T, true, 3>(
3297 *
this, this->
values.begin() + i * subobject_size));
3302 template <
typename T>
3303 inline ::internal::TableBaseAccessors::Accessor<4, T, false, 3>
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));
3315 template <
typename T>
3316 inline typename AlignedVector<T>::const_reference
3320 const size_type l)
const 3327 ->values[((
size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3329 this->table_size[3] +
3335 template <
typename T>
3336 inline typename AlignedVector<T>::reference
3347 ->values[((
size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3349 this->table_size[3] +
3355 template <
typename T>
3356 inline typename AlignedVector<T>::const_reference
3364 template <
typename T>
3365 inline typename AlignedVector<T>::reference
3373 template <
typename T>
3375 const size_type size2,
3376 const size_type size3,
3377 const size_type size4,
3378 const size_type size5)
3384 template <
typename T>
3385 inline ::internal::TableBaseAccessors::Accessor<5, T, true, 4>
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));
3398 template <
typename T>
3399 inline ::internal::TableBaseAccessors::Accessor<5, T, false, 4>
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));
3412 template <
typename T>
3413 inline typename AlignedVector<T>::const_reference
3418 const size_type m)
const 3426 ->values[(((
size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3428 this->table_size[3] +
3430 this->table_size[4] +
3436 template <
typename T>
3437 inline typename AlignedVector<T>::reference
3450 ->values[(((
size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3452 this->table_size[3] +
3454 this->table_size[4] +
3460 template <
typename T>
3461 inline typename AlignedVector<T>::const_reference
3469 template <
typename T>
3470 inline typename AlignedVector<T>::reference
3478 template <
typename T>
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)
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;
3500 template <
typename T>
3501 inline ::internal::TableBaseAccessors::Accessor<6, T, true, 5>
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));
3514 template <
typename T>
3515 inline ::internal::TableBaseAccessors::Accessor<6, T, false, 5>
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));
3528 template <
typename T>
3529 inline typename AlignedVector<T>::const_reference
3535 const size_type n)
const 3544 ->values[((((
size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3546 this->table_size[3] +
3548 this->table_size[4] +
3550 this->table_size[5] +
3556 template <
typename T>
3557 inline typename AlignedVector<T>::reference
3572 ->values[((((
size_type(i) * this->table_size[1] + j) * this->table_size[2] +
3574 this->table_size[3] +
3576 this->table_size[4] +
3578 this->table_size[5] +
3584 template <
typename T>
3585 inline typename AlignedVector<T>::const_reference
3593 template <
typename T>
3594 inline typename AlignedVector<T>::reference
3602 template <
typename T>
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)
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;
3626 template <
typename T>
3627 inline ::internal::TableBaseAccessors::Accessor<7, T, true, 6>
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));
3640 template <
typename T>
3641 inline ::internal::TableBaseAccessors::Accessor<7, T, false, 6>
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));
3654 template <
typename T>
3655 inline typename AlignedVector<T>::const_reference
3662 const size_type o)
const 3672 [(((((
size_type(i) * this->table_size[1] + j) * this->table_size[2] + k) *
3673 this->table_size[3] +
3675 this->table_size[4] +
3677 this->table_size[5] +
3679 this->table_size[6] +
3685 template <
typename T>
3686 inline typename AlignedVector<T>::reference
3703 [(((((
size_type(i) * this->table_size[1] + j) * this->table_size[2] + k) *
3704 this->table_size[3] +
3706 this->table_size[4] +
3708 this->table_size[5] +
3710 this->table_size[6] +
3716 template <
typename T>
3717 inline typename AlignedVector<T>::const_reference
3725 template <
typename T>
3726 inline typename AlignedVector<T>::reference
3744 template <
int N,
typename T>
3751 DEAL_II_NAMESPACE_CLOSE
bool operator==(const TableBase< N, T > &T2) const
typename TableBase< 3, T >::size_type size_type
size_type position(const TableIndices< N > &indices) const
Storage
Enumeration describing the storage order (i.e., the in-memory layout) of a table class.
void serialize(Archive &ar, const unsigned int version)
void swap(TableBase< N, T > &v)
typename TableBase< 2, T >::size_type size_type
MatrixTableIterators::Iterator< TransposeTable< T >, true, MatrixTableIterators::Storage::column_major > const_iterator
const TableIndices< N > & size() const
typename TableBase< 6, T >::size_type size_type
const value_type & value() const
typename AccessorBase< TableType, true, storage_order >::value_type value_type
typename TableType::size_type size_type
typename AlignedVector< number >::reference reference
typename std::conditional< Constness, const TableType *, TableType * >::type container_pointer_type
#define AssertIndexRange(index, range)
Accessor< TableType, Constness, storage_order > accessor
typename TableBase< 2, T >::size_type size_type
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
size_type n_elements() const
typename TableBase< 1, T >::size_type size_type
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
typename TableBase< 4, T >::size_type size_type
MatrixTableIterators::Iterator< TransposeTable< T >, false, MatrixTableIterators::Storage::column_major > iterator
typename AccessorBase< TableType, true, storage_order >::size_type size_type
static ::ExceptionBase & ExcMessage(std::string arg1)
void swap(BlockIndices &u, BlockIndices &v)
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
#define Assert(cond, exc)
typename AccessorBase< TableType, true, storage_order >::size_type size_type
Accessor base class for Table<2, T> and TransposeTable.
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
std::ptrdiff_t linear_index
typename TableType::size_type size_type
Accessor class offering read and write access to the elements of a table.
void swap(Vector< Number > &u, Vector< Number > &v)
Iterator class for both matrix-like tables, i.e., Table<2, T> and TransposeTable. ...
MatrixTableIterators::Iterator< TransposeTable< T >, Constness, MatrixTableIterators::Storage::column_major > Iterator
size_type size(const unsigned int i) const
TableBase< N, T > & operator=(const TableBase< N, T > &src)
typename AlignedVector< T >::size_type size_type
std::size_t memory_consumption() const
typename TableBase< 5, T >::size_type size_type
void assert_valid_linear_index() const
typename AlignedVector< T >::reference reference
typename TableType::value_type value_type
typename AlignedVector< T >::value_type value_type
reference el(const size_type i, const size_type j)
static ::ExceptionBase & ExcNotImplemented()
TableIndices< N > table_size
#define DeclException3(Exception3, type1, type2, type3, outsequence)
const_reference operator()(const size_type i, const size_type j) const
AlignedVector< T >::reference operator()(const TableIndices< N > &indices)
AlignedVector< T > values
Accessor class template. This class is partially specialized for both values of Constness.
typename TableBase< 7, T >::size_type size_type
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
typename std::conditional< Constness, const TableType *, TableType * >::type container_pointer_type
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
static ::ExceptionBase & ExcInternalError()