libMesh
Loading...
Searching...
No Matches
Classes | Functions
libMesh::TensorTools Namespace Reference

Classes

struct  DecrementRank
 
struct  DecrementRank< TensorValue< T > >
 
struct  DecrementRank< TypeNTensor< N, T > >
 
struct  DecrementRank< TypeTensor< T > >
 
struct  DecrementRank< TypeVector< T > >
 
struct  DecrementRank< VectorValue< T > >
 
struct  IncrementRank
 
struct  IncrementRank< TensorValue< T > >
 
struct  IncrementRank< TypeNTensor< N, T > >
 
struct  IncrementRank< TypeTensor< T > >
 
struct  IncrementRank< TypeVector< T > >
 
struct  IncrementRank< VectorValue< T > >
 
struct  MakeBaseNumber
 
struct  MakeBaseNumber< T, typename std::enable_if< ScalarTraits< T >::value >::type >
 
struct  MakeBaseNumber< Wrapper< T >, typename std::enable_if< MathWrapperTraits< Wrapper< T > >::value >::type >
 
struct  MakeNumber
 
struct  MakeNumber< std::complex< T > >
 
struct  MakeNumber< TensorValue< T > >
 
struct  MakeNumber< TypeNTensor< N, T > >
 
struct  MakeNumber< TypeTensor< T > >
 
struct  MakeNumber< TypeVector< T > >
 
struct  MakeNumber< VectorValue< T > >
 
struct  MakeReal
 
struct  MakeReal< std::complex< T > >
 
struct  MakeReal< TensorValue< T > >
 
struct  MakeReal< TypeNTensor< N, T > >
 
struct  MakeReal< TypeTensor< T > >
 
struct  MakeReal< TypeVector< T > >
 
struct  MakeReal< VectorValue< T > >
 
struct  MathWrapperTraits
 This helper structure is used to determine whether a template class is one of our mathematical structures, like TypeVector, TypeTensor and their descendents. More...
 
struct  MathWrapperTraits< TensorValue< T > >
 
struct  MathWrapperTraits< TypeNTensor< N, T > >
 
struct  MathWrapperTraits< TypeTensor< T > >
 
struct  MathWrapperTraits< TypeVector< T > >
 
struct  MathWrapperTraits< VectorValue< T > >
 
struct  TensorTraits
 
struct  TensorTraits< T, typename std::enable_if< ScalarTraits< T >::value >::type >
 
struct  TensorTraits< TensorValue< T > >
 
struct  TensorTraits< TypeNTensor< N, T > >
 
struct  TensorTraits< TypeTensor< T > >
 
struct  TensorTraits< TypeVector< T > >
 
struct  TensorTraits< VectorValue< T > >
 

Functions

template<typename T , typename T2 >
std::enable_if< ScalarTraits< T >::value &&ScalarTraits< T2 >::value, typenameCompareTypes< T, T2 >::supertype >::type inner_product (const T &a, const T2 &b)
 
template<typename T , typename T2 >
CompareTypes< T, T2 >::supertype inner_product (const TypeVector< T > &a, const TypeVector< T2 > &b)
 
template<typename T , typename T2 >
CompareTypes< T, T2 >::supertype inner_product (const TypeTensor< T > &a, const TypeTensor< T2 > &b)
 
template<unsigned int N, typename T , typename T2 >
CompareTypes< T, T2 >::supertype inner_product (const TypeNTensor< N, T > &a, const TypeNTensor< N, T2 > &b)
 
template<typename T >
auto norm (const T &a)
 
template<typename T >
norm (std::complex< T > a)
 
template<typename T >
auto norm (const TypeVector< T > &a) -> decltype(TensorTools::norm(T()))
 
template<typename T >
auto norm (const VectorValue< T > &a) -> decltype(TensorTools::norm(T()))
 
template<typename T >
auto norm (const TypeTensor< T > &a) -> decltype(TensorTools::norm(T()))
 
template<typename T >
auto norm (const TensorValue< T > &a) -> decltype(TensorTools::norm(T()))
 
template<typename T >
auto norm_sq (const T &a)
 
template<typename T >
norm_sq (std::complex< T > a)
 
template<typename T >
auto norm_sq (const TypeVector< T > &a)
 
template<typename T >
auto norm_sq (const VectorValue< T > &a)
 
template<typename T >
auto norm_sq (const TypeTensor< T > &a)
 
