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.");
106 static constexpr
unsigned int dimension = dim;
111 static constexpr
unsigned int rank = 0;
116 static constexpr
unsigned int n_independent_components = 1;
156 template <
typename OtherNumber>
165 template <
typename OtherNumber>
167 Tensor(
const OtherNumber &initializer);
222 template <
typename OtherNumber>
226 #ifdef __INTEL_COMPILER 245 template <
typename OtherNumber>
247 operator=(
const OtherNumber &
d);
252 template <
typename OtherNumber>
259 template <
typename OtherNumber>
268 template <
typename OtherNumber>
277 template <
typename OtherNumber>
286 template <
typename OtherNumber>
288 operator*=(
const OtherNumber &factor);
295 template <
typename OtherNumber>
297 operator/=(
const OtherNumber &factor);
344 template <
class Archive>
346 serialize(Archive &ar,
const unsigned int version);
363 template <
typename OtherNumber>
365 unroll_recursion(Vector<OtherNumber> &result,
366 unsigned int & start_index)
const;
369 template <
int,
int,
typename>
448 template <
int rank_,
int dim,
typename Number>
452 static_assert(rank_ >= 0,
453 "Tensors must have a rank greater than or equal to one.");
454 static_assert(dim >= 0,
455 "Tensors must have a dimension greater than or equal to one.");
464 static constexpr
unsigned int dimension = dim;
469 static constexpr
unsigned int rank = rank_;
475 static constexpr
unsigned int n_independent_components =
476 Tensor<rank_ - 1, dim>::n_independent_components * dim;
521 template <
typename ElementType,
typename MemorySpace>
532 template <
typename OtherNumber>
539 template <
typename OtherNumber>
546 template <
typename OtherNumber>
548 operator Tensor<1, dim, Tensor<rank_ - 1, dim, OtherNumber>>()
const;
556 operator[](
const unsigned int i);
564 operator[](
const unsigned int i)
const;
608 template <
typename OtherNumber>
619 operator=(
const Number &
d);
624 template <
typename OtherNumber>
631 template <
typename OtherNumber>
640 template <
typename OtherNumber>
649 template <
typename OtherNumber>
659 template <
typename OtherNumber>
661 operator*=(
const OtherNumber &factor);
668 template <
typename OtherNumber>
670 operator/=(
const OtherNumber &factor);
723 template <
typename OtherNumber>
725 unroll(Vector<OtherNumber> &result)
const;
740 unrolled_to_component_indices(
const unsigned int i);
746 static constexpr std::size_t
754 template <
class Archive>
756 serialize(Archive &ar,
const unsigned int version);
768 Tensor<rank_ - 1, dim, Number>
values[(dim != 0) ? dim : 1];
775 template <
typename OtherNumber>
777 unroll_recursion(Vector<OtherNumber> &result,
778 unsigned int & start_index)
const;
786 template <
typename ArrayLike, std::size_t... Indices>
788 Tensor(
const ArrayLike &initializer, std::index_sequence<Indices...>);
791 template <
int,
int,
typename>
807 template <
int rank,
int dim,
typename T,
typename U>
808 struct ProductTypeImpl<
Tensor<rank, dim,
T>,
std::complex<U>>
814 template <
int rank,
int dim,
typename T,
typename U>
815 struct ProductTypeImpl<
Tensor<rank, dim,
std::complex<T>>, std::complex<U>>
821 template <
typename T,
int rank,
int dim,
typename U>
822 struct ProductTypeImpl<
std::complex<T>,
Tensor<rank, dim, U>>
828 template <
int rank,
int dim,
typename T,
typename U>
829 struct ProductTypeImpl<
std::complex<T>,
Tensor<rank, dim, std::complex<U>>>
840 template <
int rank,
int dim,
typename T>
841 struct NumberType<
Tensor<rank, dim,
T>>
863 template <
int dim,
typename Number>
873 template <
int dim,
typename Number>
874 template <
typename OtherNumber>
877 : value(
internal::NumberType<Number>::value(initializer))
882 template <
int dim,
typename Number>
883 template <
typename OtherNumber>
891 template <
int dim,
typename Number>
895 return std::addressof(value);
900 template <
int dim,
typename Number>
901 inline const Number *
904 return std::addressof(value);
909 template <
int dim,
typename Number>
918 template <
int dim,
typename Number>
927 template <
int dim,
typename Number>
932 # ifndef __CUDA_ARCH__ 934 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
940 template <
int dim,
typename Number>
945 # ifndef __CUDA_ARCH__ 947 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
953 template <
int dim,
typename Number>
954 template <
typename OtherNumber>
964 # ifdef __INTEL_COMPILER 965 template <
int dim,
typename Number>
976 template <
int dim,
typename Number>
977 template <
typename OtherNumber>
987 template <
int dim,
typename Number>
988 template <
typename OtherNumber>
992 # if defined(DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING) 993 Assert(!(std::is_same<Number, adouble>::value ||
994 std::is_same<OtherNumber, adouble>::value),
996 "The Tensor equality operator for ADOL-C taped numbers has not yet " 997 "been extended to support advanced branching."));
1004 template <
int dim,
typename Number>
1005 template <
typename OtherNumber>
1009 return !((*this) == p);
1013 template <
int dim,
typename Number>
1014 template <
typename OtherNumber>
1024 template <
int dim,
typename Number>
1025 template <
typename OtherNumber>
1038 namespace ComplexWorkaround
1040 template <
typename Number,
typename OtherNumber>
1042 multiply_assign_scalar(Number &val,
const OtherNumber &s)
1047 # ifdef __CUDA_ARCH__ 1048 template <
typename Number,
typename OtherNumber>
1050 multiply_assign_scalar(std::complex<Number> &,
const OtherNumber &)
1052 printf(
"This function is not implemented for std::complex<Number>!\n");
1060 template <
int dim,
typename Number>
1061 template <
typename OtherNumber>
1066 internal::ComplexWorkaround::multiply_assign_scalar(value, s);
1072 template <
int dim,
typename Number>
1073 template <
typename OtherNumber>
1082 template <
int dim,
typename Number>
1090 template <
int dim,
typename Number>
1095 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1100 template <
int dim,
typename Number>
1106 # ifndef __CUDA_ARCH__ 1108 ExcMessage(
"Cannot access an object of type Tensor<0,0,Number>"));
1114 template <
int dim,
typename Number>
1115 template <
typename OtherNumber>
1118 unsigned int & index)
const 1121 ExcMessage(
"Cannot unroll an object of type Tensor<0,0,Number>"));
1122 result[index] = value;
1127 template <
int dim,
typename Number>
1137 template <
int dim,
typename Number>
1138 template <
class Archive>
1146 template <
int dim,
typename Number>
1152 template <
int rank_,
int dim,
typename Number>
1153 template <
typename ArrayLike, std::size_t... indices>
1156 std::index_sequence<indices...>)
1157 :
values{
Tensor<rank_ - 1, dim, Number>(initializer[indices])...}
1159 static_assert(
sizeof...(indices) == dim,
1160 "dim should match the number of indices");
1165 template <
int rank_,
int dim,
typename Number>
1175 template <
int rank_,
int dim,
typename Number>
1178 :
Tensor(initializer,
std::make_index_sequence<dim>{})
1183 template <
int rank_,
int dim,
typename Number>
1184 template <
typename ElementType,
typename MemorySpace>
1197 template <
int rank_,
int dim,
typename Number>
1198 template <
typename OtherNumber>
1202 :
Tensor(initializer,
std::make_index_sequence<dim>{})
1206 template <
int rank_,
int dim,
typename Number>
1207 template <
typename OtherNumber>
1211 :
Tensor(initializer,
std::make_index_sequence<dim>{})
1215 template <
int rank_,
int dim,
typename Number>
1216 template <
typename OtherNumber>
1218 operator
Tensor<1, dim, Tensor<rank_ - 1, dim, OtherNumber>>()
const 1220 return Tensor<1, dim, Tensor<rank_ - 1, dim, Number>>(
values);
1227 namespace TensorSubscriptor
1229 template <
typename ArrayElementType,
int dim>
1232 subscript(ArrayElementType *
values,
1233 const unsigned int i,
1234 std::integral_constant<int, dim>)
1237 # ifndef __CUDA_ARCH__ 1248 template <
typename ArrayElementType>
1249 struct Uninitialized
1251 static ArrayElementType value;
1254 template <
typename Type>
1255 Type Uninitialized<Type>::value;
1257 template <
typename ArrayElementType>
1260 subscript(ArrayElementType *,
1262 std::integral_constant<int, 0>)
1265 # ifndef __CUDA_ARCH__ 1269 "Cannot access elements of an object of type Tensor<rank,0,Number>."));
1271 return Uninitialized<ArrayElementType>::value;
1277 template <
int rank_,
int dim,
typename Number>
1282 return ::internal::TensorSubscriptor::subscript(
1283 values, i, std::integral_constant<int, dim>());
1287 template <
int rank_,
int dim,
typename Number>
1292 # ifndef DEAL_II_COMPILER_CUDA_AWARE 1300 template <
int rank_,
int dim,
typename Number>
1305 # ifndef DEAL_II_COMPILER_CUDA_AWARE 1307 ExcMessage(
"Cannot access an object of type Tensor<rank_,0,Number>"));
1310 return TensorAccessors::extract<rank_>(*
this, indices);
1315 template <
int rank_,
int dim,
typename Number>
1319 # ifndef DEAL_II_COMPILER_CUDA_AWARE 1321 ExcMessage(
"Cannot access an object of type Tensor<rank_,0,Number>"));
1324 return TensorAccessors::extract<rank_>(*
this, indices);
1329 template <
int rank_,
int dim,
typename Number>
1333 return std::addressof(
1339 template <
int rank_,
int dim,
typename Number>
1340 inline const Number *
1343 return std::addressof(
1349 template <
int rank_,
int dim,
typename Number>
1358 template <
int rank_,
int dim,
typename Number>
1359 inline const Number *
1367 template <
int rank_,
int dim,
typename Number>
1368 template <
typename OtherNumber>
1374 for (
unsigned int i = 0; i < dim; ++i)
1380 template <
int rank_,
int dim,
typename Number>
1385 ExcMessage(
"Only assignment with zero is allowed"));
1388 for (
unsigned int i = 0; i < dim; ++i)
1394 template <
int rank_,
int dim,
typename Number>
1395 template <
typename OtherNumber>
1400 for (
unsigned int i = 0; i < dim; ++i)
1421 template <
int rank_,
int dim,
typename Number>
1422 template <
typename OtherNumber>
1427 return !((*this) == p);
1431 template <
int rank_,
int dim,
typename Number>
1432 template <
typename OtherNumber>
1438 for (
unsigned int i = 0; i < dim; ++i)
1444 template <
int rank_,
int dim,
typename Number>
1445 template <
typename OtherNumber>
1451 for (
unsigned int i = 0; i < dim; ++i)
1457 template <
int rank_,
int dim,
typename Number>
1458 template <
typename OtherNumber>
1463 for (
unsigned int i = 0; i < dim; ++i)
1471 namespace TensorImplementation
1476 typename OtherNumber,
1477 typename std::enable_if<
1480 !std::is_same<Number, Differentiation::SD::Expression>::value,
1484 const OtherNumber &factor)
1486 const Number inverse_factor = Number(1.) / factor;
1488 for (
unsigned int d = 0; d < dim; ++
d)
1489 t[d] *= inverse_factor;
1496 typename OtherNumber,
1497 typename std::enable_if<
1500 std::is_same<Number, Differentiation::SD::Expression>::value,
1504 const OtherNumber &factor)
1507 for (
unsigned int d = 0; d < dim; ++
d)
1514 template <
int rank_,
int dim,
typename Number>
1515 template <
typename OtherNumber>
1525 template <
int rank_,
int dim,
typename Number>
1532 for (
unsigned int i = 0; i < dim; ++i)
1539 template <
int rank_,
int dim,
typename Number>
1547 template <
int rank_,
int dim,
typename Number>
1554 for (
unsigned int i = 0; i < dim; ++i)
1561 template <
int rank_,
int dim,
typename Number>
1562 template <
typename OtherNumber>
1567 (Utilities::fixed_power<rank_, unsigned int>(dim)));
1569 unsigned int index = 0;
1574 template <
int rank_,
int dim,
typename Number>
1575 template <
typename OtherNumber>
1578 unsigned int & index)
const 1580 for (
unsigned int i = 0; i < dim; ++i)
1585 template <
int rank_,
int dim,
typename Number>
1590 unsigned int index = 0;
1591 for (
int r = 0; r < rank_; ++r)
1592 index = index * dim + indices[r];
1606 mod(
const unsigned int x)
1613 mod<0>(
const unsigned int x)
1621 div(
const unsigned int x)
1628 div<0>(
const unsigned int x)
1638 template <
int rank_,
int dim,
typename Number>
1646 unsigned int remainder = i;
1647 for (
int r = rank_ - 1; r >= 0; --r)
1649 indices[r] = internal::mod<dim>(remainder);
1650 remainder = internal::div<dim>(remainder);
1658 template <
int rank_,
int dim,
typename Number>
1662 for (
unsigned int i = 0; i < dim; ++i)
1667 template <
int rank_,
int dim,
typename Number>
1668 constexpr std::size_t
1675 template <
int rank_,
int dim,
typename Number>
1676 template <
class Archive>
1684 template <
int rank_,
int dim,
typename Number>
1703 template <
int rank_,
int dim,
typename Number>
1704 inline std::ostream &
1705 operator<<(std::ostream &out, const Tensor<rank_, dim, Number> &p)
1707 for (
unsigned int i = 0; i < dim; ++i)
1724 template <
int dim,
typename Number>
1725 inline std::ostream &
1726 operator<<(std::ostream &out, const Tensor<0, dim, Number> &p)
1728 out << static_cast<const Number &>(p);
1750 template <
int dim,
typename Number,
typename Other>
1755 return object *
static_cast<const Number &
>(t);
1770 template <
int dim,
typename Number,
typename Other>
1775 return static_cast<const Number &
>(t) *
object;
1790 template <
int dim,
typename Number,
typename OtherNumber>
1796 return static_cast<const Number &
>(src1) *
1797 static_cast<const OtherNumber &>(src2);
1808 template <
int dim,
typename Number,
typename OtherNumber>
1816 return static_cast<const Number &
>(t) / factor;
1827 template <
int dim,
typename Number,
typename OtherNumber>
1833 return static_cast<const Number &
>(p) + static_cast<const OtherNumber &>(q);
1844 template <
int dim,
typename Number,
typename OtherNumber>
1850 return static_cast<const Number &
>(p) - static_cast<const OtherNumber &>(q);
1866 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1876 for (
unsigned int d = 0; d < dim; ++
d)
1877 tt[d] = t[d] * factor;
1894 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1909 namespace TensorImplementation
1914 typename OtherNumber,
1915 typename std::enable_if<
1922 const OtherNumber & factor)
1925 const Number inverse_factor = Number(1.) / factor;
1927 for (
unsigned int d = 0; d < dim; ++
d)
1928 tt[d] = t[d] * inverse_factor;
1936 typename OtherNumber,
1937 typename std::enable_if<
1944 const OtherNumber & factor)
1948 for (
unsigned int d = 0; d < dim; ++
d)
1949 tt[d] = t[d] / factor;
1965 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1986 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
1994 for (
unsigned int i = 0; i < dim; ++i)
2010 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2018 for (
unsigned int i = 0; i < dim; ++i)
2030 template <
int dim,
typename Number,
typename OtherNumber>
2059 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2067 for (
unsigned int i = 0; i < dim; ++i)
2103 template <
int rank_1,
2107 typename OtherNumber,
2108 typename =
typename std::enable_if<rank_1 >= 1 && rank_2 >= 1>::type>
2110 typename Tensor<rank_1 + rank_2 - 2,
2116 typename Tensor<rank_1 + rank_2 - 2,
2121 TensorAccessors::internal::
2122 ReorderedIndexView<0, rank_2, const Tensor<rank_2, dim, OtherNumber>>
2123 reordered = TensorAccessors::reordered_index_view<0, rank_2>(src2);
2124 TensorAccessors::contract<1, rank_1, rank_2, dim>(result, src1, reordered);
2158 template <
int index_1,
2164 typename OtherNumber>
2166 typename Tensor<rank_1 + rank_2 - 2,
2172 Assert(0 <= index_1 && index_1 < rank_1,
2174 "The specified index_1 must lie within the range [0,rank_1)"));
2175 Assert(0 <= index_2 && index_2 < rank_2,
2177 "The specified index_2 must lie within the range [0,rank_2)"));
2184 reord_01 = reordered_index_view<index_1, rank_1>(src1);
2188 reord_02 = reordered_index_view<index_2, rank_2>(src2);
2190 typename Tensor<rank_1 + rank_2 - 2,
2194 TensorAccessors::contract<1, rank_1, rank_2, dim>(result, reord_01, reord_02);
2229 template <
int index_1,
2237 typename OtherNumber>
2239 typename Tensor<rank_1 + rank_2 - 4,
2245 Assert(0 <= index_1 && index_1 < rank_1,
2247 "The specified index_1 must lie within the range [0,rank_1)"));
2248 Assert(0 <= index_3 && index_3 < rank_1,
2250 "The specified index_3 must lie within the range [0,rank_1)"));
2251 Assert(index_1 != index_3,
2252 ExcMessage(
"index_1 and index_3 must not be the same"));
2253 Assert(0 <= index_2 && index_2 < rank_2,
2255 "The specified index_2 must lie within the range [0,rank_2)"));
2256 Assert(0 <= index_4 && index_4 < rank_2,
2258 "The specified index_4 must lie within the range [0,rank_2)"));
2259 Assert(index_2 != index_4,
2260 ExcMessage(
"index_2 and index_4 must not be the same"));
2267 reord_1 = TensorAccessors::reordered_index_view<index_1, rank_1>(src1);
2271 reord_2 = TensorAccessors::reordered_index_view<index_2, rank_2>(src2);
2277 (index_3 < index_1 ? index_3 : index_3 - 1),
2289 (index_4 < index_2 ? index_4 : index_4 - 1),
2297 typename Tensor<rank_1 + rank_2 - 4,
2301 TensorAccessors::contract<2, rank_1, rank_2, dim>(result, reord_3, reord_4);
2318 template <
int rank,
int dim,
typename Number,
typename OtherNumber>
2325 TensorAccessors::contract<rank, rank, rank, dim>(result, left, right);
2347 template <
template <
int,
int,
typename>
class TensorT1,
2348 template <
int,
int,
typename>
class TensorT2,
2349 template <
int,
int,
typename>
class TensorT3,
2359 const TensorT2<rank_1 + rank_2, dim, T2> &middle,
2360 const TensorT3<rank_2, dim, T3> & right)
2364 return TensorAccessors::contract3<rank_1, rank_2, dim, return_type>(left,
2380 template <
int rank_1,
2384 typename OtherNumber>
2390 typename Tensor<rank_1 + rank_2,
2394 TensorAccessors::contract<0, rank_1, rank_2, dim>(result, src1, src2);
2416 template <
int dim,
typename Number>
2425 result[1] = -src[0];
2440 template <
int dim,
typename Number1,
typename Number2>
2451 constexpr
int s0 = 0 % dim;
2452 constexpr
int s1 = 1 % dim;
2453 constexpr
int s2 = 2 % dim;
2455 result[s0] = src1[s1] * src2[s2] - src1[s2] * src2[s1];
2456 result[s1] = src1[s2] * src2[s0] - src1[s0] * src2[s2];
2457 result[s2] = src1[s0] * src2[s1] - src1[s1] * src2[s0];
2475 template <
int dim,
typename Number>
2483 for (
unsigned int k = 0; k < dim; ++k)
2485 Tensor<2, dim - 1, Number> minor;
2486 for (
unsigned int i = 0; i < dim - 1; ++i)
2487 for (
unsigned int j = 0; j < dim - 1; ++j)
2488 minor[i][j] = t[i][j < k ? j : j + 1];
2495 return ((dim % 2 == 0) ? 1. : -1.) * det;
2503 template <
typename Number>
2515 template <
typename Number>
2520 return t[0][0] * t[1][1] - t[1][0] * t[0][1];
2528 template <
typename Number>
2539 return t[0][0] * C0 + t[0][1] * C1 + t[0][2] * C2;
2549 template <
int dim,
typename Number>
2554 for (
unsigned int i = 1; i < dim; ++i)
2568 template <
int dim,
typename Number>
2572 Number return_tensor[dim][dim];
2585 template <
typename Number>
2593 return return_tensor;
2597 template <
typename Number>
2604 1.0 / (t[0][0] * t[1][1] - t[1][0] * t[0][1]));
2605 return_tensor[0][0] = t[1][1];
2606 return_tensor[0][1] = -t[0][1];
2607 return_tensor[1][0] = -t[1][0];
2608 return_tensor[1][1] = t[0][0];
2609 return_tensor *= inv_det_t;
2611 return return_tensor;
2615 template <
typename Number>
2640 1.0 / (t[0][0] * return_tensor[0][0] + t[0][1] * return_tensor[1][0] +
2641 t[0][2] * return_tensor[2][0]));
2642 return_tensor *= inv_det_t;
2644 return return_tensor;
2655 template <
int dim,
typename Number>
2660 for (
unsigned int i = 0; i < dim; ++i)
2663 for (
unsigned int j = i + 1; j < dim; ++j)
2686 template <
int dim,
typename Number>
2707 template <
int dim,
typename Number>
2778 template <
int dim,
typename Number>
2790 template <
int dim,
typename Number>
2795 for (
unsigned int j = 0; j < dim; ++j)
2798 for (
unsigned int i = 0; i < dim; ++i)
2816 template <
int dim,
typename Number>
2821 for (
unsigned int i = 0; i < dim; ++i)
2824 for (
unsigned int j = 0; j < dim; ++j)
2840 # ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING 2849 for (
unsigned int j = 0; j < dim; ++j)
2852 for (
unsigned int i = 0; i < dim; ++i)
2855 condassign(max, (sum > max), sum, max);
2867 for (
unsigned int i = 0; i < dim; ++i)
2870 for (
unsigned int j = 0; j < dim; ++j)
2873 condassign(max, (sum > max), sum, max);
2879 # endif // DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING constexpr Tensor & operator+=(const Tensor< rank_, dim, OtherNumber > &)
Tensor< rank, dim, Number > sum(const Tensor< rank, dim, Number > &local, const MPI_Comm &mpi_communicator)
constexpr Tensor< 2, dim, Number > invert(const Tensor< 2, dim, Number > &)
static constexpr unsigned int component_to_unrolled_index(const TableIndices< rank_ > &indices)
#define AssertDimension(dim1, dim2)
constexpr ProductType< Number, OtherNumber >::type scalar_product(const Tensor< rank, dim, Number > &left, const Tensor< rank, dim, OtherNumber > &right)
constexpr Tensor< 2, dim, Number > cofactor(const Tensor< 2, dim, Number > &t)
static constexpr const T & value(const T &t)
constexpr bool values_are_equal(const Number1 &value_1, const Number2 &value_2)
typename internal::ProductTypeImpl< typename std::decay< T >::type, typename std::decay< U >::type >::type type
constexpr Tensor< 2, dim, Number > transpose(const Tensor< 2, dim, Number > &t)
static constexpr std::enable_if< std::is_same< Dummy, number >::value &&is_cuda_compatible< Dummy >::value, real_type >::type abs_square(const number &x)
constexpr ProductType< Other, Number >::type operator*(const Other &object, const Tensor< 0, dim, Number > &t)
constexpr Tensor operator-() const
constexpr Tensor< 1, dim, Number > cross_product_2d(const Tensor< 1, dim, Number > &src)
Number l1_norm(const Tensor< 2, dim, Number > &t)
#define AssertIndexRange(index, range)
constexpr Tensor< 1, dim, typename ProductType< Number1, Number2 >::type > cross_product_3d(const Tensor< 1, dim, Number1 > &src1, const Tensor< 1, dim, Number2 > &src2)
Number linfty_norm(const Tensor< 2, dim, Number > &t)
constexpr Tensor & operator-=(const Tensor< rank_, dim, OtherNumber > &)
Tensor< rank_ - 1, dim, Number > values[(dim !=0) ? dim :1]
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim >>> &Du)
typename Tensor< rank_ - 1, dim, Number >::array_type[(dim !=0) ? dim :1] array_type
#define AssertThrow(cond, exc)
static real_type abs(const number &x)
void unroll_recursion(Vector< OtherNumber > &result, unsigned int &start_index) const
constexpr Tensor & operator=(const Tensor< rank_, dim, OtherNumber > &rhs)
Tensor< rank_, dim, Number > tensor_type
static ::ExceptionBase & ExcMessage(std::string arg1)
constexpr value_type & operator[](const unsigned int i)
static constexpr TableIndices< rank_ > unrolled_to_component_indices(const unsigned int i)
#define Assert(cond, exc)
constexpr Number trace(const Tensor< 2, dim, Number > &d)
constexpr internal::ReorderedIndexView< index, rank, T > reordered_index_view(T &t)
void serialize(Archive &ar, const unsigned int version)
constexpr bool operator==(const Tensor< rank_, dim, OtherNumber > &) const
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_ALWAYS_INLINE
typename Tensor< rank_ - 1, dim, Number >::tensor_type value_type
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 numbers::NumberTraits< Number >::real_type norm_square() const
Expression fabs(const Expression &x)
static constexpr unsigned int rank
constexpr Tensor< 2, dim, Number > adjugate(const Tensor< 2, dim, Number > &t)
constexpr Tensor & operator*=(const OtherNumber &factor)
constexpr Tensor & operator/=(const OtherNumber &factor)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
static constexpr std::size_t memory_consumption()
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)
constexpr bool operator!=(const Tensor< rank_, dim, OtherNumber > &) const
typename numbers::NumberTraits< Number >::real_type real_type
constexpr Tensor< 0, dim, typename ProductType< Number, typename EnableIfScalar< OtherNumber >::type >::type > operator/(const Tensor< 0, dim, Number > &t, const OtherNumber &factor)
constexpr Tensor< rank, dim, typename ProductType< Number, OtherNumber >::type > division_operator(const Tensor< rank, dim, Number > &t, const OtherNumber &factor)
Expression operator==(const Expression &lhs, const Expression &rhs)
constexpr Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > operator+(const Tensor< 0, dim, Number > &p, const Tensor< 0, dim, OtherNumber > &q)
#define DEAL_II_NAMESPACE_OPEN
constexpr bool value_is_zero(const Number &value)
#define DEAL_II_CUDA_HOST_DEV
Expression operator-(Expression lhs, const Expression &rhs)
static ::ExceptionBase & ExcNotImplemented()
void unroll(Vector< OtherNumber > &result) const
Tensor< 2, dim, Number > project_onto_orthogonal_tensors(const Tensor< 2, dim, Number > &A)
numbers::NumberTraits< Number >::real_type norm() const
static constexpr unsigned int n_independent_components
constexpr Tensor< 0, dim, typename ProductType< Number, OtherNumber >::type > schur_product(const Tensor< 0, dim, Number > &src1, const Tensor< 0, dim, OtherNumber > &src2)
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< 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)
Expression operator!=(const Expression &lhs, const Expression &rhs)
T max(const T &t, const MPI_Comm &mpi_communicator)
#define DEAL_II_CONSTEXPR
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
inline ::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &x)
static ::ExceptionBase & ExcInternalError()
constexpr Number determinant(const Tensor< 2, dim, Number > &t)