16 #ifndef dealii_tensor_h
17 #define dealii_tensor_h
28 #ifdef DEAL_II_WITH_ADOLC
29 # include <adolc/adouble.h>
42 template <
typename ElementType,
typename MemorySpace>
44 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 #if __GNUC__ >= 11 || defined __INTEL_COMPILER
248 template <
typename OtherNumber>
258 template <
typename OtherNumber>
265 template <
typename OtherNumber>
272 template <
typename OtherNumber>
281 template <
typename OtherNumber>
290 template <
typename OtherNumber>
299 template <
typename OtherNumber>
308 template <
typename OtherNumber>
357 template <
class Archive>
376 template <
typename OtherNumber>
379 unsigned int & start_index)
const;
382 template <
int,
int,
typename>
461 template <
int rank_,
int dim,
typename Number>
465 static_assert(rank_ >= 1,
466 "Tensors must have a rank greater than or equal to one.");
467 static_assert(dim >= 0,
468 "Tensors must have a dimension greater than or equal to one.");
482 static constexpr
unsigned int rank = rank_;
534 template <
typename ElementType,
typename MemorySpace>
545 template <
typename OtherNumber>
552 template <
typename OtherNumber>
559 template <
typename OtherNumber>
563 #if __GNUC__ >= 11 || defined __INTEL_COMPILER
583 constexpr
Tensor<rank_, dim, Number> &
584 operator=(
Tensor<rank_, dim, Number> &&) noexcept;
643 template <
typename OtherNumber>
659 template <
typename OtherNumber>
666 template <
typename OtherNumber>
675 template <
typename OtherNumber>
684 template <
typename OtherNumber>
694 template <
typename OtherNumber>
703 template <
typename OtherNumber>
758 template <
typename OtherNumber>
766 static constexpr
unsigned int
781 static constexpr std::size_t
789 template <
class Archive>
810 template <
typename OtherNumber>
813 unsigned int & start_index)
const;
821 template <
typename ArrayLike, std::size_t... Indices>
823 Tensor(
const ArrayLike &initializer, std::index_sequence<Indices...>);
826 template <
int,
int,
typename>
831 friend class Point<dim, Number>;
842 template <
int rank,
int dim,
typename T,
typename U>
843 struct ProductTypeImpl<
Tensor<rank, dim,
T>, std::complex<U>>
849 template <
int rank,
int dim,
typename T,
typename U>
850 struct ProductTypeImpl<
Tensor<rank, dim, std::complex<T>>, std::complex<U>>
856 template <
typename T,
int rank,
int dim,
typename U>
857 struct ProductTypeImpl<std::complex<T>,
Tensor<rank, dim, U>>
863 template <
int rank,
int dim,
typename T,
typename U>
864 struct ProductTypeImpl<std::complex<T>,
Tensor<rank, dim, std::complex<U>>>
875 template <
int rank,
int dim,
typename T>
876 struct NumberType<
Tensor<rank, dim,
T>>
898 template <
int dim,
typename Number>
908 template <
int dim,
typename Number>
909 template <
typename OtherNumber>
917 template <
int dim,
typename Number>
918 template <
typename OtherNumber>
926 # if __GNUC__ >= 11 || defined __INTEL_COMPILER
927 template <
int dim,
typename Number>
935 template <
int dim,
typename Number>
945 template <
int dim,
typename Number>
948 :
value{std::move(other.value)}
953 template <
int dim,
typename Number>
957 value = std::move(other.value);
964 template <
int dim,
typename Number>
968 return std::addressof(value);
973 template <
int dim,
typename Number>
974 inline const Number *
977 return std::addressof(value);
982 template <
int dim,
typename Number>
991 template <
int dim,
typename Number>
1000 template <
int dim,
typename Number>
1005 # ifndef __CUDA_ARCH__
1007 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1013 template <
int dim,
typename Number>
1018 # ifndef __CUDA_ARCH__
1020 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1026 template <
int dim,
typename Number>
1027 template <
typename OtherNumber>
1037 template <
int dim,
typename Number>
1038 template <
typename OtherNumber>
1048 template <
int dim,
typename Number>
1049 template <
typename OtherNumber>
1050 constexpr
inline bool
1053 # if defined(DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING)
1054 Assert(!(std::is_same<Number, adouble>::value ||
1055 std::is_same<OtherNumber, adouble>::value),
1057 "The Tensor equality operator for ADOL-C taped numbers has not yet "
1058 "been extended to support advanced branching."));
1065 template <
int dim,
typename Number>
1066 template <
typename OtherNumber>
1070 return !((*this) == p);
1074 template <
int dim,
typename Number>
1075 template <
typename OtherNumber>
1085 template <
int dim,
typename Number>
1086 template <
typename OtherNumber>
1099 namespace ComplexWorkaround
1101 template <
typename Number,
typename OtherNumber>
1103 multiply_assign_scalar(Number &val,
const OtherNumber &s)
1108 # ifdef __CUDA_ARCH__
1109 template <
typename Number,
typename OtherNumber>
1111 multiply_assign_scalar(std::complex<Number> &,
const OtherNumber &)
1113 printf(
"This function is not implemented for std::complex<Number>!\n");
1121 template <
int dim,
typename Number>
1122 template <
typename OtherNumber>
1127 internal::ComplexWorkaround::multiply_assign_scalar(value, s);
1133 template <
int dim,
typename Number>
1134 template <
typename OtherNumber>
1143 template <
int dim,
typename Number>
1151 template <
int dim,
typename Number>
1156 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1161 template <
int dim,
typename Number>
1167 # ifndef __CUDA_ARCH__
1169 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1175 template <
int dim,
typename Number>
1176 template <
typename OtherNumber>
1179 unsigned int & index)
const
1182 ExcMessage(
"Cannot unroll an object of type Tensor<0,0,Number>"));
1183 result[index] =
value;
1188 template <
int dim,
typename Number>
1189 constexpr
inline void
1198 template <
int dim,
typename Number>
1199 template <
class Archive>
1207 template <
int dim,
typename Number>
1213 template <
int rank_,
int dim,
typename Number>
1214 template <
typename ArrayLike, std::size_t... indices>
1217 std::index_sequence<indices...>)
1218 :
values{
Tensor<rank_ - 1, dim, Number>(initializer[indices])...}
1220 static_assert(
sizeof...(indices) == dim,
1221 "dim should match the number of indices");
1226 template <
int rank_,
int dim,
typename Number>
1236 template <
int rank_,
int dim,
typename Number>
1239 :
Tensor(initializer, std::make_index_sequence<dim>{})
1244 template <
int rank_,
int dim,
typename Number>
1245 template <
typename ElementType,
typename MemorySpace>
1252 for (
unsigned int i = 0; i < n_independent_components; ++i)
1253 (*
this)[unrolled_to_component_indices(i)] = initializer[i];
1258 template <
int rank_,
int dim,
typename Number>
1259 template <
typename OtherNumber>
1263 :
Tensor(initializer, std::make_index_sequence<dim>{})
1267 template <
int rank_,
int dim,
typename Number>
1268 template <
typename OtherNumber>
1272 :
Tensor(initializer, std::make_index_sequence<dim>{})
1276 template <
int rank_,
int dim,
typename Number>
1277 template <
typename OtherNumber>
1279 operator
Tensor<1, dim,
Tensor<rank_ - 1, dim, OtherNumber>>()
const
1285 # if __GNUC__ >= 11 || defined __INTEL_COMPILER
1286 template <
int rank_,
int dim,
typename Number>
1290 for (
unsigned int i = 0; i < dim; ++i)
1295 template <
int rank_,
int dim,
typename Number>
1299 for (
unsigned int i = 0; i < dim; ++i)
1305 template <
int rank_,
int dim,
typename Number>
1309 for (
unsigned int i = 0; i < dim; ++i)
1314 template <
int rank_,
int dim,
typename Number>
1319 for (
unsigned int i = 0; i < dim; ++i)
1328 namespace TensorSubscriptor
1330 template <
typename ArrayElementType,
int dim>
1333 subscript(ArrayElementType *
values,
1334 const unsigned int i,
1335 std::integral_constant<int, dim>)
1338 # ifndef __CUDA_ARCH__
1349 template <
typename ArrayElementType>
1350 struct Uninitialized
1352 static ArrayElementType
value;
1355 template <
typename Type>
1356 Type Uninitialized<Type>::value;
1358 template <
typename ArrayElementType>
1361 subscript(ArrayElementType *,
1363 std::integral_constant<int, 0>)
1366 # ifndef __CUDA_ARCH__
1370 "Cannot access elements of an object of type Tensor<rank,0,Number>."));
1372 return Uninitialized<ArrayElementType>::value;
1378 template <
int rank_,
int dim,
typename Number>
1383 return ::internal::TensorSubscriptor::subscript(
1384 values, i, std::integral_constant<int, dim>());
1388 template <
int rank_,
int dim,
typename Number>
1393 # ifndef DEAL_II_COMPILER_CUDA_AWARE
1401 template <
int rank_,
int dim,
typename Number>
1406 # ifndef DEAL_II_COMPILER_CUDA_AWARE
1408 ExcMessage(
"Cannot access an object of type Tensor<rank_,0,Number>"));
1411 return TensorAccessors::extract<rank_>(*
this, indices);
1416 template <
int rank_,
int dim,
typename Number>
1420 # ifndef DEAL_II_COMPILER_CUDA_AWARE
1422 ExcMessage(
"Cannot access an object of type Tensor<rank_,0,Number>"));
1425 return TensorAccessors::extract<rank_>(*
this, indices);
1430 template <
int rank_,
int dim,
typename Number>
1434 return std::addressof(
1435 this->
operator[](this->unrolled_to_component_indices(0)));
1440 template <
int rank_,
int dim,
typename Number>
1441 inline const Number *
1444 return std::addressof(
1445 this->
operator[](this->unrolled_to_component_indices(0)));
1450 template <
int rank_,
int dim,
typename Number>
1454 return begin_raw() + n_independent_components;
1459 template <
int rank_,
int dim,
typename Number>
1460 inline const Number *
1463 return begin_raw() + n_independent_components;
1468 template <
int rank_,
int dim,
typename Number>
1469 template <
typename OtherNumber>
1475 for (
unsigned int i = 0; i < dim; ++i)
1481 template <
int rank_,
int dim,
typename Number>
1488 for (
unsigned int i = 0; i < dim; ++i)
1494 template <
int rank_,
int dim,
typename Number>
1495 template <
typename OtherNumber>
1496 constexpr
inline bool
1500 for (
unsigned int i = 0; i < dim; ++i)
1514 constexpr
inline bool
1521 template <
int rank_,
int dim,
typename Number>
1522 template <
typename OtherNumber>
1527 return !((*this) == p);
1531 template <
int rank_,
int dim,
typename Number>
1532 template <
typename OtherNumber>
1538 for (
unsigned int i = 0; i < dim; ++i)
1544 template <
int rank_,
int dim,
typename Number>
1545 template <
typename OtherNumber>
1551 for (
unsigned int i = 0; i < dim; ++i)
1557 template <
int rank_,
int dim,
typename Number>
1558 template <
typename OtherNumber>
1563 for (
unsigned int i = 0; i < dim; ++i)
1571 namespace TensorImplementation
1576 typename OtherNumber,
1577 typename std::enable_if<
1580 !std::is_same<Number, Differentiation::SD::Expression>::value,
1584 const OtherNumber &factor)
1586 const Number inverse_factor = Number(1.) / factor;
1588 for (
unsigned int d = 0;
d < dim; ++
d)
1589 t[
d] *= inverse_factor;
1596 typename OtherNumber,
1597 typename std::enable_if<
1600 std::is_same<Number, Differentiation::SD::Expression>::value,
1604 const OtherNumber &factor)
1607 for (
unsigned int d = 0;
d < dim; ++
d)
1614 template <
int rank_,
int dim,
typename Number>
1615 template <
typename OtherNumber>
1625 template <
int rank_,
int dim,
typename Number>
1632 for (
unsigned int i = 0; i < dim; ++i)
1639 template <
int rank_,
int dim,
typename Number>
1647 template <
int rank_,
int dim,
typename Number>
1654 for (
unsigned int i = 0; i < dim; ++i)
1655 s +=
values[i].norm_square();
1661 template <
int rank_,
int dim,
typename Number>
1662 template <
typename OtherNumber>
1667 (Utilities::fixed_power<rank_, unsigned int>(dim)));
1669 unsigned int index = 0;
1670 unroll_recursion(result, index);
1674 template <
int rank_,
int dim,
typename Number>
1675 template <
typename OtherNumber>
1678 unsigned int & index)
const
1680 for (
unsigned int i = 0; i < dim; ++i)
1681 values[i].unroll_recursion(result, index);
1685 template <
int rank_,
int dim,
typename Number>
1686 constexpr
inline unsigned int
1690 unsigned int index = 0;
1691 for (
int r = 0; r < rank_; ++r)
1692 index = index * dim + indices[r];
1705 inline constexpr
unsigned int
1706 mod(
const unsigned int x)
1713 mod<0>(
const unsigned int x)
1720 inline constexpr
unsigned int
1721 div(
const unsigned int x)
1728 div<0>(
const unsigned int x)
1738 template <
int rank_,
int dim,
typename Number>
1746 unsigned int remainder = i;
1747 for (
int r = rank_ - 1; r >= 0; --r)
1749 indices[r] = internal::mod<dim>(remainder);
1750 remainder = internal::div<dim>(remainder);
1758 template <
int rank_,
int dim,
typename Number>
1759 constexpr
inline void
1762 for (
unsigned int i = 0; i < dim; ++i)
1767 template <
int rank_,
int dim,
typename Number>
1768 constexpr std::size_t
1775 template <
int rank_,
int dim,
typename Number>
1776 template <
class Archive>
1784 template <
int rank_,
int dim,
typename Number>
1803 template <
int rank_,
int dim,
typename Number>
1804 inline std::ostream &
1807 for (
unsigned int i = 0; i < dim; ++i)
1824 template <
int dim,
typename Number>
1825 inline std::ostream &
1828 out << static_cast<const Number &>(p);
1850 template <
int dim,
typename Number,
typename Other>
1855 return object *
static_cast<const Number &
>(t);
1870 template <
int dim,
typename Number,
typename Other>
1875 return static_cast<const Number &
>(t) *
object;
1890 template <
int dim,
typename Number,
typename OtherNumber>
1896 return static_cast<const Number &
>(src1) *
1897 static_cast<const OtherNumber &
>(src2);
1908 template <
int dim,
typename Number,
typename OtherNumber>
1916 return static_cast<const Number &
>(t) / factor;
1927 template <
int dim,
typename Number,
typename OtherNumber>
1933 return static_cast<const Number &
>(p) +
static_cast<const OtherNumber &
>(q);
1944 template <
int dim,
typename Number,
typename OtherNumber>
1950 return static_cast<const Number &
>(p) -
static_cast<const OtherNumber &
>(q);
1966 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1976 for (
unsigned int d = 0;
d < dim; ++
d)
1977 tt[
d] = t[
d] * factor;
1994 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2009 namespace TensorImplementation
2014 typename OtherNumber,
2015 typename std::enable_if<
2022 const OtherNumber & factor)
2025 const Number inverse_factor = Number(1.) / factor;
2027 for (
unsigned int d = 0;
d < dim; ++
d)
2028 tt[
d] = t[
d] * inverse_factor;
2036 typename OtherNumber,
2037 typename std::enable_if<
2044 const OtherNumber & factor)
2048 for (
unsigned int d = 0;
d < dim; ++
d)
2049 tt[
d] = t[
d] / factor;
2065 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2086 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2094 for (
unsigned int i = 0; i < dim; ++i)
2110 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2118 for (
unsigned int i = 0; i < dim; ++i)
2130 template <
int dim,
typename Number,
typename OtherNumber>
2159 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2167 for (
unsigned int i = 0; i < dim; ++i)
2203 template <
int rank_1,
2207 typename OtherNumber,
2208 typename =
typename std::enable_if<rank_1 >= 1 && rank_2 >= 1>::type>
2210 typename Tensor<rank_1 + rank_2 - 2,
2216 typename Tensor<rank_1 + rank_2 - 2,
2221 TensorAccessors::internal::
2222 ReorderedIndexView<0, rank_2, const Tensor<rank_2, dim, OtherNumber>>
2223 reordered = TensorAccessors::reordered_index_view<0, rank_2>(src2);
2224 TensorAccessors::contract<1, rank_1, rank_2, dim>(result, src1, reordered);
2258 template <
int index_1,
2264 typename OtherNumber>
2266 typename Tensor<rank_1 + rank_2 - 2,
2272 Assert(0 <= index_1 && index_1 < rank_1,
2274 "The specified index_1 must lie within the range [0,rank_1)"));
2275 Assert(0 <= index_2 && index_2 < rank_2,
2277 "The specified index_2 must lie within the range [0,rank_2)"));
2284 reord_01 = reordered_index_view<index_1, rank_1>(src1);
2290 reord_02 = reordered_index_view<index_2, rank_2>(src2);
2292 typename Tensor<rank_1 + rank_2 - 2,
2296 TensorAccessors::contract<1, rank_1, rank_2, dim>(result, reord_01, reord_02);
2331 template <
int index_1,
2339 typename OtherNumber>
2341 typename Tensor<rank_1 + rank_2 - 4,
2347 Assert(0 <= index_1 && index_1 < rank_1,
2349 "The specified index_1 must lie within the range [0,rank_1)"));
2350 Assert(0 <= index_3 && index_3 < rank_1,
2352 "The specified index_3 must lie within the range [0,rank_1)"));
2353 Assert(index_1 != index_3,
2354 ExcMessage(
"index_1 and index_3 must not be the same"));
2355 Assert(0 <= index_2 && index_2 < rank_2,
2357 "The specified index_2 must lie within the range [0,rank_2)"));
2358 Assert(0 <= index_4 && index_4 < rank_2,
2360 "The specified index_4 must lie within the range [0,rank_2)"));
2361 Assert(index_2 != index_4,
2362 ExcMessage(
"index_2 and index_4 must not be the same"));
2369 reord_1 = TensorAccessors::reordered_index_view<index_1, rank_1>(src1);
2373 reord_2 = TensorAccessors::reordered_index_view<index_2, rank_2>(src2);
2379 (index_3 < index_1 ? index_3 : index_3 - 1),
2391 (index_4 < index_2 ? index_4 : index_4 - 1),
2399 typename Tensor<rank_1 + rank_2 - 4,
2403 TensorAccessors::contract<2, rank_1, rank_2, dim>(result, reord_3, reord_4);
2420 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2427 TensorAccessors::contract<rank, rank, rank, dim>(result, left, right);
2449 template <
template <
int,
int,
typename>
class TensorT1,
2450 template <
int,
int,
typename>
class TensorT2,
2451 template <
int,
int,
typename>
class TensorT3,
2461 const TensorT2<rank_1 + rank_2, dim, T2> &middle,
2462 const TensorT3<rank_2, dim, T3> & right)
2466 return TensorAccessors::contract3<rank_1, rank_2, dim, return_type>(left,
2482 template <
int rank_1,
2486 typename OtherNumber>
2492 typename Tensor<rank_1 + rank_2,
2496 TensorAccessors::contract<0, rank_1, rank_2, dim>(result, src1, src2);
2518 template <
int dim,
typename Number>
2527 result[1] = -src[0];
2542 template <
int dim,
typename Number1,
typename Number2>
2553 constexpr
int s0 = 0 % dim;
2554 constexpr
int s1 = 1 % dim;
2555 constexpr
int s2 = 2 % dim;
2557 result[s0] = src1[s1] * src2[s2] - src1[s2] * src2[s1];
2558 result[s1] = src1[s2] * src2[s0] - src1[s0] * src2[s2];
2559 result[s2] = src1[s0] * src2[s1] - src1[s1] * src2[s0];
2577 template <
int dim,
typename Number>
2585 for (
unsigned int k = 0; k < dim; ++k)
2587 Tensor<2, dim - 1, Number> minor;
2588 for (
unsigned int i = 0; i < dim - 1; ++i)
2589 for (
unsigned int j = 0; j < dim - 1; ++j)
2590 minor[i][j] = t[i][j < k ? j : j + 1];
2597 return ((dim % 2 == 0) ? 1. : -1.) * det;
2605 template <
typename Number>
2617 template <
typename Number>
2622 return t[0][0] * t[1][1] - t[1][0] * t[0][1];
2630 template <
typename Number>
2641 return t[0][0] * C0 + t[0][1] * C1 + t[0][2] * C2;
2651 template <
int dim,
typename Number>
2656 for (
unsigned int i = 1; i < dim; ++i)
2670 template <
int dim,
typename Number>
2674 Number return_tensor[dim][dim];
2687 template <
typename Number>
2695 return return_tensor;
2699 template <
typename Number>
2706 1.0 / (t[0][0] * t[1][1] - t[1][0] * t[0][1]));
2707 return_tensor[0][0] = t[1][1];
2708 return_tensor[0][1] = -t[0][1];
2709 return_tensor[1][0] = -t[1][0];
2710 return_tensor[1][1] = t[0][0];
2711 return_tensor *= inv_det_t;
2713 return return_tensor;
2717 template <
typename Number>
2742 1.0 / (t[0][0] * return_tensor[0][0] + t[0][1] * return_tensor[1][0] +
2743 t[0][2] * return_tensor[2][0]));
2744 return_tensor *= inv_det_t;
2746 return return_tensor;
2757 template <
int dim,
typename Number>
2762 for (
unsigned int i = 0; i < dim; ++i)
2765 for (
unsigned int j = i + 1; j < dim; ++j)
2788 template <
int dim,
typename Number>
2809 template <
int dim,
typename Number>
2880 template <
int dim,
typename Number>
2892 template <
int dim,
typename Number>
2897 for (
unsigned int j = 0; j < dim; ++j)
2900 for (
unsigned int i = 0; i < dim; ++i)
2918 template <
int dim,
typename Number>
2923 for (
unsigned int i = 0; i < dim; ++i)
2926 for (
unsigned int j = 0; j < dim; ++j)
2942 # ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING
2951 for (
unsigned int j = 0; j < dim; ++j)
2954 for (
unsigned int i = 0; i < dim; ++i)
2969 for (
unsigned int i = 0; i < dim; ++i)
2972 for (
unsigned int j = 0; j < dim; ++j)
OutputOperator< VectorType > & operator<<(OutputOperator< VectorType > &out, unsigned int step)
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)
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)
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)
void unroll_recursion(Vector< OtherNumber > &result, unsigned int &start_index) const
constexpr Tensor(const ArrayView< ElementType, MemorySpace > &initializer)
constexpr Tensor< 2, dim, Number > cofactor(const Tensor< 2, dim, Number > &t)
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)
constexpr Tensor< rank_1+rank_2, dim, typename ProductType< Number, OtherNumber >::type > outer_product(const Tensor< rank_1, dim, Number > &src1, const Tensor< rank_2, dim, OtherNumber > &src2)
constexpr Tensor< 2, dim, Number > adjugate(const Tensor< 2, dim, Number > &t)
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< 2, dim, Number > transpose(const Tensor< 2, dim, Number > &t)
constexpr Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > operator-(const Tensor< 0, dim, Number > &p, const Tensor< 0, dim, OtherNumber > &q)
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 Number determinant(const Tensor< 2, dim, Number > &t)
constexpr Tensor< rank_1+rank_2 - 4, dim, typename ProductType< Number, OtherNumber >::type >::tensor_type double_contract(const Tensor< rank_1, dim, Number > &src1, const Tensor< rank_2, dim, OtherNumber > &src2)
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(Vector< OtherNumber > &result) const
constexpr Number & operator[](const TableIndices< rank_ > &indices)
constexpr Tensor & operator=(const Tensor< rank_, dim, OtherNumber > &rhs)
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 bool operator!=(const Tensor< rank_, dim, OtherNumber > &) const
constexpr ProductType< Number, OtherNumber >::type scalar_product(const Tensor< rank, dim, Number > &left, const Tensor< rank, dim, OtherNumber > &right)
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
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)
Tensor< 2, dim, Number > project_onto_orthogonal_tensors(const Tensor< 2, dim, Number > &A)
Number l1_norm(const Tensor< 2, dim, Number > &t)
constexpr Number trace(const Tensor< 2, dim, Number > &d)
constexpr Tensor< rank_1+rank_2 - 2, dim, typename ProductType< Number, OtherNumber >::type >::tensor_type contract(const Tensor< rank_1, dim, Number > &src1, const Tensor< rank_2, dim, OtherNumber > &src2)
constexpr Tensor & operator/=(const OtherNumber &factor)
static constexpr unsigned int dimension
constexpr Tensor< 1, dim, Number > cross_product_2d(const Tensor< 1, dim, Number > &src)
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()
OtherNumber::type::tensor_type operator*(const Tensor< rank_1, dim, Number > &src1, const Tensor< rank_2, dim, OtherNumber > &src2)
constexpr Number determinant(const Tensor< 2, 1, Number > &t)
constexpr Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > operator+(const Tensor< 0, dim, Number > &p, const Tensor< 0, dim, OtherNumber > &q)
void unroll_recursion(Vector< OtherNumber > &result, unsigned int &start_index) const
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)
constexpr Tensor & operator=(const Number &d)
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... >)
constexpr Number determinant(const Tensor< 2, 2, Number > &t)
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)
constexpr Tensor< 2, dim, Number > invert(const Tensor< 2, dim, Number > &)
void serialize(Archive &ar, const unsigned int version)
constexpr Number determinant(const Tensor< 2, 3, Number > &t)
constexpr Tensor(const array_type &initializer)
static constexpr unsigned int n_independent_components
constexpr Tensor operator-() const
constexpr ProductType< T1, typename ProductType< T2, T3 >::type >::type contract3(const TensorT1< rank_1, dim, T1 > &left, const TensorT2< rank_1+rank_2, dim, T2 > &middle, const TensorT3< rank_2, dim, T3 > &right)
Tensor< rank_ - 1, dim, Number > values[(dim !=0) ? dim :1]
constexpr Tensor< 1, dim, typename ProductType< Number1, Number2 >::type > cross_product_3d(const Tensor< 1, dim, Number1 > &src1, const Tensor< 1, dim, Number2 > &src2)
numbers::NumberTraits< Number >::real_type norm() const
#define DEAL_II_ALWAYS_INLINE
#define DEAL_II_NAMESPACE_OPEN
#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 internal::ReorderedIndexView< index, rank, T > reordered_index_view(T &t)
T sum(const T &t, const MPI_Comm &mpi_communicator)
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_CUDA_HOST_DEV
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
typename internal::ProductTypeImpl< typename std::decay< T >::type, typename std::decay< U >::type >::type type
static constexpr const T & value(const T &t)
decltype(std::declval< T >() *std::declval< U >()) type
static constexpr std::enable_if< std::is_same< Dummy, number >::value &&is_cuda_compatible< Dummy >::value, real_type >::type abs_square(const number &x)
static real_type abs(const number &x)
constexpr Tensor< 2, dim, Number > cofactor(const Tensor< 2, dim, Number > &t)
constexpr Tensor< 2, dim, Number > adjugate(const Tensor< 2, dim, Number > &t)
constexpr Tensor< 2, dim, Number > transpose(const Tensor< 2, dim, Number > &t)
constexpr Number determinant(const Tensor< 2, dim, Number > &t)
Number linfty_norm(const Tensor< 2, dim, Number > &t)
Number l1_norm(const Tensor< 2, dim, Number > &t)
constexpr Tensor< 2, dim, Number > invert(const Tensor< 2, dim, Number > &)