16 #ifndef dealii_tensor_h
17 #define dealii_tensor_h
28 #ifdef DEAL_II_WITH_ADOLC
29 # include <adolc/adouble.h>
39 template <
typename ElementType,
typename MemorySpace>
42 template <
int dim,
typename Number>
46 template <
int rank_,
int dim, typename Number =
double>
48 template <typename Number>
50 template <typename number>
91 template <
int dim,
typename Number>
95 static_assert(dim >= 0,
96 "Tensors must have a dimension greater than or equal to one.");
111 static constexpr
unsigned int rank = 0;
156 template <
typename OtherNumber>
165 template <
typename OtherNumber>
169 #ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
261 template <
typename OtherNumber>
265 #if defined(__INTEL_COMPILER) || defined(DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG)
278 #ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
292 template <
typename OtherNumber>
301 template <
typename OtherNumber>
308 template <
typename OtherNumber>
315 template <
typename OtherNumber>
324 template <
typename OtherNumber>
333 template <
typename OtherNumber>
342 template <
typename OtherNumber>
351 template <
typename OtherNumber>
402 template <
class Iterator>
411 template <
class Archive>
430 template <
typename Iterator>
435 template <
int,
int,
typename>
514 template <
int rank_,
int dim,
typename Number>
518 static_assert(rank_ >= 1,
519 "Tensors must have a rank greater than or equal to one.");
520 static_assert(dim >= 0,
521 "Tensors must have a dimension greater than or equal to zero.");
535 static constexpr
unsigned int rank = rank_;
585 template <
typename ElementType,
typename MemorySpace>
596 template <
typename OtherNumber>
603 template <
typename OtherNumber>
610 template <
typename OtherNumber>
614 #ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
645 constexpr
const Number &
685 template <
typename OtherNumber>
706 #ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
723 template <
typename OtherNumber>
730 template <
typename OtherNumber>
739 template <
typename OtherNumber>
748 template <
typename OtherNumber>
758 template <
typename OtherNumber>
767 template <
typename OtherNumber>
825 template <
typename OtherNumber>
839 template <
class Iterator>
862 static constexpr std::size_t
870 template <
class Archive>
891 template <
typename Iterator>
901 template <
typename ArrayLike, std::size_t... Indices>
903 Tensor(
const ArrayLike &initializer, std::index_sequence<Indices...>);
906 template <
int,
int,
typename>
911 friend class Point<dim, Number>;
922 template <
int rank,
int dim,
typename T,
typename U>
923 struct ProductTypeImpl<
Tensor<rank, dim,
T>, std::complex<U>>
929 template <
int rank,
int dim,
typename T,
typename U>
930 struct ProductTypeImpl<
Tensor<rank, dim, std::complex<T>>, std::complex<U>>
936 template <
typename T,
int rank,
int dim,
typename U>
937 struct ProductTypeImpl<std::complex<T>,
Tensor<rank, dim, U>>
943 template <
int rank,
int dim,
typename T,
typename U>
944 struct ProductTypeImpl<std::complex<T>,
Tensor<rank, dim, std::complex<U>>>
955 template <
int rank,
int dim,
typename T>
956 struct NumberType<
Tensor<rank, dim,
T>>
979 template <
int dim,
typename Number>
989 template <
int dim,
typename Number>
990 template <
typename OtherNumber>
998 template <
int dim,
typename Number>
999 template <
typename OtherNumber>
1006 # ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
1007 template <
int dim,
typename Number>
1015 template <
int dim,
typename Number>
1018 :
value{std::move(other.value)}
1023 template <
int dim,
typename Number>
1027 return std::addressof(value);
1032 template <
int dim,
typename Number>
1033 inline const Number *
1036 return std::addressof(value);
1041 template <
int dim,
typename Number>
1050 template <
int dim,
typename Number>
1059 template <
int dim,
typename Number>
1064 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1069 template <
int dim,
typename Number>
1074 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1080 template <
int dim,
typename Number>
1081 template <
typename OtherNumber>
1090 # if defined(__INTEL_COMPILER) || defined(DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG)
1091 template <
int dim,
typename Number>
1100 # ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
1101 template <
int dim,
typename Number>
1105 value = std::move(other.value);
1112 template <
int dim,
typename Number>
1113 template <
typename OtherNumber>
1122 template <
int dim,
typename Number>
1123 template <
typename OtherNumber>
1124 constexpr
inline bool
1127 # ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING
1128 Assert(!(std::is_same_v<Number, adouble> ||
1129 std::is_same_v<OtherNumber, adouble>),
1131 "The Tensor equality operator for ADOL-C taped numbers has not yet "
1132 "been extended to support advanced branching."));
1139 template <
int dim,
typename Number>
1140 template <
typename OtherNumber>
1144 return !((*this) == p);
1148 template <
int dim,
typename Number>
1149 template <
typename OtherNumber>
1158 template <
int dim,
typename Number>
1159 template <
typename OtherNumber>
1171 namespace ComplexWorkaround
1173 template <
typename Number,
typename OtherNumber>
1175 multiply_assign_scalar(Number &val,
const OtherNumber &s)
1180 template <
typename Number,
typename OtherNumber>
1182 multiply_assign_scalar(std::complex<Number> &val,
const OtherNumber &s)
1184 # if KOKKOS_VERSION >= 30600
1185 KOKKOS_IF_ON_HOST((val *= s;))
1186 KOKKOS_IF_ON_DEVICE(({
1190 "This function is not implemented for std::complex<Number>!\n");
1193 # ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
1199 "This function is not implemented for std::complex<Number>!\n");
1207 template <
int dim,
typename Number>
1208 template <
typename OtherNumber>
1212 internal::ComplexWorkaround::multiply_assign_scalar(value, s);
1218 template <
int dim,
typename Number>
1219 template <
typename OtherNumber>
1228 template <
int dim,
typename Number>
1236 template <
int dim,
typename Number>
1241 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1246 template <
int dim,
typename Number>
1252 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1258 template <
int dim,
typename Number>
1259 template <
typename Iterator>
1262 const Iterator
end)
const
1266 ExcMessage(
"Cannot unroll an object of type Tensor<0,0,Number>"));
1267 Assert(std::distance(current,
end) >= 1,
1268 ExcMessage(
"The provided iterator range must contain at least one "
1271 return std::next(current);
1276 template <
int dim,
typename Number>
1277 constexpr
inline void
1287 template <
int dim,
typename Number>
1288 template <
class Iterator>
1298 template <
int dim,
typename Number>
1299 template <
class Archive>
1307 template <
int dim,
typename Number>
1313 template <
int rank_,
int dim,
typename Number>
1314 template <
typename ArrayLike, std::size_t... indices>
1317 std::index_sequence<indices...>)
1318 :
values{
Tensor<rank_ - 1, dim, Number>(initializer[indices])...}
1320 static_assert(
sizeof...(indices) == dim,
1321 "dim should match the number of indices");
1326 template <
int rank_,
int dim,
typename Number>
1336 template <
int rank_,
int dim,
typename Number>
1339 :
Tensor(initializer, std::make_index_sequence<dim>{})
1344 template <
int rank_,
int dim,
typename Number>
1345 template <
typename ElementType,
typename MemorySpace>
1351 const int my_n_independent_components = n_independent_components;
1354 for (
unsigned int i = 0; i < my_n_independent_components; ++i)
1355 (*
this)[unrolled_to_component_indices(i)] = initializer[i];
1360 template <
int rank_,
int dim,
typename Number>
1361 template <
typename OtherNumber>
1365 :
Tensor(initializer, std::make_index_sequence<dim>{})
1370 template <
int rank_,
int dim,
typename Number>
1371 template <
typename OtherNumber>
1375 :
Tensor(initializer, std::make_index_sequence<dim>{})
1380 template <
int rank_,
int dim,
typename Number>
1381 template <
typename OtherNumber>
1383 operator
Tensor<1, dim,
Tensor<rank_ - 1, dim, OtherNumber>>()
const
1389 # ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
1390 template <
int rank_,
int dim,
typename Number>
1394 for (
unsigned int i = 0; i < dim; ++i)
1400 template <
int rank_,
int dim,
typename Number>
1404 for (
unsigned int i = 0; i < dim; ++i)
1411 namespace TensorSubscriptor
1413 template <
typename ArrayElementType,
int dim>
1415 subscript(ArrayElementType *
values,
1416 const unsigned int i,
1417 std::integral_constant<int, dim>)
1423 template <
typename ArrayElementType>
1425 subscript(ArrayElementType *dummy,
1427 std::integral_constant<int, 0>)
1432 "Cannot access elements of an object of type Tensor<rank,0,Number>."));
1439 template <
int rank_,
int dim,
typename Number>
1444 return ::internal::TensorSubscriptor::subscript(
1445 values, i, std::integral_constant<int, dim>());
1449 template <
int rank_,
int dim,
typename Number>
1454 # if KOKKOS_VERSION < 30700
1455 # ifdef KOKKOS_ACTIVE_MEMORY_SPACE_HOST
1466 template <
int rank_,
int dim,
typename Number>
1470 # if KOKKOS_VERSION < 30700
1471 # ifdef KOKKOS_ACTIVE_MEMORY_SPACE_HOST
1473 ExcMessage(
"Cannot access an object of type Tensor<rank_,0,Number>"));
1479 "Cannot access an object of type Tensor<rank_,0,Number>"));))
1482 return TensorAccessors::extract<rank_>(*
this, indices);
1487 template <
int rank_,
int dim,
typename Number>
1491 # if KOKKOS_VERSION < 30700
1492 # ifdef KOKKOS_ACTIVE_MEMORY_SPACE_HOST
1494 ExcMessage(
"Cannot access an object of type Tensor<rank_,0,Number>"));
1500 "Cannot access an object of type Tensor<rank_,0,Number>"));))
1503 return TensorAccessors::extract<rank_>(*
this, indices);
1508 template <
int rank_,
int dim,
typename Number>
1512 return std::addressof(
1513 this->
operator[](this->unrolled_to_component_indices(0)));
1518 template <
int rank_,
int dim,
typename Number>
1519 inline const Number *
1522 return std::addressof(
1523 this->
operator[](this->unrolled_to_component_indices(0)));
1528 template <
int rank_,
int dim,
typename Number>
1532 return begin_raw() + n_independent_components;
1537 template <
int rank_,
int dim,
typename Number>
1538 inline const Number *
1541 return begin_raw() + n_independent_components;
1546 template <
int rank_,
int dim,
typename Number>
1547 template <
typename OtherNumber>
1553 for (
unsigned int i = 0; i < dim; ++i)
1560 template <
int rank_,
int dim,
typename Number>
1568 for (
unsigned int i = 0; i < dim; ++i)
1574 # ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
1575 template <
int rank_,
int dim,
typename Number>
1579 for (
unsigned int i = 0; i < dim; ++i)
1586 template <
int rank_,
int dim,
typename Number>
1591 for (
unsigned int i = 0; i < dim; ++i)
1598 template <
int rank_,
int dim,
typename Number>
1599 template <
typename OtherNumber>
1600 constexpr
inline bool
1604 for (
unsigned int i = 0; i < dim; ++i)
1618 constexpr
inline bool
1625 template <
int rank_,
int dim,
typename Number>
1626 template <
typename OtherNumber>
1631 return !((*this) == p);
1635 template <
int rank_,
int dim,
typename Number>
1636 template <
typename OtherNumber>
1642 for (
unsigned int i = 0; i < dim; ++i)
1648 template <
int rank_,
int dim,
typename Number>
1649 template <
typename OtherNumber>
1655 for (
unsigned int i = 0; i < dim; ++i)
1661 template <
int rank_,
int dim,
typename Number>
1662 template <
typename OtherNumber>
1667 for (
unsigned int i = 0; i < dim; ++i)
1675 namespace TensorImplementation
1680 typename OtherNumber,
1684 !std::is_same_v<Number, Differentiation::SD::Expression>,
1688 const OtherNumber &factor)
1690 const Number inverse_factor = Number(1.) / factor;
1692 for (
unsigned int d = 0;
d < dim; ++
d)
1693 t[
d] *= inverse_factor;
1700 typename OtherNumber,
1704 std::is_same_v<Number, Differentiation::SD::Expression>,
1708 const OtherNumber &factor)
1711 for (
unsigned int d = 0;
d < dim; ++
d)
1718 template <
int rank_,
int dim,
typename Number>
1719 template <
typename OtherNumber>
1729 template <
int rank_,
int dim,
typename Number>
1736 for (
unsigned int i = 0; i < dim; ++i)
1743 template <
int rank_,
int dim,
typename Number>
1749 return sqrt(norm_square());
1753 template <
int rank_,
int dim,
typename Number>
1760 for (
unsigned int i = 0; i < dim; ++i)
1761 s +=
values[i].norm_square();
1768 template <
int rank_,
int dim,
typename Number>
1769 template <
typename OtherNumber>
1773 unroll(result.
begin(), result.
end());
1778 template <
int rank_,
int dim,
typename Number>
1779 template <
class Iterator>
1782 const Iterator
end)
const
1790 template <
int rank_,
int dim,
typename Number>
1791 template <
typename Iterator>
1794 const Iterator
end)
const
1796 Iterator next = current;
1797 for (
unsigned int i = 0; i < dim; ++i)
1798 next =
values[i].unroll_recursion(next,
end);
1803 template <
int rank_,
int dim,
typename Number>
1804 constexpr
inline unsigned int
1808 unsigned int index = 0;
1809 for (
int r = 0; r < rank_; ++r)
1810 index = index * dim + indices[r];
1824 mod(
const unsigned int x)
1831 mod<0>(
const unsigned int x)
1839 div(
const unsigned int x)
1846 div<0>(
const unsigned int x)
1856 template <
int rank_,
int dim,
typename Number>
1861 unsigned int dummy = n_independent_components;
1867 unsigned int remainder = i;
1868 for (
int r = rank_ - 1; r >= 0; --r)
1870 indices[r] = internal::mod<dim>(remainder);
1871 remainder = internal::div<dim>(remainder);
1879 template <
int rank_,
int dim,
typename Number>
1880 constexpr
inline void
1883 for (
unsigned int i = 0; i < dim; ++i)
1888 template <
int rank_,
int dim,
typename Number>
1889 constexpr std::size_t
1896 template <
int rank_,
int dim,
typename Number>
1897 template <
class Archive>
1905 template <
int rank_,
int dim,
typename Number>
1924 template <
int rank_,
int dim,
typename Number>
1925 inline std::ostream &
1928 for (
unsigned int i = 0; i < dim; ++i)
1945 template <
int dim,
typename Number>
1946 inline std::ostream &
1949 out << static_cast<const Number &>(p);
1972 template <
int dim,
typename Number,
typename Other>
1977 return object *
static_cast<const Number &
>(t);
1992 template <
int dim,
typename Number,
typename Other>
1997 return static_cast<const Number &
>(t) *
object;
2012 template <
int dim,
typename Number,
typename OtherNumber>
2018 return static_cast<const Number &
>(src1) *
2019 static_cast<const OtherNumber &
>(src2);
2030 template <
int dim,
typename Number,
typename OtherNumber>
2038 return static_cast<const Number &
>(t) / factor;
2049 template <
int dim,
typename Number,
typename OtherNumber>
2055 return static_cast<const Number &
>(p) +
static_cast<const OtherNumber &
>(q);
2066 template <
int dim,
typename Number,
typename OtherNumber>
2072 return static_cast<const Number &
>(p) -
static_cast<const OtherNumber &
>(q);
2088 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2098 for (
unsigned int d = 0;
d < dim; ++
d)
2099 tt[
d] = t[
d] * factor;
2116 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2131 namespace TensorImplementation
2136 typename OtherNumber,
2144 const OtherNumber &factor)
2147 const Number inverse_factor = Number(1.) / factor;
2149 for (
unsigned int d = 0;
d < dim; ++
d)
2150 tt[
d] = t[
d] * inverse_factor;
2158 typename OtherNumber,
2166 const OtherNumber &factor)
2170 for (
unsigned int d = 0;
d < dim; ++
d)
2171 tt[
d] = t[
d] / factor;
2187 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2208 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2216 for (
unsigned int i = 0; i < dim; ++i)
2232 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2240 for (
unsigned int i = 0; i < dim; ++i)
2252 template <
int dim,
typename Number,
typename OtherNumber>
2281 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2289 for (
unsigned int i = 0; i < dim; ++i)
2340 template <
int rank_1,
2344 typename OtherNumber,
2345 typename = std::enable_if_t<rank_1 >= 1 && rank_2 >= 1>>
2347 typename Tensor<rank_1 + rank_2 - 2,
2353 typename Tensor<rank_1 + rank_2 - 2,
2358 TensorAccessors::internal::
2359 ReorderedIndexView<0, rank_2, const Tensor<rank_2, dim, OtherNumber>>
2360 reordered = TensorAccessors::reordered_index_view<0, rank_2>(src2);
2361 TensorAccessors::contract<1, rank_1, rank_2, dim>(result, src1, reordered);
2395 template <
int index_1,
2401 typename OtherNumber>
2403 typename Tensor<rank_1 + rank_2 - 2,
2409 Assert(0 <= index_1 && index_1 < rank_1,
2411 "The specified index_1 must lie within the range [0,rank_1)"));
2412 Assert(0 <= index_2 && index_2 < rank_2,
2414 "The specified index_2 must lie within the range [0,rank_2)"));
2421 reord_01 = reordered_index_view<index_1, rank_1>(src1);
2427 reord_02 = reordered_index_view<index_2, rank_2>(src2);
2429 typename Tensor<rank_1 + rank_2 - 2,
2433 TensorAccessors::contract<1, rank_1, rank_2, dim>(result, reord_01, reord_02);
2468 template <
int index_1,
2476 typename OtherNumber>
2478 typename Tensor<rank_1 + rank_2 - 4,
2484 Assert(0 <= index_1 && index_1 < rank_1,
2486 "The specified index_1 must lie within the range [0,rank_1)"));
2487 Assert(0 <= index_3 && index_3 < rank_1,
2489 "The specified index_3 must lie within the range [0,rank_1)"));
2490 Assert(index_1 != index_3,
2491 ExcMessage(
"index_1 and index_3 must not be the same"));
2492 Assert(0 <= index_2 && index_2 < rank_2,
2494 "The specified index_2 must lie within the range [0,rank_2)"));
2495 Assert(0 <= index_4 && index_4 < rank_2,
2497 "The specified index_4 must lie within the range [0,rank_2)"));
2498 Assert(index_2 != index_4,
2499 ExcMessage(
"index_2 and index_4 must not be the same"));
2506 reord_1 = TensorAccessors::reordered_index_view<index_1, rank_1>(src1);
2510 reord_2 = TensorAccessors::reordered_index_view<index_2, rank_2>(src2);
2516 (index_3 < index_1 ? index_3 : index_3 - 1),
2528 (index_4 < index_2 ? index_4 : index_4 - 1),
2536 typename Tensor<rank_1 + rank_2 - 4,
2540 TensorAccessors::contract<2, rank_1, rank_2, dim>(result, reord_3, reord_4);
2557 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2564 TensorAccessors::contract<rank, rank, rank, dim>(result, left, right);
2586 template <
template <
int,
int,
typename>
class TensorT1,
2587 template <
int,
int,
typename>
2589 template <
int,
int,
typename>
2599 contract3(
const TensorT1<rank_1, dim, T1> &left,
2600 const TensorT2<rank_1 + rank_2, dim, T2> &middle,
2601 const TensorT3<rank_2, dim, T3> &right)
2605 return TensorAccessors::contract3<rank_1, rank_2, dim, return_type>(left,
2621 template <
int rank_1,
2625 typename OtherNumber>
2631 typename Tensor<rank_1 + rank_2,
2635 TensorAccessors::contract<0, rank_1, rank_2, dim>(result, src1, src2);
2658 template <
int dim,
typename Number>
2667 result[1] = -src[0];
2682 template <
int dim,
typename Number1,
typename Number2>
2693 constexpr
int s0 = 0 % dim;
2694 constexpr
int s1 = 1 % dim;
2695 constexpr
int s2 = 2 % dim;
2697 result[s0] = src1[s1] * src2[s2] - src1[s2] * src2[s1];
2698 result[s1] = src1[s2] * src2[s0] - src1[s0] * src2[s2];
2699 result[s2] = src1[s0] * src2[s1] - src1[s1] * src2[s0];
2718 template <
int dim,
typename Number>
2726 for (
unsigned int k = 0; k < dim; ++k)
2728 Tensor<2, dim - 1, Number> minor;
2729 for (
unsigned int i = 0; i < dim - 1; ++i)
2730 for (
unsigned int j = 0; j < dim - 1; ++j)
2731 minor[i][j] = t[i][j < k ? j : j + 1];
2733 const Number cofactor = ((k % 2 == 0) ? -1. : 1.) *
determinant(minor);
2735 det += t[dim - 1][k] * cofactor;
2738 return ((dim % 2 == 0) ? 1. : -1.) * det;
2746 template <
typename Number>
2758 template <
typename Number>
2763 return t[0][0] * t[1][1] - t[1][0] * t[0][1];
2771 template <
typename Number>
2782 return t[0][0] * C0 + t[0][1] * C1 + t[0][2] * C2;
2792 template <
int dim,
typename Number>
2797 for (
unsigned int i = 1; i < dim; ++i)
2811 template <
int dim,
typename Number>
2815 Number return_tensor[dim][dim];
2828 template <
typename Number>
2836 return return_tensor;
2840 template <
typename Number>
2847 1.0 / (t[0][0] * t[1][1] - t[1][0] * t[0][1]));
2848 return_tensor[0][0] = t[1][1];
2849 return_tensor[0][1] = -t[0][1];
2850 return_tensor[1][0] = -t[1][0];
2851 return_tensor[1][1] = t[0][0];
2852 return_tensor *= inv_det_t;
2854 return return_tensor;
2858 template <
typename Number>
2883 1.0 / (t[0][0] * return_tensor[0][0] + t[0][1] * return_tensor[1][0] +
2884 t[0][2] * return_tensor[2][0]));
2885 return_tensor *= inv_det_t;
2887 return return_tensor;
2898 template <
int dim,
typename Number>
2903 for (
unsigned int i = 0; i < dim; ++i)
2906 for (
unsigned int j = i + 1; j < dim; ++j)
2929 template <
int dim,
typename Number>
2950 template <
int dim,
typename Number>
3021 template <
int dim,
typename Number>
3033 template <
int dim,
typename Number>
3038 for (
unsigned int j = 0; j < dim; ++j)
3041 for (
unsigned int i = 0; i < dim; ++i)
3059 template <
int dim,
typename Number>
3064 for (
unsigned int i = 0; i < dim; ++i)
3067 for (
unsigned int j = 0; j < dim; ++j)
3085 # ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING
3094 for (
unsigned int j = 0; j < dim; ++j)
3097 for (
unsigned int i = 0; i < dim; ++i)
3112 for (
unsigned int i = 0; i < dim; ++i)
3115 for (
unsigned int j = 0; j < dim; ++j)
OutputOperator< VectorType > & operator<<(OutputOperator< VectorType > &out, unsigned int step)
Point< dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator*(const OtherNumber) const
const Number * begin_raw() const
constexpr Tensor & operator+=(const Tensor< 0, dim, OtherNumber > &rhs)
void serialize(Archive &ar, const unsigned int version)
constexpr Tensor & operator*=(const OtherNumber &factor)
constexpr Tensor(const Tensor< 0, dim, OtherNumber > &initializer)
constexpr Tensor(const OtherNumber &initializer)
Iterator unroll_recursion(const Iterator current, const Iterator end) const
constexpr Tensor & operator=(const OtherNumber &d) &&=delete
constexpr real_type norm_square() const
constexpr Tensor & operator-=(const Tensor< 0, dim, OtherNumber > &rhs)
const Number * end_raw() const
constexpr bool operator!=(const Tensor< 0, dim, OtherNumber > &rhs) const
constexpr Tensor & operator=(const Tensor< 0, dim, OtherNumber > &rhs)
void unroll(const Iterator begin, const Iterator end) const
constexpr bool operator==(const Tensor< 0, dim, OtherNumber > &rhs) const
typename numbers::NumberTraits< Number >::real_type real_type
constexpr Tensor & operator/=(const OtherNumber &factor)
constexpr Tensor operator-() const
constexpr Tensor & operator=(const OtherNumber &d) &
constexpr Tensor(const ArrayView< ElementType, MemorySpace > &initializer)
constexpr bool operator==(const Tensor< rank_, dim, OtherNumber > &) const
constexpr Tensor< rank, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator/(const Tensor< rank, dim, Number > &t, const OtherNumber &factor)
typename Tensor< rank_ - 1, dim, Number >::array_type[(dim !=0) ? dim :1] array_type
constexpr Tensor & operator+=(const Tensor< rank_, dim, OtherNumber > &)
constexpr Tensor & operator-=(const Tensor< rank_, dim, OtherNumber > &)
constexpr Tensor & operator*=(const OtherNumber &factor)
static constexpr TableIndices< rank_ > unrolled_to_component_indices(const unsigned int i)
constexpr Tensor< 0, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator/(const Tensor< 0, dim, Number > &t, const OtherNumber &factor)
static constexpr unsigned int rank
constexpr const Number & operator[](const TableIndices< rank_ > &indices) const
constexpr Tensor(const Tensor< rank_, dim, OtherNumber > &initializer)
constexpr const value_type & operator[](const unsigned int i) const
void unroll(const Iterator begin, const Iterator end) const
void unroll(Vector< OtherNumber > &result) const
constexpr Number & operator[](const TableIndices< rank_ > &indices)
constexpr Tensor & operator=(const Tensor< rank_, dim, OtherNumber > &rhs)
Iterator unroll_recursion(const Iterator current, const Iterator end) const
constexpr Tensor(const Tensor< 1, dim, Tensor< rank_ - 1, dim, OtherNumber >> &initializer)
static constexpr unsigned int component_to_unrolled_index(const TableIndices< rank_ > &indices)
constexpr ProductType< Number, OtherNumber >::type operator*(const Tensor< 0, dim, Number > &src1, const Tensor< 0, dim, OtherNumber > &src2)
constexpr Tensor & operator=(const Number &d) &
constexpr bool operator!=(const Tensor< rank_, dim, OtherNumber > &) const
constexpr Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > schur_product(const Tensor< 0, dim, Number > &src1, const Tensor< 0, dim, OtherNumber > &src2)
constexpr numbers::NumberTraits< Number >::real_type norm_square() const
const Number * begin_raw() const
constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > operator-(const Tensor< 0, dim, Number > &p, const Tensor< 0, dim, OtherNumber > &q)
typename Tensor< rank_ - 1, dim, Number >::tensor_type value_type
constexpr Tensor< rank, dim, typename ProductType< Number, OtherNumber >::type > operator+(const Tensor< rank, dim, Number > &p, const Tensor< rank, dim, OtherNumber > &q)
Number linfty_norm(const Tensor< 2, dim, Number > &t)
constexpr ProductType< Other, Number >::type operator*(const Other &object, const Tensor< 0, dim, Number > &t)
constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE Tensor()
Number l1_norm(const Tensor< 2, dim, Number > &t)
constexpr Tensor & operator/=(const OtherNumber &factor)
static constexpr unsigned int dimension
constexpr Tensor< rank, dim, typename ProductType< typename EnableIfScalar< Number >::type, OtherNumber >::type > operator*(const Number &factor, const Tensor< rank, dim, OtherNumber > &t)
static constexpr std::size_t memory_consumption()
constexpr Tensor & operator=(const Number &d) &&=delete
constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > operator+(const Tensor< 0, dim, Number > &p, const Tensor< 0, dim, OtherNumber > &q)
constexpr Tensor< rank, dim, typename ProductType< Number, OtherNumber >::type > schur_product(const Tensor< rank, dim, Number > &src1, const Tensor< rank, dim, OtherNumber > &src2)
constexpr Tensor< rank, dim, typename ProductType< Number, OtherNumber >::type > operator-(const Tensor< rank, dim, Number > &p, const Tensor< rank, dim, OtherNumber > &q)
Tensor< rank_, dim, Number > tensor_type
constexpr value_type & operator[](const unsigned int i)
constexpr ProductType< Number, Other >::type operator*(const Tensor< 0, dim, Number > &t, const Other &object)
constexpr Tensor(const ArrayLike &initializer, std::index_sequence< Indices... >)
const Number * end_raw() const
constexpr Tensor< rank, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator*(const Tensor< rank, dim, Number > &t, const OtherNumber &factor)
void serialize(Archive &ar, const unsigned int version)
constexpr Tensor(const array_type &initializer)
static constexpr unsigned int n_independent_components
constexpr Tensor operator-() const
Tensor< rank_ - 1, dim, Number > values[(dim !=0) ? dim :1]
numbers::NumberTraits< Number >::real_type norm() const
VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &x)
#define DEAL_II_ALWAYS_INLINE
#define DEAL_II_DEPRECATED
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcScalarAssignmentOnlyForZeroValue()
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotImplemented()
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
Expression fabs(const Expression &x)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
constexpr void contract(T1 &result, const T2 &left, const T3 &right)
constexpr T1 contract3(const T2 &left, const T3 &middle, const T4 &right)
constexpr internal::ReorderedIndexView< index, rank, T > reordered_index_view(T &t)
VectorType::value_type * begin(VectorType &V)
VectorType::value_type * end(VectorType &V)
T sum(const T &t, const MPI_Comm mpi_communicator)
void abort(const ExceptionBase &exc) noexcept
constexpr Tensor< rank, dim, typename ProductType< Number, OtherNumber >::type > division_operator(const Tensor< rank, dim, Number > &t, const OtherNumber &factor)
constexpr bool value_is_zero(const Number &value)
constexpr bool values_are_equal(const Number1 &value_1, const Number2 &value_2)
#define DEAL_II_HOST_DEVICE
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
#define DEAL_II_HOST_DEVICE_ALWAYS_INLINE
typename internal::ProductTypeImpl< std::decay_t< T >, std::decay_t< U > >::type type
static constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE const T & value(const T &t)
decltype(std::declval< T >() *std::declval< U >()) type
static real_type abs(const number &x)
static constexpr real_type abs_square(const number &x)
constexpr DEAL_II_HOST SymmetricTensor< 4, dim, Number > outer_product(const SymmetricTensor< 2, dim, Number > &t1, const SymmetricTensor< 2, dim, Number > &t2)
constexpr DEAL_II_HOST Number trace(const SymmetricTensor< 2, dim2, Number > &)
constexpr DEAL_II_HOST SymmetricTensor< 2, dim, Number > invert(const SymmetricTensor< 2, dim, Number > &)
constexpr DEAL_II_HOST Number determinant(const SymmetricTensor< 2, dim, Number > &)
Tensor< 2, dim, Number > project_onto_orthogonal_tensors(const Tensor< 2, dim, Number > &A)
Number linfty_norm(const Tensor< 2, dim, Number > &t)
Number l1_norm(const Tensor< 2, dim, Number > &t)