template<typename T >
auto norm_sq (const TensorValue< T > &a)
 
template<typename T >
bool is_zero (const T &a)
 
Number curl_from_grad (const VectorValue< Number > &)
 
VectorValue< Numbercurl_from_grad (const TensorValue< Number > &grad)
 Computes the curl of a vector given the gradient of that vector.
 
TensorValue< Numbercurl_from_grad (const TypeNTensor< 3, Number > &grad)
 
Number div_from_grad (const VectorValue< Number > &grad)
 Dummy. Divergence of a scalar not defined, but is needed for ExactSolution to compile.
 
Number div_from_grad (const TensorValue< Number > &grad)
 Computes the divergence of a vector given the gradient of that vector.
 
VectorValue< Numberdiv_from_grad (const TypeNTensor< 3, Number > &grad)
 

Function Documentation

◆ curl_from_grad() [1/3]

VectorValue< Number > libMesh::TensorTools::curl_from_grad ( const TensorValue< Number > &  grad)

Computes the curl of a vector given the gradient of that vector.

Definition at line 33 of file tensor_tools.C.

34{
35 const Number duz_dy = grad(2,1);
36 const Number duy_dz = grad(1,2);
37 const Number dux_dz = grad(0,2);
38 const Number duz_dx = grad(2,0);
39 const Number duy_dx = grad(1,0);
40 const Number dux_dy = grad(0,1);
41
42 return VectorValue<Number>(duz_dy - duy_dz,
43 dux_dz - duz_dx,
44 duy_dx - dux_dy);
45}
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.

◆ curl_from_grad() [2/3]

TensorValue< Number > libMesh::TensorTools::curl_from_grad ( const TypeNTensor< 3, Number > &  grad)

Place holder needed for ExactSolution to compile. Will compute the curl of a tensor given the gradient of that tensor.

Definition at line 48 of file tensor_tools.C.

49{
50 libmesh_not_implemented();
51}

◆ curl_from_grad() [3/3]

Number libMesh::TensorTools::curl_from_grad ( const VectorValue< Number > &  )

Definition at line 28 of file tensor_tools.C.

29{
30 libmesh_error_msg("Operation not defined for scalar quantities.");
31}

Referenced by libMesh::ExactSolution::_compute_error().

◆ div_from_grad() [1/3]

Number libMesh::TensorTools::div_from_grad ( const TensorValue< Number > &  grad)

Computes the divergence of a vector given the gradient of that vector.

Definition at line 59 of file tensor_tools.C.

60{
61 const Number dux_dx = grad(0,0);
62 const Number duy_dy = grad(1,1);
63 const Number duz_dz = grad(2,2);
64
65 return dux_dx + duy_dy + duz_dz;
66}

◆ div_from_grad() [2/3]

VectorValue< Number > libMesh::TensorTools::div_from_grad ( const TypeNTensor< 3, Number > &  grad)

Place holder needed for ExactSolution to compile. Will compute the divergence of a tensor given the gradient of that tensor.

Definition at line 69 of file tensor_tools.C.

70{
71 libmesh_not_implemented();
72}

◆ div_from_grad() [3/3]

Number libMesh::TensorTools::div_from_grad ( const VectorValue< Number > &  grad)

Dummy. Divergence of a scalar not defined, but is needed for ExactSolution to compile.

Definition at line 54 of file tensor_tools.C.

55{
56 libmesh_error_msg("Operation not defined for scalar quantities.");
57}

Referenced by libMesh::ExactSolution::_compute_error().

◆ inner_product() [1/4]

template<typename T , typename T2 >
std::enable_if< ScalarTraits< T >::value &&ScalarTraits< T2 >::value, typenameCompareTypes< T, T2 >::supertype >::type libMesh::TensorTools::inner_product ( const T &  a,
const T2 &  b 
)
inline

◆ inner_product() [2/4]

template<unsigned int N, typename T , typename T2 >
CompareTypes< T, T2 >::supertype libMesh::TensorTools::inner_product ( const TypeNTensor< N, T > &  a,
const TypeNTensor< N, T2 > &  b 
)
inline

Definition at line 69 of file tensor_tools.h.

70{ return a.contract(b); }
CompareTypes< T, T2 >::supertype contract(const TypeNTensor< N, T2 > &) const
Multiply 2 tensors together to return a scalar, i.e.

