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"
34template <
typename T>
class TypeVector;
35template <
typename T>
class VectorValue;
36template <
typename T>
class TypeTensor;
37template <
typename T>
class TensorValue;
38template <
unsigned int N,
typename T>
class TypeNTensor;
47template <
typename T,
typename T2>
54template <
typename T,
typename T2>
60template <
typename T,
typename T2>
66template <
unsigned int N,
typename T,
typename T2>
75{
using std::abs;
return abs(a); }
79T
norm(std::complex<T> a) {
using std::abs;
return abs(a); }
84{
using std::sqrt;
return sqrt(a.norm_sq());}
89{
using std::sqrt;
return sqrt(a.norm_sq());}
94{
using std::sqrt;
return sqrt(a.norm_sq());}
99{
using std::sqrt;
return sqrt(a.norm_sq());}
134bool is_zero(
const T & a){
return a.is_zero();}
174template <
unsigned int N,
typename T>
215template <
unsigned int N,
typename T>
225#ifdef LIBMESH_USE_COMPLEX_NUMBERS
266template <
unsigned int N,
typename T>
269#ifdef LIBMESH_USE_COMPLEX_NUMBERS
314template <
unsigned int N,
typename T>
347 static constexpr bool value =
false;
374template <
unsigned int N,
typename T>
387template <
template <
typename>
class Wrapper,
typename T>
390 typename
std::enable_if<MathWrapperTraits<Wrapper<T>>::value>::type> {
394template <
typename T,
typename Enable =
void>
397 static_assert(always_false<T>,
398 "Instantiating the generic template of TensorTraits. You must specialize "
399 "TensorTraits for your type.");
400 static constexpr unsigned char rank = 0;
406 static constexpr unsigned char rank = 0;
412 static constexpr unsigned char rank = 1;
418 static constexpr unsigned char rank = 1;
424 static constexpr unsigned char rank = 2;
430 static constexpr unsigned char rank = 2;
433template <
typename T,
unsigned int N>
436 static constexpr unsigned char rank =
static_cast<unsigned char>(N);
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
This class will eventually define a rank-N tensor in LIBMESH_DIM dimensional space of type T.
CompareTypes< T, T2 >::supertype contract(const TypeNTensor< N, T2 > &) const
Multiply 2 tensors together to return a scalar, i.e.
This class defines a tensor in LIBMESH_DIM dimensional space of type T.
CompareTypes< T, T2 >::supertype contract(const TypeTensor< T2 > &) const
Multiply 2 tensors together to return a scalar, i.e.
This class defines a vector in LIBMESH_DIM dimensional space of type T.
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
The libMesh namespace provides an interface to certain functionality in the library.
auto norm(const libMesh::TypeVector< T > &vector) -> decltype(std::norm(T()))