20 #ifndef LIBMESH_TENSOR_TOOLS_H
21 #define LIBMESH_TENSOR_TOOLS_H
24 #include "libmesh/libmesh_common.h"
25 #include "libmesh/compare_types.h"
27 #ifdef LIBMESH_HAVE_METAPHYSICL
28 #include "metaphysicl/dualnumber_decl.h"
43 template <
typename T,
typename T2>
45 typename boostcopy::enable_if_c<ScalarTraits<T>::value && ScalarTraits<T2>::value,
46 typename CompareTypes<T, T2>::supertype>::type
51 template <
typename T,
typename T2>
53 typename CompareTypes<T, T2>::supertype
58 template <
typename T,
typename T2>
60 typename CompareTypes<T, T2>::supertype
65 template <
unsigned int N,
typename T,
typename T2>
67 typename CompareTypes<T, T2>::supertype
86 {
return a.norm_sq(); }
92 {
return a.norm_sq(); }
97 bool is_zero(
const T & a){
return a.is_zero();}
100 template <
typename T>
107 template <
typename T>
114 template <
typename T>
121 template <
typename T>
128 template <
typename T>
134 template <
unsigned int N,
typename T>
142 template <
typename T>
151 template <
typename T>
157 template <
typename T>
163 template <
typename T>
169 template <
typename T>
175 template <
unsigned int N,
typename T>
182 template <
typename T>
185 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
192 template <
typename T>
202 template <
typename T>
208 template <
typename T>
214 template <
typename T>
220 template <
typename T>
226 template <
unsigned int N,
typename T>
229 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
238 template <
typename T>
244 template <
typename T>
250 template <
typename T>
256 template <
typename T>
262 template <
typename T>
268 template <
typename T>
274 template <
unsigned int N,
typename T>
302 template <
typename T>
305 static constexpr
bool value =
false;
311 template <
typename T>
320 template <
typename T>
329 template <
typename T>
338 template <
typename T>
347 template <
unsigned int N,
typename T>
357 template <
typename T,
typename enable =
void>
363 template <
typename T>
372 template <
template <
typename>
class Wrapper,
typename T>
375 typename std::enable_if<MathWrapperTraits<Wrapper<T>>::value>
::type> {
383 template <
typename T,
typename Enable =
void>
386 static_assert(always_false<T>,
387 "Instantiating the generic template of TensorTraits. You must specialize "
388 "TensorTraits for your type.");
389 static constexpr
unsigned char rank = 0;
395 template <
typename T>
396 struct TensorTraits<T, typename std::enable_if<ScalarTraits<T>::value>::type>
398 static constexpr
unsigned char rank = 0;
404 template <
typename T>
407 static constexpr
unsigned char rank = 1;
413 template <
typename T>
416 static constexpr
unsigned char rank = 1;
422 template <
typename T>
425 static constexpr
unsigned char rank = 2;
431 template <
typename T>
434 static constexpr
unsigned char rank = 2;
440 template <
typename T,
unsigned int N>
443 static constexpr
unsigned char rank =
static_cast<unsigned char>(N);
450 #endif // LIBMESH_TENSOR_TOOLS_H
此类定义了LIBMESH_DIM维的实数或复数空间中的向量。
CompareTypes< T, T2 >::supertype contract(const TypeNTensor< N, T2 > &) const
将两个张量相乘,返回一个标量,即 张量可能包含不同的数值类型。 也被称为张量的“双内积”或“双点积”。
This class defines a tensor in LIBMESH_DIM dimensional space of type T.
该类定义了一个在 LIBMESH_DIM 维度空间中类型为 T 的向量。
该类最终将定义一个在类型为T的LIBMESH_DIM维空间中的N阶张量。
CompareTypes< T, T2 >::supertype contract(const TypeTensor< T2 > &) const
将两个 Tensor 相乘,返回一个标量,即 。 这些 Tensor 可能包含不同的数值类型。
ADRealEigenVector< T, D, asd > norm(const ADRealEigenVector< T, D, asd > &)
计算自动微分实数向量的范数。
此类定义了LIBMESH_DIM维度的实数或复数空间中的张量。typedef RealTensorValue总是定义为实数值的张量, 而NumberTensorValue则根据库的配置定义为实数或复数值...