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_;
586 template <
typename ElementType,
typename MemorySpace>
597 template <
typename OtherNumber>
604 template <
typename OtherNumber>
611 template <
typename OtherNumber>
615 #ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
646 constexpr
const Number &
686 template <
typename OtherNumber>
707 #ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
724 template <
typename OtherNumber>
731 template <
typename OtherNumber>
740 template <
typename OtherNumber>
749 template <
typename OtherNumber>
759 template <
typename OtherNumber>
768 template <
typename OtherNumber>
826 template <
typename OtherNumber>
840 template <
class Iterator>
848 static constexpr
unsigned int
863 static constexpr std::size_t
871 template <
class Archive>
892 template <
typename Iterator>
902 template <
typename ArrayLike, std::size_t... Indices>
904 Tensor(
const ArrayLike &initializer, std::index_sequence<Indices...>);
907 template <
int,
int,
typename>
912 friend class Point<dim, Number>;
923 template <
int rank,
int dim,
typename T,
typename U>
924 struct ProductTypeImpl<
Tensor<rank, dim,
T>, std::complex<U>>
930 template <
int rank,
int dim,
typename T,
typename U>
931 struct ProductTypeImpl<
Tensor<rank, dim, std::complex<T>>, std::complex<U>>
937 template <
typename T,
int rank,
int dim,
typename U>
938 struct ProductTypeImpl<std::complex<T>,
Tensor<rank, dim, U>>
944 template <
int rank,
int dim,
typename T,
typename U>
945 struct ProductTypeImpl<std::complex<T>,
Tensor<rank, dim, std::complex<U>>>
956 template <
int rank,
int dim,
typename T>
957 struct NumberType<
Tensor<rank, dim,
T>>
980 template <
int dim,
typename Number>
990 template <
int dim,
typename Number>
991 template <
typename OtherNumber>
999 template <
int dim,
typename Number>
1000 template <
typename OtherNumber>
1007 # ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
1008 template <
int dim,
typename Number>
1016 template <
int dim,
typename Number>
1019 :
value{std::move(other.value)}
1024 template <
int dim,
typename Number>
1028 return std::addressof(value);
1033 template <
int dim,
typename Number>
1034 inline const Number *
1037 return std::addressof(value);
1042 template <
int dim,
typename Number>
1051 template <
int dim,
typename Number>
1060 template <
int dim,
typename Number>
1065 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1070 template <
int dim,
typename Number>
1075 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1081 template <
int dim,
typename Number>
1082 template <
typename OtherNumber>
1091 # if defined(__INTEL_COMPILER) || defined(DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG)
1092 template <
int dim,
typename Number>
1101 # ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
1102 template <
int dim,
typename Number>
1106 value = std::move(other.value);
1113 template <
int dim,
typename Number>
1114 template <
typename OtherNumber>
1123 template <
int dim,
typename Number>
1124 template <
typename OtherNumber>
1125 constexpr
inline bool
1128 # ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING
1129 Assert(!(std::is_same<Number, adouble>::value ||
1130 std::is_same<OtherNumber, adouble>::value),
1132 "The Tensor equality operator for ADOL-C taped numbers has not yet "
1133 "been extended to support advanced branching."));
1140 template <
int dim,
typename Number>
1141 template <
typename OtherNumber>
1145 return !((*this) == p);
1149 template <
int dim,
typename Number>
1150 template <
typename OtherNumber>
1159 template <
int dim,
typename Number>
1160 template <
typename OtherNumber>
1172 namespace ComplexWorkaround
1174 template <
typename Number,
typename OtherNumber>
1176 multiply_assign_scalar(Number &val,
const OtherNumber &s)
1181 template <
typename Number,
typename OtherNumber>
1183 multiply_assign_scalar(std::complex<Number> &val,
const OtherNumber &s)
1185 # if KOKKOS_VERSION >= 30600
1186 KOKKOS_IF_ON_HOST((val *= s;))
1187 KOKKOS_IF_ON_DEVICE(({
1191 "This function is not implemented for std::complex<Number>!\n");
1194 # ifdef KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST
1200 "This function is not implemented for std::complex<Number>!\n");
1208 template <
int dim,
typename Number>
1209 template <
typename OtherNumber>
1213 internal::ComplexWorkaround::multiply_assign_scalar(value, s);
1219 template <
int dim,
typename Number>
1220 template <
typename OtherNumber>
1229 template <
int dim,
typename Number>
1237 template <
int dim,
typename Number>
1242 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1247 template <
int dim,
typename Number>
1253 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1259 template <
int dim,
typename Number>
1260 template <
typename Iterator>
1263 const Iterator
end)
const
1267 ExcMessage(
"Cannot unroll an object of type Tensor<0,0,Number>"));
1268 Assert(std::distance(current,
end) >= 1,
1269 ExcMessage(
"The provided iterator range must contain at least one "
1272 return std::next(current);
1277 template <
int dim,
typename Number>
1278 constexpr
inline void
1288 template <
int dim,
typename Number>
1289 template <
class Iterator>
1299 template <
int dim,
typename Number>
1300 template <
class Archive>
1308 template <
int dim,
typename Number>
1314 template <
int rank_,
int dim,
typename Number>
1315 template <
typename ArrayLike, std::size_t... indices>
1318 std::index_sequence<indices...>)
1319 :
values{
Tensor<rank_ - 1, dim, Number>(initializer[indices])...}
1321 static_assert(
sizeof...(indices) == dim,
1322 "dim should match the number of indices");
1327 template <
int rank_,
int dim,
typename Number>
1337 template <
int rank_,
int dim,
typename Number>
1340 :
Tensor(initializer, std::make_index_sequence<dim>{})
1345 template <
int rank_,
int dim,
typename Number>
1346 template <
typename ElementType,
typename MemorySpace>
1352 const int my_n_independent_components = n_independent_components;
1355 for (
unsigned int i = 0; i < my_n_independent_components; ++i)
1356 (*
this)[unrolled_to_component_indices(i)] = initializer[i];
1361 template <
int rank_,
int dim,
typename Number>
1362 template <
typename OtherNumber>
1366 :
Tensor(initializer, std::make_index_sequence<dim>{})
1371 template <
int rank_,
int dim,
typename Number>
1372 template <
typename OtherNumber>
1376 :
Tensor(initializer, std::make_index_sequence<dim>{})
1381 template <
int rank_,
int dim,
typename Number>
1382 template <
typename OtherNumber>
1384 operator
Tensor<1, dim,
Tensor<rank_ - 1, dim, OtherNumber>>()
const
1390 # ifdef DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
1391 template <
int rank_,
int dim,
typename Number>
1395 for (
unsigned int i = 0; i < dim; ++i)
1401 template <
int rank_,
int dim,
typename Number>
1405 for (
unsigned int i = 0; i < dim; ++i)
1412 namespace TensorSubscriptor
1414 template <
typename ArrayElementType,
int dim>
1416 subscript(ArrayElementType *
values,
1417 const unsigned int i,
1418 std::integral_constant<int, dim>)
1424 template <
typename ArrayElementType>
1426 subscript(ArrayElementType *dummy,
1428 std::integral_constant<int, 0>)
1433 "Cannot access elements of an object of type Tensor<rank,0,Number>."));
1440 template <
int rank_,
int dim,
typename Number>
1445 return ::internal::TensorSubscriptor::subscript(
1446 values, i, std::integral_constant<int, dim>());
1450 template <
int rank_,
int dim,
typename Number>
1455 # if KOKKOS_VERSION < 30700
1456 # ifdef KOKKOS_ACTIVE_MEMORY_SPACE_HOST
1467 template <
int rank_,
int dim,
typename Number>
1471 # if KOKKOS_VERSION < 30700
1472 # ifdef KOKKOS_ACTIVE_MEMORY_SPACE_HOST
1474 ExcMessage(
"Cannot access an object of type Tensor<rank_,0,Number>"));
1480 "Cannot access an object of type Tensor<rank_,0,Number>"));))
1483 return TensorAccessors::extract<rank_>(*
this, indices);
1488 template <
int rank_,
int dim,
typename Number>
1492 # if KOKKOS_VERSION < 30700
1493 # ifdef KOKKOS_ACTIVE_MEMORY_SPACE_HOST
1495 ExcMessage(
"Cannot access an object of type Tensor<rank_,0,Number>"));
1501 "Cannot access an object of type Tensor<rank_,0,Number>"));))
1504 return TensorAccessors::extract<rank_>(*
this, indices);
1509 template <
int rank_,
int dim,
typename Number>
1513 return std::addressof(
1514 this->
operator[](this->unrolled_to_component_indices(0)));
1519 template <
int rank_,
int dim,
typename Number>
1520 inline const Number *
1523 return std::addressof(
1524 this->
operator[](this->unrolled_to_component_indices(0)));
1529 template <
int rank_,
int dim,
typename Number>
1533 return begin_raw() + n_independent_components;
1538 template <
int rank_,
int dim,
typename Number>
1539 inline const Number *
1542 return begin_raw() + n_independent_components;
1547 template <
int rank_,
int dim,
typename Number>
1548 template <
typename OtherNumber>
1554 for (
unsigned int i = 0; i < dim; ++i)
1561 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<Number, Differentiation::SD::Expression>::value,
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<Number, Differentiation::SD::Expression>::value,
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 auto 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];
1823 inline constexpr
unsigned int
1824 mod(
const unsigned int x)
1831 mod<0>(
const unsigned int x)
1838 inline constexpr
unsigned int
1839 div(
const unsigned int x)
1846 div<0>(
const unsigned int x)
1856 template <
int rank_,
int dim,
typename Number>
1864 unsigned int remainder = i;
1865 for (
int r = rank_ - 1; r >= 0; --r)
1867 indices[r] = internal::mod<dim>(remainder);
1868 remainder = internal::div<dim>(remainder);
1876 template <
int rank_,
int dim,
typename Number>
1877 constexpr
inline void
1880 for (
unsigned int i = 0; i < dim; ++i)
1885 template <
int rank_,
int dim,
typename Number>
1886 constexpr std::size_t
1893 template <
int rank_,
int dim,
typename Number>
1894 template <
class Archive>
1902 template <
int rank_,
int dim,
typename Number>
1921 template <
int rank_,
int dim,
typename Number>
1922 inline std::ostream &
1925 for (
unsigned int i = 0; i < dim; ++i)
1942 template <
int dim,
typename Number>
1943 inline std::ostream &
1946 out << static_cast<const Number &>(p);
1969 template <
int dim,
typename Number,
typename Other>
1974 return object *
static_cast<const Number &
>(t);
1989 template <
int dim,
typename Number,
typename Other>
1994 return static_cast<const Number &
>(t) *
object;
2009 template <
int dim,
typename Number,
typename OtherNumber>
2015 return static_cast<const Number &
>(src1) *
2016 static_cast<const OtherNumber &
>(src2);
2027 template <
int dim,
typename Number,
typename OtherNumber>
2035 return static_cast<const Number &
>(t) / factor;
2046 template <
int dim,
typename Number,
typename OtherNumber>
2052 return static_cast<const Number &
>(p) +
static_cast<const OtherNumber &
>(q);
2063 template <
int dim,
typename Number,
typename OtherNumber>
2069 return static_cast<const Number &
>(p) -
static_cast<const OtherNumber &
>(q);
2085 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2095 for (
unsigned int d = 0;
d < dim; ++
d)
2096 tt[
d] = t[
d] * factor;
2113 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2128 namespace TensorImplementation
2133 typename OtherNumber,
2141 const OtherNumber & factor)
2144 const Number inverse_factor = Number(1.) / factor;
2146 for (
unsigned int d = 0;
d < dim; ++
d)
2147 tt[
d] = t[
d] * inverse_factor;
2155 typename OtherNumber,
2163 const OtherNumber & factor)
2167 for (
unsigned int d = 0;
d < dim; ++
d)
2168 tt[
d] = t[
d] / factor;
2184 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2205 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2213 for (
unsigned int i = 0; i < dim; ++i)
2229 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2237 for (
unsigned int i = 0; i < dim; ++i)
2249 template <
int dim,
typename Number,
typename OtherNumber>
2278 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2286 for (
unsigned int i = 0; i < dim; ++i)
2337 template <
int rank_1,
2341 typename OtherNumber,
2342 typename = std::enable_if_t<rank_1 >= 1 && rank_2 >= 1>>
2344 typename Tensor<rank_1 + rank_2 - 2,
2350 typename Tensor<rank_1 + rank_2 - 2,
2355 TensorAccessors::internal::
2356 ReorderedIndexView<0, rank_2, const Tensor<rank_2, dim, OtherNumber>>
2357 reordered = TensorAccessors::reordered_index_view<0, rank_2>(src2);
2358 TensorAccessors::contract<1, rank_1, rank_2, dim>(result, src1, reordered);
2392 template <
int index_1,
2398 typename OtherNumber>
2400 typename Tensor<rank_1 + rank_2 - 2,
2406 Assert(0 <= index_1 && index_1 < rank_1,
2408 "The specified index_1 must lie within the range [0,rank_1)"));
2409 Assert(0 <= index_2 && index_2 < rank_2,
2411 "The specified index_2 must lie within the range [0,rank_2)"));
2418 reord_01 = reordered_index_view<index_1, rank_1>(src1);
2424 reord_02 = reordered_index_view<index_2, rank_2>(src2);
2426 typename Tensor<rank_1 + rank_2 - 2,
2430 TensorAccessors::contract<1, rank_1, rank_2, dim>(result, reord_01, reord_02);
2465 template <
int index_1,
2473 typename OtherNumber>
2475 typename Tensor<rank_1 + rank_2 - 4,
2481 Assert(0 <= index_1 && index_1 < rank_1,
2483 "The specified index_1 must lie within the range [0,rank_1)"));
2484 Assert(0 <= index_3 && index_3 < rank_1,
2486 "The specified index_3 must lie within the range [0,rank_1)"));
2487 Assert(index_1 != index_3,
2488 ExcMessage(
"index_1 and index_3 must not be the same"));
2489 Assert(0 <= index_2 && index_2 < rank_2,
2491 "The specified index_2 must lie within the range [0,rank_2)"));
2492 Assert(0 <= index_4 && index_4 < rank_2,
2494 "The specified index_4 must lie within the range [0,rank_2)"));
2495 Assert(index_2 != index_4,
2496 ExcMessage(
"index_2 and index_4 must not be the same"));
2503 reord_1 = TensorAccessors::reordered_index_view<index_1, rank_1>(src1);
2507 reord_2 = TensorAccessors::reordered_index_view<index_2, rank_2>(src2);
2513 (index_3 < index_1 ? index_3 : index_3 - 1),
2525 (index_4 < index_2 ? index_4 : index_4 - 1),
2533 typename Tensor<rank_1 + rank_2 - 4,
2537 TensorAccessors::contract<2, rank_1, rank_2, dim>(result, reord_3, reord_4);
2554 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2561 TensorAccessors::contract<rank, rank, rank, dim>(result, left, right);
2583 template <
template <
int,
int,
typename>
class TensorT1,
2584 template <
int,
int,
typename>
2586 template <
int,
int,
typename>
2596 contract3(
const TensorT1<rank_1, dim, T1> & left,
2597 const TensorT2<rank_1 + rank_2, dim, T2> &middle,
2598 const TensorT3<rank_2, dim, T3> & right)
2602 return TensorAccessors::contract3<rank_1, rank_2, dim, return_type>(left,
2618 template <
int rank_1,
2622 typename OtherNumber>
2628 typename Tensor<rank_1 + rank_2,
2632 TensorAccessors::contract<0, rank_1, rank_2, dim>(result, src1, src2);
2655 template <
int dim,
typename Number>
2664 result[1] = -src[0];
2679 template <
int dim,
typename Number1,
typename Number2>
2690 constexpr
int s0 = 0 % dim;
2691 constexpr
int s1 = 1 % dim;
2692 constexpr
int s2 = 2 % dim;
2694 result[s0] = src1[s1] * src2[s2] - src1[s2] * src2[s1];
2695 result[s1] = src1[s2] * src2[s0] - src1[s0] * src2[s2];
2696 result[s2] = src1[s0] * src2[s1] - src1[s1] * src2[s0];
2715 template <
int dim,
typename Number>
2723 for (
unsigned int k = 0; k < dim; ++k)
2725 Tensor<2, dim - 1, Number> minor;
2726 for (
unsigned int i = 0; i < dim - 1; ++i)
2727 for (
unsigned int j = 0; j < dim - 1; ++j)
2728 minor[i][j] = t[i][j < k ? j : j + 1];
2730 const Number cofactor = ((k % 2 == 0) ? -1. : 1.) *
determinant(minor);
2732 det += t[dim - 1][k] * cofactor;
2735 return ((dim % 2 == 0) ? 1. : -1.) * det;
2743 template <
typename Number>
2755 template <
typename Number>
2760 return t[0][0] * t[1][1] - t[1][0] * t[0][1];
2768 template <
typename Number>
2779 return t[0][0] * C0 + t[0][1] * C1 + t[0][2] * C2;
2789 template <
int dim,
typename Number>
2794 for (
unsigned int i = 1; i < dim; ++i)
2808 template <
int dim,
typename Number>
2812 Number return_tensor[dim][dim];
2825 template <
typename Number>
2833 return return_tensor;
2837 template <
typename Number>
2844 1.0 / (t[0][0] * t[1][1] - t[1][0] * t[0][1]));
2845 return_tensor[0][0] = t[1][1];
2846 return_tensor[0][1] = -t[0][1];
2847 return_tensor[1][0] = -t[1][0];
2848 return_tensor[1][1] = t[0][0];
2849 return_tensor *= inv_det_t;
2851 return return_tensor;
2855 template <
typename Number>
2880 1.0 / (t[0][0] * return_tensor[0][0] + t[0][1] * return_tensor[1][0] +
2881 t[0][2] * return_tensor[2][0]));
2882 return_tensor *= inv_det_t;
2884 return return_tensor;
2895 template <
int dim,
typename Number>
2900 for (
unsigned int i = 0; i < dim; ++i)
2903 for (
unsigned int j = i + 1; j < dim; ++j)
2926 template <
int dim,
typename Number>
2947 template <
int dim,
typename Number>
3018 template <
int dim,
typename Number>
3030 template <
int dim,
typename Number>
3035 for (
unsigned int j = 0; j < dim; ++j)
3038 for (
unsigned int i = 0; i < dim; ++i)
3056 template <
int dim,
typename Number>
3061 for (
unsigned int i = 0; i < dim; ++i)
3064 for (
unsigned int j = 0; j < dim; ++j)
3082 # ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING
3091 for (
unsigned int j = 0; j < dim; ++j)
3094 for (
unsigned int i = 0; i < dim; ++i)
3109 for (
unsigned int i = 0; i < dim; ++i)
3112 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< typename std::decay< T >::type, typename std::decay< U >::type >::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)