References b, and libMesh::TypeNTensor< N, T >::contract().

◆ inner_product() [3/4]

template<typename T , typename T2 >
CompareTypes< T, T2 >::supertype libMesh::TensorTools::inner_product ( const TypeTensor< T > &  a,
const TypeTensor< T2 > &  b 
)
inline

Definition at line 63 of file tensor_tools.h.

64{ return a.contract(b); }
CompareTypes< T, T2 >::supertype contract(const TypeTensor< T2 > &) const
Multiply 2 tensors together to return a scalar, i.e.

References b, and libMesh::TypeTensor< T >::contract().

◆ inner_product() [4/4]

template<typename T , typename T2 >
CompareTypes< T, T2 >::supertype libMesh::TensorTools::inner_product ( const TypeVector< T > &  a,
const TypeVector< T2 > &  b 
)
inline

Definition at line 57 of file tensor_tools.h.

58{ return a * b; }

References b.

◆ is_zero()

template<typename T >
bool libMesh::TensorTools::is_zero ( const T &  a)
inline

Definition at line 134 of file tensor_tools.h.

134{ return a.is_zero();}

◆ norm() [1/6]

template<typename T >
auto libMesh::TensorTools::norm ( const T &  a)
inline

Definition at line 74 of file tensor_tools.h.

75{ using std::abs; return abs(a); }

Referenced by norm_sq(), and norm_sq().

◆ norm() [2/6]

template<typename T >
auto libMesh::TensorTools::norm ( const TensorValue< T > &  a) -> decltype(TensorTools::norm(T()))
inline

Definition at line 98 of file tensor_tools.h.

99{using std::sqrt; return sqrt(a.norm_sq());}
auto norm_sq() const

◆ norm() [3/6]

template<typename T >
auto libMesh::TensorTools::norm ( const TypeTensor< T > &  a) -> decltype(TensorTools::norm(T()))
inline

Definition at line 93 of file tensor_tools.h.

94{using std::sqrt; return sqrt(a.norm_sq());}

◆ norm() [4/6]

template<typename T >
auto libMesh::TensorTools::norm ( const TypeVector< T > &  a) -> decltype(TensorTools::norm(T()))
inline

Definition at line 83 of file tensor_tools.h.

84{using std::sqrt; return sqrt(a.norm_sq());}
auto norm_sq() const

◆ norm() [5/6]

template<typename T >
auto libMesh::TensorTools::norm ( const VectorValue< T > &  a) -> decltype(TensorTools::norm(T()))
inline

Definition at line 88 of file tensor_tools.h.

89{using std::sqrt; return sqrt(a.norm_sq());}

◆ norm() [6/6]

template<typename T >
T libMesh::TensorTools::norm ( std::complex< T >  a)
inline

Definition at line 79 of file tensor_tools.h.

79{ using std::abs; return abs(a); }

◆ norm_sq() [1/6]

template<typename T >
auto libMesh::TensorTools::norm_sq ( const T &  a)
inline

◆ norm_sq() [2/6]

template<typename T >
auto libMesh::TensorTools::norm_sq ( const TensorValue< T > &  a)
inline

Definition at line 128 of file tensor_tools.h.

129{return a.norm_sq();}

References libMesh::TypeTensor< T >::norm_sq().

◆ norm_sq() [3/6]

template<typename T >
auto libMesh::TensorTools::norm_sq ( const TypeTensor< T > &  a)
inline

Definition at line 123 of file tensor_tools.h.

124{return a.norm_sq();}

References libMesh::TypeTensor< T >::norm_sq().

◆ norm_sq() [4/6]

template<typename T >
auto libMesh::TensorTools::norm_sq ( const TypeVector< T > &  a)
inline

Definition at line 113 of file tensor_tools.h.

114{return a.norm_sq();}

References libMesh::TypeVector< T >::norm_sq().

◆ norm_sq() [5/6]

template<typename T >
auto libMesh::TensorTools::norm_sq ( const VectorValue< T > &  a)
inline

Definition at line 118 of file tensor_tools.h.

119{return a.norm_sq();}

References libMesh::TypeVector< T >::norm_sq().

◆ norm_sq() [6/6]

template<typename T >
T libMesh::TensorTools::norm_sq ( std::complex< T >  a)
inline

Definition at line 109 of file tensor_tools.h.

109{ using std::norm; return norm(a); }

References std::norm(), and norm().